--- trunk/mkinitrd-magellan/livecd/linuxrc.sh 2010/12/16 01:24:51 1188 +++ trunk/mkinitrd-magellan/livecd/linuxrc.sh 2011/05/27 14:42:36 1296 @@ -61,6 +61,9 @@ FORCED_ROOTFS="" INITEXEC="/sbin/init" BREAK_ENABLED=no +UNIONFS=no +UNIONFS_FILE="" +CLOOPMOUNTDIR="/sysroot/mnt/cloop" ## starts here ## @@ -92,6 +95,8 @@ rootfs=*) FORCED_ROOTFS="${i#*=}";; init=*) INITEXEC="${i#*=}";; break) BREAK_ENABLED=yes ;; + unionfs) UNIONFS=yes;; + unionfs_file=*) UNIONFS_FILE="${i#*=}";; esac done @@ -171,14 +176,27 @@ echo -e "Mounting squashfs system image ..." echo [ ! -e /dev/loop0 ] && mknod /dev/loop0 b 7 0 - mount -o loop,ro -t squashfs /sysroot/mnt/cdrom/livecdrootfs.sqsh /sysroot/mnt/cloop + mount -o loop,ro -t squashfs /sysroot/mnt/cdrom/livecdrootfs.sqsh "${CLOOPMOUNTDIR}" + + # mount unionfs if enabled + if [[ ${UNIONFS} = yes ]] + then + echo -e "Mounting writeable cdbuffer (unionfs) ..." + + # default setting + CLOOPMOUNTDIR="/sysroot/mnt/unionfs" + [[ -z ${UNIONFS_FILE} ]] && UNIONFS_FILE="/sysroot/mnt/cdrom/unionfs" + + [[ ! -d /sysroot/mnt/unionfs ]] && install -d /sysroot/mnt/unionfs + mount -t unionfs dirs=${UNIONFS_FILE}=rw:/sysroot/mnt/cloop=ro ${CLOOPMOUNTDIR} + fi # symlinking cloop rootfs to /mnt as newroot cd /sysroot for x in bin sbin lib lib64 boot usr opt do - [ -d mnt/cloop/${x} ] && ln -s mnt/cloop/${x} ${x} + [ -d ${CLOOPMOUNTDIR/\/sysroot\//}/${x} ] && ln -s ${CLOOPMOUNTDIR/\/sysroot\//}/${x} ${x} done mkdir -p initrd proc tmp sys var/tmp dev media @@ -190,7 +208,7 @@ # busybox needs this one [ ! -e /sysroot/dev/tty5 ] && mknod /sysroot/dev/tty5 c 4 5 - (cd /sysroot/mnt/cloop; cp -a etc root home var /sysroot) + (cd ${CLOOPMOUNTDIR}; cp -a etc root home var /sysroot) # ensure the right permissions chmod 1777 /sysroot/tmp