diff --git a/check_process b/check_process index c6cbd5a..f89ed58 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" @@ -10,8 +5,7 @@ admin="john" language="fr" is_public=1 - password="pass" - port="9001" + password="password" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/scripts/_common.sh b/scripts/_common.sh index 72e3749..320cbb8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -20,16 +20,3 @@ nodejs_version=14 #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# Execute a command as another user -# usage: ynh_exec_as USER COMMAND [ARG ...] -ynh_exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]]; then - eval "$@" - else - sudo -u "$USER" "$@" - fi -} \ No newline at end of file diff --git a/scripts/change_url b/scripts/change_url index e46b99a..5b2e91d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -115,7 +115,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Your Etherpad version is" -sleep 120 #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index c897fab..88c2303 100644 --- a/scripts/install +++ b/scripts/install @@ -103,6 +103,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path git clone --branch master https://github.com/ether/etherpad-lite.git "$final_path" --quiet +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -121,7 +125,7 @@ chown -R $app: $final_path pushd "$final_path" || ynh_die ynh_use_nodejs ynh_exec_as $app env "$ynh_node_load_PATH" src/bin/installDeps.sh - ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_automatic_logut ep_countable ep_spellcheck ep_delete_empty_pads ep_subscript_and_superscript ep_headings2 ep_author_hover ep_markdown ep_comments_page ep_align ep_font_color + #ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_automatic_logut ep_countable ep_spellcheck ep_delete_empty_pads ep_subscript_and_superscript ep_headings2 ep_author_hover ep_markdown ep_comments_page ep_align ep_font_color popd || ynh_die #================================================= @@ -132,15 +136,7 @@ ynh_script_progression --message="Configuring Etherpad..." --weight=6 ynh_add_config --template="../conf/settings.json" --destination="$final_path/settings.json" ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R $app: $final_path -chmod 600 $final_path/credentials.json +chmod 400 $final_path/credentials.json #================================================= # SETUP SYSTEMD @@ -148,7 +144,7 @@ chmod 600 $final_path/credentials.json ynh_script_progression --message="Configuring a systemd service..." --weight=4 # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_add_systemd_config #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/restore b/scripts/restore index 3e1e0dc..11acae7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -66,6 +66,11 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod 600 $final_path/credentials.json + #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -86,14 +91,6 @@ ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R $app: $final_path -chmod 600 $final_path/credentials.json - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -115,7 +112,6 @@ systemctl enable $app.service --quiet ynh_script_progression --message="Starting a systemd service..." --weight=8 ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Your Etherpad version is" -sleep 120 #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 31e3ec6..645d170 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -125,14 +125,9 @@ then popd fi -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R $app: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" chmod 600 $final_path/credentials.json #================================================= @@ -141,7 +136,7 @@ chmod 600 $final_path/credentials.json ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_add_systemd_config #================================================= # INTEGRATE SERVICE IN YUNOHOST