From: Richard Maw Date: Sat, 24 Feb 2024 18:13:59 +0000 (+0000) Subject: TEST-81-GENERATORS: Clean /proc/cmdline of unusual mounts X-Git-Tag: v256-rc2~188^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=337d246fafc74867bf5566e0e5a09bb5b310d099;p=thirdparty%2Fsystemd.git TEST-81-GENERATORS: Clean /proc/cmdline of unusual mounts --- diff --git a/test/units/testsuite-81.fstab-generator.sh b/test/units/testsuite-81.fstab-generator.sh index 4a69245ed87..e50419a0ecc 100755 --- a/test/units/testsuite-81.fstab-generator.sh +++ b/test/units/testsuite-81.fstab-generator.sh @@ -13,6 +13,7 @@ OUT_DIR="$(mktemp -d /tmp/fstab-generator.XXX)" FSTAB="$(mktemp)" at_exit() { + mountpoint -q /proc/cmdline && umount /proc/cmdline rm -fr "${OUT_DIR:?}" "${FSTAB:?}" } @@ -294,6 +295,12 @@ check_fstab_mount_units() { done } +# Drop usrhash on the command-line so fstab-generator doesn't add a /dev/mapper +# mount for /usr, add a root= to emulate a more typical environment, +# and remove any systemd.mount-extra= +sed -r -e 's/usrhash=[^[:space:]+]/root=\/dev\/sda2/' -e 's/systemd.mount-extra=[^[:space:]+]//g' /proc/cmdline >/tmp/cmdline.tmp +mount --bind /tmp/cmdline.tmp /proc/cmdline + : "fstab-generator: regular" printf "%s\n" "${FSTAB_GENERAL_ROOT[@]}" >"$FSTAB" cat "$FSTAB"