3 TEST_DESCRIPTION
="/etc/machine-id testing"
6 .
$TEST_BASE_DIR/test-functions
9 create_empty_image_rootdir
11 # Create what will eventually be our root filesystem onto an overlay
14 eval $
(udevadm info
--export --query=env
--name=${LOOPDEV}p2
)
16 setup_basic_environment
17 mask_supporting_services
18 printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >$initdir/etc
/machine-id
19 dracut_install mount
cmp
21 # setup the testsuite service
22 cat >$initdir/etc
/systemd
/system
/testsuite.service
<<EOF
24 Description=Testsuite service
27 ExecStart=/bin/sh -e -x -c '/test-machine-id-setup.sh; systemctl --state=failed --no-legend --no-pager > /failed ; echo OK > /testok'
31 cat >$initdir/test-machine-id-setup.sh
<<'EOF'
40 mount -t tmpfs tmpfs "$_root"
41 mkdir -p "$_root/etc" "$_root/run"
52 r="$(pwd)/overwrite-broken-machine-id"
54 systemd-machine-id-setup --print --root "$r"
55 echo abc >>"$r/etc/machine-id"
56 id=$(systemd-machine-id-setup --print --root "$r")
58 check expected "$r/etc/machine-id"
60 r="$(pwd)/transient-machine-id"
62 systemd-machine-id-setup --print --root "$r"
63 echo abc >>"$r/etc/machine-id"
64 mount -o remount,ro "$r"
65 mount -t tmpfs tmpfs "$r/run"
66 transient_id=$(systemd-machine-id-setup --print --root "$r")
67 mount -o remount,rw "$r"
68 commited_id=$(systemd-machine-id-setup --print --commit --root "$r")
69 [[ "$transient_id" = "$commited_id" ]]
70 check "$r/etc/machine-id" "$r/run/machine-id"
72 chmod +x
$initdir/test-machine-id-setup.sh