From 2d8ed7a7d59a0b02aa6bb1e476cc80c5e788a2f1 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 18 Aug 2015 09:29:41 +0200 Subject: [PATCH 1/3] Multi-instance I think this is all that is needed :) Your scripts are very clean so YunoHost takes care of the rest (adds __1, __2, etc... behind $app names). --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index e338297..870b5b8 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ "email": "matlink@matlink.fr", "url": "" }, - "multi_instance": "false", + "multi_instance": "true", "arguments": { "install" : [ { From 6dd6e0396b357f29c1e8e93fe39ac757633242e2 Mon Sep 17 00:00:00 2001 From: matlink Date: Thu, 20 Aug 2015 20:46:47 +0200 Subject: [PATCH 2/3] [fix] support root subfolder, subfolder with and without trailing slash --- conf/nginx.conf | 4 ++-- scripts/install | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f106810..cb55b1b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,10 +13,10 @@ location YNH_EXAMPLE_PATH { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } - location YNH_EXAMPLE_PATH/data/images{ + location YNH_EXAMPLE_FOLDER/data/images{ allow all; } - location YNH_EXAMPLE_PATH/data { + location YNH_EXAMPLE_FOLDER/data { deny all; return 403; } diff --git a/scripts/install b/scripts/install index 9cc5615..d35df86 100644 --- a/scripts/install +++ b/scripts/install @@ -10,6 +10,9 @@ password=$4 is_public=$5 default_lang=$6 +# Remove trailing slash +[ "$path" != "/" ] && path=${path%/} + # Check domain/path availability sudo yunohost app checkurl $domain$path -a $app if [[ ! $? -eq 0 ]]; then @@ -45,8 +48,13 @@ sudo find $final_path -type f | xargs sudo chmod 644 sudo find $final_path -type d | xargs sudo chmod 755 #configure nginx settings +folder_path=${path%/} sudo sed -i "s@YNH_EXAMPLE_PATH@$path@g" ../conf/nginx.conf -sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path@g" ../conf/nginx.conf +# If path is only / (without subfolder), add trailing slash to alias +alias_path=$final_path +[ "$path" == '/' ] && alias_path=$alias_path'/' +sudo sed -i "s@YNH_EXAMPLE_ALIAS@$alias_path@g" ../conf/nginx.conf +sudo sed -i "s@YNH_EXAMPLE_FOLDER@$folder_path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf #temporary set public accessible @@ -61,7 +69,8 @@ sudo sed -i "1 i\127.0.0.1 $domain #pluxml_hosts" /etc/hosts #make request to install app #get the html page -curl -kL -o install_page.html https://$domain$path/install.php >/dev/null 2>&1 +curl_path=$([ "$path" == "/" ] || echo $path) +curl -kL -o install_page.html https://$domain$curl_path/install.php >/dev/null 2>&1 #get the token for form validation @@ -75,7 +84,7 @@ curl -k -X POST \ --data-urlencode "pwd=$password" \ --data-urlencode "pwd2=$password" \ --data-urlencode "token=$token" \ - https://$domain$path/install.php > /dev/null 2>&1 + https://$domain$curl_path/install.php > /dev/null 2>&1 sudo rm -f $final_path/install.php From 9cd5a32cba55aaeec0cbbb460419b2c8909043a9 Mon Sep 17 00:00:00 2001 From: Matlink Date: Thu, 20 Aug 2015 23:01:42 +0200 Subject: [PATCH 3/3] [fix] removing useless .htaccess whatever, it was removed anyway just after to be copied. --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index d35df86..c185e54 100644 --- a/scripts/install +++ b/scripts/install @@ -38,7 +38,6 @@ sudo mkdir -p $final_path #copy files to final folder and set permissions sudo cp -R ../sources/* $final_path/ -sudo cp ../sources/.htaccess $final_path/ sudo find $final_path -type f -name ".htaccess" | xargs sudo rm #setup permissions