]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/units/testsuite-29.sh
Merge pull request #19243 from bluca/lgtm
[thirdparty/systemd.git] / test / units / testsuite-29.sh
1 #!/usr/bin/env bash
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4 set -ex
5 set -o pipefail
6
7 export SYSTEMD_LOG_LEVEL=debug
8
9 portablectl attach --now --runtime /usr/share/minimal_0.raw app0
10
11 systemctl is-active app0.service
12 systemctl is-active app0-foo.service
13 set +o pipefail
14 set +e
15 systemctl is-active app0-bar.service && exit 1
16 set -e
17 set -o pipefail
18
19 portablectl reattach --now --runtime /usr/share/minimal_1.raw app0
20
21 systemctl is-active app0.service
22 systemctl is-active app0-bar.service
23 set +o pipefail
24 set +e
25 systemctl is-active app0-foo.service && exit 1
26 set -e
27 set -o pipefail
28
29 portablectl list | grep -q -F "minimal_1"
30
31 portablectl detach --now --runtime /usr/share/minimal_1.raw app0
32
33 portablectl list | grep -q -F "No images."
34
35 # portablectl also works with directory paths rather than images
36
37 unsquashfs -dest /tmp/minimal_0 /usr/share/minimal_0.raw
38 unsquashfs -dest /tmp/minimal_1 /usr/share/minimal_1.raw
39
40 portablectl attach --copy=symlink --now --runtime /tmp/minimal_0 app0
41
42 systemctl is-active app0.service
43 systemctl is-active app0-foo.service
44 set +o pipefail
45 set +e
46 systemctl is-active app0-bar.service && exit 1
47 set -e
48 set -o pipefail
49
50 portablectl reattach --now --enable --runtime /tmp/minimal_1 app0
51
52 systemctl is-active app0.service
53 systemctl is-active app0-bar.service
54 set +o pipefail
55 set +e
56 systemctl is-active app0-foo.service && exit 1
57 set -e
58 set -o pipefail
59
60 portablectl list | grep -q -F "minimal_1"
61
62 portablectl detach --now --enable --runtime /tmp/minimal_1 app0
63
64 portablectl list | grep -q -F "No images."
65
66 root="/usr/share/minimal_0.raw"
67 app1="/usr/share/app1.raw"
68
69 portablectl attach --now --runtime --extension ${app1} ${root} app1
70
71 systemctl is-active app1.service
72
73 portablectl reattach --now --runtime --extension ${app1} ${root} app1
74
75 systemctl is-active app1.service
76
77 portablectl detach --now --runtime --extension ${app1} ${root} app1
78
79 # portablectl also works with directory paths rather than images
80
81 mkdir /tmp/rootdir /tmp/app1 /tmp/overlay
82 mount ${app1} /tmp/app1
83 mount ${root} /tmp/rootdir
84 mount -t overlay overlay -o lowerdir=/tmp/app1:/tmp/rootdir /tmp/overlay
85
86 portablectl attach --copy=symlink --now --runtime /tmp/overlay app1
87
88 systemctl is-active app1.service
89
90 portablectl detach --now --runtime overlay app1
91
92 umount /tmp/overlay
93 umount /tmp/rootdir
94 umount /tmp/app1
95
96 echo OK >/testok
97
98 exit 0