mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Apply example_ynh to upgrade
This commit is contained in:
parent
2c1dc36d21
commit
eed72dd957
1 changed files with 30 additions and 8 deletions
|
@ -31,8 +31,9 @@ fi
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Check version
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
abort_if_up_to_date
|
abort_if_up_to_date
|
||||||
# previous function is what defines 'version', more precisely the 'previous version'
|
# previous function is what defines 'version', more precisely the 'previous version'
|
||||||
previous_version="${version}"
|
previous_version="${version}"
|
||||||
|
@ -41,11 +42,14 @@ previous_version="${version}"
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup_before_upgrade # Backup the current version of the app
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_restore_upgradebackup # restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
ynh_abort_if_errors # 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -55,9 +59,11 @@ if ynh_version_gt "0.45-2" "${previous_version}" ; then
|
||||||
ynh_replace_string "Environment=ROOT_URL=http://127.0.0.1:$port$path_url" "Environment=ROOT_URL=https://$domain$path_url/" "/etc/systemd/system/$app.service"
|
ynh_replace_string "Environment=ROOT_URL=http://127.0.0.1:$port$path_url" "Environment=ROOT_URL=https://$domain$path_url/" "/etc/systemd/system/$app.service"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_version_gt "0.45-3" "${previous_version}" ; then
|
if ynh_version_gt "0.45-3" "${previous_version}" ; then
|
||||||
yunohost service add $app
|
yunohost service add $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_version_gt "0.77-2" "${previous_version}" ; then
|
if ynh_version_gt "0.77-2" "${previous_version}" ; then
|
||||||
ynh_install_nodejs 8.9.3
|
ynh_install_nodejs 8.9.3
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
|
@ -69,6 +75,7 @@ if ynh_version_gt "0.77-2" "${previous_version}" ; then
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service"
|
ynh_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service"
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
|
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
|
||||||
|
|
||||||
# Replace mongodb packages
|
# Replace mongodb packages
|
||||||
|
@ -91,6 +98,12 @@ if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK THE PATH
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Normalize the URL path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
@ -99,24 +112,33 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# For this app sources are in app subdirectory
|
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set strong right permissions to app files
|
# Set permissions on app files
|
||||||
chown -R $app: "$final_path"
|
chown -R $app: "$final_path"
|
||||||
chmod -R 640 "$final_path"
|
chmod -R 640 "$final_path"
|
||||||
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
||||||
|
|
||||||
# Relaunch a npm install
|
# Relaunch a npm install
|
||||||
pushd $final_path/programs/server
|
pushd $final_path/programs/server
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
npm install
|
npm install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue