From 0518b751255536cc9f1a2acb683597003730cdbc Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sat, 26 May 2018 10:01:42 +0200 Subject: [PATCH] Remove sudo --- scripts/backup | 6 +++--- scripts/install | 20 ++++++++++---------- scripts/remove | 8 ++++---- scripts/restore | 10 +++++----- scripts/upgrade | 14 +++++++------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/scripts/backup b/scripts/backup index 9e3ada6..90a3e49 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,8 +19,8 @@ set -e app=$YNH_APP_INSTANCE_NAME # Retrieve arguments -domain=$(sudo yunohost app setting $app domain) +domain=$(yunohost app setting $app domain) # Copy the conf files -sudo mkdir -p ./conf -sudo cp -a "/etc/nginx/conf.d/${domain}.d/${app}.conf" ./conf/nginx.conf \ No newline at end of file +mkdir -p ./conf +cp -a "/etc/nginx/conf.d/${domain}.d/${app}.conf" ./conf/nginx.conf \ No newline at end of file diff --git a/scripts/install b/scripts/install index 869afc4..60643f3 100644 --- a/scripts/install +++ b/scripts/install @@ -31,7 +31,7 @@ path=${path%/} location=${path:-/} # Check domain/path availability -sudo yunohost app checkurl $domain$path -a $app \ +yunohost app checkurl $domain$path -a $app \ || (echo "Path not available: $domain$path" && exit 1) # Validate redirect path @@ -40,32 +40,32 @@ url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%= "Invalid destination: $redirect_path" 1 # Save extra settings -sudo yunohost app setting $app is_public -v "$is_public" -sudo yunohost app setting $app redirect_type -v "$redirect_type" -sudo yunohost app setting $app redirect_path -v "$redirect_path" +yunohost app setting $app is_public -v "$is_public" +yunohost app setting $app redirect_type -v "$redirect_type" +yunohost app setting $app redirect_path -v "$redirect_path" # Nginx configuration sed -i "s@YNH_LOCATION@$location@g" ../conf/nginx-*.conf if [ "$redirect_type" = "visible_302" ]; then sed -i "s@YNH_REDIRECT_PATH@$redirect_path@g" ../conf/nginx-visible-302.conf - sudo cp ../conf/nginx-visible-302.conf /etc/nginx/conf.d/$domain.d/$app.conf + cp ../conf/nginx-visible-302.conf /etc/nginx/conf.d/$domain.d/$app.conf elif [ "$redirect_type" = "visible_301" ]; then sed -i "s@YNH_REDIRECT_PATH@$redirect_path@g" ../conf/nginx-visible-301.conf - sudo cp ../conf/nginx-visible-301.conf /etc/nginx/conf.d/$domain.d/$app.conf + cp ../conf/nginx-visible-301.conf /etc/nginx/conf.d/$domain.d/$app.conf elif [ "$redirect_type" = "proxy" ]; then sed -i "s@YNH_REDIRECT_PATH@$redirect_path@g" ../conf/nginx-proxy.conf - sudo cp ../conf/nginx-proxy.conf /etc/nginx/conf.d/$domain.d/$app.conf + cp ../conf/nginx-proxy.conf /etc/nginx/conf.d/$domain.d/$app.conf fi # Make app public if necessary if [[ "$is_public" -ne 0 ]]; then - sudo yunohost app setting $app unprotected_uris -v "/" + yunohost app setting $app unprotected_uris -v "/" fi # Reload Nginx and regenerate SSOwat conf -sudo service nginx reload -sudo yunohost app ssowatconf +service nginx reload +yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove index c05f24c..f670970 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,11 +16,11 @@ set -e app=$YNH_APP_INSTANCE_NAME # Retrieve arguments -domain=$(sudo yunohost app setting $app domain) +domain=$(yunohost app setting $app domain) # Remove configuration files -sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf +rm -f /etc/nginx/conf.d/$domain.d/$app.conf # Restart services -sudo service nginx reload -sudo yunohost app ssowatconf +service nginx reload +yunohost app ssowatconf diff --git a/scripts/restore b/scripts/restore index a3590bb..a74fbc8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,7 +29,7 @@ redirect_path=$(ynh_app_setting_get "$app" redirect_path) path=${path%/} # Check domain/path availability -sudo yunohost app checkurl $domain$path -a $app \ +yunohost app checkurl $domain$path -a $app \ || die "The path ${domain}${path} is not available for app installation." # Validate redirect path @@ -44,14 +44,14 @@ NGINX_CONF="/etc/nginx/conf.d/${domain}.d/${app}.conf" You should safely delete it before restoring this app." # Restore configuration files -sudo cp -a ./conf/nginx.conf "$NGINX_CONF" +cp -a ./conf/nginx.conf "$NGINX_CONF" # Make app public if necessary if [[ "$is_public" -ne 0 ]]; then - sudo yunohost app setting $app unprotected_uris -v "/" + yunohost app setting $app unprotected_uris -v "/" fi # Reload Nginx and regenerate SSOwat conf -sudo service nginx reload -sudo yunohost app ssowatconf +service nginx reload +yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade index a56770a..e8d9a88 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,7 +38,7 @@ path=${path%/} location=${path:-/} # Check domain/path availability -sudo yunohost app checkurl $domain$path -a $app \ +yunohost app checkurl $domain$path -a $app \ || (echo "Path not available: $domain$path" && exit 1) # Validate redirect path @@ -51,23 +51,23 @@ sed -i "s@YNH_LOCATION@$location@g" ../conf/nginx-*.conf if [ "$redirect_type" = "visible_302" ]; then sed -i "s@YNH_REDIRECT_PATH@$redirect_path@g" ../conf/nginx-visible-302.conf - sudo cp ../conf/nginx-visible-302.conf /etc/nginx/conf.d/$domain.d/$app.conf + cp ../conf/nginx-visible-302.conf /etc/nginx/conf.d/$domain.d/$app.conf elif [ "$redirect_type" = "visible_301" ]; then sed -i "s@YNH_REDIRECT_PATH@$redirect_path@g" ../conf/nginx-visible-301.conf - sudo cp ../conf/nginx-visible-301.conf /etc/nginx/conf.d/$domain.d/$app.conf + cp ../conf/nginx-visible-301.conf /etc/nginx/conf.d/$domain.d/$app.conf elif [ "$redirect_type" = "proxy" ]; then sed -i "s@YNH_REDIRECT_PATH@$redirect_path@g" ../conf/nginx-proxy.conf - sudo cp ../conf/nginx-proxy.conf /etc/nginx/conf.d/$domain.d/$app.conf + cp ../conf/nginx-proxy.conf /etc/nginx/conf.d/$domain.d/$app.conf fi # Make app public if necessary if [[ "$is_public" -ne 0 ]]; then - sudo yunohost app setting $app unprotected_uris -v "/" + yunohost app setting $app unprotected_uris -v "/" fi # Reload Nginx and regenerate SSOwat conf -sudo service nginx reload -sudo yunohost app ssowatconf +service nginx reload +yunohost app ssowatconf