From: Frederick Grose <fgrose@xxxxxxxxxxxxx> commit a6cd70fc9df2d299ed4f347461c33e4824df62f0 Author: Frederick Grose <fgrose@xxxxxxxxxxxxx> Enable read-only mounting of a persistent home.img filesystem. Enable one to call for filesystem checking of home.img before mounting on the next boot. --- fedora-live-base.ks | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fedora-live-base.ks b/fedora-live-base.ks index 6c76e96..0512f67 100644 --- a/fedora-live-base.ks +++ b/fedora-live-base.ks @@ -116,9 +116,13 @@ mountPersistentHome() { elif [ ! -b "\$homedev" ]; then loopdev=\`losetup -f\` if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then - action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live + if [ "\$liverw" = rw ]; then + action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live + else + opts="-r" + fi fi - losetup \$loopdev \$homedev + losetup \$opts \$loopdev \$homedev homedev=\$loopdev fi @@ -130,6 +134,22 @@ mountPersistentHome() { homedev=/dev/mapper/EncHome fi + # If read-only is requested, prepare a non-persistent overlay and snapshot target. + if [ "\$opts" = "-r" ]; then + dd if=/dev/null of=/run/initramfs/overlayfs/home_overlay bs=1024 count=1 seek=\$((512*1024)) 2> /dev/null + HOME_OVERLAY_LOOPDEV=\$(losetup -f) + losetup \$HOME_OVERLAY_LOOPDEV /run/initramfs/overlayfs/home_overlay + sz=\$(blockdev --getsz \$homedev) + echo 0 \$sz snapshot \$homedev \$HOME_OVERLAY_LOOPDEV N 8 | dmsetup create home-rw + homedev=/dev/mapper/home-rw + fi + + # Check the filesystem, if requested. + if [ -e /forcehomefsck ]; then + e2fsck -f -y -v \$homedev || e2fsck -f -y \$homedev + rm /forcehomefsck + fi + # and finally do the mount mount \$mountopts \$homedev /home # if we have /home under what's passed for persistent home, then -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html