1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fider_ynh.git synced 2024-09-03 18:36:11 +02:00

Remove sudo prefixes (not needed any more in YunoHost 2.6)

This commit is contained in:
JimboJoe 2017-07-21 18:46:55 +02:00 committed by GitHub
commit 447d8a8d97
7 changed files with 39 additions and 39 deletions

View file

@ -14,7 +14,7 @@
"url": "http://example.com" "url": "http://example.com"
}, },
"requirements": { "requirements": {
"yunohost": ">> 2.5.6" "yunohost": ">= 2.6.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -10,7 +10,7 @@
ynh_add_nginx_config () { ynh_add_nginx_config () {
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalnginxconf" 1 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. # 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 # Substitute in a nginx config file only if the variable is not empty
@ -31,7 +31,7 @@ ynh_add_nginx_config () {
fi fi
ynh_store_checksum_config "$finalnginxconf" ynh_store_checksum_config "$finalnginxconf"
sudo systemctl reload nginx systemctl reload nginx
} }
# Remove the dedicated nginx config # Remove the dedicated nginx config
@ -39,7 +39,7 @@ ynh_add_nginx_config () {
# usage: ynh_remove_nginx_config # usage: ynh_remove_nginx_config
ynh_remove_nginx_config () { ynh_remove_nginx_config () {
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
sudo systemctl reload nginx systemctl reload nginx
} }
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
@ -48,23 +48,23 @@ ynh_remove_nginx_config () {
ynh_add_fpm_config () { ynh_add_fpm_config () {
finalphpconf="/etc/php5/fpm/pool.d/$app.conf" finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalphpconf" 1 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 "__NAMETOCHANGE__" "$app" "$finalphpconf"
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf" ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
ynh_replace_string "__USER__" "$app" "$finalphpconf" ynh_replace_string "__USER__" "$app" "$finalphpconf"
sudo chown root: "$finalphpconf" chown root: "$finalphpconf"
ynh_store_file_checksum "$finalphpconf" ynh_store_file_checksum "$finalphpconf"
if [ -e "../conf/php-fpm.ini" ] if [ -e "../conf/php-fpm.ini" ]
then then
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini" finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
ynh_compare_checksum_config "$finalphpini" 1 ynh_compare_checksum_config "$finalphpini" 1
sudo cp ../conf/php-fpm.ini "$finalphpini" cp ../conf/php-fpm.ini "$finalphpini"
sudo chown root: "$finalphpini" chown root: "$finalphpini"
ynh_store_checksum_config "$finalphpini" ynh_store_checksum_config "$finalphpini"
fi fi
sudo systemctl reload php5-fpm systemctl reload php5-fpm
} }
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
@ -73,7 +73,7 @@ ynh_add_fpm_config () {
ynh_remove_fpm_config () { ynh_remove_fpm_config () {
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf" ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1 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 # Create a dedicated systemd config
@ -82,7 +82,7 @@ ynh_remove_fpm_config () {
ynh_add_systemd_config () { ynh_add_systemd_config () {
finalsystemdconf="/etc/systemd/system/$app.service" finalsystemdconf="/etc/systemd/system/$app.service"
ynh_compare_checksum_config "$finalsystemdconf" 1 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. # 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 # Substitute in a nginx config file only if the variable is not empty
@ -94,9 +94,9 @@ ynh_add_systemd_config () {
fi fi
ynh_store_checksum_config "$finalsystemdconf" ynh_store_checksum_config "$finalsystemdconf"
sudo chown root: "$finalsystemdconf" chown root: "$finalsystemdconf"
sudo systemctl enable $app systemctl enable $app
sudo systemctl daemon-reload systemctl daemon-reload
} }
# Remove the dedicated systemd config # Remove the dedicated systemd config
@ -105,8 +105,8 @@ ynh_add_systemd_config () {
ynh_remove_systemd_config () { ynh_remove_systemd_config () {
finalsystemdconf="/etc/systemd/system/$app.service" finalsystemdconf="/etc/systemd/system/$app.service"
if [ -e "$finalsystemdconf" ]; then if [ -e "$finalsystemdconf" ]; then
sudo systemctl stop $app systemctl stop $app
sudo systemctl disable $app systemctl disable $app
ynh_secure_remove "$finalsystemdconf" ynh_secure_remove "$finalsystemdconf"
fi fi
} }

View file

@ -15,8 +15,8 @@ set -eu
if [ ! -e _common.sh ]; then if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory # Get the _common.sh file if it's not in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers

View file

@ -72,7 +72,7 @@ ynh_app_setting_set $app language $language
# Find a free port # Find a free port
port=$(ynh_find_port 8095) port=$(ynh_find_port 8095)
# Open this port # 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 ynh_app_setting_set $app port $port
#================================================= #=================================================
@ -138,15 +138,15 @@ ynh_systemd_config
#================================================= #=================================================
# Set right permissions for curl install # 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 # Set the app as temporarily public for curl call
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app unprotected_uris "/"
# Reload SSOwat config # Reload SSOwat config
sudo yunohost app ssowatconf yunohost app ssowatconf
# Reload Nginx # Reload Nginx
sudo systemctl reload nginx systemctl reload nginx
# Installation with curl # Installation with curl
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" 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 # Set permissions to app files
sudo chown -R root: $final_path chown -R root: $final_path
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -178,7 +178,7 @@ ynh_use_logrotate
# ADVERTISE SERVICE IN ADMIN PANEL # 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 # SETUP SSOWAT
@ -199,4 +199,4 @@ fi
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
sudo systemctl reload nginx systemctl reload nginx

View file

@ -32,10 +32,10 @@ ynh_remove_systemd_config
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
#================================================= #=================================================
if sudo yunohost service status | grep -q $app if yunohost service status | grep -q $app
then then
echo "Remove $app service" echo "Remove $app service"
sudo yunohost service remove $app yunohost service remove $app
fi fi
#================================================= #=================================================
@ -84,10 +84,10 @@ ynh_remove_logrotate
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
if sudo yunohost firewall list | grep -q "\- $port$" if yunohost firewall list | grep -q "\- $port$"
then then
echo "Close port $port" echo "Close port $port"
QUIET sudo yunohost firewall disallow TCP $port QUIET yunohost firewall disallow TCP $port
fi fi
#================================================= #=================================================

View file

@ -15,8 +15,8 @@ set -eu
if [ ! -e _common.sh ]; then if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory # Get the _common.sh file if it's not in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers 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 # 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}" || ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die "There is already a directory: $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 # Restore permissions on app files
sudo chown -R root: $final_path chown -R root: $final_path
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
@ -97,14 +97,14 @@ ynh_install_app_dependencies deb1 deb2
# ADVERTISE SERVICE IN ADMIN PANEL # 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 # RESTORE SYSTEMD
#================================================= #=================================================
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file "/etc/systemd/system/$app.service"
sudo systemctl enable $app.service systemctl enable $app.service
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
@ -124,5 +124,5 @@ ynh_restore_file "/etc/logrotate.d/$app"
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
sudo systemctl reload php5-fpm systemctl reload php5-fpm
sudo systemctl reload nginx systemctl reload nginx

View file

@ -109,7 +109,7 @@ ynh_systemd_config
#================================================= #=================================================
# Set right permissions for curl installation # Set right permissions for curl installation
sudo chown -R root: $final_path chown -R root: $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
@ -130,4 +130,4 @@ fi
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
sudo systemctl reload nginx systemctl reload nginx