mirror of
				https://github.com/YunoHost-Apps/send_ynh.git
				synced 2025-11-03 23:35:35 +01:00 
			
		
		
		
	Cleaning up
This commit is contained in:
		@@ -123,12 +123,6 @@ chown $app "$final_path/server/config.js"
 | 
				
			|||||||
#==============================================
 | 
					#==============================================
 | 
				
			||||||
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20
 | 
					ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pushd "$final_path"
 | 
					 | 
				
			||||||
#	ynh_use_nodejs
 | 
					 | 
				
			||||||
#	ynh_exec_warn_less ynh_npm install
 | 
					 | 
				
			||||||
#	ynh_exec_warn_less ynh_npm run build
 | 
					 | 
				
			||||||
#popd
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pushd "$final_path"
 | 
					pushd "$final_path"
 | 
				
			||||||
	ynh_use_nodejs
 | 
						ynh_use_nodejs
 | 
				
			||||||
	ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install
 | 
						ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
 | 
					ynh_script_progression --message="Validating restoration parameters..." --weight=2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
 | 
					test ! -d $final_path \
 | 
				
			||||||
 | 
						|| ynh_die --message="There is already a directory: $final_path "
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# STANDARD RESTORATION STEPS
 | 
					# STANDARD RESTORATION STEPS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,15 @@ port=$(ynh_app_setting_get --app=$app --key=port)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
upgrade_type=$(ynh_check_app_version_changed)
 | 
					upgrade_type=$(ynh_check_app_version_changed)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#=================================================
 | 
				
			||||||
 | 
					# STANDARD UPGRADE STEPS
 | 
				
			||||||
 | 
					#=================================================
 | 
				
			||||||
 | 
					# STOP SYSTEMD SERVICE
 | 
				
			||||||
 | 
					#=================================================
 | 
				
			||||||
 | 
					ynh_script_progression --message="Stopping a systemd service..." --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
 | 
					# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@@ -41,15 +50,6 @@ ynh_clean_setup () {
 | 
				
			|||||||
# Exit if an error occurs during the execution of the script
 | 
					# Exit if an error occurs during the execution of the script
 | 
				
			||||||
ynh_abort_if_errors
 | 
					ynh_abort_if_errors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					 | 
				
			||||||
# STANDARD UPGRADE STEPS
 | 
					 | 
				
			||||||
#=================================================
 | 
					 | 
				
			||||||
# STOP SYSTEMD SERVICE
 | 
					 | 
				
			||||||
#=================================================
 | 
					 | 
				
			||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# CREATE DEDICATED USER
 | 
					# CREATE DEDICATED USER
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@@ -66,23 +66,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
 | 
				
			|||||||
then
 | 
					then
 | 
				
			||||||
	ynh_script_progression --message="Upgrading source files..." --weight=10
 | 
						ynh_script_progression --message="Upgrading source files..." --weight=10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Create a temporary directory
 | 
					 | 
				
			||||||
	tmpdir="$(mktemp -d)"
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Backup the config file in the temp dir
 | 
					 | 
				
			||||||
	cp -a "$final_path/server/config.js" "$tmpdir/config.js"
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Remove the app directory securely
 | 
					 | 
				
			||||||
	ynh_secure_remove --file=$final_path
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Download, check integrity, uncompress and patch the source from app.src
 | 
						# Download, check integrity, uncompress and patch the source from app.src
 | 
				
			||||||
	ynh_setup_source --dest_dir=$final_path
 | 
						ynh_setup_source --dest_dir=$final_path --keep="$final_path/server/config.js" 
 | 
				
			||||||
 | 
					 | 
				
			||||||
	#Copy the admin saved settings from tmp directory to final path	
 | 
					 | 
				
			||||||
	cp -a "$tmpdir/config.js" "$final_path/server/config.js" 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Remove the tmp directory securely
 | 
					 | 
				
			||||||
	ynh_secure_remove --file="$tmpdir"
 | 
					 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chmod 750 "$final_path"
 | 
					chmod 750 "$final_path"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user