2021-04-15 10:27:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
if [ "${UID}" -ne "0" ]; then
|
|
|
|
echo "Keine Rootrechte."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-04-18 11:38:18 +02:00
|
|
|
cfg="/etc/btrbk/btrbk.conf.void"
|
|
|
|
|
2021-04-15 10:27:27 +02:00
|
|
|
if [ -f /etc/btrbk/btrbk.conf ]; then
|
2021-04-18 11:38:18 +02:00
|
|
|
btrbk --progress --quiet run snapshot
|
2021-04-15 10:27:27 +02:00
|
|
|
else
|
2021-04-18 11:38:18 +02:00
|
|
|
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
|
2021-04-15 10:27:27 +02:00
|
|
|
fi
|
|
|
|
|
2021-04-18 15:30:09 +02:00
|
|
|
if [[ ! $- == *i* ]]; then
|
|
|
|
if [[ ! "${1}" == "home" ]]; then
|
|
|
|
echo "Private Daten wurden nicht snapshotted."
|
|
|
|
echo '`void-snaptshot home` um dieses mit zu snapshotten.'
|
|
|
|
if ! grep "#void.system" /var/spool/cron/root | grep -q "home"; then
|
|
|
|
echo "Folgender Befehl um das dauerhaft regelmässig zu machen."
|
|
|
|
echo '`sudo sed -i "s/t #/t home #/" /var/spool/cron/root`'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "${1}" == "home" ]]; then
|
2021-04-18 12:16:11 +02:00
|
|
|
btrbk --config="${cfg}" --quiet run snapshothomefs
|
|
|
|
fi
|
|
|
|
|
2021-04-15 10:27:27 +02:00
|
|
|
if ! sudo update-grub 2> /dev/null; then
|
|
|
|
echo update-grub failed
|
|
|
|
fi
|