Backup scripts read device/UUID/target from the host config

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 14:36:46 -04:00
co-authored by Claude Sonnet 5
parent 83974f731d
commit 3d117e714c
3 changed files with 34 additions and 7 deletions
+6 -1
View File
@@ -19,9 +19,14 @@
# The bootloader in the SD's first sectors (idbloader/u-boot) is not touched.
set -euo pipefail
# Backup settings come from the host config (see hosts/vanlink.conf.example).
# shellcheck disable=SC1090
. "${VANLINK_CONF:-/etc/vanlink.conf}"
: "${SD_BACKUP_UUID:?set SD_BACKUP_UUID in /etc/vanlink.conf}"
[ "$(id -u)" -eq 0 ] || { echo "Run as root (sudo)." >&2; exit 1; }
SD_UUID=39118305-4927-47a4-acc7-ba022f37af22
SD_UUID=$SD_BACKUP_UUID
SD_ROOT_PART=/dev/disk/by-uuid/$SD_UUID
MOUNT_POINT=/mnt/sd-backup-root
FAILSAFE='boot-failesafe-rename-to:boot.scr'
+10 -6
View File
@@ -11,15 +11,19 @@
# memory "sd-fallback-fstab-clobber" for what breaks if those leak across.
set -euo pipefail
# Backup settings come from the host config (see hosts/vanlink.conf.example).
# shellcheck disable=SC1090
. "${VANLINK_CONF:-/etc/vanlink.conf}"
: "${USB_BACKUP_ROOT_PART:?set USB_BACKUP_ROOT_PART in /etc/vanlink.conf}"
: "${USB_BACKUP_MOUNT:?set USB_BACKUP_MOUNT in /etc/vanlink.conf}"
[ "$(id -u)" -eq 0 ] || { echo "Run as root (sudo)." >&2; exit 1; }
USB_ROOT_PART=/dev/sda2
MOUNT_POINT=/mnt/usb-backup-root
MOUNT_POINT=10.42.1.44:/media/andreas/writable-nvme
USB_ROOT_PART=$USB_BACKUP_ROOT_PART
MOUNT_POINT=$USB_BACKUP_MOUNT
[[ "$MOUNT_POINT" == *":"* ]]
LOCAL_MOUNT=$?
# host:/path means an already-exported NFS target: nothing to mount locally.
if [[ "$MOUNT_POINT" == *":"* ]]; then LOCAL_MOUNT=0; else LOCAL_MOUNT=1; fi
root_src=$(findmnt -no SOURCE /)
if [ "$root_src" = "$USB_ROOT_PART" ]; then