diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index bed8f7a..e7ed0e7 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -101,11 +101,34 @@ run_hook () /bin/modprobe -q squashfs >/dev/null 2>&1 /bin/modprobe -q aufs >/dev/null 2>&1 + rootdevice=1 + if [ -n "${rootlabel}" ]; then + if ! poll_device /dev/rootrw 5; then + echo "ERROR: Writable root device didn't show up after 5 seconds..." + echo " Falling back to tmpfs root" + rootdevice=0 + fi + fi msg ":: Mounting root (aufs) filesystem" - /bin/mount -t aufs -o dirs=/tmpfs=rw none /real_root - if [ $? -ne 0 ]; then - echo "ERROR: while mounting root (aufs) filesystem." - exit 1 + if [ $rootdevice -eq 1 ]; then + /bin/modprobe -q ext2 > /dev/null 2>&1 + mkdir /rootrw + if /bin/mount -t ext2 /dev/rootrw /rootrw + then + /bin/mount -t aufs -o dirs=/rootrw=rw none /real_root || rootdevice=0 + else + rootdevice=0 + fi + fi + + if [ $rootdevice -eq 0 ]; then + echo "ERROR: Fail to mount rw root (aufs) filesystem." + + /bin/mount -t aufs -o dirs=/tmpfs=rw none /real_root + if [ $? -ne 0 ]; then + echo "ERROR: while mounting tmpfs root (aufs) filesystem." + exit 1 + fi fi export LOOP_NUM="0" diff --git a/archiso/hooks/archiso-early b/archiso/hooks/archiso-early index d57b73b..aa314a6 100644 --- a/archiso/hooks/archiso-early +++ b/archiso/hooks/archiso-early @@ -4,5 +4,8 @@ run_hook () if [ -n "${archisolabel}" ]; then echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"vol_id --export \$tempnode\"" > /lib/udev/rules.d/00-archiso-device.rules echo "ENV{ID_FS_LABEL_ENC}==\"${archisolabel}\", SYMLINK+=\"archiso\"" >> /lib/udev/rules.d/00-archiso-device.rules + if [ -n "${rootlabel}" ]; then + echo "ENV{ID_FS_LABEL_ENC}==\"${rootlabel}\", SYMLINK+=\"rootrw\"" >> /lib/udev/rules.d/00-archiso-device.rules + fi fi }