#!/usr/bin/env bash # Puts back what restore-filter lists from the backup drive into the new # system's home folder (MIGRATION.md, step 3). Run it as root from the backup # drive itself, which NixOS mounts read-only at /mnt/backup: # # /mnt/backup/vizie/git/dot/tools/restore-from-sata set -euo pipefail user=vizie repo=$(dirname "$(dirname "$(readlink -f "$0")")") backup=$(dirname "$(dirname "$repo")") if [ "$EUID" -ne 0 ]; then echo "Run it as root." >&2 exit 1 fi if [ ! -d "$backup/.ssh" ] || [ ! -f "$repo/restore-filter" ]; then echo "$backup doesn't look like the home folder backup." >&2 exit 1 fi # Owned by you (uid 1000) and the users group (100), as NixOS sets them up. rsync -aHAX --info=progress2 --chown=1000:100 \ --filter="merge $repo/restore-filter" "$backup/" "/home/$user/" echo "== Done. Log in on the desktop."