From 62851722305bcf8177bf49988b455ef51ab3c7f6 Mon Sep 17 00:00:00 2001 From: MoritzBoehme Date: Thu, 30 Sep 2021 20:26:36 +0200 Subject: [PATCH] added essentials to darling erasure --- .../default.nix} | 3 +++ modules/darling-erasure/fs-diff.sh | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) rename modules/{darling-erasure.nix => darling-erasure/default.nix} (95%) create mode 100755 modules/darling-erasure/fs-diff.sh diff --git a/modules/darling-erasure.nix b/modules/darling-erasure/default.nix similarity index 95% rename from modules/darling-erasure.nix rename to modules/darling-erasure/default.nix index e9ed79c..7274e6b 100644 --- a/modules/darling-erasure.nix +++ b/modules/darling-erasure/default.nix @@ -58,4 +58,7 @@ # we can unmount /mnt and continue on the boot process. umount /mnt ''; + + # In case one forgets to move /etc/shadow to /persist + users.users.moritz.initialPassword = "password"; } diff --git a/modules/darling-erasure/fs-diff.sh b/modules/darling-erasure/fs-diff.sh new file mode 100755 index 0000000..bd581d0 --- /dev/null +++ b/modules/darling-erasure/fs-diff.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# fs-diff.sh +set -euo pipefail + +OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999) +OLD_TRANSID=${OLD_TRANSID#transid marker was } + +sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" | +sed '$d' | +cut -f17- -d' ' | +sort | +uniq | +while read path; do + path="/$path" + if [ -L "$path" ]; then + : # The path is a symbolic link, so is probably handled by NixOS already + elif [ -d "$path" ]; then + : # The path is a directory, ignore + else + echo "$path" + fi +done