Specify current backup version at the top of the script

This commit is contained in:
Alexander committed 2013-11-14 21:52:49 +01:00
1 parent 8981b9e613
commit 682229baae
1 file changed
+4 -8
+4 -8
View File
@@ -1,27 +1,23 @@
#!/bin/bash #!/bin/bash
CURRENT_BACKUP_VERSION=1
set -e; case "$1" in set -e; case "$1" in
backup:export) backup:export)
OUTPUT_FILE="$2" OUTPUT_FILE="$2"
BACKUP_DIR=/home/git BACKUP_DIR=/home/git
if [[ ! -f $BACKUP_DIR/.dokku_backup_version ]]; then
echo "Unable to determine backup version"
exit 1
fi
BACKUP_TMP_DIR=$(mktemp -d) BACKUP_TMP_DIR=$(mktemp -d)
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar" BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
# we want to insert the version file in the root of the file
pushd $BACKUP_DIR > /dev/null pushd $BACKUP_DIR > /dev/null
tar --append -f $BACKUP_TMP_FILE .dokku_backup_version
ls -d */ > "$BACKUP_TMP_DIR/.dokku_backup_apps" ls -d */ > "$BACKUP_TMP_DIR/.dokku_backup_apps"
popd > /dev/null popd > /dev/null
# we want to insert the apps file in the root of the file # we want to insert the files in the root of the tar
pushd $BACKUP_TMP_DIR > /dev/null pushd $BACKUP_TMP_DIR > /dev/null
echo $CURRENT_BACKUP_VERSION > .dokku_backup_version
tar --append -f $BACKUP_TMP_FILE .dokku_backup_version
tar --append -f $BACKUP_TMP_FILE .dokku_backup_apps tar --append -f $BACKUP_TMP_FILE .dokku_backup_apps
popd > /dev/null popd > /dev/null