Formatted all existing scripts with restic style

This commit is contained in:
Eric Renfro 2023-12-03 06:44:35 -05:00
parent c83ab1a749
commit a97d0551fa
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF
11 changed files with 156 additions and 47 deletions

View file

@ -4,14 +4,14 @@ restoreDir=/etc/restore
consulDir="$restoreDir/consul"
hook_check() {
check() {
if [[ -d "$consulDir" ]]; then
rm -rf "$consulDir" || exit 1
fi
}
hook_pre() {
hook_check
hook_before() {
check
mkdir -p "$consulDir" || exit 1
pushd "$restoreDir" || exit 2
@ -20,12 +20,21 @@ hook_pre() {
popd || exit 2
}
hook_post() {
hook_after() {
rm -rf "$consulDir" || exit 1
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_check) hook_check;;
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -2,7 +2,7 @@
restoreDir="/etc/restore"
hook_pre() {
hook_before() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
@ -25,11 +25,21 @@ EOF
popd || exit 2
}
hook_post() {
hook_after() {
:
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -3,7 +3,7 @@
restoreDir=/etc/restore
giteaDir="$restoreDir/gitea"
hook_pre() {
hook_before() {
if [[ -d "$giteaDir" ]]; then
rm -rf "$giteaDir" || exit 1
fi
@ -15,11 +15,22 @@ hook_pre() {
sudo -u git "${giteaHome}/bin/gitea" dump --type tar.xz --file - > "${giteaDir}/gitea-dump-${backupDate}.tar.xz"
}
hook_post() {
hook_after() {
rm -rf "$giteaDir" || exit 1
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -3,7 +3,7 @@
restoreDir=/etc/restore
ldapDir="$restoreDir/openldap"
hook_pre() {
hook_before() {
if [[ -d "$ldapDir" ]]; then
rm -rf "$ldapDir" || exit 1
fi
@ -54,11 +54,21 @@ EOF
popd || exit 2
}
hook_post() {
hook_after() {
rm -rf "$ldapDir" || exit 1
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -2,7 +2,7 @@
restoreDir="/etc/restore"
hook_pre() {
hook_before() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
@ -23,11 +23,21 @@ EOF
popd || exit 2
}
hook_post() {
hook_after() {
:
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -2,7 +2,7 @@
restoreDir="/etc/restore"
hook_pre() {
hook_before() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
@ -26,11 +26,21 @@ EOF
popd || exit 2
}
hook_post() {
hook_after() {
:
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -2,7 +2,7 @@
restoreDir="$HOME/.borgmatic/restore"
hook_pre() {
hook_before() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
brew bundle dump || exit 3
@ -23,12 +23,21 @@ EOF
popd || exit 2
}
hook_post() {
hook_after() {
:
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre || exit $?;;
after_backup) hook_post || exit $?;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -2,7 +2,7 @@
restoreDir="/etc/restore"
hook_pre() {
hook_before() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
@ -11,11 +11,21 @@ hook_pre() {
popd || exit 2
}
hook_post() {
hook_after() {
:
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -2,7 +2,7 @@
restoreDir="/etc/restore"
hook_pre() {
hook_before() {
mkdir -p "$restoreDir" || exit 1
pushd "$restoreDir" || exit 2
@ -23,11 +23,21 @@ EOF
popd || exit 2
}
hook_post() {
hook_after() {
:
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -3,7 +3,7 @@
restoreDir=/etc/restore
pgsqlDir="$restoreDir/postgresql"
hook_pre() {
hook_before() {
if [[ -d "$pgsqlDir" ]]; then
rm -rf "$pgsqlDir" || exit 1
fi
@ -18,11 +18,21 @@ hook_pre() {
fi
}
hook_post() {
hook_after() {
rm -rf "$pgsqlDir" || exit 1
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac

View file

@ -3,7 +3,7 @@
restoreDir=/etc/restore
vaultwardenDir="$restoreDir/vaultwarden"
hook_pre() {
hook_before() {
if [[ -d "$vaultwardenDir" ]]; then
rm -rf "$vaultwardenDir" || exit 1
fi
@ -16,11 +16,21 @@ hook_pre() {
sqlite3 "${vaultwardenHome}/data/db.sqlite3" ".backup '${vaultwardenDir}/db-${backupDate}.sqlite3'"
}
hook_post() {
hook_after() {
rm -rf "$vaultwardenDir" || exit 1
}
hook_fail() {
:
}
hook_final() {
:
}
case "$1" in
before_backup) hook_pre;;
after_backup) hook_post;;
before) hook_before || exit $?;;
after) hook_after || exit $?;;
fail) hook_fail || exit $?;;
finally) hook_final || exit $?;;
esac