void-bash-installer/files/bin/void-snapshot

27 lines
567 B
Bash

#!/bin/bash
if [ "${UID}" -ne "0" ]; then
echo "Keine Rootrechte."
exit 1
fi
cfg="/etc/btrbk/btrbk.conf.void"
if [ -f /etc/btrbk/btrbk.conf ]; then
btrbk --progress --quiet run snapshot
else
if mountpoint -q /var/lib/backup/quelle/bootfs; then
snapshotbootfs="snapshotbootfs"
fi
for s in snapshotrootfs "${snapshotbootfs}"; do
test "${s}" && btrbk --config="${cfg}" --quiet run "${s}"
done
fi
if [[ "${1}" == "homefs" ]]; then
btrbk --config="${cfg}" --quiet run snapshothomefs
fi
if ! sudo update-grub 2> /dev/null; then
echo update-grub failed
fi