Skip to content

Commit

Permalink
feat: add force restore option (#72)
Browse files Browse the repository at this point in the history
* 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ó
  • Loading branch information
gtrancillo authored Jul 28, 2022
1 parent 8ba2b05 commit a4416f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ See [Options](#options) for options information.

#### Options

##### --force-restore

For restore whithout asking for confirmation.

USE WITH CAUTION!!

<details>
<summary><strong>※ You have the compressed file named <code>backup</code></strong></summary>

Expand Down
16 changes: 13 additions & 3 deletions scripts/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit a4416f4

Please sign in to comment.