diff --git a/scripts/_common.sh b/scripts/_common.sh index d83babe..a854a50 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,10 @@ #================================================= # PERSONAL HELPERS #================================================= -ntfy_setup_source() { +ntfy_setup_source { + $YNH_ARCH=$1 + $install_dir=$2 + ynh_setup_source -d "$install_dir" -a "$YNH_ARCH" ynh_secure_remove --file=$install_dir/client ynh_secure_remove --file=$install_dir/server @@ -15,7 +18,10 @@ ntfy_setup_source() { mkdir -p "$install_dir/data" } -ntfy_fix_permissions() { +ntfy_fix_permissions { + $app=$1 + $install_dir=$2 + chmod o+w "$install_dir/data" chmod 400 "$install_dir/server.yml" chown $app:$app "$install_dir/server.yml" diff --git a/scripts/install b/scripts/install index 5ad1df4..49f9a5f 100755 --- a/scripts/install +++ b/scripts/install @@ -4,7 +4,7 @@ source _common.sh source /usr/share/yunohost/helpers ynh_script_progression -m "Setting up source files..." -w 6 -ntfy_setup_src +ntfy_setup_src $YNH_ARCH $install_dir ynh_script_progression -m "Configuring web server..." -w 2 ynh_add_nginx_config @@ -16,7 +16,7 @@ ynh_script_progression -m "Adding a command wrapper..." -w 1 ynh_add_config -t "ntfy.sh" -d "$install_dir/ntfy.sh" ynh_script_progression -m "Fixing file permissions..." -w 1 -ntfy_fix_permissions +ntfy_fix_permissions $install_dir $app ynh_script_progression -m "Configuring systemd service..." -w 1 ynh_add_systemd_config diff --git a/scripts/restore b/scripts/restore index 5962cc2..478063e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -7,7 +7,7 @@ ynh_script_progression -m "Restoring the main directory..." -w 1 ynh_restore_file -o "$install_dir" ynh_script_progression -m "Fixing file permissions..." -w 1 -ntfy_fix_permissions +ntfy_fix_permissions $app $install_dir ynh_script_progression -m "Restoring the web server configuration..." -w 1 ynh_restore_file -o "/etc/nginx/conf.d/$domain.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index b89657c..0cf37c4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,14 +9,14 @@ upgrade_type=$(ynh_check_app_version_changed) if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression -m "Upgrading source files..." -w 1 - ntfy_setup_source + ntfy_setup_source $YNH_ARCH $install_dir fi ynh_script_progression -m "Upgrading web server configuration..." -w 2 ynh_add_nginx_config ynh_script_progression -m "Updating configuration file..." -w 1 -ynh_add_config -t "server.yml" -d "$ntfy_config" +ynh_add_config -t "server.yml" -d "$install_dir/server.yml" ynh_script_progression -m "Updating simple command wrapper..." -w 1 ynh_add_config -t "ntfy.sh" -d "$install_dir/ntfy.sh"