From 942d0c033f9f367d9001d83bbcee4fa19a792c16 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 5 Jul 2017 18:10:43 +0200 Subject: [PATCH 1/3] Remove sudo prefixes (not needed any more in YunoHost 2.6) --- scripts/_common.sh | 30 +++++++++++++++--------------- scripts/backup | 4 ++-- scripts/install | 14 +++++++------- scripts/remove | 8 ++++---- scripts/restore | 16 ++++++++-------- scripts/upgrade | 4 ++-- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8ae77b5..7b1c62d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,7 +10,7 @@ ynh_add_nginx_config () { finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup_if_checksum_is_different "$finalnginxconf" 1 - sudo cp ../conf/nginx.conf "$finalnginxconf" + cp ../conf/nginx.conf "$finalnginxconf" # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. # Substitute in a nginx config file only if the variable is not empty @@ -31,7 +31,7 @@ ynh_add_nginx_config () { fi ynh_store_checksum_config "$finalnginxconf" - sudo systemctl reload nginx + systemctl reload nginx } # Remove the dedicated nginx config @@ -39,7 +39,7 @@ ynh_add_nginx_config () { # usage: ynh_remove_nginx_config ynh_remove_nginx_config () { ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf" - sudo systemctl reload nginx + systemctl reload nginx } # Create a dedicated php-fpm config @@ -48,23 +48,23 @@ ynh_remove_nginx_config () { ynh_add_fpm_config () { finalphpconf="/etc/php5/fpm/pool.d/$app.conf" ynh_backup_if_checksum_is_different "$finalphpconf" 1 - sudo cp ../conf/php-fpm.conf "$finalphpconf" + cp ../conf/php-fpm.conf "$finalphpconf" ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf" ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf" ynh_replace_string "__USER__" "$app" "$finalphpconf" - sudo chown root: "$finalphpconf" + chown root: "$finalphpconf" ynh_store_file_checksum "$finalphpconf" if [ -e "../conf/php-fpm.ini" ] then finalphpini="/etc/php5/fpm/conf.d/20-$app.ini" ynh_compare_checksum_config "$finalphpini" 1 - sudo cp ../conf/php-fpm.ini "$finalphpini" - sudo chown root: "$finalphpini" + cp ../conf/php-fpm.ini "$finalphpini" + chown root: "$finalphpini" ynh_store_checksum_config "$finalphpini" fi - sudo systemctl reload php5-fpm + systemctl reload php5-fpm } # Remove the dedicated php-fpm config @@ -73,7 +73,7 @@ ynh_add_fpm_config () { ynh_remove_fpm_config () { ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf" ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1 - sudo systemctl reload php5-fpm + systemctl reload php5-fpm } # Create a dedicated systemd config @@ -82,7 +82,7 @@ ynh_remove_fpm_config () { ynh_add_systemd_config () { finalsystemdconf="/etc/systemd/system/$app.service" ynh_compare_checksum_config "$finalsystemdconf" 1 - sudo cp ../conf/systemd.service "$finalsystemdconf" + cp ../conf/systemd.service "$finalsystemdconf" # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. # Substitute in a nginx config file only if the variable is not empty @@ -94,9 +94,9 @@ ynh_add_systemd_config () { fi ynh_store_checksum_config "$finalsystemdconf" - sudo chown root: "$finalsystemdconf" - sudo systemctl enable $app - sudo systemctl daemon-reload + chown root: "$finalsystemdconf" + systemctl enable $app + systemctl daemon-reload } # Remove the dedicated systemd config @@ -105,8 +105,8 @@ ynh_add_systemd_config () { ynh_remove_systemd_config () { finalsystemdconf="/etc/systemd/system/$app.service" if [ -e "$finalsystemdconf" ]; then - sudo systemctl stop $app - sudo systemctl disable $app + systemctl stop $app + systemctl disable $app ynh_secure_remove "$finalsystemdconf" fi } diff --git a/scripts/backup b/scripts/backup index 34afd23..7764d59 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,8 +15,8 @@ set -eu if [ ! -e _common.sh ]; then # Get the _common.sh file if it's not in the current directory - sudo cp ../settings/scripts/_common.sh ./_common.sh - sudo chmod a+rx _common.sh + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh fi source _common.sh source /usr/share/yunohost/helpers diff --git a/scripts/install b/scripts/install index 2f02ac2..97336c7 100755 --- a/scripts/install +++ b/scripts/install @@ -72,7 +72,7 @@ ynh_app_setting_set $app language $language # Find a free port port=$(ynh_find_port 8095) # Open this port -sudo yunohost firewall allow --no-upnp TCP $port 2>&1 +yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port #================================================= @@ -138,15 +138,15 @@ ynh_systemd_config #================================================= # Set right permissions for curl install -sudo chown -R $app: $final_path +chown -R $app: $final_path # Set the app as temporarily public for curl call ynh_app_setting_set $app unprotected_uris "/" # Reload SSOwat config -sudo yunohost app ssowatconf +yunohost app ssowatconf # Reload Nginx -sudo systemctl reload nginx +systemctl reload nginx # Installation with curl ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" @@ -165,7 +165,7 @@ ynh_store_file_checksum "$final_path/CONFIG_FILE" #================================================= # Set permissions to app files -sudo chown -R root: $final_path +chown -R root: $final_path #================================================= # SETUP LOGROTATE @@ -178,7 +178,7 @@ ynh_use_logrotate # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -sudo yunohost service add NAME_INIT.D --log "/var/log/FILE.log" +yunohost service add NAME_INIT.D --log "/var/log/FILE.log" #================================================= # SETUP SSOWAT @@ -199,4 +199,4 @@ fi # RELOAD NGINX #================================================= -sudo systemctl reload nginx +systemctl reload nginx diff --git a/scripts/remove b/scripts/remove index ede1b0f..fbd8064 100755 --- a/scripts/remove +++ b/scripts/remove @@ -32,10 +32,10 @@ ynh_remove_systemd_config # REMOVE SERVICE FROM ADMIN PANEL #================================================= -if sudo yunohost service status | grep -q $app +if yunohost service status | grep -q $app then echo "Remove $app service" - sudo yunohost service remove $app + yunohost service remove $app fi #================================================= @@ -84,10 +84,10 @@ ynh_remove_logrotate # CLOSE A PORT #================================================= -if sudo yunohost firewall list | grep -q "\- $port$" +if yunohost firewall list | grep -q "\- $port$" then echo "Close port $port" - QUIET sudo yunohost firewall disallow TCP $port + QUIET yunohost firewall disallow TCP $port fi #================================================= diff --git a/scripts/restore b/scripts/restore index 79cdbe1..e29e9ed 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,8 +15,8 @@ set -eu if [ ! -e _common.sh ]; then # Get the _common.sh file if it's not in the current directory - sudo cp ../settings/scripts/_common.sh ./_common.sh - sudo chmod a+rx _common.sh + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh fi source _common.sh source /usr/share/yunohost/helpers @@ -36,7 +36,7 @@ db_name=$(ynh_app_setting_get $app db_name) # CHECK IF THE APP CAN BE RESTORED #================================================= -sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ +yunohost app checkurl "${domain}${path_url}" -a "$app" \ || ynh_die "Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die "There is already a directory: $final_path " @@ -75,7 +75,7 @@ ynh_system_user_create $app #================================================= # Restore permissions on app files -sudo chown -R root: $final_path +chown -R root: $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -97,14 +97,14 @@ ynh_install_app_dependencies deb1 deb2 # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -sudo yunohost service add $app --log "/var/log/$app/APP.log" +yunohost service add $app --log "/var/log/$app/APP.log" #================================================= # RESTORE SYSTEMD #================================================= ynh_restore_file "/etc/systemd/system/$app.service" -sudo systemctl enable $app.service +systemctl enable $app.service #================================================= # RESTORE THE CRON FILE @@ -124,5 +124,5 @@ ynh_restore_file "/etc/logrotate.d/$app" # RELOAD NGINX AND PHP-FPM #================================================= -sudo systemctl reload php5-fpm -sudo systemctl reload nginx +systemctl reload php5-fpm +systemctl reload nginx diff --git a/scripts/upgrade b/scripts/upgrade index bbaf187..68a0d77 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,7 +109,7 @@ ynh_systemd_config #================================================= # Set right permissions for curl installation -sudo chown -R root: $final_path +chown -R root: $final_path #================================================= # SETUP SSOWAT @@ -130,4 +130,4 @@ fi # RELOAD NGINX #================================================= -sudo systemctl reload nginx +systemctl reload nginx From 495c587f4a0e4a2a5fa9b443fca59fb98c1b5a8e Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Thu, 6 Jul 2017 10:14:42 +0200 Subject: [PATCH 2/3] [fix] YunoHost version requirement --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 63e057f..606f903 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "url": "http://example.com" }, "requirements": { - "yunohost": ">> 2.5.6" + "yunohost": ">> 2.6.4" }, "multi_instance": true, "services": [ From a21c5dbdf4afa38b9b4921d48535abbc037bd94c Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Fri, 21 Jul 2017 18:45:33 +0200 Subject: [PATCH 3/3] Update minimum version syntax --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 606f903..a1f7b55 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "url": "http://example.com" }, "requirements": { - "yunohost": ">> 2.6.4" + "yunohost": ">= 2.6.4" }, "multi_instance": true, "services": [