]>
Commit | Line | Data |
---|---|---|
91f9f8f1 | 1 | #!/bin/bash |
818567fc | 2 | set -e |
91f9f8f1 | 3 | TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2730" |
054ee249 | 4 | TEST_NO_NSPAWN=1 |
91f9f8f1 EV |
5 | |
6 | . $TEST_BASE_DIR/test-functions | |
91f9f8f1 EV |
7 | QEMU_TIMEOUT=180 |
8 | FSTYPE=ext4 | |
9 | ||
91f9f8f1 | 10 | test_setup() { |
ec4cab49 | 11 | create_empty_image_rootdir |
91f9f8f1 EV |
12 | |
13 | # Create what will eventually be our root filesystem onto an overlay | |
14 | ( | |
15 | LOG_LEVEL=5 | |
16 | eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) | |
17 | ||
18 | setup_basic_environment | |
19 | ||
20 | # setup the testsuite service | |
21 | cat >$initdir/etc/systemd/system/testsuite.service <<EOF | |
22 | [Unit] | |
23 | Description=Testsuite service | |
91f9f8f1 EV |
24 | |
25 | [Service] | |
26 | ExecStart=/bin/sh -x -c 'mount -o remount,rw /dev/sda1 && echo OK > /testok; systemctl poweroff' | |
27 | Type=oneshot | |
28 | EOF | |
29 | ||
30 | rm $initdir/etc/fstab | |
31 | cat >$initdir/etc/systemd/system/-.mount <<EOF | |
32 | [Unit] | |
33 | Before=local-fs.target | |
34 | ||
35 | [Mount] | |
36 | What=/dev/sda1 | |
37 | Where=/ | |
38 | Type=ext4 | |
39 | Options=errors=remount-ro,noatime | |
40 | ||
41 | [Install] | |
42 | WantedBy=local-fs.target | |
43 | Alias=root.mount | |
62a992be ZJS |
44 | EOF |
45 | ||
46 | cat >$initdir/etc/systemd/system/systemd-remount-fs.service <<EOF | |
47 | [Unit] | |
48 | DefaultDependencies=no | |
49 | Conflicts=shutdown.target | |
50 | After=systemd-fsck-root.service | |
51 | Before=local-fs-pre.target local-fs.target shutdown.target | |
52 | Wants=local-fs-pre.target | |
53 | ||
54 | [Service] | |
55 | Type=oneshot | |
56 | RemainAfterExit=yes | |
57 | ExecStart=/bin/systemctl reload / | |
91f9f8f1 EV |
58 | EOF |
59 | ||
60 | setup_testsuite | |
cc469c3d | 61 | ) |
91f9f8f1 EV |
62 | |
63 | ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/root.mount | |
64 | mkdir -p $initdir/etc/systemd/system/local-fs.target.wants | |
65 | ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/local-fs.target.wants/-.mount | |
66 | ||
67 | # mask some services that we do not want to run in these tests | |
976ed3b6 ZJS |
68 | ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service |
69 | ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service | |
70 | ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service | |
71 | ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket | |
72 | ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service | |
91f9f8f1 EV |
73 | } |
74 | ||
91f9f8f1 | 75 | do_test "$@" |