feat: add force restore option (#72)
* 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ó
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user