Kay0u
5 years ago
No known key found for this signature in database
GPG Key ID: AAFEEB16CFA2AE2D
3 changed files with
1 additions and
25 deletions
-
scripts/_common.sh
-
scripts/backup
-
scripts/install
|
|
@ -1,27 +1,5 @@ |
|
|
#!/bin/bash |
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
#================================================= |
|
|
|
|
|
# BACKUP |
|
|
|
|
|
#================================================= |
|
|
|
|
|
|
|
|
|
|
|
HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un humain |
|
|
|
|
|
human=$(numfmt --to=iec --from-unit=1K $1) |
|
|
|
|
|
echo $human |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant |
|
|
|
|
|
file_to_analyse=$1 |
|
|
|
|
|
backup_size=$(du --summarize "$file_to_analyse" | cut -f1) |
|
|
|
|
|
free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d) |
|
|
|
|
|
|
|
|
|
|
|
if [ $free_space -le $backup_size ] |
|
|
|
|
|
then |
|
|
|
|
|
ynh_print_err "Espace insuffisant pour sauvegarder $file_to_analyse." |
|
|
|
|
|
ynh_print_err "Espace disponible: $(HUMAN_SIZE $free_space)" |
|
|
|
|
|
ynh_die "Espace nécessaire: $(HUMAN_SIZE $backup_size)" |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#================================================= |
|
|
#================================================= |
|
|
# EXPERIMENTAL HELPERS |
|
|
# EXPERIMENTAL HELPERS |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
@ -37,7 +37,6 @@ ynh_print_info --message="Declaring files to be backed up..." |
|
|
# BACKUP THE APP MAIN DIR |
|
|
# BACKUP THE APP MAIN DIR |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
|
|
|
CHECK_SIZE "$final_path" |
|
|
|
|
|
ynh_backup --src_path="$final_path" |
|
|
ynh_backup --src_path="$final_path" |
|
|
|
|
|
|
|
|
#================================================= |
|
|
#================================================= |
|
|
@ -58,7 +57,6 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" |
|
|
ynh_print_info --message="Backing up the MySQL database..." |
|
|
ynh_print_info --message="Backing up the MySQL database..." |
|
|
|
|
|
|
|
|
ynh_mysql_dump_db --database="$db_name" > db.sql |
|
|
ynh_mysql_dump_db --database="$db_name" > db.sql |
|
|
CHECK_SIZE "db.sql" |
|
|
|
|
|
|
|
|
|
|
|
#================================================= |
|
|
#================================================= |
|
|
# BACKUP FAIL2BAN CONFIGURATION |
|
|
# BACKUP FAIL2BAN CONFIGURATION |
|
|
|
|
|
@ -166,7 +166,7 @@ done |
|
|
#================================================= |
|
|
#================================================= |
|
|
ynh_script_progression --message="Installing wordpress plugins..." --weight=20 |
|
|
ynh_script_progression --message="Installing wordpress plugins..." --weight=20 |
|
|
|
|
|
|
|
|
wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$final_path/wp-cli.phar |
|
|
|
|
|
|
|
|
ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$final_path/wp-cli.phar |
|
|
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path" |
|
|
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path" |
|
|
|
|
|
|
|
|
$wpcli_alias plugin install simple-ldap-login |
|
|
$wpcli_alias plugin install simple-ldap-login |
|
|
|