40 lines
759 B
Bash
Executable file
40 lines
759 B
Bash
Executable file
#!/bin/bash
|
|
|
|
restoreDir="$HOME/.borgmatic/restore"
|
|
|
|
|
|
hook_check() {
|
|
:
|
|
}
|
|
|
|
hook_pre() {
|
|
mkdir -p "$restoreDir" || exit 1
|
|
pushd "$restoreDir" || exit 2
|
|
brew bundle dump || exit 3
|
|
|
|
cat > restore.sh <<EOF
|
|
#!/bin/bash
|
|
|
|
if which brew; then
|
|
echo "Installing Homebrew Bundle"
|
|
brew bundle
|
|
else
|
|
echo "Install Homebrew first using the following:"
|
|
echo '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)'
|
|
echo "Re-run restore.sh after installing Homebrew to install Homebrew Bundle"
|
|
fi
|
|
EOF
|
|
|
|
popd || exit 2
|
|
}
|
|
|
|
hook_post() {
|
|
:
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
before_check) hook_check || exit $?;;
|
|
before_backup) hook_pre || exit $?;;
|
|
after_backup) hook_post || exit $?;;
|
|
esac
|