From 3ba9028844c7b8ad2404916c31e7f08be3866fa2 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Thu, 15 Sep 2016 12:44:17 +0200 Subject: [PATCH] Extra rootfs as part of the container manager startup --- scripts/container-manager.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/container-manager.sh b/scripts/container-manager.sh index c4570d2..6de532b 100755 --- a/scripts/container-manager.sh +++ b/scripts/container-manager.sh @@ -1,8 +1,23 @@ #!/bin/bash +# We need to put the rootfs somewhere where we can modify some +# parts of the content on first boot (namely file permissions). +# Other than that nothing should ever modify the content of the +# rootfs. + +ROOTFS_PATH=$SNAP_COMMON/var/lib/anbox/rootfs +ROOTFS_VERSION=1 + +if [ ! -e $ROOTFS_PATH ] || [ "$ROOTFS_VERSION" != "$(cat $ROOTFS_PATH/.version)" ] ; then + rm -rf $ROOTFS_PATH + echo "Copying rootfs into $ROOTFS_PATH .." + mkdir -p $ROOTFS_PATH + tar xf $SNAP/android-rootfs.tar -C $ROOTFS_PATH/ --strip-components=1 +fi + # Make sure our setup path for the container rootfs # is present as lxc is statically configured for # this path. mkdir -p $SNAP_COMMON/lxc -exec $SNAP/bin/anbox container-manager +exec $SNAP/bin/anbox.wrapper container-manager