From 75929a36cda3b2477ec507ff74d08a21f9e13679 Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 5 Mar 2020 20:27:10 +0100 Subject: [PATCH] [mod] Remove now useless 'sudo' prefix, all commands are now run as root --- scripts/install | 10 +++++----- scripts/remove | 6 +++--- scripts/restore | 10 +++++----- scripts/upgrade | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index 46e9a75..0f673bd 100755 --- a/scripts/install +++ b/scripts/install @@ -16,22 +16,22 @@ source /usr/share/yunohost/helpers ynh_app_setting_set "$app" is_public "$is_public" # Check domain/path availability -sudo yunohost app checkurl "${domain}${path}" -a "$app" \ +yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" # Retrieve sources and install them src_path=/var/www/$app -sudo mkdir -p $src_path +mkdir -p $src_path # Download, check integrity, uncompress and patch the source from app.src ynh_script_progression --message="Setting up source files..." --time --weight=1 ynh_setup_source --dest_dir=$src_path -sudo chown -R www-data: $src_path +chown -R www-data: $src_path # Modify Nginx configuration file and copy it to Nginx conf directory nginx_conf=../conf/nginx.conf sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf -sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf +cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf # If app is public, add url to SSOWat conf as skipped_uris if [[ $is_public -eq 1 ]]; then @@ -40,4 +40,4 @@ if [[ $is_public -eq 1 ]]; then fi # Reload nginx service -sudo service nginx reload +service nginx reload diff --git a/scripts/remove b/scripts/remove index 1408650..00a0c3f 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,10 +8,10 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) # Remove sources -sudo rm -rf /var/www/$app +rm -rf /var/www/$app # Remove configuration files -sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf +rm -f /etc/nginx/conf.d/$domain.d/$app.conf # Reload nginx service -sudo service nginx reload +service nginx reload diff --git a/scripts/restore b/scripts/restore index fd542ee..4996dd2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,19 +17,19 @@ domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) # Check domain/path availability -sudo yunohost app checkurl "${domain}${path}" -a "$app" \ +yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" # Restore sources & data src_path="/var/www/${app}" -sudo cp -a ./sources "$src_path" +cp -a ./sources "$src_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 www-data: "$src_path" +chown -R www-data: "$src_path" # Restore NGINX configuration -sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" +cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" # Restart webserver -sudo service nginx reload +service nginx reload diff --git a/scripts/upgrade b/scripts/upgrade index ab93dc2..7aa7b9c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,13 +27,13 @@ path=${path%/} src_path=/var/www/$app if [ "$upgrade_type" == "UPGRADE_APP" ] then - sudo rm -rf $src_path - sudo mkdir -p $src_path + rm -rf $src_path + mkdir -p $src_path ynh_script_progression --message="Upgrading source files..." --time --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$src_path - sudo chown -R www-data: $src_path + chown -R www-data: $src_path fi @@ -41,7 +41,7 @@ fi nginx_conf=../conf/nginx.conf sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf -sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf +cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf # If app is public, add url to SSOWat conf as skipped_uris if [[ $is_public -eq 1 ]]; then @@ -49,4 +49,4 @@ if [[ $is_public -eq 1 ]]; then fi # Reload nginx service -sudo service nginx reload +service nginx reload