2023-12-03 02:09:46 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
restoreDir="$HOME/.borgmatic/restore"
|
|
|
|
|
2023-12-03 06:44:35 -05:00
|
|
|
hook_before() {
|
2023-12-03 02:09:46 -05:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-12-03 06:44:35 -05:00
|
|
|
hook_after() {
|
2023-12-03 02:09:46 -05:00
|
|
|
:
|
|
|
|
}
|
|
|
|
|
2023-12-03 06:44:35 -05:00
|
|
|
hook_fail() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
hook_final() {
|
|
|
|
:
|
|
|
|
}
|
2023-12-03 02:09:46 -05:00
|
|
|
|
|
|
|
case "$1" in
|
2023-12-03 06:44:35 -05:00
|
|
|
before) hook_before || exit $?;;
|
|
|
|
after) hook_after || exit $?;;
|
|
|
|
fail) hook_fail || exit $?;;
|
|
|
|
finally) hook_final || exit $?;;
|
2023-12-03 02:09:46 -05:00
|
|
|
esac
|