From a4416f417bfb6c98999e99d5c27f9369be86146d Mon Sep 17 00:00:00 2001 From: gtrancillo <46755069+gtrancillo@users.noreply.github.com> Date: Wed, 27 Jul 2022 21:45:39 -0500 Subject: [PATCH] feat: add force restore option (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update restore.sh Agregado de force restore * Update Dockerfile cambiando version de alpine * Update Dockerfile Editado para mi arquitectura * Update Dockerfile comentando el install de rclone, ya incluido en la imagen base * Update Dockerfile Comentado el FROM extra * Update restore.sh arreglo de sintaxys * Update README.md Agregando el nuevo parametro del restore * Update Dockerfile revert changes * Update restore.sh Ajuste de indentacion * Update Dockerfile Agregando la linea que se eliminĂ³ --- README.md | 6 ++++++ scripts/restore.sh | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e585b72..0c74229 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,12 @@ See [Options](#options) for options information. #### Options +##### --force-restore + +For restore whithout asking for confirmation. + +USE WITH CAUTION!! +
※ You have the compressed file named backup diff --git a/scripts/restore.sh b/scripts/restore.sh index 92c0311..739c75f 100644 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -10,6 +10,7 @@ RESTORE_FILE_SENDS="" RESTORE_FILE_ZIP="" RESTORE_FILE_DIR="${RESTORE_DIR}" ZIP_PASSWORD="" +FORCE_RESTORE=false function clear_extract_dir() { rm -rf "${RESTORE_EXTRACT_DIR}" @@ -262,6 +263,11 @@ function restore() { RESTORE_FILE_SENDS="$(basename "$1")" shift ;; + --force-restore) + shift + FORCE_RESTORE=true + shift + ;; *) color red "Illegal input" exit 1 @@ -273,9 +279,13 @@ function restore() { check_empty_input check_data_dir_exist - color yellow "Restore will overwrite the existing files, continue? (y/N)" - read -p "(Default: n): " READ_RESTORE_CONTINUE - if [[ $(echo "${READ_RESTORE_CONTINUE:-n}" | tr [a-z] [A-Z]) == "Y" ]]; then + if $FORCE_RESTORE; then restore_file + else + color yellow "Restore will overwrite the existing files, continue? (y/N)" + read -p "(Default: n): " READ_RESTORE_CONTINUE + if [[ $(echo "${READ_RESTORE_CONTINUE:-n}" | tr [a-z] [A-Z]) == "Y" ]]; then + restore_file + fi fi }