firstboot: Add --reset option

This can be used to prepare an image for firstboot by removing all
files that systemd knows about that contain machine specific
information.
This commit is contained in:
Daan De Meyer
2023-04-01 10:50:15 +02:00
parent b39710cccf
commit 05eb2c60bd
3 changed files with 73 additions and 0 deletions
+9
View File
@@ -119,6 +119,15 @@ grep -q "^root:x:0:0:.*:/bin/barshell$" "$ROOT/etc/passwd"
grep -q "^root:$ROOT_HASHED_PASSWORD2:" "$ROOT/etc/shadow"
grep -q "hello.world=0" "$ROOT/etc/kernel/cmdline"
# Test that --reset removes all files configured by firstboot.
systemd-firstboot --root="$ROOT" --reset
[[ ! -e "$ROOT/etc/locale.conf" ]]
[[ ! -e "$ROOT/etc/vconsole.conf" ]]
[[ ! -e "$ROOT/etc/localtime" ]]
[[ ! -e "$ROOT/etc/hostname" ]]
[[ ! -e "$ROOT/etc/machine-id" ]]
[[ ! -e "$ROOT/etc/kernel/cmdline" ]]
# --copy-* options
rm -fr "$ROOT"
mkdir "$ROOT"