2016-03-08 13:42:20 -06:00
|
|
|
#!/bin/sh -e
|
2017-09-06 22:07:32 -05:00
|
|
|
|
|
|
|
PREREQS="varlog"
|
|
|
|
|
|
|
|
prereqs() { echo "$PREREQS"; }
|
|
|
|
|
2016-03-08 13:42:20 -06:00
|
|
|
case $1 in
|
|
|
|
prereqs)
|
2017-09-06 22:07:32 -05:00
|
|
|
prereqs
|
2016-03-08 13:42:20 -06:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
2016-07-26 14:01:58 -05:00
|
|
|
|
|
|
|
## Mount the aufs file system: rw layer over squashfs
|
2017-04-21 19:23:36 -05:00
|
|
|
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}
|
2017-02-16 01:18:02 -06:00
|
|
|
## Check if the root block device is still there
|
|
|
|
[ -b ${ROOT} ] || mdev -s
|
2016-07-26 14:01:58 -05:00
|
|
|
## Mount the raw partition again
|
2016-03-08 13:42:20 -06:00
|
|
|
mount ${ROOT} ${rootmnt}/host
|
2016-07-26 14:01:58 -05:00
|
|
|
## Mount the working directory of docker engine in the raw partition, bypass the aufs
|
|
|
|
mkdir -p ${rootmnt}/var/lib/docker
|
2017-04-21 19:23:36 -05:00
|
|
|
mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker
|
2016-07-26 14:01:58 -05:00
|
|
|
## Mount the boot directory in the raw partition, bypass the aufs
|
|
|
|
mkdir -p ${rootmnt}/boot
|
2017-04-21 19:23:36 -05:00
|
|
|
mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot
|
2017-02-17 01:28:09 -06:00
|
|
|
## 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
|