dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | #!/usr/bin/env bash |
| 2 | # Puts back what restore-filter lists from the backup drive into the new |
| 3 | # system's home folder (MIGRATION.md, step 3). Run it as root from the backup |
| 4 | # drive itself, mounted at /mnt: |
| 5 | # |
| 6 | # mount -o ro /dev/disk/by-label/backup /mnt |
| 7 | # /mnt/vizie/git/dot/tools/restore-from-sata |
| 8 | set -euo pipefail |
| 9 | |
| 10 | user=vizie |
| 11 | repo=$(dirname "$(dirname "$(readlink -f "$0")")") |
| 12 | backup=$(dirname "$(dirname "$repo")") |
| 13 | |
| 14 | if [ "$EUID" -ne 0 ]; then |
| 15 | echo "Run it as root." >&2 |
| 16 | exit 1 |
| 17 | fi |
| 18 | if [ ! -d "$backup/.ssh" ] || [ ! -f "$repo/restore-filter" ]; then |
| 19 | echo "$backup doesn't look like the home folder backup." >&2 |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
| 23 | # Owned by you (uid 1000) and the users group (100), as NixOS sets them up. |
| 24 | rsync -aHAX --info=progress2 --chown=1000:100 \ |
| 25 | --filter="merge $repo/restore-filter" "$backup/" "/home/$user/" |
| 26 | echo "== Done. Log in on the desktop." |