From 25e47e2cac526ad27e2040234057f133459e10ef Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sun, 12 Apr 2020 17:13:11 +0200 Subject: [PATCH] Do not use expect anymore --- README.md | 4 ---- conf/backup-with-restic-answerbot.j2 | 6 ------ conf/systemd.service | 2 +- scripts/_common.sh | 2 -- scripts/install | 8 ++------ scripts/restore | 3 +-- scripts/upgrade | 3 +-- 7 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 conf/backup-with-restic-answerbot.j2 diff --git a/README.md b/README.md index 270fa57..bab4127 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,3 @@ yunohost app setting restic apps -v "nextcloud,wordpress" ## Backup on different server, and apply distinct schedule for apps You can setup the restic app several times on the same server so you can backup on several server or manage your frequency backup differently for specific part of your server. - -## TODO - -* Remove expect message when question was not matched diff --git a/conf/backup-with-restic-answerbot.j2 b/conf/backup-with-restic-answerbot.j2 deleted file mode 100644 index 20df760..0000000 --- a/conf/backup-with-restic-answerbot.j2 +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/expect -f -set timeout -1 -spawn /usr/local/bin/backup-with-{{ app }} -expect -re "Some files couldn't be prepared.*Do you agree?" -send -- "{% if allow_extra_space_use %}y{% else %}n{% endif %}\r" -expect eof diff --git a/conf/systemd.service b/conf/systemd.service index 1096d0e..db07912 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,7 +4,7 @@ After=network.target [Service] Type=oneshot -ExecStart=/usr/local/bin/backup-with-__APP__-answerbot +ExecStart=/usr/local/bin/backup-with-__APP__ ExecStartPost=/bin/bash -c 'echo -e "Subject: YunoHost Restic backup log on $(hostname)\n$(/bin/journalctl _SYSTEMD_INVOCATION_ID=`systemctl show -p InvocationID --value __APP__.service`)" | /usr/sbin/sendmail root' User=root Group=root diff --git a/scripts/_common.sh b/scripts/_common.sh index a4b60ba..dd1705a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,8 +7,6 @@ PKG_DIR=$(cd ../; pwd) RESTIC_VERSION="0.9.6" -pkg_dependencies="expect" - # Install restic if restic is not here install_restic () { architecture=$(uname -m) diff --git a/scripts/install b/scripts/install index b37ee06..15f9f7e 100755 --- a/scripts/install +++ b/scripts/install @@ -31,11 +31,9 @@ ynh_export server port ssh_user backup_path passphrase on_calendar check_on_cale ynh_save_args server port ssh_user backup_path passphrase on_calendar check_on_calendar check_read_data_on_calendar conf data apps allow_extra_space_use #================================================= -# INSTALL DEPENDENCIES +# INSTALL RESTIC #================================================= -ynh_script_progression --message="Installing dependencies" --weight=7 -ynh_install_app_dependencies $pkg_dependencies -ynh_script_progression --message="Installing restic binary" --weight=4 +ynh_script_progression --message="Installing restic binary" --weight=7 install_restic #================================================= @@ -57,10 +55,8 @@ ynh_configure check_method "${final_path}/check_method" #================================================= ynh_script_progression --message="Configuring cron" --weight=5 ynh_configure backup-with-restic "/usr/local/bin/backup-with-${app}" -ynh_configure backup-with-restic-answerbot "/usr/local/bin/backup-with-${app}-answerbot" ynh_configure check-restic "${final_path}/check-${app}" chmod u+x "/usr/local/bin/backup-with-${app}" -chmod u+x "/usr/local/bin/backup-with-${app}-answerbot" chmod u+x "${final_path}/check-${app}" chmod u+x "${final_path}/check_method" ynh_add_systemd_config --service=${app} --template=systemd.service diff --git a/scripts/restore b/scripts/restore index 7293e6a..c55046d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -25,9 +25,8 @@ app=$YNH_APP_INSTANCE_NAME server=$(ynh_app_setting_get $app server) #================================================= -# INSTALL DEPENDENCIES +# INSTALL RESTIC #================================================= -ynh_install_app_dependencies $pkg_dependencies install_restic #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index da9c116..83f9d45 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,7 +41,6 @@ if grep "restic.timer" /etc/yunohost/services.yml > /dev/null ; then fi #================================================= -# INSTALL DEPENDENCIES +# INSTALL RESTIC #================================================= -ynh_install_app_dependencies $pkg_dependencies install_restic