diff --git a/scripts/install b/scripts/install index d31cbff..3c14a3a 100644 --- a/scripts/install +++ b/scripts/install @@ -79,7 +79,7 @@ adduser turnserver ssl-cert #================================================= ynh_script_progression "Fixing database type..." -ynh_psql_execute_as_root \ +ynh_psql_db_shell \ <<< "update pg_database set datcollate='C', datctype='C' where datname='$db_name';" #================================================= @@ -203,8 +203,8 @@ fi # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files -ynh_replace __APP__ "$app" ../hooks/post_cert_update -ynh_replace __DOMAIN__ "$domain" ../hooks/post_cert_update +ynh_replace --match=__APP__ --replace="$app" --file=../hooks/post_cert_update +ynh_replace --match=__DOMAIN__ --replace="$domain" --file=../hooks/post_cert_update #================================================= # SECURE FILES AND DIRECTORIES diff --git a/scripts/remove b/scripts/remove index f68b07d..c9d1953 100755 --- a/scripts/remove +++ b/scripts/remove @@ -21,7 +21,7 @@ ynh_script_progression "Stopping and removing the systemd service" ynh_config_remove_systemd -ynh_config_remove_systemd"$app"-coturn +ynh_config_remove_systemd "$app"-coturn #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 0c8d450..cf20764 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ adduser turnserver ssl-cert #================================================= ynh_script_progression "Fixing database type..." -ynh_psql_execute_as_root \ +ynh_psql_db_shell \ <<< "update pg_database set datcollate='C', datctype='C' where datname='$db_name';" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ec95fe3..13fde26 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -372,8 +372,8 @@ set_permissions data # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files -ynh_replace __APP__ "$app" ../hooks/post_cert_update -ynh_replace __DOMAIN__ "$domain" ../hooks/post_cert_update +ynh_replace --match=__APP__ --replace="$app" --file=../hooks/post_cert_update +ynh_replace --match=__DOMAIN__ --replace="$domain" --file=../hooks/post_cert_update #================================================= # RELOAD SERVICES diff --git a/sources/set_admin_user.sh b/sources/set_admin_user.sh index 2bbee3a..8a33acb 100644 --- a/sources/set_admin_user.sh +++ b/sources/set_admin_user.sh @@ -5,17 +5,19 @@ set -eu source /usr/share/yunohost/helpers app=__APP__ +YNH_APP_BASEDIR=/etc/yunohost/apps/"$app" +YNH_HELPERS_VERSION=2.1 -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) -server_name=$(ynh_app_setting_get --app=$app --key=server_name) +db_name=$(ynh_app_setting_get --key=db_name) +db_user=$(ynh_app_setting_get --key=db_user) +db_pwd=$(ynh_app_setting_get --key=db_pwd) +server_name=$(ynh_app_setting_get --key=server_name) if [ -z ${1:-} ]; then echo "Usage: set_admin_user.sh user_to_set_as_admin" exit 1 fi -ynh_psql_execute_as_root --database=$db_name --sql="UPDATE users SET admin = 1 WHERE name = '@$1:$server_name'" +ynh_psql_db_shell --database=$db_name --sql="UPDATE users SET admin = 1 WHERE name = '@$1:$server_name'" exit 0