2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
7 export SYSTEMD_LOG_LEVEL
=debug
8 mkdir
-p /run
/systemd
/system
/systemd-portabled.service.d
/
9 cat <<EOF >/run/systemd/system/systemd-portabled.service.d/override.conf
11 Environment=SYSTEMD_LOG_LEVEL=debug
14 portablectl attach
--now --runtime /usr
/share
/minimal_0.raw app0
16 systemctl is-active app0.service
17 systemctl is-active app0-foo.service
20 systemctl is-active app0-bar.service
&& exit 1
24 portablectl reattach
--now --runtime /usr
/share
/minimal_1.raw app0
26 systemctl is-active app0.service
27 systemctl is-active app0-bar.service
30 systemctl is-active app0-foo.service
&& exit 1
34 portablectl list |
grep -q -F "minimal_1"
36 portablectl detach
--now --runtime /usr
/share
/minimal_1.raw app0
38 portablectl list |
grep -q -F "No images."
40 # portablectl also works with directory paths rather than images
42 unsquashfs
-dest /tmp
/minimal_0
/usr
/share
/minimal_0.raw
43 unsquashfs
-dest /tmp
/minimal_1
/usr
/share
/minimal_1.raw
45 portablectl attach
--copy=symlink
--now --runtime /tmp
/minimal_0 app0
47 systemctl is-active app0.service
48 systemctl is-active app0-foo.service
51 systemctl is-active app0-bar.service
&& exit 1
55 portablectl reattach
--now --enable --runtime /tmp
/minimal_1 app0
57 systemctl is-active app0.service
58 systemctl is-active app0-bar.service
61 systemctl is-active app0-foo.service
&& exit 1
65 portablectl list |
grep -q -F "minimal_1"
67 portablectl detach
--now --enable --runtime /tmp
/minimal_1 app0
69 portablectl list |
grep -q -F "No images."
71 portablectl attach
--now --runtime --extension /usr
/share
/app0.raw
/usr
/share
/minimal_0.raw app0
73 systemctl is-active app0.service
75 portablectl reattach
--now --runtime --extension /usr
/share
/app0.raw
/usr
/share
/minimal_1.raw app0
77 systemctl is-active app0.service
79 portablectl detach
--now --runtime --extension /usr
/share
/app0.raw
/usr
/share
/minimal_1.raw app0
81 portablectl attach
--now --runtime --extension /usr
/share
/app1.raw
/usr
/share
/minimal_0.raw app1
83 systemctl is-active app1.service
85 portablectl reattach
--now --runtime --extension /usr
/share
/app1.raw
/usr
/share
/minimal_1.raw app1
87 systemctl is-active app1.service
89 portablectl detach
--now --runtime --extension /usr
/share
/app1.raw
/usr
/share
/minimal_1.raw app1
91 # portablectl also works with directory paths rather than images
93 mkdir
/tmp
/rootdir
/tmp
/app1
/tmp
/overlay
94 mount
/usr
/share
/app1.raw
/tmp
/app1
95 mount
/usr
/share
/minimal_0.raw
/tmp
/rootdir
96 mount
-t overlay overlay
-o lowerdir
=/tmp
/app1
:/tmp
/rootdir
/tmp
/overlay
98 portablectl attach
--copy=symlink
--now --runtime /tmp
/overlay app1
100 systemctl is-active app1.service
102 portablectl detach
--now --runtime overlay app1