diff -Nurp genkernel-3.4.9_pre3.orig/gen_compile.sh genkernel-3.4.9_pre3/gen_compile.sh --- genkernel-3.4.9_pre3.orig/gen_compile.sh 2007-10-12 02:18:19.000000000 +0200 +++ genkernel-3.4.9_pre3/gen_compile.sh 2007-10-12 02:18:30.000000000 +0200 @@ -403,13 +403,10 @@ compile_unionfs_utils() { gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!' cd "${UNIONFS_DIR}" print_info 1 'unionfs tools: >> Compiling...' - sed -i utils/Makefile -e 's|${CC} -o|${CC} -static -o|g' - sed -i Makefile -e 's|${CC} -o|${CC} -static -o|g' - compile_generic utils utils - - if [ ! -e "uniondbg" ]; then - cd utils - fi + #./bootstrap &> /dev/null + ./configure >> ${DEBUGFILE} 2>&1 || gen_die 'Configuring unionfs-utils failed!' + sed -i Makefile -e 's|LDFLAGS = |LDFLAGS = -all-static|g' + compile_generic '' utils print_info 1 'unionfs: >> Copying to cache...' strip uniondbg unionctl cp uniondbg ${TEMP}/unionfs/sbin/ || diff -Nurp genkernel-3.4.9_pre3.orig/generic/initrd.scripts genkernel-3.4.9_pre3/generic/initrd.scripts --- genkernel-3.4.9_pre3.orig/generic/initrd.scripts 2007-10-12 02:18:19.000000000 +0200 +++ genkernel-3.4.9_pre3/generic/initrd.scripts 2007-10-12 02:18:30.000000000 +0200 @@ -186,13 +186,10 @@ mount_sysfs() { # $1 = union absolute path (starting with /) # $2 = path to data directory # -union_insert_dir() { - # detect branch 0 because newer unionfs doesn't support "0,1,2" - BRANCH_0="/"$(/sbin/unionctl $1 --list | cut -d/ -f2- | cut -d'(' -f1) - /sbin/unionctl $1 --add --after $BRANCH_0 --mode ro $2 - if [ $? = '0' ] - then - good_msg "Addition of $2 to $1 after branch $BRANCH_0 successful" +union_setup_dir() { + mount -t unionfs -o dirs=$1=rw:$2=ro none $1 + if [ "$?" -eq '0' ]; then + good_msg "Addition of $2 to $1 after" fi } @@ -812,54 +809,10 @@ setup_unionfs() { then # Directory used for rw changes in union mount filesystem UNION=/union - MEMORY=/memory - if [ -z "$UID" ] - then - CHANGES=$MEMORY/unionfs_changes/default - else - CHANGES=$MEMORY/unionfs_changes/$UID - fi - - mkdir -p ${MEMORY} mkdir -p ${UNION} + mount -t tmpfs none ${UNION} good_msg "Loading unionfs module" modprobe unionfs > /dev/null 2>&1 - if [ -n "${UNIONFS}" ] - then - CHANGESDEV=${UNIONFS} - good_msg "mounting $CHANGESDEV to $MEMORY for unionfs support" - mount -t auto $CHANGESDEV $MEMORY - # mount tmpfs only in the case when changes= boot parameter was - # empty or we were not able to mount the storage device - ret=$? - if [ "${ret}" -ne 0 ] - then - bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based unionfs" - mount -t tmpfs tmpfs $MEMORY - fi - if [ "${CDROOT}" -eq '1' -a ! -f ${MEMORY}/livecd.unionfs ] - then - umount $MEMORY - bad_msg "failed to find livecd.unionfs file on $CHANGESDEV" - bad_msg "create a livecd.unionfs file on this device if you wish to use it for unionfs" - bad_msg "falling back to ramdisk based unionfs for safety" - mount -t tmpfs tmpfs $MEMORY - fi - else - good_msg "Mounting ramdisk to $MEMORY for unionfs support..." - mount -t tmpfs tmpfs $MEMORY - fi - - mkdir -p $CHANGES - mount -t unionfs -o dirs=$CHANGES=rw unionfs ${UNION} - ret=$? - if [ "${ret}" -ne 0 ] - then - bad_msg "Can't setup union ${UNION} in directory!" - USE_UNIONFS_NORMAL=0 - fi - else - USE_UNIONFS_NORMAL=0 fi } diff -Nurp genkernel-3.4.9_pre3.orig/generic/linuxrc genkernel-3.4.9_pre3/generic/linuxrc --- genkernel-3.4.9_pre3.orig/generic/linuxrc 2007-10-12 02:18:19.000000000 +0200 +++ genkernel-3.4.9_pre3/generic/linuxrc 2007-10-12 02:19:45.000000000 +0200 @@ -80,30 +80,18 @@ do LOOPTYPE=`parse_opt "${x}"` ;; unionfs) - if [ ! -x /sbin/unionctl ] - then - USE_UNIONFS_NORMAL=0 - bad_msg 'Unionctl not found: aborting use of unionfs!' - else - USE_UNIONFS_NORMAL=1 - fi + USE_UNIONFS_NORMAL=1 ;; unionfs\=*) - if [ ! -x /sbin/unionctl ] + USE_UNIONFS_NORMAL=1 + CMD_UNIONFS=`parse_opt "${x}"` + echo ${CMD_UNIONFS}|grep , >/dev/null 2>&1 + if [ "$?" -eq '0' ] then - USE_UNIONFS_NORMAL=0 - bad_msg 'Unionctl not found: aborting use of unionfs!' + UID=`echo ${CMD_UNIONFS#*,}` + UNIONFS=`echo ${CMD_UNIONFS%,*}` else - USE_UNIONFS_NORMAL=1 - CMD_UNIONFS=`parse_opt "${x}"` - echo ${CMD_UNIONFS}|grep , >/dev/null 2>&1 - if [ "$?" -eq '0' ] - then - UID=`echo ${CMD_UNIONFS#*,}` - UNIONFS=`echo ${CMD_UNIONFS%,*}` - else - UNIONFS=${CMD_UNIONFS} - fi + UNIONFS=${CMD_UNIONFS} fi ;; # Start Volume manager options @@ -595,7 +583,14 @@ then if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] then - union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} + union_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} + + mkdir -p ${UNION}/mnt/livecd + if [ ! -e "${UNION}/mnt/cdrom" ]; then + mkdir ${UNION}/mnt/cdrom -p + fi + mount --bind ${NEW_ROOT}/${FS_LOCATION} ${UNION}/mnt/livecd + mount --bind ${NEW_ROOT}/mnt/cdrom ${UNION}/mnt/cdrom # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on unionfs dirs. sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new @@ -699,7 +694,7 @@ then else if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] then - union_insert_dir ${UNION} ${NEW_ROOT} + union_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} mkdir -p ${UNION}/tmp/.initrd fi fi @@ -715,16 +710,6 @@ fi verbose_kmsg -# Move the /memory mount point to what will be the system root so that -# init scripts will be able to unmount it properly at next reboot -# -# Eventually, all "unions over /" mounts should go in that /.unions/ -if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] -then - mkdir -p /${CHROOT}/.unions/memory 2>/dev/null - mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move unionfs /memory into the system root!' -fi - if [ "$0" = '/linuxrc' ] || [ "$0" = 'linuxrc' ] then [ ! -e ${CHROOT}/dev/console ] && mknod ${CHROOT}/dev/console c 5 1 diff -Nurp genkernel-3.4.9_pre3.orig/gen_initramfs.sh genkernel-3.4.9_pre3/gen_initramfs.sh --- genkernel-3.4.9_pre3.orig/gen_initramfs.sh 2007-10-12 02:18:19.000000000 +0200 +++ genkernel-3.4.9_pre3/gen_initramfs.sh 2007-10-12 02:18:30.000000000 +0200 @@ -74,21 +74,6 @@ append_blkid(){ rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null } -append_unionfs_modules(){ - if [ -d "${TEMP}/initramfs-unionfs-modules-temp" ] - then - rm -r "${TEMP}/initramfs-unionfs-modules-temp/" - fi - print_info 1 'UNIONFS MODULES: Adding support (compiling)...' - compile_unionfs_modules - mkdir -p "${TEMP}/initramfs-unionfs-modules-temp/" - /bin/tar -jxpf "${UNIONFS_MODULES_BINCACHE}" -C "${TEMP}/initramfs-unionfs-modules-temp" || - gen_die "Could not extract unionfs modules binary cache!"; - cd "${TEMP}/initramfs-unionfs-modules-temp/" - find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" - rm -r "${TEMP}/initramfs-unionfs-modules-temp/" -} - append_unionfs_tools(){ if [ -d "${TEMP}/initramfs-unionfs-tools-temp" ] then @@ -431,7 +416,6 @@ create_initramfs() { append_data 'auxilary' append_data 'busybox' "${BUSYBOX}" append_data 'devfs' "${DEVFS}" - append_data 'unionfs_modules' "${UNIONFS}" append_data 'unionfs_tools' "${UNIONFS}" append_data 'lvm' "${LVM}" append_data 'dmraid' "${DMRAID}"