From 34ce2a4153c3394a2f29acb44cf93c176c503285 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 22 Jun 2016 14:11:25 +0200 Subject: [PATCH] Installation racine --- conf/nginx.conf | 2 +- scripts/install | 11 ++++++++++- scripts/remove | 2 +- scripts/upgrade | 10 ++++++++++ sources/ajouts/{infcloud => }/cache_update.sh | 0 sources/ajouts/{infcloud => }/interface.js | 0 6 files changed, 22 insertions(+), 3 deletions(-) rename sources/ajouts/{infcloud => }/cache_update.sh (100%) rename sources/ajouts/{infcloud => }/interface.js (100%) diff --git a/conf/nginx.conf b/conf/nginx.conf index d997b95..beae6d8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -25,7 +25,7 @@ location @radicale { uwsgi_param SERVER_NAME $server_name; } -#INFCLOUD#location __PATH__/infcloud { +#INFCLOUD#location __PATH_NO_ROOT__/infcloud { #INFCLOUD# alias __FINALPATH__/infcloud; #INFCLOUD# if ($scheme = http) { #INFCLOUD# rewrite ^ https://$server_name$request_uri? permanent; diff --git a/scripts/install b/scripts/install index a675d4f..df29a7b 100755 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ fi # Enregistre les infos dans la config YunoHost sudo yunohost app setting $app domain -v $domain -sudo yunohost app setting $app path -v $path +sudo yunohost app setting $app path -v $path/ sudo yunohost app setting $app admin -v $admin sudo yunohost app setting $app infcloud -v $infcloud @@ -86,7 +86,10 @@ sudo mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radi sudo rm /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.pyc if [ "$infcloud" = "1" ] then #Instal InfCloud + final_path_backup=$final_path # Sauvegarde le contenu de $final_path + final_path=$final_path/infcloud # Change final_path pour l'installation de infcloud SETUP_SOURCE "infcloud.zip" # Télécharge la source, décompresse et copie dans $final_path + final_path=$final_path_backup # Restaure le contenu de $final_path fi #Configuration Radicale @@ -162,6 +165,12 @@ sudo ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/ # Modify Nginx configuration file and copy it to Nginx conf directory sudo sed -i "s@__PATH__@$path@g" ../conf/nginx.conf +if [ "$path" = "/" ] +then + sudo sed -i "s@__PATH_NO_ROOT__@@g" ../conf/nginx.conf +else + sudo sed -i "s@__PATH_NO_ROOT__@$path@g" ../conf/nginx.conf +fi sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf sudo sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf diff --git a/scripts/remove b/scripts/remove index cda7827..97bdc63 100644 --- a/scripts/remove +++ b/scripts/remove @@ -31,7 +31,7 @@ if [ -e "/etc/uwsgi/apps-available/radicale.ini" ]; then echo "Delete uwsgi config" sudo rm "/etc/uwsgi/apps-available/radicale.ini" fi -if [ -e "/etc/uwsgi/apps-enabled/radicale.ini" ]; then +if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then echo "Delete uwsgi config" sudo rm "/etc/uwsgi/apps-enabled/radicale.ini" fi diff --git a/scripts/upgrade b/scripts/upgrade index aed417b..fa31435 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,6 +14,7 @@ path=$(sudo yunohost app setting $app path) admin=$(sudo yunohost app setting $app admin) infcloud=$(sudo yunohost app setting $app infcloud) language=$(sudo yunohost app setting $app language) +final_path=$(sudo yunohost app setting $app final_path) CHECK_PATH # Vérifie et corrige la syntaxe du path. @@ -49,7 +50,10 @@ sudo mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radi sudo rm /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.pyc if [ "$infcloud" = "1" ] then #Instal InfCloud + final_path_backup=$final_path # Sauvegarde le contenu de $final_path + final_path=$final_path/infcloud # Change final_path pour l'installation de infcloud SETUP_SOURCE "infcloud.zip" # Télécharge la source, décompresse et copie dans $final_path + final_path=$final_path_backup # Restaure le contenu de $final_path fi # Radicale configuration @@ -112,6 +116,12 @@ sudo cp ../conf/radicale.ini /etc/uwsgi/apps-available/ # Update Nginx configuration file sudo sed -i "s@__PATH__@$path@g" ../conf/nginx.conf +if [ "$path" = "/" ] +then + sudo sed -i "s@__PATH_NO_ROOT__@@g" ../conf/nginx.conf +else + sudo sed -i "s@__PATH_NO_ROOT__@$path@g" ../conf/nginx.conf +fi sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf sudo sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf diff --git a/sources/ajouts/infcloud/cache_update.sh b/sources/ajouts/cache_update.sh similarity index 100% rename from sources/ajouts/infcloud/cache_update.sh rename to sources/ajouts/cache_update.sh diff --git a/sources/ajouts/infcloud/interface.js b/sources/ajouts/interface.js similarity index 100% rename from sources/ajouts/infcloud/interface.js rename to sources/ajouts/interface.js