mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Add a backup-check used to validate the archive.
This allows plugins to refuse a backup, before the import process starts. Users can force the import using -f.
This commit is contained in:
@@ -33,6 +33,13 @@ set -e; case "$1" in
|
||||
;;
|
||||
|
||||
backup:import)
|
||||
if [[ $2 == "-f" ]]; then
|
||||
force=true
|
||||
shift
|
||||
else
|
||||
force=false
|
||||
fi
|
||||
|
||||
INPUT_FILE="$2"
|
||||
[[ -z $INPUT_FILE ]] && INPUT_FILE="-"
|
||||
|
||||
@@ -56,6 +63,15 @@ set -e; case "$1" in
|
||||
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
|
||||
TARGET_DIR="$DOKKU_ROOT"
|
||||
|
||||
if ! pluginhook backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
|
||||
if $force; then
|
||||
echo "-f used. Ignoring warnings."
|
||||
else
|
||||
echo "Archive did not pass sanity checks. Use -f to import anyway" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# create all the app directories
|
||||
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user