fixes
This commit is contained in:
parent
531172f818
commit
8f908be592
|
@ -28,85 +28,89 @@ do
|
|||
fhelp
|
||||
exit
|
||||
;;
|
||||
update)
|
||||
update=y
|
||||
;;
|
||||
passwd)
|
||||
passwd=y
|
||||
;;
|
||||
update) update=y ;;
|
||||
passwd) passwd=y ;;
|
||||
clean) do=clean ;;
|
||||
run) do=run ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -f "${backupcfg}" ]]; then
|
||||
source "${backupcfg}"
|
||||
else
|
||||
echo "${backupcfg} fehlt."
|
||||
echo "Diese Datei wird normalerweise durch \`void-createbackupcontainer\`"
|
||||
echo "angelegt. Bitte Sprich mit deinem Systemadministrator."
|
||||
fi
|
||||
test -z "${do}" && do=run
|
||||
|
||||
if [ -z "${UUID}" ]; then
|
||||
echo "Keine Backupplatte angegeben."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "/dev/disk/by-uuid/${UUID}" ]; then
|
||||
echo "Bitte Backupfestplatte anschliessen."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e /tmp/backup ]; then
|
||||
echo "Es läuft schon ein Backupvorgang oder wurde nicht richtig beendet."
|
||||
echo "Bei letzterem: 'sudo rm -rf /tmp/backup'"
|
||||
exit 1
|
||||
fi
|
||||
touch /tmp/backup
|
||||
|
||||
if [[ "${passwd}" == "y" ]]; then
|
||||
cryptsetup luksChangeKey "/dev/disk/by-uuid/${UUID}"
|
||||
rm -rf /tmp/backup
|
||||
exit 0
|
||||
fi
|
||||
|
||||
function finish {
|
||||
sync
|
||||
if [ "${poweroff}" = "y" ]; then
|
||||
shutdown -h now
|
||||
if [[ ! -f /etc/btrbk/btrbk.conf ]]; then
|
||||
if [[ -f "${backupcfg}" ]]; then
|
||||
source "${backupcfg}"
|
||||
else
|
||||
echo "${backupcfg} fehlt."
|
||||
echo "Diese Datei wird normalerweise durch \`void-createbackupcontainer\`"
|
||||
echo "angelegt. Bitte Sprich mit deinem Systemadministrator."
|
||||
fi
|
||||
sleep 4
|
||||
umount "${ziel}"
|
||||
echo " "
|
||||
echo " "
|
||||
if [[ "${MOUNTEDBY}" == "script" ]]; then
|
||||
cryptsetup close "luks-${UUID}"
|
||||
echo "Festplatte kann nun sicher entfernt werden."
|
||||
elif [[ "${MOUNTEDBY}" == "gnome" ]]; then
|
||||
echo "Festplatte bitte mit der grafischen Oberflaeche auswerfen (wie ein USB-Stick)"
|
||||
echo ""
|
||||
echo "oder:"
|
||||
echo "sudo umount /dev/mapper/luks-${UUID}"
|
||||
echo "sudo cryptsetup close luks-${UUID}"
|
||||
echo ""
|
||||
|
||||
if [ -z "${UUID}" ]; then
|
||||
echo "Keine Backupplatte angegeben."
|
||||
exit 1
|
||||
fi
|
||||
rm -rf /tmp/backup
|
||||
echo "FERTIG"
|
||||
|
||||
}
|
||||
trap finish EXIT
|
||||
if [ ! -e "/dev/disk/by-uuid/${UUID}" ]; then
|
||||
echo "Bitte Backupfestplatte anschliessen."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! $(mountpoint -q -x "/dev/mapper/luks-${UUID}") ]; then
|
||||
if ! cryptsetup open UUID="${UUID}" "luks-${UUID}"; then
|
||||
echo "Konnte /dev/disk/by-uuid/${UUID} nicht öffnen."
|
||||
if [ -e /tmp/backup ]; then
|
||||
echo "Es läuft schon ein Backupvorgang oder wurde nicht richtig beendet."
|
||||
echo "Bei letzterem: 'sudo rm -rf /tmp/backup'"
|
||||
exit 1
|
||||
fi
|
||||
touch /tmp/backup
|
||||
|
||||
if [[ "${passwd}" == "y" ]]; then
|
||||
cryptsetup luksChangeKey "/dev/disk/by-uuid/${UUID}"
|
||||
rm -rf /tmp/backup
|
||||
exit 0
|
||||
fi
|
||||
|
||||
function finish {
|
||||
sync
|
||||
if [ "${poweroff}" = "y" ]; then
|
||||
shutdown -h now
|
||||
fi
|
||||
sleep 4
|
||||
umount "${ziel}"
|
||||
echo " "
|
||||
echo " "
|
||||
if [[ "${MOUNTEDBY}" == "script" ]]; then
|
||||
cryptsetup close "luks-${UUID}"
|
||||
echo "Festplatte kann nun sicher entfernt werden."
|
||||
elif [[ "${MOUNTEDBY}" == "gnome" ]]; then
|
||||
echo "Festplatte bitte mit der grafischen Oberflaeche auswerfen (wie ein USB-Stick)"
|
||||
echo ""
|
||||
echo "oder:"
|
||||
echo "sudo umount /dev/mapper/luks-${UUID}"
|
||||
echo "sudo cryptsetup close luks-${UUID}"
|
||||
echo ""
|
||||
fi
|
||||
rm -rf /tmp/backup
|
||||
echo "FERTIG"
|
||||
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
if [ ! $(mountpoint -q -x "/dev/mapper/luks-${UUID}") ]; then
|
||||
if ! cryptsetup open UUID="${UUID}" "luks-${UUID}"; then
|
||||
echo "Konnte /dev/disk/by-uuid/${UUID} nicht öffnen."
|
||||
exit
|
||||
fi
|
||||
MOUNTEDBY="script"
|
||||
else
|
||||
MOUNTEDBY="gnome"
|
||||
fi
|
||||
|
||||
if ! mount "/dev/mapper/luks-${UUID}" "${ziel}"; then
|
||||
echo "Konnte /dev/mapper/luks-${UUID} in ${ziel} nicht mounten."
|
||||
exit
|
||||
fi
|
||||
MOUNTEDBY="script"
|
||||
else
|
||||
MOUNTEDBY="gnome"
|
||||
fi
|
||||
|
||||
if ! mount "/dev/mapper/luks-${UUID}" "${ziel}"; then
|
||||
echo "Konnte /dev/mapper/luks-${UUID} in ${ziel} nicht mounten."
|
||||
exit
|
||||
cfg="/etc/btrbk/btrbk.conf"
|
||||
fi
|
||||
|
||||
if mountpoint -q /var/lib/backup/quelle/bootfs; then
|
||||
|
@ -117,7 +121,7 @@ fi
|
|||
mkdir -p /var/lib/backup/quelle/rootfs/system/backup "/var/lib/backup/ziel/void/rootfs" "/var/lib/backup/ziel/void/homefs"
|
||||
for t in backup "${boot}"; do
|
||||
if [[ "${t}" ]]; then
|
||||
if ! btrbk --config="${cfg}" --progress --quiet run "${t}"; then
|
||||
if ! btrbk --config="${cfg}" --progress --quiet "${do}" "${t}"; then
|
||||
btrbk --config="${cfg}" --progress --quiet clean
|
||||
echo "Wegen Fehler nicht herunterfahren."
|
||||
poweroff=n
|
||||
|
|
|
@ -30,7 +30,6 @@ case $1 in
|
|||
;;
|
||||
*)
|
||||
infos
|
||||
echo "Falscher aufruf"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
@ -41,6 +40,7 @@ if [ "$#" -eq "0" ]; then
|
|||
fi
|
||||
|
||||
cfg="/etc/btrbk/btrbk.conf.void"
|
||||
test -f "/etc/btrbk/btrbk.conf" && cfg="/etc/btrbk/btrbk.conf"
|
||||
|
||||
if mountpoint -q /var/lib/backup/quelle/bootfs; then
|
||||
mkdir -p "/var/lib/backup/quelle/bootfs/system/snapshots/${word}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user