diff --git a/scripts/install b/scripts/install index 0e9d309..a2401f4 100644 --- a/scripts/install +++ b/scripts/install @@ -79,7 +79,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -131,7 +131,8 @@ popd || ynh_die #================================================= ynh_script_progression --message="Securing files and directories..." --weight=1 -chown -R $app: $final_path +chown -R $app:$app $final_path +chmod 600 "$final_path/config/config.js" #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -146,7 +147,7 @@ yunohost service add $app --description="Zero Knowledge realtime collaborative e ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="server available" +ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="server available" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index a63cc5b..374e5eb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -49,6 +49,14 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -56,20 +64,13 @@ ynh_script_progression --message="Restoring CryptPad main directory..." --weight ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files chown -R $app: $final_path +chmod 600 "$final_path/config/config.js" #================================================= # REINSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 5d3423a..ab8d77a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,6 +71,14 @@ 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" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -99,14 +107,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=6 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # CONFIGURE CONFIG.JS #================================================= @@ -140,6 +140,7 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Set permissions on app files chown -R $app: $final_path +chmod 600 "$final_path/config/config.js" #================================================= # INTEGRATE SERVICE IN YUNOHOST