mirror of
https://github.com/YunoHost-Apps/calibreweb_ynh.git
synced 2024-09-03 18:16:20 +02:00
Update through 0.6.6
This commit is contained in:
parent
ef218bf3ff
commit
f06e133eb1
11 changed files with 122 additions and 77 deletions
|
@ -15,12 +15,10 @@
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1 from_commit=3b9c5041e4fa73cb965368379f2b83d076c65341
|
upgrade=1
|
||||||
upgrade=1 from_commit=03bafd5219544c5d317eaf54182e4122ba63a4ad
|
upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9
|
||||||
upgrade_1 from_commit=9e5fa45df7cd840d8a26d25f953857a13d6bc5de
|
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
|
||||||
port_already_use=1 (8083)
|
port_already_use=1 (8083)
|
||||||
change_url=1
|
change_url=1
|
||||||
#;; Failed upgrade
|
#;; Failed upgrade
|
||||||
|
@ -41,23 +39,11 @@
|
||||||
# setup_root=1
|
# setup_root=1
|
||||||
# upgrade=1 from_commit=3b9c5041e4fa73cb965368379f2b83d076c65341
|
# upgrade=1 from_commit=3b9c5041e4fa73cb965368379f2b83d076c65341
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
Level 4=1
|
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=nicolas@aubonalbanais.ovh
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=3b9c5041e4fa73cb965368379f2b83d076c65341
|
; commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9
|
||||||
name=First in progress release of the app 0.9~ynh1
|
name=Version 0.96.0~ynh4
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1&
|
|
||||||
; commit=03bafd5219544c5d317eaf54182e4122ba63a4ad
|
|
||||||
name=Release 0.91~ynh2
|
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1&
|
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1&
|
3
conf/app066.src
Normal file
3
conf/app066.src
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
SOURCE_URL=https://github.com/janeczku/calibre-web/archive/0.6.6.zip
|
||||||
|
SOURCE_SUM=87633c2817263ed2d12fce67ea292b1c6d042aa949aafb728789c15d495415cc
|
||||||
|
SOURCE_FORMAT=zip
|
|
@ -1,13 +1,5 @@
|
||||||
config_calibre_dir=\'$calibre_dir\',
|
config_calibre_dir=\'$calibre_dir\',
|
||||||
config_port=$port,
|
config_port=$port,
|
||||||
config_certfile=\'\',
|
|
||||||
config_keyfile=\'\',
|
|
||||||
config_use_google_drive=0,
|
|
||||||
config_remote_login=0,
|
|
||||||
config_use_goodreads=0,
|
|
||||||
config_logfile=\'\',
|
|
||||||
config_converterpath=\'\',
|
|
||||||
config_calibre=\'\',
|
|
||||||
config_logfile=\'$LOG_FILE\',
|
config_logfile=\'$LOG_FILE\',
|
||||||
config_access_log=1,
|
config_access_log=1,
|
||||||
config_access_logfile=\'$ACCESS_LOG_FILE\',
|
config_access_logfile=\'$ACCESS_LOG_FILE\',
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"license": "free",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Krakinou",
|
"name": "Krakinou",
|
||||||
"email": "misterl56@hotmail.com"
|
"email": "nicolas@aubonalbanais.ovh"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.7.1"
|
"yunohost": ">= 3.7.1"
|
||||||
|
@ -66,6 +66,7 @@
|
||||||
{
|
{
|
||||||
"name": "language",
|
"name": "language",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Select a default language",
|
"en": "Select a default language",
|
||||||
"fr": "Choisissez une langue par défaut"
|
"fr": "Choisissez une langue par défaut"
|
||||||
|
|
|
@ -11,6 +11,11 @@ get_db() {
|
||||||
sqlite3 $final_path/app.db ".schema $1" | awk '/\t/ {print $1}' | grep -v -e "UNIQUE" -e "PRIMARY" -e "CHECK" -e "FOREIGN" | awk '{printf "%s, ", $0}' | head -c -2
|
sqlite3 $final_path/app.db ".schema $1" | awk '/\t/ {print $1}' | grep -v -e "UNIQUE" -e "PRIMARY" -e "CHECK" -e "FOREIGN" | awk '{printf "%s, ", $0}' | head -c -2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version_gt() {
|
||||||
|
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
# TO BE DELETED WHEN RELEASED
|
# TO BE DELETED WHEN RELEASED
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PKG_DEPENDENCIES="sqlite3 python3-pip imagemagick"
|
PKG_DEPENDENCIES="sqlite3 python-dev libldap2-dev python3-pip imagemagick"
|
||||||
DOSSIER_MEDIA=/home/yunohost.multimedia
|
DOSSIER_MEDIA=/home/yunohost.multimedia
|
||||||
LOG_FILE=/var/log/$app/$app.log
|
LOG_FILE=/var/log/$app/$app.log
|
||||||
ACCESS_LOG_FILE=/var/log/$app/$app-access.log
|
ACCESS_LOG_FILE=/var/log/$app/$app-access.log
|
|
@ -81,7 +81,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up data directory..."
|
ynh_script_progression --message="Backing up data directory..."
|
||||||
|
|
||||||
ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big
|
ynh_backup --src_path="$calibre_dir" --is_big
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -22,11 +22,27 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=10
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
|
@ -55,9 +71,17 @@ fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -87,16 +111,23 @@ then
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="start"
|
||||||
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||||
|
|
|
@ -38,7 +38,7 @@ source _settings.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..." --weight=5
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
@ -54,7 +54,7 @@ ynh_webpath_register $app $domain $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..." --weight=5
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
@ -90,10 +90,10 @@ ynh_setup_source "$final_path"
|
||||||
ynh_script_progression --message="Installing package dependencies..." --weight=15
|
ynh_script_progression --message="Installing package dependencies..." --weight=15
|
||||||
ynh_install_app_dependencies $PKG_DEPENDENCIES
|
ynh_install_app_dependencies $PKG_DEPENDENCIES
|
||||||
|
|
||||||
ynh_script_progression --message="Installing pip requirements ..." --weight=30
|
ynh_script_progression --message="Installing pip requirements..." --weight=50
|
||||||
pip3 install --no-cache-dir --target $final_path/vendor -r $final_path/requirements.txt
|
pip3 install --no-cache-dir --target $final_path/vendor -r $final_path/requirements.txt
|
||||||
|
|
||||||
ynh_script_progression --message="Installing pip additionnal requirements..." --weight=40
|
ynh_script_progression --message="Installing pip additionnal requirements..." --weight=60
|
||||||
pip3 install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/optional-requirements.txt
|
pip3 install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/optional-requirements.txt
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -129,7 +129,7 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE FILES AND DIRECTORIES
|
# CREATE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating files and directory..."
|
ynh_script_progression --message="Creating files and directory..." --weight=5
|
||||||
#Logic is as follow : if app is set to be publicly accessible, we will assume that the library should be set in "Share" multimedia directory
|
#Logic is as follow : if app is set to be publicly accessible, we will assume that the library should be set in "Share" multimedia directory
|
||||||
# If app is set to be private but access is requested for all user, we will assume the same
|
# If app is set to be private but access is requested for all user, we will assume the same
|
||||||
# If app is set to be private but access is limited to the admin user, we will set it inside his own multimedia directory.
|
# If app is set to be private but access is limited to the admin user, we will set it inside his own multimedia directory.
|
||||||
|
@ -169,7 +169,7 @@ chown -R $app:$app /var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET SQLITE DATABASE SETTINGS
|
# SET SQLITE DATABASE SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up database and settings..."
|
ynh_script_progression --message="Setting up database and settings..." --weight=5
|
||||||
#we need to start and stop the service so that initial app.db file is created and that we can set default data
|
#we need to start and stop the service so that initial app.db file is created and that we can set default data
|
||||||
ynh_systemd_action
|
ynh_systemd_action
|
||||||
|
|
||||||
|
@ -227,11 +227,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx and start $app..."
|
ynh_script_progression --message="Reload nginx and start $app..." --weight=5 -t
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
ynh_systemd_action
|
ynh_systemd_action
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression --message="Installation of $app completed" --last -t
|
||||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
@ -27,7 +27,7 @@ calibre_dir=$(ynh_app_setting_get $app calibre_dir)
|
||||||
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service..." --time --weight=1
|
ynh_script_progression --message="Removing $app service..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_script_progression --message="Removing Dependencies..."
|
ynh_script_progression --message="Removing Dependencies..." --weight=5
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_script_progression --message="Removing $final_path..."
|
ynh_script_progression --message="Removing $final_path..." --weight=1
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -65,7 +65,7 @@ ynh_secure_remove --file="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_script_progression --message="Removing nginx web server configuration..."
|
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -73,7 +73,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_script_progression --message="Removing logrotate configuration..."
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -82,16 +82,12 @@ ynh_remove_logrotate
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $port..."
|
ynh_script_progression --message="Closing port $port..." --weight=10
|
||||||
yunohost firewall disallow TCP $port 2>&1
|
yunohost firewall disallow TCP $port 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing log and user $app..."
|
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
|
ynh_script_progression --message="Removing log file..." --weight=1
|
||||||
ynh_secure_remove "/var/log/$app/"
|
ynh_secure_remove "/var/log/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -99,8 +95,8 @@ ynh_secure_remove "/var/log/$app/"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
@ -37,10 +37,24 @@ source _settings.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
current_upstream_package_version=$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$app/manifest.json") #0.96.0
|
||||||
|
current_upstream_package_version="${current_upstream_package_version/".96"/".6"}" #0.6.0
|
||||||
|
|
||||||
|
new_upstream_package_version=$(ynh_app_upstream_version) #0.96.0
|
||||||
|
new_upstream_package_version="${new_upstream_package_version/".96"/".6"}" #0.6.0
|
||||||
|
|
||||||
|
if [ -f $final_path/cps/constants.py ]; then
|
||||||
|
current_upstream_app_version=$(cat $final_path/cps/constants.py | grep STABLE_VERSION)
|
||||||
|
current_upstream_app_version="${current_upstream_app_version/STABLE_VERSION = \{\'version\': \'/""}"
|
||||||
|
current_upstream_app_version="${current_upstream_app_version/\'\}/""}"
|
||||||
|
else
|
||||||
|
current_upstream_app_version='0.6.0'
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
|
@ -51,7 +65,7 @@ ynh_clean_setup () {
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#Stop the app in case database is updated
|
#Stop the app in case database is updated
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop"
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
|
@ -68,12 +82,24 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
#binaries version is 0.6.0, we need to go throught upgrade to 0.6.6 so that app.db is correctly updated, otherwise database is corrupted
|
||||||
ynh_print_info "Download and install new sources"
|
if version_gt "0.6.6" $current_upstream_app_version && [ $current_upstream_package_version == "0.6.0" ] && [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||||
|
ynh_script_progression --message="Upgrading from $current_upstream_app_version to 0.6.6..." --weight=50
|
||||||
|
ynh_setup_source --dest_dir="$final_path" --source_id="app066"
|
||||||
|
pip install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/requirements.txt
|
||||||
|
chown -R $app: $final_path
|
||||||
|
#set database settings as per conf file : restart server so that app.db is regenerated
|
||||||
|
ynh_systemd_action
|
||||||
|
#sleep required on low spec like raspberryPi
|
||||||
|
sleep 5s
|
||||||
|
ynh_systemd_action -a stop
|
||||||
|
current_upstream_app_version="0.6.6"
|
||||||
|
#remove unwanted entry in settings db
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
ynh_script_progression --message="Upgrading source files from $current_upstream_app_version to new_upstream_package_version..." --weight=10
|
||||||
|
|
||||||
# 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"
|
||||||
fi
|
fi
|
||||||
|
@ -81,26 +107,29 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
|
|
||||||
|
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=5
|
||||||
if [ $path_url = "/" ] ; then
|
if [ $path_url = "/" ] ; then
|
||||||
ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf
|
ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing package dependencies..." --weight=15
|
|
||||||
ynh_install_app_dependencies $PKG_DEPENDENCIES
|
|
||||||
|
|
||||||
ynh_script_progression --message="Installing pip requirements ..." --weight=30
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
pip3 install --no-cache-dir --target $final_path/vendor -r $final_path/requirements.txt
|
then
|
||||||
|
ynh_script_progression --message="Installing package dependencies..." --weight=15
|
||||||
|
ynh_install_app_dependencies $PKG_DEPENDENCIES
|
||||||
|
|
||||||
ynh_script_progression --message="Installing pip additionnal requirements..." --weight=40
|
ynh_script_progression --message="Installing pip requirements ..." --weight=30
|
||||||
pip3 install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/optional-requirements.txt
|
pip3 install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/requirements.txt
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installing pip additionnal requirements..." --weight=40
|
||||||
|
pip3 install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/optional-requirements.txt
|
||||||
|
fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -130,13 +159,13 @@ ynh_script_progression --message="Update database..." --time --weight=1
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
ynh_backup_if_checksum_is_different "$final_path/app.db"
|
ynh_backup_if_checksum_is_different "$final_path/app.db"
|
||||||
|
|
||||||
#set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap settings
|
#set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap & log settings
|
||||||
ynh_systemd_action
|
ynh_systemd_action
|
||||||
#sleep required on low spec like raspberryPi
|
#sleep required on low spec like raspberryPi
|
||||||
sleep 5s
|
sleep 5s
|
||||||
ynh_systemd_action -a stop
|
ynh_systemd_action -a stop
|
||||||
|
|
||||||
conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\""
|
conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\""
|
||||||
eval sqlite3 $final_path/app.db "$conf"
|
eval sqlite3 $final_path/app.db "$conf"
|
||||||
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
|
@ -150,6 +179,7 @@ ynh_store_file_checksum "$final_path/app.db"
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1
|
ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -204,3 +234,4 @@ ynh_systemd_action --service_name=$app --action="start"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue