mirror of
https://github.com/YunoHost-Apps/paperless-ngx_ynh.git
synced 2024-09-03 19:56:33 +02:00
Cleaning
This commit is contained in:
parent
39237c9212
commit
8416f09df3
6 changed files with 3 additions and 73 deletions
|
@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
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
|
# 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-scheduler.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-task-queue.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
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up 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
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_redis
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_redis
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# 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/_common.sh
|
||||||
source ../settings/scripts/ynh_redis
|
|
||||||
source /usr/share/yunohost/helpers
|
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)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
|
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -7,14 +7,8 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_redis
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,13 +42,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --keep="paperless.conf"
|
ynh_setup_source --dest_dir="$install_dir" --keep="paperless.conf"
|
||||||
fi
|
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
|
@ -73,7 +63,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL PYTHON DEPENDENCIES
|
# INSTALL PYTHON DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Python dependencies..."
|
ynh_script_progression --message="Installing Python dependencies..." --weight=5
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in a new issue