From 67499e79becea78e978aa1a15218733cf7f9c2c4 Mon Sep 17 00:00:00 2001 From: Moul Date: Wed, 3 Feb 2016 16:48:44 +0100 Subject: [PATCH] Scripts updates. --- scripts/install | 1 + scripts/remove | 6 +++++- scripts/upgrade | 13 ++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index c4e7361..7f6b41b 100755 --- a/scripts/install +++ b/scripts/install @@ -40,6 +40,7 @@ sudo cp ../conf/nginx.conf $nginxconf sudo chown root: $nginxconf sudo chmod 600 $nginxconf +# Only give one user access to this app sudo yunohost app removeaccess $app sudo yunohost app addaccess $app -u $user diff --git a/scripts/remove b/scripts/remove index 1cf48eb..6d28ede 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,7 @@ #!/bin/bash app=linuxdash -domain=$(sudo yunohost app setting linuxdash domain) +domain=$(sudo yunohost app setting $app domain) # Remove sources and nginx configuration sudo rm -rf /var/www/$app @@ -11,5 +11,9 @@ sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo supervisorctl stop $app sudo rm -f /etc/supervisor/conf.d/$app.conf +# Remove supervisor package +# Need to be manage with future manifest/moulinette Debian package management +# sudo apt-get -y -qq remove supervisor + # Reload nginx configuration sudo service nginx reload diff --git a/scripts/upgrade b/scripts/upgrade index 0c0780b..90d4dca 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,14 +1,15 @@ #!/bin/bash # Retrieve settings -domain=$(sudo yunohost app setting linuxdash domain) -path=$(sudo yunohost app setting linuxdash path) +app=linuxdash +domain=$(sudo yunohost app setting $app domain) +path=$(sudo yunohost app setting $app path) # Remove trailing "/" for next commands path=${path%/} # Copy files to the right place -final_path=/var/www/linuxdash +final_path=/var/www/$app sudo mkdir -p $final_path sudo cp -a ../sources/* $final_path @@ -17,11 +18,13 @@ sudo chown -R www-data: $final_path # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf -sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf -nginxconf=/etc/nginx/conf.d/$domain.d/linuxdash.conf +nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf $nginxconf sudo chown root: $nginxconf sudo chmod 600 $nginxconf +# Restart Linux-dash service +sudo supervisorctl restart $app + # Reload web server & sso sudo service nginx reload