1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 11:09:46 +01:00

Another overlay mount overhaul

- Directly pass the device type to the mount command
 - Use the special default type "hwdevice" to wait for a device node
   before mounting it
 - Initialize the overlay partition from the initrd script
 - Do the bind mount setup as document

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-10-01 17:35:46 +02:00
parent 05298e3363
commit e61ca9decf

View file

@ -10,9 +10,9 @@ busybox mount -t devtmpfs none /dev
root_sfs=""
root=""
root_type=""
root_type="hwdevice"
overlay_dev=""
overlay_type=""
overlay_type="hwdevice"
singleuser=0
for param in `cat /proc/cmdline`; do
@ -53,7 +53,7 @@ mount_device() {
qemu)
mount -t 9p -o trans=virtio -oversion=9p2000.L $device $mountpoint
;;
*)
hwdevice)
while [ ! -e $device ]; do
echo "Waiting for device $device"
busybox sleep 1
@ -61,6 +61,9 @@ mount_device() {
mount $device $mountpoint
;;
*)
mount -t $type $device $mountpoint
;;
esac
}
@ -82,7 +85,16 @@ fi
if [ ! -z "$overlay_dev" ]; then
mount_device "$overlay_dev" "/newroot/cfg/overlay" "$overlay_type"
mkdir -p /newroot/cfg/overlay/etc
mkdir -p /newroot/cfg/overlay/etc_work
mkdir -p /newroot/cfg/overlay/var_lib
mkdir -p /newroot/cfg/overlay/var_lib_work
mkdir -p /newroot/cfg/overlay/usr
mkdir -p /newroot/cfg/overlay/usr_work
chroot /newroot mount -n -t overlay overlay -olowerdir=/cfg/preserve/etc,upperdir=/cfg/overlay/etc,workdir=/cfg/overlay/etc_work /etc
else
chroot /newroot mount --bind "/cfg/preserve/etc" "/etc"
fi
# cleanup mounts