Restructure container manager startup script
Mount /cache and /data properly and stop bridge correctly.
This commit is contained in:
parent
03583e360c
commit
cbb4beaac2
2 changed files with 50 additions and 31 deletions
|
|
@ -21,6 +21,7 @@ if [ ! -e $SYSTEM_IMG ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
start() {
|
||||||
# Extract ramdisk content instead of trying to bind mount the
|
# Extract ramdisk content instead of trying to bind mount the
|
||||||
# cpio image file to allow modifications.
|
# cpio image file to allow modifications.
|
||||||
rm -Rf $RAMDISK_PATH
|
rm -Rf $RAMDISK_PATH
|
||||||
|
|
@ -51,11 +52,28 @@ mkdir -p $SNAP_COMMON/lxc
|
||||||
# possible. See snapcraft.yaml for further details.
|
# possible. See snapcraft.yaml for further details.
|
||||||
$SNAP/bin/anbox-bridge.sh start
|
$SNAP/bin/anbox-bridge.sh start
|
||||||
|
|
||||||
$SNAP/usr/sbin/aa-exec -p unconfined -- $SNAP/bin/anbox-wrapper.sh container-manager
|
exec $SNAP/usr/sbin/aa-exec -p unconfined -- $SNAP/bin/anbox-wrapper.sh container-manager
|
||||||
pid=$!
|
}
|
||||||
waitpid $pid
|
|
||||||
|
stop() {
|
||||||
|
for dir in cache data; do
|
||||||
|
umount $ROOTFS_PATH/$dir
|
||||||
|
done
|
||||||
|
umount $ROOTFS_PATH/system
|
||||||
|
umount $ROOTFS_PATH
|
||||||
|
|
||||||
$SNAP/bin/anbox-bridge.sh stop
|
$SNAP/bin/anbox-bridge.sh stop
|
||||||
|
}
|
||||||
|
|
||||||
umount $ROOTFS_PATH/system
|
case "$1" in
|
||||||
umount $ROOTFS_PATH/data
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unknown command '$1'"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ apps:
|
||||||
anbox:
|
anbox:
|
||||||
command: bin/anbox-wrapper.sh
|
command: bin/anbox-wrapper.sh
|
||||||
container-manager:
|
container-manager:
|
||||||
command: bin/container-manager.sh
|
command: bin/container-manager.sh start
|
||||||
|
stop-command: bin/container-manager.sh stop
|
||||||
daemon: simple
|
daemon: simple
|
||||||
# FIXME: a oneshot unit with start/stop commands needs also RemainAfterExit=yes
|
# FIXME: a oneshot unit with start/stop commands needs also RemainAfterExit=yes
|
||||||
# but this isn't supported by snapd yet. See LP #1647169 for details.
|
# but this isn't supported by snapd yet. See LP #1647169 for details.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue