From 499a1777c4ea32a9996c67be8c82b9a75a6a4542 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 22 Dec 2016 00:44:07 +0000 Subject: [PATCH] Use of runninguser instead of usergroup --- scripts/backup | 2 +- scripts/install | 8 ++++---- scripts/remove | 1 + scripts/restore | 4 ++-- scripts/upgrade | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index a2cae69..a72b417 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ domain=$(ynh_app_setting_get $app domain) is_public=$(ynh_app_setting_get $app is_public) finalnginxconf=$(ynh_app_setting_get $app finalnginxconf) finalphpconf=$(ynh_app_setting_get $app finalphpconf) - +runninguser=$(ynh_app_setting_get $app runninguser) # Backup sources & data # Note: the last argument is where to save this path, see the restore script. diff --git a/scripts/install b/scripts/install index 14bbb6f..211c5cc 100755 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN path=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -usergroup="owncloud:owncloud" +runninguser="owncloud" # We check variables are not empty CHECK_VAR "$app" "app name not set" @@ -31,7 +31,7 @@ CHECK_FINALPATH final_path=/var/www/$app # Define variables and Save app settings -ynh_app_setting_set "$app" usergroup "$usergroup" +ynh_app_setting_set "$app" runninguser "$runninguser" ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set "$app" is_public "$is_public" ynh_app_setting_set "$app" final_path "$final_path" @@ -54,7 +54,7 @@ sudo mkdir -p $final_path # Set permissions sudo chmod 775 -R $final_path -sudo chown -hR $usergroup $final_path +sudo chown -hR $runninguser:$runninguser $final_path # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf @@ -65,7 +65,7 @@ sudo cp ../conf/nginx.conf $finalnginxconf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf sed -i "s@FOLDERTOCHANGE@$final_path@g" ../conf/php-fpm.conf -sed -i "s@USERTOCHANGE@$usergroup@g" ../conf/php-fpm.conf +sed -i "s@USERTOCHANGE@$runninguser@g" ../conf/php-fpm.conf sudo cp ../conf/php-fpm.conf $finalphpconf sudo chown root: $finalphpconf diff --git a/scripts/remove b/scripts/remove index 45ad92d..a4b6724 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,6 +22,7 @@ final_path=$(ynh_app_setting_get $app final_path) sitename=$(ynh_app_setting_get $app sitename) finalnginxconf=$(ynh_app_setting_get $app finalnginxconf) finalphpconf=$(ynh_app_setting_get $app finalphpconf) +runninguser=$(ynh_app_setting_get $app runninguser) # Suppression du dossier de la webapp sudo rm -rf $final_path diff --git a/scripts/restore b/scripts/restore index 499180c..81254da 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,7 +20,7 @@ domain=$(ynh_app_setting_get $app domain) is_public=$(ynh_app_setting_get $app is_public) finalnginxconf=$(ynh_app_setting_get $app finalnginxconf) finalphpconf=$(ynh_app_setting_get $app finalphpconf) -usergroup=$(ynh_app_setting_get $app usergroup) +runninguser=$(ynh_app_setting_get $app runninguser) # Check domain/path availability #sudo yunohost app checkurl "${domain}${path}" -a "$app" \ @@ -32,7 +32,7 @@ sudo cp -a ./sources/* $final_path/ # Restore permissions to app files # you may need to make some file and/or directory writeable by www-data (nginx user) -sudo chown -R $usergroup $final_path +sudo chown -R $runninguser:$runninguser $final_path ### MySQL (remove if not used) ### # If a MySQL database is used: diff --git a/scripts/upgrade b/scripts/upgrade index ce76a5e..3a47e53 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ final_path=$(ynh_app_setting_get $app final_path) sitename=$(ynh_app_setting_get $app sitename) finalnginxconf=$(ynh_app_setting_get $app finalnginxconf) finalphpconf=$(ynh_app_setting_get $app finalphpconf) -usergroup=$(ynh_app_setting_get $app usergroup) +runninguser=$(ynh_app_setting_get $app runninguser) # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf @@ -33,7 +33,7 @@ sudo cp ../conf/nginx.conf $finalnginxconf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf sed -i "s@FOLDERTOCHANGE@$final_path@g" ../conf/php-fpm.conf -sed -i "s@USERTOCHANGE@$usergroup@g" ../conf/php-fpm.conf +sed -i "s@USERTOCHANGE@$runninguser@g" ../conf/php-fpm.conf sudo cp ../conf/php-fpm.conf $finalphpconf sudo chown root: $finalphpconf @@ -42,7 +42,7 @@ sudo chmod 644 $finalphpconf # We adjust permissions sudo chmod 775 -R $final_path -sudo chown -hR $usergroup $final_path +sudo chown -hR $runninguser:$runninguser $final_path # Make app public if necessary