Bind mount cache/data on startup from writable space
This commit is contained in:
parent
0673c10354
commit
87da2f3744
1 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# We need to put the rootfs somewhere where we can modify some
|
# We need to put the rootfs somewhere where we can modify some
|
||||||
# parts of the content on first boot (namely file permissions).
|
# parts of the content on first boot (namely file permissions).
|
||||||
|
|
@ -10,7 +10,6 @@ ROOTFS_PATH=$DATA_PATH/rootfs
|
||||||
RAMDISK_PATH=$DATA_PATH/ramdisk
|
RAMDISK_PATH=$DATA_PATH/ramdisk
|
||||||
INITRD=$SNAP/ramdisk.img
|
INITRD=$SNAP/ramdisk.img
|
||||||
SYSTEM_IMG=$SNAP/system.img
|
SYSTEM_IMG=$SNAP/system.img
|
||||||
ANDROID_DATA_PATH=$DATA_PATH/android-data
|
|
||||||
|
|
||||||
if [ ! -e $INITRD ]; then
|
if [ ! -e $INITRD ]; then
|
||||||
echo "ERROR: boot ramdisk does not exist"
|
echo "ERROR: boot ramdisk does not exist"
|
||||||
|
|
@ -37,9 +36,11 @@ mkdir -p $ROOTFS_PATH
|
||||||
mount -o bind,ro $RAMDISK_PATH $ROOTFS_PATH
|
mount -o bind,ro $RAMDISK_PATH $ROOTFS_PATH
|
||||||
mount -o loop,ro $SYSTEM_IMG $ROOTFS_PATH/system
|
mount -o loop,ro $SYSTEM_IMG $ROOTFS_PATH/system
|
||||||
|
|
||||||
# ... but we keep /data in the read/write space
|
# but certain top-level directories need to be in a writable space
|
||||||
mkdir -p $ANDROID_DATA_PATH
|
for dir in cache data; do
|
||||||
mount -o bind $ANDROID_DATA_PATH $ROOTFS_PATH/data
|
mkdir -p $DATA_PATH/android-$dir
|
||||||
|
mount -o bind $DATA_PATH/android-$dir $ROOTFS_PATH/$dir
|
||||||
|
done
|
||||||
|
|
||||||
# Make sure our setup path for the container rootfs
|
# Make sure our setup path for the container rootfs
|
||||||
# is present as lxc is statically configured for
|
# is present as lxc is statically configured for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue