1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoprism_ynh.git synced 2024-09-03 19:56:41 +02:00

first fix upgrade

This commit is contained in:
Thomas 2023-03-31 08:13:15 +02:00 committed by Félix Piédallu
parent 3d720df967
commit aff25055f0

View file

@ -9,23 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -34,29 +17,6 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -65,23 +25,18 @@ ynh_script_progression --message="Ensuring downward compatibility..."
# If language_key doesn't exist, create it # If language_key doesn't exist, create it
if [ -z "$language_key" ]; then if [ -z "$language_key" ]; then
#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language) language_key=$(ynh_app_setting_get --app=$app --key=language)
ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_set --app=$app --key=language_key --value=$language_key
ynh_app_setting_delete --app=$app --key=language ynh_app_setting_delete --app=$app --key=language
fi fi
# Create sharing permission if needed # Create sharing permission if needed
#REMOVEME? if ! ynh_permission_exists --permission="sharing"; then if ! ynh_permission_exists --permission="sharing"; then
#REMOVEME? ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true"
fi fi
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -92,19 +47,13 @@ then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# 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="$install_dir/build/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$install_dir/build/"
fi fi
chmod 750 "$install_dir" chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -146,7 +95,7 @@ mkdir -p $data_dir
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
rsync -a "$install_dir/live/assets/" "$data_dir/assets/" rsync -a "$install_dir/live/assets/" "$data_dir/assets/"
#REMOVEME? ynh_secure_remove --file="$install_dir/live/assets/" ynh_secure_remove --file="$install_dir/live/assets/"
fi fi
chmod 750 "$data_dir" chmod 750 "$data_dir"
@ -195,12 +144,9 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT