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:
parent
05298e3363
commit
e61ca9decf
1 changed files with 15 additions and 3 deletions
|
@ -10,9 +10,9 @@ busybox mount -t devtmpfs none /dev
|
||||||
|
|
||||||
root_sfs=""
|
root_sfs=""
|
||||||
root=""
|
root=""
|
||||||
root_type=""
|
root_type="hwdevice"
|
||||||
overlay_dev=""
|
overlay_dev=""
|
||||||
overlay_type=""
|
overlay_type="hwdevice"
|
||||||
singleuser=0
|
singleuser=0
|
||||||
|
|
||||||
for param in `cat /proc/cmdline`; do
|
for param in `cat /proc/cmdline`; do
|
||||||
|
@ -53,7 +53,7 @@ mount_device() {
|
||||||
qemu)
|
qemu)
|
||||||
mount -t 9p -o trans=virtio -oversion=9p2000.L $device $mountpoint
|
mount -t 9p -o trans=virtio -oversion=9p2000.L $device $mountpoint
|
||||||
;;
|
;;
|
||||||
*)
|
hwdevice)
|
||||||
while [ ! -e $device ]; do
|
while [ ! -e $device ]; do
|
||||||
echo "Waiting for device $device"
|
echo "Waiting for device $device"
|
||||||
busybox sleep 1
|
busybox sleep 1
|
||||||
|
@ -61,6 +61,9 @@ mount_device() {
|
||||||
|
|
||||||
mount $device $mountpoint
|
mount $device $mountpoint
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
mount -t $type $device $mountpoint
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +85,16 @@ fi
|
||||||
if [ ! -z "$overlay_dev" ]; then
|
if [ ! -z "$overlay_dev" ]; then
|
||||||
mount_device "$overlay_dev" "/newroot/cfg/overlay" "$overlay_type"
|
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
|
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
|
fi
|
||||||
|
|
||||||
# cleanup mounts
|
# cleanup mounts
|
||||||
|
|
Loading…
Reference in a new issue