diff --git a/conf/config.json.example b/conf/config.json.example index 5f6ec2b..03c46e8 100644 --- a/conf/config.json.example +++ b/conf/config.json.example @@ -3,7 +3,7 @@ "protocolUseSSL": true, "domain": "__DOMAIN__", "port": "__PORT__", - "urlPath": "__PATH__", + "urlPath": "__URL_PATH__", "loglevel": "info", "useCDN": false, "allowGravatar": false, @@ -30,7 +30,7 @@ "addGoogleAnalytics": false }, "db": { - "username": "__DB_NAME__", + "username": "__DB_USER__", "password": "__DB_PWD__", "database": "__DB_NAME__", "host": "localhost", diff --git a/scripts/backup b/scripts/backup index 3115b5b..8d4d217 100644 --- a/scripts/backup +++ b/scripts/backup @@ -66,4 +66,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for HedgeDoc. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index d903e72..a9c8a53 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -73,7 +73,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # MODIFY URL IN NGINX CONF @@ -113,10 +113,13 @@ fi ynh_backup_if_checksum_is_different --file="$final_path/config.json" domain=$new_domain -path=${new_path:1} +url_path=${new_path#/} ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +chmod 400 "$final_path/config.json" +chown $app:$app "$final_path/config.json" + #================================================= # GENERIC FINALISATION #================================================= @@ -138,4 +141,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for HedgeDoc" --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index f46b65b..35fb5ac 100644 --- a/scripts/install +++ b/scripts/install @@ -86,9 +86,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_name --db_name=$db_name +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -133,10 +134,12 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -path=${path_url:1} - +url_path=${path_url#/} ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +chmod 400 "$final_path/config.json" +chown $app:$app "$final_path/config.json" + #================================================= # GENERIC FINALIZATION #================================================= @@ -186,4 +189,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of HedgeDoc completed" --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 60d5336..2e2045a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -63,7 +63,7 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing HedgeDoc main directory..." --weight=6 +ynh_script_progression --message="Removing $app main directory..." --weight=6 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -90,4 +90,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of HedgeDoc completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 86f21a9..c167e57 100644 --- a/scripts/restore +++ b/scripts/restore @@ -64,12 +64,6 @@ ynh_script_progression --message="Restoring HedgeDoc main directory..." --weight ynh_restore_file --origin_path="$final_path" -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." --weight=2 - -# Restore permissions on app files chown -R $app:$app $final_path chmod o-rwx $final_path chmod 600 $final_path/config.json @@ -134,4 +128,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for HedgeDoc" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 678957c..dbe33a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -127,7 +127,6 @@ fi ynh_script_progression --message="Configuring a systemd service..." --weight=2 env_path="$PATH" - # Create a dedicated systemd config ynh_add_systemd_config @@ -168,4 +167,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of HedgeDoc completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last