diff --git a/scripts/backup b/scripts/backup index d00d2a0..66f7b2c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -62,20 +57,11 @@ ynh_backup --src_path="/etc/systemd/system/$app-consumer.service" ynh_backup --src_path="/etc/systemd/system/$app-scheduler.service" ynh_backup --src_path="/etc/systemd/system/$app-task-queue.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -#ynh_backup --src_path="/etc/$app/" - #================================================= # BACKUP THE MYSQL DATABASE #================================================= ynh_print_info --message="Backing up the MySQL database..." -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - ynh_psql_dump_db --database="$db_name" > db.sql #================================================= diff --git a/scripts/install b/scripts/install index f5f87df..cf18621 100755 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_redis source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/remove b/scripts/remove index 7e0bb1a..2b4056f 100755 --- a/scripts/remove +++ b/scripts/remove @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_redis source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/restore b/scripts/restore index 98f6323..4c8aca0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_redis source /usr/share/yunohost/helpers #================================================= @@ -19,10 +18,6 @@ ynh_script_progression --message="Loading additionnal settings..." --weight=1 redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db -#================================================= -# STANDARD RESTORATION STEPS -#================================================= - #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6be9942..83600ab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,14 +7,8 @@ #================================================= source _common.sh -source ynh_redis source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -48,13 +42,9 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - ynh_setup_source --dest_dir="$install_dir" --keep="paperless.conf" -fi +ynh_setup_source --dest_dir="$install_dir" --keep="paperless.conf" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -73,7 +63,7 @@ ynh_add_nginx_config #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Python dependencies..." +ynh_script_progression --message="Installing Python dependencies..." --weight=5 pushd $install_dir python3 -m venv venv diff --git a/scripts/ynh_redis b/scripts/ynh_redis deleted file mode 100644 index 0071247..0000000 --- a/scripts/ynh_redis +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# get the first available redis database -# -# usage: ynh_redis_get_free_db -# | returns: the database number to use -ynh_redis_get_free_db() { - local result max db - result=$(redis-cli INFO keyspace) - - # get the num - max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") - - db=0 - # default Debian setting is 15 databases - for i in $(seq 0 "$max") - do - if ! echo "$result" | grep -q "db$i" - then - db=$i - break 1 - fi - db=-1 - done - - test "$db" -eq -1 && ynh_die --message="No available Redis databases..." - - echo "$db" -} - -# Create a master password and set up global settings -# Please always call this script in install and restore scripts -# -# usage: ynh_redis_remove_db database -# | arg: database - the database to erase -ynh_redis_remove_db() { - local db=$1 - redis-cli -n "$db" flushall -}