mirror of
https://github.com/YunoHost-Apps/vikunja_ynh.git
synced 2024-09-03 18:06:26 +02:00
Merge pull request #79 from yunohost-bot/auto-helpers-2.1
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
commit
59607a1e13
8 changed files with 83 additions and 191 deletions
|
@ -19,11 +19,15 @@ admindoc = "https://vikunja.io/docs/"
|
||||||
code = "https://kolaente.dev/vikunja/vikunja"
|
code = "https://kolaente.dev/vikunja/vikunja"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.21"
|
yunohost = ">= 11.2.29"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
||||||
ldap = false
|
ldap = false
|
||||||
|
|
||||||
sso = false
|
sso = false
|
||||||
|
|
||||||
disk = "50M"
|
disk = "50M"
|
||||||
ram.build = "1500M"
|
ram.build = "1500M"
|
||||||
ram.runtime = "50M"
|
ram.runtime = "50M"
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,42 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
ynh_print_info "Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_db > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -17,45 +11,38 @@ secret=$(ynh_string_random --length=32)
|
||||||
timezone="$(cat /etc/timezone)"
|
timezone="$(cat /etc/timezone)"
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd"
|
ynh_systemctl --service=$app --action=stop --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
domain="$new_domain"
|
domain="$new_domain"
|
||||||
path="$new_path"
|
path="$new_path"
|
||||||
ynh_add_config --template="config.yml" --destination="$install_dir/config.yml"
|
ynh_config_add --template="config.yml" --destination="$install_dir/config.yml"
|
||||||
|
|
||||||
chmod 600 "$install_dir/config.yml"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
ynh_systemctl --service=$app --action=start --log_path=systemd
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
ynh_script_progression "Change of URL completed for $app"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -31,61 +25,54 @@ maxitemsperpage=50
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd
|
ynh_app_setting_set --key=set_motd --value=$set_motd
|
||||||
ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration
|
ynh_app_setting_set --key=enable_registration --value=$enable_registration
|
||||||
ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing
|
ynh_app_setting_set --key=enable_linksharing --value=$enable_linksharing
|
||||||
ynh_app_setting_set --app=$app --key=enable_taskattachments --value=$enable_taskattachments
|
ynh_app_setting_set --key=enable_taskattachments --value=$enable_taskattachments
|
||||||
ynh_app_setting_set --app=$app --key=enable_taskcomments --value=$enable_taskcomments
|
ynh_app_setting_set --key=enable_taskcomments --value=$enable_taskcomments
|
||||||
ynh_app_setting_set --app=$app --key=enable_emailreminders --value=$enable_emailreminders
|
ynh_app_setting_set --key=enable_emailreminders --value=$enable_emailreminders
|
||||||
ynh_app_setting_set --app=$app --key=enable_userdeletion --value=$enable_userdeletion
|
ynh_app_setting_set --key=enable_userdeletion --value=$enable_userdeletion
|
||||||
ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize
|
ynh_app_setting_set --key=maxavatarsize --value=$maxavatarsize
|
||||||
ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage
|
ynh_app_setting_set --key=maxitemsperpage --value=$maxitemsperpage
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL Vikunja
|
# INSTALL Vikunja
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
|
executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
|
||||||
mv "$executable" "$install_dir/vikunja"
|
mv "$executable" "$install_dir/vikunja"
|
||||||
|
|
||||||
chmod +x "$install_dir/vikunja"
|
chmod +x "$install_dir/vikunja"
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
ynh_add_config --template="config.yml" --destination="$install_dir/config.yml"
|
ynh_config_add --template="config.yml" --destination="$install_dir/config.yml"
|
||||||
|
|
||||||
chmod 400 "$install_dir/config.yml"
|
|
||||||
chown "$app:$app" "$install_dir/config.yml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
ynh_script_progression "Adding system configurations related to $app..."
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..." --weight=2
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
ynh_systemctl --service="$app" --action=start --log_path=systemd #--wait_until="server started on"
|
||||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd #--line_match="server started on"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -14,25 +8,22 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEMD SERVICE
|
# REMOVE SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
if ynh_hide_warnings 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..." --weight=1
|
ynh_script_progression "Removing $app service..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
ynh_config_remove_systemd
|
||||||
ynh_remove_systemd_config
|
|
||||||
|
|
||||||
ynh_redis_remove_db "$redis_db"
|
ynh_redis_remove_db "$redis_db"
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
ynh_config_remove_nginx
|
||||||
ynh_remove_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -1,58 +1,45 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring $app main directory..." --weight=4
|
ynh_script_progression "Restoring $app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R "$app:www-data" "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
|
ynh_script_progression "Restoring the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_psql_db_shell < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore "/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server started on"
|
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="server started on"
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -20,116 +14,79 @@ redis_db=$(ynh_redis_get_free_db)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression "Ensuring downward compatibility..."
|
||||||
|
|
||||||
if [ -z "${set_motd:-}" ]; then
|
ynh_app_setting_set_default --key=set_motd --value=""
|
||||||
set_motd=""
|
|
||||||
ynh_app_setting_set --app="$app" --key="set_motd" --value="$set_motd"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${enable_registration:-}" ]; then
|
ynh_app_setting_set_default --key=enable_registration --value="true"
|
||||||
enable_registration="true"
|
|
||||||
ynh_app_setting_set --app="$app" --key="enable_registration" --value="$enable_registration"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${enable_linksharing:-}" ]; then
|
ynh_app_setting_set_default --key=enable_linksharing --value="true"
|
||||||
enable_linksharing="true"
|
|
||||||
ynh_app_setting_set --app="$app" --key="enable_linksharing" --value="$enable_linksharing"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${enable_taskattachments:-}" ]; then
|
ynh_app_setting_set_default --key=enable_taskattachments --value="true"
|
||||||
enable_taskattachments="true"
|
|
||||||
ynh_app_setting_set --app="$app" --key="enable_taskattachments" --value="$enable_taskattachments"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${enable_taskcomments:-}" ]; then
|
ynh_app_setting_set_default --key=enable_taskcomments --value="true"
|
||||||
enable_taskcomments="true"
|
|
||||||
ynh_app_setting_set --app="$app" --key="enable_taskcomments" --value="$enable_taskcomments"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${enable_emailreminders:-}" ]; then
|
ynh_app_setting_set_default --key=enable_emailreminders --value="true"
|
||||||
enable_emailreminders="true"
|
|
||||||
ynh_app_setting_set --app="$app" --key="enable_emailreminders" --value="$enable_emailreminders"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${enable_userdeletion:-}" ]; then
|
ynh_app_setting_set_default --key=enable_userdeletion --value="true"
|
||||||
enable_userdeletion="true"
|
|
||||||
ynh_app_setting_set --app="$app" --key="enable_userdeletion" --value="$enable_userdeletion"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${maxavatarsize:-}" ]; then
|
ynh_app_setting_set_default --key=maxavatarsize --value=1024
|
||||||
maxavatarsize=1024
|
|
||||||
ynh_app_setting_set --app="$app" --key="maxavatarsize" --value="$maxavatarsize"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${maxitemsperpage:-}" ]; then
|
ynh_app_setting_set_default --key=maxitemsperpage --value=50
|
||||||
maxitemsperpage=50
|
|
||||||
ynh_app_setting_set --app="$app" --key="maxitemsperpage" --value="$maxitemsperpage"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${language:-}" ]; then
|
ynh_app_setting_set_default --key=language --value="en"
|
||||||
language="en"
|
|
||||||
ynh_app_setting_set --app="$app" --key="language" --value="$language"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ynh_compare_current_package_version --comparison lt --version "0.23.0~ynh1"; then
|
if ynh_app_upgrading_from_version_before 0.23.0~ynh1; then
|
||||||
mv "$backend_path/config.yml" "$install_dir/config.yml"
|
mv "$backend_path/config.yml" "$install_dir/config.yml"
|
||||||
ynh_secure_remove "$backend_path"
|
ynh_safe_rm "$backend_path"
|
||||||
ynh_app_setting_delete --app="$app" --key="backend_path"
|
ynh_app_setting_delete --key="backend_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
|
ynh_systemctl --service=$app --action=stop --log_path=systemd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
||||||
executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
|
executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
|
||||||
mv "$executable" "$install_dir/vikunja"
|
mv "$executable" "$install_dir/vikunja"
|
||||||
|
|
||||||
chmod +x "$install_dir/vikunja"
|
chmod +x "$install_dir/vikunja"
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
|
ynh_script_progression "Updating $app's configuration files..."
|
||||||
|
|
||||||
ynh_add_config --template="config.yml" --destination="$install_dir/config.yml"
|
ynh_config_add --template="config.yml" --destination="$install_dir/config.yml"
|
||||||
|
|
||||||
chmod 400 "$install_dir/config.yml"
|
|
||||||
chown $app:$app "$install_dir/config.yml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server started on"
|
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="server started on"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue