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