sonic-buildimage/files/initramfs-tools/union-mount.j2
2017-04-21 17:23:36 -07:00

24 lines
969 B
Django/Jinja

#!/bin/sh -e
case $1 in
prereqs)
exit 0
;;
esac
## Mount the aufs file system: rw layer over squashfs
image_dir=$(cat /proc/cmdline | sed -e 's/.*loop=\(\S*\)\/.*/\1/')
mkdir -p ${rootmnt}/host/$image_dir/rw
mount -n -o dirs=${rootmnt}/host/$image_dir/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt}
## Check if the root block device is still there
[ -b ${ROOT} ] || mdev -s
## Mount the raw partition again
mount ${ROOT} ${rootmnt}/host
## Mount the working directory of docker engine in the raw partition, bypass the aufs
mkdir -p ${rootmnt}/var/lib/docker
mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker
## Mount the boot directory in the raw partition, bypass the aufs
mkdir -p ${rootmnt}/boot
mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot
## Mount loop device for /var/log
[ -f ${rootmnt}/host/disk-img/var-log.ext4 ] && mount -t ext4 -o loop,rw ${rootmnt}/host/disk-img/var-log.ext4 ${rootmnt}/var/log