[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: adce982154f2139c47bf3514fd4d11424a00392d Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 3 00:46:43 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=adce9821 dokeymap implementation for AUFS's union defaults/linuxrc | 6 ++ 1 file changed, 6 insertions(+) diff --git a/defaults/linuxrc b/defaults/linuxrc index 86b1954..da88bf0 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -868,6 +868,12 @@ then fi fi +# Copy user keymap file +if [ -e /etc/sysconfig/keyboard ]; then +[ ! -d ${CHROOT}/etc/sysconfig ] mkdir -p ${CHROOT}/etc/sysconfig +cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/ +fi + # Create the directories for our new union mounts test ! -d ${CHROOT}${NEW_ROOT} mkdir -p ${CHROOT}${NEW_ROOT}
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: eeb82b88ce756f4c6569820129b6fb3e27829edb Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:06:42 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=eeb82b88 Output cleaning defaults/initrd.scripts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 14800e4..0e44e61 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -335,7 +335,7 @@ setup_aufs() { else CHANGESDEV=${AUFS} good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support - mount -t auto ${CHANGESDEV} ${CHANGESMNT} + mount -t auto ${CHANGESDEV} ${CHANGESMNT} /dev/null ret=$? if [ ${ret} -ne 0 ] then @@ -383,7 +383,7 @@ setup_aufs() { # empty or we were not able to mount the storage device if [ ${CDROOT} -eq '1' -a ! -f ${CHANGESMNT}/${AUFS_CHANGESFILE} ] then - umount ${MEMORY} + umount ${MEMORY} /dev/null bad_msg failed to find ${AUFS_CHANGESFILE} file on ${CHANGESDEV} bad_msg create an ext2 ${AUFS_CHANGESFILE} file on this device if you wish to use it for aufs bad_msg falling back to ramdisk based aufs for safety
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 75fe8bf4d8eb452cbd866140f76e847666f30598 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 3 01:36:28 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=75fe8bf4 A new bootstrapFS function has been added to cut on duplicate code use which both aufs and squashfs boot types use and this it's moved to the top of the boot process. defaults/initrd.scripts | 70 + defaults/linuxrc| 29 +++- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index fe563fe..eb5ed6a 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -177,6 +177,52 @@ devicelist(){ echo ${DEVICES} } +bootstrapFS() { +if [ ${USE_AUFS_NORMAL} -eq '1' ]; then +# Directories used for rw changes in union mount filesystem +UNION=/union MEMORY=/memory + +# Mountpoint for the changesdev +CHANGESMNT=${NEW_ROOT}/mnt/changesdev + +if [ -z $UID ]; then +CHANGES=${MEMORY}/aufs_changes/default +else +CHANGES=${MEMORY}/aufs_changes/${UID} +fi + +mkdir -p ${MEMORY} ${UNION} ${CHANGESMNT} +else +# Legacy SquashFS implementation +good_msg Making tmpfs for ${NEW_ROOT} +mount -n -t tmpfs tmpfs ${NEW_ROOT} +fi + +# Setup the filesystem nodes and directories +for i in ${CDROOT_PATH} /mnt/livecd /mnt/key /mnt/gentoo /tmp /tmp/.initrd /dev /proc /run /sys; do +mkdir -p ${NEW_ROOT}${i} +chmod 755 ${NEW_ROOT}${i} +done + +[ ! -d ${CDROOT_PATH} ] mkdir -p ${CDROOT_PATH} +[ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 +[ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 660 ${NEW_ROOT}/dev/zero c 1 5 +[ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 +[ ! -e ${NEW_ROOT}/dev/ttyS0 ] mknod -m 600 ${NEW_ROOT}/dev/ttyS0 c 4 64 + +# For SGI LiveCDs +if [ ${LOOPTYPE} = sgimips ]; then +[ ! -e ${NEW_ROOT}/dev/sr0 ] mknod ${NEW_ROOT}/dev/sr0 b 11 0 +[ ! -e ${NEW_ROOT}/dev/loop0 ] mknod ${NEW_ROOT}/dev/loop0 b 7 0 +fi + +# Required for splash to work. Not an issue with the initrd as this +# device isn't created there and is not needed. +for minor in 0 1 ; do +[ ! -e ${NEW_ROOT}/dev/$minor ] mknod -m 600 ${NEW_ROOT}/dev/tty$minor c 4 $minor +done +} + bootstrapCD() { local DEVICES= @@ -302,30 +348,8 @@ create_changefs() { } setup_aufs() { -# Directory used for rw changes in union mount filesystem - UNION=/union - MEMORY=/memory - # Mountpoint for the changesdev - CHANGESMNT=${NEW_ROOT}/mnt/changesdev - if [ -z $UID ] - then - CHANGES=${MEMORY}/aufs_changes/default - else - CHANGES=${MEMORY}/aufs_changes/${UID} - fi - - mkdir -p ${MEMORY} - mkdir -p ${UNION} - mkdir -p ${CHANGESMNT} - for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p ${NEW_ROOT}/${i} - chmod 755 ${NEW_ROOT}/${i} - done - [ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 - [ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 - bootstrapCD + if [ -n ${AUFS} ] then if [ ${AUFS} = detect ] diff --git a/defaults/linuxrc b/defaults/linuxrc index da88bf0..0e40d16 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -458,40 +458,17 @@ rundebugshell before setting up the root filesystem if [ ${CDROOT} = '1' ] then +# Setup the root filesystem +bootstrapFS + if [ ${USE_AUFS_NORMAL} -eq '1' ] then setup_aufs CHROOT=${UNION} else CHROOT=${NEW_ROOT} - good_msg Making tmpfs for ${NEW_ROOT} - mount -n -t tmpfs tmpfs ${NEW_ROOT} - - for i in dev mnt ${CDROOT_PATH} proc run mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p ${NEW_ROOT}/${i} - chmod 755 ${NEW_ROOT}/${i} - done - [ ! -d ${CDROOT_PATH} ] mkdir -p ${CDROOT_PATH} - [ ! -e ${NEW_ROOT}/dev/null ] mknod -m 666 ${NEW_ROOT}/dev/null c 1 3 - [ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 666 ${NEW_ROOT}/dev/zero c 1 5 - [ ! -e ${NEW_ROOT}/dev/console ] mknod -m 600 ${NEW_ROOT}/dev/console c 5
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 3ad1b69ab16292a28f03ed457e95ba221db7d654 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Sun Aug 17 00:18:36 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:33:04 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=3ad1b69a restructure no_umounts from being set in /etc/rc.conf to /etc/conf.d/localmount defaults/initrd.defaults | 2 +- defaults/initrd.scripts | 15 +++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index f2cb42a..f6fd564 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -60,7 +60,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' -RC_NO_UMOUNTS='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' +no_umounts='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index d168b94..8edaea4 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -323,13 +323,12 @@ union_mod() { union_insert_dir $aufs_union $aufs_union/mnt/modules/$mod } -# Implements RC_NO_UMOUNTS variable into $CHROOT/etc/rc.conf for a cleaner shutdown process -# This should really go into /etc/init.d/localmounts but until then we manually set this here +# Implements no_umounts variable into $CHROOT/etc/conf.d/localmount for a cleaner shutdown process conf_rc_no_umounts() { local conf nomount fnd -conf=$CHROOT/etc/rc.conf fnd=0 +conf=$CHROOT/etc/conf.d/localmount fnd=0 -if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then +if nomount=$(grep -n '^[[:blank:]]*no_umounts=' $conf); then local i n data cmd IFS IFS=' ' @@ -341,20 +340,20 @@ conf_rc_no_umounts() { data=${i#*=} case $data in -\$RC_NO_UMOUNTS\|'$RC_NO_UMOUNTS') fnd=1;; +\$no_umounts\|'$no_umounts') fnd=1;; *) cmd=$cmd$n d; esac done if [ -n $cmd ]; then sed -i ${cmd%;} $conf -test_success Unable to edit rc.conf +test_success Unable to edit /etc/conf.d/localmount fi fi if [ 0 -eq $fnd ]; then -printf 'RC_NO_UMOUNTS=%s\n' $RC_NO_UMOUNTS $conf -test_success Unable to write to rc.conf +printf 'no_umounts=%s\n' $no_umounts $conf +test_success Unable to write to /etc/conf.d/localmount fi }
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: d8f76f80288f19c0d2d90e9c4999879ad0c61d1e Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:02:30 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=d8f76f80 Restructure the setup_aufs function, it had redundant code and moved the call to it further down the pipe. defaults/initrd.scripts | 181 +++- defaults/linuxrc| 2 +- 2 files changed, 89 insertions(+), 94 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index a9ec5ab..14800e4 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -302,115 +302,110 @@ create_changefs() { } setup_aufs() { - if [ ${USE_AUFS_NORMAL} -eq '1' ] +# Directory used for rw changes in union mount filesystem + UNION=/union + MEMORY=/memory + # Mountpoint for the changesdev + CHANGESMNT=${NEW_ROOT}/mnt/changesdev + if [ -z $UID ] then - # Directory used for rw changes in union mount filesystem - UNION=/union - MEMORY=/memory - # Mountpoint for the changesdev - CHANGESMNT=${NEW_ROOT}/mnt/changesdev - if [ -z $UID ] - then - CHANGES=${MEMORY}/aufs_changes/default - else - CHANGES=${MEMORY}/aufs_changes/${UID} - fi + CHANGES=${MEMORY}/aufs_changes/default + else + CHANGES=${MEMORY}/aufs_changes/${UID} + fi - mkdir -p ${MEMORY} - mkdir -p ${UNION} - mkdir -p ${CHANGESMNT} - for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p ${NEW_ROOT}/${i} - chmod 755 ${NEW_ROOT}/${i} - done - [ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 - [ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 + mkdir -p ${MEMORY} + mkdir -p ${UNION} + mkdir -p ${CHANGESMNT} + for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys + do + mkdir -p ${NEW_ROOT}/${i} + chmod 755 ${NEW_ROOT}/${i} + done + [ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 + [ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 - bootstrapCD - if [ -n ${AUFS} ] + bootstrapCD + if [ -n ${AUFS} ] + then + if [ ${AUFS} = detect ] then - if [ ${AUFS} = detect ] + CHANGESMNT=${NEW_ROOT}${CDROOT_PATH} + CHANGESDEV=${REAL_ROOT} + else + CHANGESDEV=${AUFS} + good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support + mount -t auto ${CHANGESDEV} ${CHANGESMNT} + ret=$? + if [ ${ret} -ne 0 ] then - CHANGESMNT=${NEW_ROOT}${CDROOT_PATH} - CHANGESDEV=${REAL_ROOT} - else - CHANGESDEV=${AUFS} - good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support - mount -t auto ${CHANGESDEV} ${CHANGESMNT} + bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs + unset AUFS + fi + fi + # Check and attempt to create the changesfile + if [ ! -e ${CHANGESMNT}/${AUFS_CHANGESFILE} ] [ -n ${AUFS} ] + then + create_changefs + mount -t auto ${CHANGESMNT}/${AUFS_CHANGESFILE} ${MEMORY} + elif [ -n ${AUFS} ] + then + local nbpass=0 + while [ 1 ] + do + mount -t auto ${CHANGESMNT}/${AUFS_CHANGESFILE} ${MEMORY} ret=$? if [ ${ret} -ne 0 ] then - bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs - unset AUFS - fi - fi - # Check and attempt to create the changesfile - if [ ! -e ${CHANGESMNT}/${AUFS_CHANGESFILE} ] [ -n ${AUFS} ] - then -
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: de648288f5cc03636396e93b7128969b95101a53 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:31:13 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=de648288 Wording changes, cosmetic crap defaults/initrd.scripts | 21 +++-- defaults/linuxrc| 7 --- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 0e44e61..fe563fe 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -334,12 +334,12 @@ setup_aufs() { CHANGESDEV=${REAL_ROOT} else CHANGESDEV=${AUFS} - good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support + good_msg Mounting ${CHANGESDEV} to ${MEMORY} for aufs support mount -t auto ${CHANGESDEV} ${CHANGESMNT} /dev/null ret=$? if [ ${ret} -ne 0 ] then - bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs + bad_msg Mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs unset AUFS fi fi @@ -359,15 +359,15 @@ setup_aufs() { then if [ ${nbpass} -eq 0 ] then - bad_msg mounting of changes file failed, Running e2fsck + bad_msg Mounting of changes file failed, Running e2fsck e2fsck ${CHANGESMNT}/${AUFS_CHANGESFILE} nbpass=$((${nbpass} + 1)) else - bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs + bad_msg Mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs bad_msg your ${AUFS_CHANGESFILE} might be messed up, and I couldn't fix it bad_msg moving ${AUFS_CHANGESFILE} to ${AUFS_CHANGESFILE}.bad mv ${CHANGESMNT}/${AUFS_CHANGESFILE} ${CHANGESMNT}/${AUFS_CHANGESFILE}.bad - bad_msg try to fix it yourself with e2fsck later on, sorry for disturbing + bad_msg Try to fix it yourself with e2fsck break fi else @@ -383,19 +383,20 @@ setup_aufs() { # empty or we were not able to mount the storage device if [ ${CDROOT} -eq '1' -a ! -f ${CHANGESMNT}/${AUFS_CHANGESFILE} ] then +XINO=${MEMORY} umount ${MEMORY} /dev/null - bad_msg failed to find ${AUFS_CHANGESFILE} file on ${CHANGESDEV} - bad_msg create an ext2 ${AUFS_CHANGESFILE} file on this device if you wish to use it for aufs - bad_msg falling back to ramdisk based aufs for safety + bad_msg Failed to find ${AUFS_CHANGESFILE} file on ${CHANGESDEV} + bad_msg Create an ext2 ${AUFS_CHANGESFILE} file on this device if you wish to use it for aufs + bad_msg Falling back to ramdisk based aufs for safety +good_msg Mounting ramdisk to $MEMORY for aufs support mount -t tmpfs tmpfs ${MEMORY} - XINO=${MEMORY} else XINO=${MEMORY}/xino mkdir -p ${XINO} mount -t tmpfs tmpfs ${XINO} fi else - good_msg Mounting ramdisk to $MEMORY for aufs support... + good_msg Mounting ramdisk to $MEMORY for aufs support mount -t tmpfs tmpfs ${MEMORY} XINO=${MEMORY} fi diff --git a/defaults/linuxrc b/defaults/linuxrc index 894ec45..009b4c4 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -758,9 +758,10 @@ then do_rundebugshell } else - good_msg 'Mounting squashfs aufs filesystems' + good_msg 'Mounting squashfs filesystem' + setup_squashfs_aufs -
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: a5f4045080278ac43d13ff79bfbad388055867c5 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Aug 4 01:23:02 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:33:04 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a5f40450 Fixed a bug which prevented aufs.modules from functioning properly and changed the variables names to reflect the actual logic. defaults/initrd.defaults | 1 + defaults/initrd.scripts | 17 - defaults/linuxrc | 22 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 782fd14..f2cb42a 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -72,6 +72,7 @@ CDROOT_MARKER='/livecd' # AUFS variables aufs=0 aufs_union_file=/livecd.aufs +aufs_modules_dir=mnt/cdrom LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 5c7703b..d168b94 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -297,12 +297,12 @@ union_insert_dir() { union_insert_modules() { local module -for module in $NEW_ROOT/$1/modules/*.mo; do -union_mod $module || bad_msg Unable to load module: '$module' +for module in $1/modules/*.mo; do +union_mod $module || bad_msg Unable to insert module: '$module' done -for module in $NEW_ROOT/$1/modules/*.lzm; do -union_mod $module lzm || bad_msg Unable to load module: '$module' +for module in $1/modules/*.lzm; do +union_mod $module || bad_msg Unable to insert module: '$module' done } @@ -315,13 +315,12 @@ union_mod() { mod=${1##*/} mod=${mod%.*} -mkdir -p $aufs_memory/modules/$mod || return - -if [ lzm = $2 ]; then - mount -o loop,ro $1 $aufs_memory/modules/$mod +if [ ! -d $aufs_union/mnt/$mod ]; then +mkdir -p $aufs_union/mnt/modules/$mod || return fi -union_insert_dir $aufs_union $aufs_memory/modules/$mod +mount -o loop,ro $1 $aufs_union/mnt/modules/$mod +union_insert_dir $aufs_union $aufs_union/mnt/modules/$mod } # Implements RC_NO_UMOUNTS variable into $CHROOT/etc/rc.conf for a cleaner shutdown process diff --git a/defaults/linuxrc b/defaults/linuxrc index 3098866..951f5e1 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -265,7 +265,7 @@ do ;; # Allow user to specify the modules location aufs.modules\=*) - aufs_modules_dev=${x#*=} + aufs_modules_dir=${x#*=} aufs_modules=1 ;; unionfs) @@ -786,16 +786,20 @@ distfiles /usr/portage/distfiles tmpfs defaults0 0 FSTAB fi -# When aufs.modules= is used -if [ 1 = $aufs_modules ]; then -warn_msg Adding all modules in $aufs_modules_dev/modules/ +# When aufs.modules= is used or $CDROOT_PATH/modules +# directory is available +if [[ 1 = $aufs_modules || -d $CDROOT_PATH/modules ]]; then +warn_msg Adding all modules in $aufs_modules_dir/modules/ -if [ -z $aufs_modules_dev ]; then +if [ mnt/cdrom = $aufs_modules_dir ]; then union_insert_modules $CDROOT_PATH - else - mkdir $NEW_ROOT/mnt/modulesd - mount $aufs_modules_dev $NEW_ROOT/mnt/modulesd - union_insert_modules $NEW_ROOT/mnt/modulesd +elif [ ! -b $aufs_modules_dir ]; then +bad_msg $aufs_modules_dir is not a valid block device +bad_msg aborting modules insert into $aufs_union +else +mkdir /mnt/modules + mount $aufs_modules_dir /mnt/modules + union_insert_modules /mnt/modules fi fi
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 075da3bc84ffec2a39d70f9bb155f1ecbe03a963 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 24 22:36:40 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=075da3bc Reverting back old mknod permission settings for netboot compatibility defaults/initrd.scripts | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 02842bf..9b88d6a 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -205,10 +205,10 @@ bootstrapFS() { done [ ! -d ${CDROOT_PATH} ] mkdir -p ${CDROOT_PATH} -[ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 -[ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 660 ${NEW_ROOT}/dev/zero c 1 5 -[ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 -[ ! -e ${NEW_ROOT}/dev/ttyS0 ] mknod -m 600 ${NEW_ROOT}/dev/ttyS0 c 4 64 +[ ! -e ${NEW_ROOT}/dev/null ] mknod -m 666 ${NEW_ROOT}/dev/null c 1 3 +[ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 666 ${NEW_ROOT}/dev/zero c 1 5 +[ ! -e ${NEW_ROOT}/dev/console ] mknod -m 600 ${NEW_ROOT}/dev/console c 5 1 +[ ! -e ${NEW_ROOT}/dev/ttyS0 ] mknod -m 660 ${NEW_ROOT}/dev/ttyS0 c 4 64 # For SGI LiveCDs if [ ${LOOPTYPE} = sgimips ]; then
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: b4d40c20a5cb327540ea2f7d84f818b39b8657dc Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Wed Jun 25 16:12:11 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=b4d40c20 This is commit contains several changes summarized below. 1. Changed renaming of RC_NO_UMOUNTS directories 2. Upper to lowercase variables because this is the year 2014 3. Renamed aufs related variables for better readability 4. Fixed a typo in mke2fs command which was missing an 5. Cleaned up setup_squashfs_aufs() function 6. Fixed an issue with legacy squashfs implementation which caused /mnt/cdrom to be shown twice in 'mount' and removed the --bind and replaced this with --move 7. Restructured the union_* functions so that we don't parse 'ls' and enabled globbing 8. Coding style changes - rid of the unnecessary braces - fix a missing for mke2fs on livecd.aufs - renamed variables for more readabilit 9. Better error handling for changesfs() 10. Removed aufs.persistent since 'aufs' already mounts a tmpfs which uses half the available ram, and since this feature is not true persistent we remove it in favor of aufs=DEV defaults/initrd.defaults | 10 +-- defaults/initrd.scripts | 208 --- defaults/linuxrc | 151 +- 3 files changed, 185 insertions(+), 184 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 17847fe..782fd14 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -12,6 +12,8 @@ BAD=\033[31;1m BOLD=\033[1m GOOD=\033[32;1m +# Sets the default collation order +LC_COLLATE=C # From KNOPPIX LINUXRC # Reset fb color mode RESET=]R @@ -58,7 +60,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' -RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/rw_branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino +RC_NO_UMOUNTS='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' @@ -68,10 +70,8 @@ CDROOT_PATH='/mnt/cdrom' CDROOT_MARKER='/livecd' # AUFS variables -USE_AUFS_NORMAL=0 -AUFS_MODULES=false -AUFS_CHANGES=false -AUFS_CHANGESFILE=/livecd.aufs +aufs=0 +aufs_union_file=/livecd.aufs LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 9b88d6a..2e48504 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -178,20 +178,20 @@ devicelist(){ } bootstrapFS() { -if [ ${USE_AUFS_NORMAL} -eq '1' ]; then -# Directories used for rw changes in union mount filesystem -UNION=/union MEMORY=/memory +if [ 1 = $aufs ]; then +# Directories used for rw aufs mount filesystem +aufs_union=/union aufs_memory=/memory -# Mountpoint for the changesdev -CHANGESMNT=${NEW_ROOT}/mnt/changesdev +# Mountpoint for the aufs dev +aufs_dev_mnt=/mnt/aufs-dev -if [ -z $UID ]; then -CHANGES=${MEMORY}/aufs_changes/default +if [ -z $aufs_dev_uid ]; then +aufs_branch=$aufs_memory/aufs-branch/default else -CHANGES=${MEMORY}/aufs_changes/${UID} +aufs_branch=$aufs_memory/aufs-branch/$aufs_dev_uid fi -mkdir -p ${MEMORY} ${UNION} ${CHANGESMNT} +mkdir -p $aufs_memory $aufs_union $aufs_dev_mnt else # Legacy SquashFS implementation good_msg Making tmpfs for ${NEW_ROOT} @@ -280,37 +280,51 @@ mount_sysfs() { [ ${ret} -eq 0 ] || bad_msg Failed to mount /sys! } -# Insert a directory tree ${2} to an union specified by ${1} +# Insert a directory tree $2 to an union specified by $1 # Top-level read-write branch is specified by it's index 0 -# ${1} = union absolute path (starting with /) -# ${2} = path to data directory +# $1 = union absolute path (starting with /) +# $2 = path to data directory # union_insert_dir() { # Always mount it over the precedent (add:1:) - mount -n -o remount,add:1:${2}=rr aufs ${1} - if [ $? = '0' ] - then - good_msg Addition of ${2} to ${1} successful + if mount -n -o remount,add:1:$2=rr aufs $1; then +good_msg Addition of $2 to $1 successful fi } -# Insert all modules found in $1, usually ${CDROOT_PATH} +# Insert all modules found in $1, usually $CDROOT_PATH # added to allow users to add their own apps. union_insert_modules() { - for module in $(ls ${NEW_ROOT}/${1}/modules/*.mo 2/dev/null| sort) - do -
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 2eae1bbb0da75bec6d38b98c97a3de3a3365f901 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Jun 23 20:03:36 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=2eae1bbb Introduced a new funtion to test for numeric values that that our changes_fs doesn't fail when non-numeric values are given, also the styling of changes_fs was changed to reflect new logic. defaults/initrd.scripts | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index c258c00..02842bf 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -345,6 +345,18 @@ conf_rc_no_umounts() { fi } +# is_int $A [$B..] +# NOTE we consider a leading 0 false as it would be interpreted as octal +is_int(){ +local i +for i; do +case $i in +''|*[!0-9]*|0?*) return 1 ;; +*) : +esac +done +} + # Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint create_changefs() { local size @@ -352,11 +364,12 @@ create_changefs() { while :; do read -p ' Size of file (Press Enter for default 256 Mb): ' size -[ -n $size ] || size=256 - -size=$size +size=${size:-256} -if [ 15 -ge $size ]; then +if ! is_int $size; then +bad_msg Non numeric value given for size, try again +continue +elif [ 15 -ge $size ]; then bad_msg Please give a size of at least 16 Megabytes else if dd if=/dev/zero of=$CHANGESMNT$AUFS_CHANGESFILE bs=1M count=$size /dev/null; then
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: b9de2417a6587f2d206841e15ad53c8a4672 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu Jul 10 01:53:07 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:33:04 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=b9de Changed to the dd command which creates the livecd.aufs image for the aufs writable branch to make the process faster we create a sparse file. Added a check for a block device so that we don't try mounting the aufs device some small comestic changes. defaults/initrd.scripts | 33 ++--- defaults/linuxrc| 3 ++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 2e48504..5c7703b 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -376,7 +376,7 @@ create_changefs() { local size while :; do - read -p ' Size of file (Press Enter for default 256 Mb): ' size + read -p ' Size of file (Press Enter for default 256 MB): ' size size=${size:-256} @@ -386,13 +386,13 @@ create_changefs() { elif [ 15 -ge $size ]; then bad_msg Please give a size of at least 16 Megabytes else - if dd if=/dev/zero of=$aufs_dev_mnt$aufs_union_file bs=1M count=$size /dev/null; then - good_msg Creation of $aufs_union_file, ${size}Mb on $aufs_dev successful, formatting it ext2 + if dd if=/dev/zero of=$aufs_dev_mnt$aufs_union_file bs=1 seek=$sizeM count=0 /dev/null; then + good_msg Creation of $aufs_union_file, ${size}MB on $aufs_dev successful, formatting it ext2 mke2fs -F $aufs_dev_mnt$aufs_union_file /dev/null break else rm $aufs_dev_mnt$aufs_union_file - bad_msg Unable to create ${aufs_union_file#*/} on $aufs_dev of ${size}Mb + bad_msg Unable to create ${aufs_union_file#*/} on $aufs_dev of ${size}MB bad_msg Ensure your disk is not full or read-only read -p ' Type a to abort, anything else to continue : ' doabort @@ -410,13 +410,19 @@ create_changefs() { setup_aufs() { bootstrapCD - if [ -n $aufs_dev ]; then -good_msg Mounting $aufs_dev to $aufs_memory for aufs support +if [ -n $aufs_dev ]; then +if [ ! -b $aufs_dev ]; then +bad_msg $aufs_dev is not a valid block device +local invalidblk=1 +unset aufs_dev +else +good_msg Mounting $aufs_dev to $aufs_memory for aufs support - if ! mount -t auto $aufs_dev $aufs_dev_mnt /dev/null; then - bad_msg Mount of $aufs_dev failed, falling back to ramdisk based aufs - unset aufs_dev - fi +if ! mount -t auto $aufs_dev $aufs_dev_mnt /dev/null; then +bad_msg Mount of $aufs_dev failed, falling back to ramdisk based aufs +unset aufs_dev + fi +fi # Check and attempt to create the AUFS union file if [ ! -e $aufs_dev_mnt$aufs_union_file ] [ -n $aufs_dev ]; then @@ -455,7 +461,12 @@ setup_aufs() { aufs_xino=$aufs_memory umount $aufs_memory /dev/null -bad_msg Create an extfs ${aufs_union_file#*/} file on this device +if [ 1 = $invalidblk ]; then +bad_msg Verify that you've entered a valid device path +else +bad_msg Create an extfs ${aufs_union_file#*/} file on this device +fi + bad_msg if you wish to have aufs data persistency on reboots bad_msg Falling back to ramdisk based aufs good_msg Mounting ramdisk to $aufs_memory for aufs support diff --git a/defaults/linuxrc b/defaults/linuxrc index 276f150..3098866 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -786,6 +786,7 @@ distfiles /usr/portage/distfiles tmpfs defaults0 0 FSTAB fi +# When aufs.modules= is used if [ 1 = $aufs_modules ]; then warn_msg Adding all modules in $aufs_modules_dev/modules/ @@ -804,7 +805,7 @@ FSTAB cp /etc/sysconfig/keyboard $CHROOT/etc/sysconfig/ fi -
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: dbf39867145b304b63ade4f52c21f28d4ea8aa89 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:46:09 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=dbf39867 Better handle on if aufs.modules kernel parameter is used defaults/initrd.defaults | 1 + defaults/linuxrc | 22 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 9937e00..b08ff50 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -68,6 +68,7 @@ CDROOT_PATH='/mnt/cdrom' CDROOT_MARKER='/livecd' # AUFS variables +AUFS_MODULES=false AUFS_CHANGES=false AUFS_CHANGESFILE=livecd.aufs diff --git a/defaults/linuxrc b/defaults/linuxrc index 009b4c4..281de8e 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -284,6 +284,7 @@ do # Allow user to specify the modules location aufs.modules\=*) MODULESD=${x#*=} +AUFS_MODULES=true ;; unionfs) if [ ! -x /sbin/unionfs ] @@ -839,15 +840,18 @@ then test ! $(grep -o ^aufs ${CHROOT}/etc/fstab) echo aufs / aufs defaults 0 0 ${CHROOT}/etc/fstab - warn_msg Adding all modules in $MODULESD/modules/ - if [ -z ${MODULESD} ] - then - union_insert_modules ${CDROOT_PATH} - else - mkdir ${NEW_ROOT}/mnt/modulesd - mount ${MODULESD} ${NEW_ROOT}/mnt/modulesd - union_insert_modules ${NEW_ROOT}/mnt/modulesd - fi +if ${AUFS_MODULES}; then +warn_msg Adding all modules in $MODULESD/modules/ + +if [ -z ${MODULESD} ] +then + union_insert_modules ${CDROOT_PATH} + else + mkdir ${NEW_ROOT}/mnt/modulesd + mount ${MODULESD} ${NEW_ROOT}/mnt/modulesd + union_insert_modules ${NEW_ROOT}/mnt/modulesd +fi +fi # Create the directories for our new union mounts test ! -d ${CHROOT}${NEW_ROOT} mkdir -p ${CHROOT}${NEW_ROOT}
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 3a4aa156c84bbc832618b8795bb8b3fae0be3f1f Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Tue Sep 23 00:19:43 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:33:04 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=3a4aa156 /usr/portage/distfiles shouldn't be tmpfs It really doesn't make sense for /usr/portage/distfiles to be tmpfs, plus, if a user is using aufs and trying to save changes we don't want to lose these files. Only /tmp and /var/tmp should be tmpfs. defaults/linuxrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 951f5e1..19b9878 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -770,7 +770,7 @@ then # Fstab changes for aufs if ! grep -q '^aufs' $CHROOT/etc/fstab 2/dev/null; then -for dir in /var/tmp /tmp /usr/portage/distfiles; do +for dir in /var/tmp /tmp; do [ ! -d $CHROOT$dir ] mkdir -p $CHROOT$dir done @@ -782,7 +782,6 @@ then aufs/ aufsdefaults0 0 vartmp /var/tmptmpfs defaults0 0 tmp /tmptmpfs defaults0 0 -distfiles /usr/portage/distfiles tmpfs defaults0 0 FSTAB fi
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 3d379af92b227994d2e82b4b068a5d706c201514 Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Fri Sep 5 16:11:48 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:33:04 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=3d379af9 change default aufs branch naming likewhoa didn't like my default naming, and I don't like his, so we compromised on aufs-rw-branch so no one is happy :-) defaults/initrd.scripts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 8edaea4..d8142a2 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -186,9 +186,9 @@ bootstrapFS() { aufs_dev_mnt=/mnt/aufs-dev if [ -z $aufs_dev_uid ]; then -aufs_branch=$aufs_memory/aufs-branch/default +aufs_branch=$aufs_memory/aufs-rw-branch/default else -aufs_branch=$aufs_memory/aufs-branch/$aufs_dev_uid +aufs_branch=$aufs_memory/aufs-rw-branch/$aufs_dev_uid fi mkdir -p $aufs_memory $aufs_union $aufs_dev_mnt
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 482a092a86bd4889482cffc9004230a68bece1db Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu Jun 5 01:29:32 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=482a092a Fixes a bug introduced by 8405e23 that broke none AUFS boots defaults/initrd.defaults | 1 + 1 file changed, 1 insertion(+) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index b08ff50..2d79fc3 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -68,6 +68,7 @@ CDROOT_PATH='/mnt/cdrom' CDROOT_MARKER='/livecd' # AUFS variables +USE_AUFS_NORMAL=0 AUFS_MODULES=false AUFS_CHANGES=false AUFS_CHANGESFILE=livecd.aufs
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 4e55218f080fab85514112a38e6fe6aee6a922ba Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Tue Sep 23 00:07:28 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:33:04 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=4e55218f aufs changes saving automation The aufs code has the ability to save changes in a file, however, it requires the user to manually tell us where the file is. This code will automatically check for the file on $CDROOT, as well as automatically pick up the casper-rw file created by unetbooting for persistence. Additionally we add the option for aufs=search which will search all drives for livecd.aufs. Possible later enhancements include searching other partitions on the CDROOT_DEV for livecd.aufs automatically instead of needing aufs=search. Then again, possible later enhancements also include just always searching, it's shockingly fast to do the search... defaults/initrd.scripts | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index d8142a2..e05809c 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -123,7 +123,7 @@ findmediamount() { fi good_msg Attempting to mount media: ${x} ${CRYPT_SILENT} - mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} /dev/null 21 + mount -t ${CDROOT_TYPE} ${x} ${mntcddir} /dev/null 21 if [ $? = '0' ] then if [ -n ${ISOBOOT} ]; then @@ -408,12 +408,29 @@ create_changefs() { setup_aufs() { bootstrapCD +if [ $aufs_dev = search ]; then +findmediamount aufs-dev $aufs_union_file \ +aufs_dev $aufs_dev_mnt $(devicelist) +aufs_mounted=1 +elif [ -z $aufs_dev ] [ -w $CDROOT_PATH/$aufs_union_file ]; then +aufs_dev=$REAL_ROOT +aufs_dev_mnt=$CDROOT_PATH +aufs_mounted=1 +fi +if [ -z $aufs_dev ] [ -w $CDROOT_PATH/casper-rw ]; then +aufs_dev=$REAL_ROOT +aufs_dev_mnt=$CDROOT_PATH +aufs_union_file=/casper-rw +aufs_mounted=1 +fi + if [ -n $aufs_dev ]; then if [ ! -b $aufs_dev ]; then bad_msg $aufs_dev is not a valid block device local invalidblk=1 unset aufs_dev -else + #skip this block when aufs_dev_mnt is already mounted +elif [ $aufs_mounted != 1 ]; then good_msg Mounting $aufs_dev to $aufs_memory for aufs support if ! mount -t auto $aufs_dev $aufs_dev_mnt /dev/null; then @@ -428,6 +445,9 @@ setup_aufs() { elif [ -n $aufs_dev ]; then while :; do if mount -t auto $aufs_dev_mnt$aufs_union_file $aufs_memory /dev/null; then +if [ $aufs_union_file = /casper-rw ];then +bad_msg Use of livecd.aufs preferred to casper-rw for changes saving, please rename the file. +fi break else bad_msg Mounting of changes file failed, Running e2fsck
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 09cce549319068807b9e1dba7a3ad3160da3f160 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Jun 2 15:19:23 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=09cce549 This improves the way we handle RC_NO_UMOUNT variable in openrc so that future changes can scale and fixes previous bugs which didn't actually remove duplicates. defaults/linuxrc | 43 +-- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 42749d6..86b1954 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -816,24 +816,39 @@ then # RC_NO_UMOUNTS variable for a clean shutdown/reboot RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' ${CHROOT}/etc/rc.conf) -RESULTS=false # Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever # our RC_NO_UMOUNTS variable changes. -printf '%s\n' ${RC_MOUNTS} | while read -r mount; do -if [[ ${mount} = RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ]]; then -RESULTS=true -else -# Escape characters in ${mounts} for use in sed -mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') - -# Remove non matching pattern -sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf -fi -done +if [ -n ${RC_MOUNTS} ]; then +printf '%s\n' ${RC_MOUNTS} | +{ +while read -r mount; do +# Remove double quotes from ${mount} +new_mount=$(echo ${mount} | sed 's///g') + +if [[ ${new_mount} = RC_NO_UMOUNTS=${RC_NO_UMOUNTS} ]]; then +RESULTS=false +else +# Escape characters in ${mounts} for use in sed +mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') + +# Remove non matching pattern +sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf + +RESULTS=true +fi +done + +# no RC_NO_UMOUNTS match found +if ${RESULTS}; then return 1;fi +} +else +echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf +fi -if ! ${RESULTS}; then -echo 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' ${CHROOT}/etc/rc.conf +# An RC_NO_UMOUNTS was not found that matches our current one +if [ $? -eq 1 ]; then +echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf fi # Fstab change for aufs
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 935febab43502bfd27a0b18d2d4e0cc99a8a4b11 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Jun 23 17:58:33 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=935febab Coding style changes throughout all the AUFS related code. defaults/initrd.defaults | 4 +- defaults/initrd.scripts | 179 ++--- defaults/linuxrc | 227 +-- 3 files changed, 188 insertions(+), 222 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 2d79fc3..17847fe 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -58,7 +58,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' -RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino +RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/rw_branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' @@ -71,7 +71,7 @@ CDROOT_MARKER='/livecd' USE_AUFS_NORMAL=0 AUFS_MODULES=false AUFS_CHANGES=false -AUFS_CHANGESFILE=livecd.aufs +AUFS_CHANGESFILE=/livecd.aufs LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 91056b1..c258c00 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -314,8 +314,7 @@ union_insert_modules() { # This should really go into /etc/init.d/localmounts but until then we manually set this here conf_rc_no_umounts() { local conf nomount fnd -conf=${CHROOT}/etc/rc.conf -fnd=0 +conf=$CHROOT/etc/rc.conf fnd=0 if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then local i n data cmd IFS @@ -350,33 +349,28 @@ conf_rc_no_umounts() { create_changefs() { local size - while [ 1 ] - do + while :; do read -p ' Size of file (Press Enter for default 256 Mb): ' size - if [ -z ${size} ]; then - size=256 - fi - size=${size} -if [ ${size} -lt 16 ] - then - bad_msg Please give a size of at least 16 Mb +[ -n $size ] || size=256 + +size=$size + +if [ 15 -ge $size ]; then +bad_msg Please give a size of at least 16 Megabytes else - dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} /dev/null - if [ $? = '0' ] - then - good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2 - mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} /dev/null + if dd if=/dev/zero of=$CHANGESMNT$AUFS_CHANGESFILE bs=1M count=$size /dev/null; then + good_msg Creation of $AUFS_CHANGESFILE, ${size}Mb on $CHANGESDEV successful, formatting it ext2 + mke2fs -F $CHANGESMNT$AUFS_CHANGESFILE /dev/null AUFS_CHANGES=true break else - rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE} - bad_msg Unable to create ${AUFS_CHANGESFILE} on ${CHANGESDEV} of ${size} Mb + rm -f $CHANGESMNT$AUFS_CHANGESFILE + bad_msg Unable to create ${AUFS_CHANGESFILE#*/} on $CHANGESDEV of ${size}Mb bad_msg Ensure your disk is not full or read-only + read -p ' Type a to abort, anything else to continue : ' doabort - if [ ${doabort} = a ]; then - return 1 - fi + if [ a = $doabort ]; then return 1; fi fi fi done @@ -386,87 +380,80 @@ create_changefs() { setup_aufs() { bootstrapCD - if [ -n ${AUFS} ] - then - if [ ${AUFS} = detect ] - then - CHANGESMNT=${NEW_ROOT}${CDROOT_PATH} - CHANGESDEV=${REAL_ROOT} + if [ -n $AUFS ]; then + if [ detect = $AUFS ]; then + CHANGESMNT=$NEW_ROOT$CDROOT_PATH + CHANGESDEV=$REAL_ROOT else - CHANGESDEV=${AUFS} - good_msg Mounting ${CHANGESDEV} to ${MEMORY} for aufs support - mount -t auto ${CHANGESDEV}
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: f29d304e5d71f65778ea7bff7e9628851bb17ed5 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu May 29 08:15:13 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f29d304e Removing --bind on some directories to prevent ${NEW_ROOT} path from existing in favor of --move. Got rid of the no longer required subshell call for aufs ${NEW_ROOT} overlay. defaults/initrd.scripts | 11 ++- defaults/linuxrc| 7 --- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index c76abb5..2fe540b 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1363,10 +1363,9 @@ getdvhoff() { } setup_squashfs_aufs() { - ( # Setup aufs directories and vars - local overlay=/mnt/overlay - local static=/mnt/livecd + overlay=/mnt/overlay + static=/mnt/livecd for i in ${overlay} ${static}; do [ ! -d ${i} ] mkdir -p ${i} @@ -1381,12 +1380,6 @@ setup_squashfs_aufs() { [ ! -d ${NEW_ROOT}${overlay} ] mkdir -p ${NEW_ROOT}${overlay} [ ! -d ${NEW_ROOT}${static} ] mkdir -p ${NEW_ROOT}${static} for i in ${overlay} ${static}; do mount --move ${i} ${NEW_ROOT}${i}; done - - # have handy /mnt/cdrom (CDROOT_PATH) as well - local new_cdroot=${NEW_ROOT}${CDROOT_PATH} - [ ! -d ${new_cdroot} ] mkdir -p ${new_cdroot} - mount --bind ${CDROOT_PATH} ${new_cdroot} - ) } setup_unionfs() { diff --git a/defaults/linuxrc b/defaults/linuxrc index d5b424c..0a91c58 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -995,7 +995,7 @@ then mkdir -p /${CHROOT}/.unions/memory mount -o move /memory /${CHROOT}/.unions/memory test_success Failed to move aufs /memory into the system root -for i in mnt/gentoo mnt/livecd ${CDROOT_PATH} +for i in mnt/gentoo mnt/livecd /mnt/overlay ${CDROOT_PATH} do mkdir -p ${CHROOT}/$i chmod 755 ${CHROOT}/$i @@ -1012,8 +1012,9 @@ then warn_msg ${str}are mounted in ram warn_msg consider saving important files elsewhere... read -t 3 UNUSEDVAL - mount --bind ${NEW_ROOT}${CDROOT_PATH} ${CHROOT}${CDROOT_PATH} - mount --bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd +for i in ${CDROOT_PATH} ${overlay} ${static}; do +mount --move ${NEW_ROOT}${i} ${CHROOT}${i} +done fi good_msg Booting (initramfs)
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 6e5daaadb38e1bae6a30c57f9997ff01528dc6aa Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 01:03:37 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=6e5daaad Cleanup dd output from changes file creation defaults/initrd.scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 2fe540b..a9ec5ab 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -280,7 +280,7 @@ create_changefs() { then bad_msg Please give a size of at least 16 Mb else - dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} + dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} /dev/null if [ $? = '0' ] then good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 5a62af115cf85e15fbac4f35d98af2a5bf34d004 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 00:51:08 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5a62af11 Enhanced the shutdown process and changed from using ${UNION} to ${CHROOT} to better understand the logic behind things as CHROOT is set to ${UNION} anyways. RC_NO_UMOUNTS is more dynamic now and should scale up. defaults/initrd.defaults | 1 + defaults/linuxrc | 45 +++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index aa9f85c..9937e00 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -58,6 +58,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' +RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' diff --git a/defaults/linuxrc b/defaults/linuxrc index 0a91c58..5d4d2a1 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -805,24 +805,38 @@ then if [ ${USE_AUFS_NORMAL} -eq '1' ] then - union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} + union_insert_dir ${CHROOT} ${NEW_ROOT}/${FS_LOCATION} # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on aufs dirs. # TODO: remounting all tmpfs as RO seems weird, can we be more specific? - sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new - mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab + #sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new + #mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab # RC_NO_UMOUNTS variable for a clean shutdown/reboot -test ! $(grep 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/aufs|\ -/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|/.unions/\ -memory|/.unions/memory/xino' ${UNION}/etc/rc.conf) -echo RC_NO_UMOUNTS=\/newroot|/newroot/mnt/aufs|\ -/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|\ -/.unions/memory|/.unions/memory/xino\ ${UNION}/etc/rc.conf +RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' ${CHROOT}/etc/rc.conf) +RESULTS=false + +# Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever +# our RC_NO_UMOUNTS variable changes. +printf '%s\n' ${RC_MOUNTS} | while read -r mount; do +if [[ ${mount} = RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ]]; then +RESULTS=true +else +# Escape characters in ${mounts} for use in sed +mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') + +# Remove non matching pattern +sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf +fi +done + +if ! ${RESULTS}; then +echo 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' ${CHROOT}/etc/rc.conf +fi # Fstab change for aufs -test ! $(grep aufs ${UNION}/etc/fstab) -echo aufs / aufs defaults 0 0 ${UNION}/etc/fstab +test ! $(grep -o ^aufs ${CHROOT}/etc/fstab) +echo aufs / aufs defaults 0 0 ${CHROOT}/etc/fstab warn_msg Adding all modules in $MODULESD/modules/ if [ -z ${MODULESD} ] @@ -834,9 +848,12 @@ memory|/.unions/memory/xino' ${UNION}/etc/rc.conf) union_insert_modules ${NEW_ROOT}/mnt/modulesd fi -mkdir -p ${UNION}/newroot/mnt/aufs -test ${AUFS_CHANGES} test ! -d ${UNION}/newroot/mnt/changesdev -mkdir ${UNION}/newroot/mnt/changesdev +# Create the directories for our new union mounts +test ! -d ${CHROOT}${NEW_ROOT} mkdir -p ${CHROOT}${NEW_ROOT} + +if ${AUFS_CHANGES} [ ! -d ${CHROOT}${NEW_ROOT}/mnt/changesdev ]; then +mkdir -p ${CHROOT}${NEW_ROOT}/mnt/changesdev +fi fi # Unpacking additional packages from NFS mount
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: aa073bf7ee057fa5d7b1643ccb25618162c2bbd6 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 3 17:48:14 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=aa073bf7 Better implementation which was originally done in 946918e 7a38d63. defaults/initrd.scripts | 36 defaults/linuxrc| 38 ++ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index eb5ed6a..91056b1 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -310,6 +310,42 @@ union_insert_modules() { done } +# Implements RC_NO_UMOUNTS variable into ${CHROOT}/etc/rc.conf for a cleaner shutdown process +# This should really go into /etc/init.d/localmounts but until then we manually set this here +conf_rc_no_umounts() { +local conf nomount fnd +conf=${CHROOT}/etc/rc.conf +fnd=0 + +if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then +local i n data cmd IFS +IFS=' +' +set -- $nomount +unset IFS + +for i; do +n=${i%%:*}; i=${i#$n} +data=${i#*=} + +case $data in +\$RC_NO_UMOUNTS\|'$RC_NO_UMOUNTS') fnd=1;; +*) cmd=$cmd$n d; +esac +done + +if [ -n $cmd ]; then +sed -i ${cmd%;} $conf +test_success Unable to edit rc.conf +fi +fi + +if [ 0 -eq $fnd ]; then +printf 'RC_NO_UMOUNTS=%s\n' $RC_NO_UMOUNTS $conf +test_success Unable to write to rc.conf +fi +} + # Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint create_changefs() { local size diff --git a/defaults/linuxrc b/defaults/linuxrc index 0e40d16..a6c4806 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -791,42 +791,8 @@ then #sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new #mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab -# RC_NO_UMOUNTS variable for a clean shutdown/reboot -RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' ${CHROOT}/etc/rc.conf) - -# Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever -# our RC_NO_UMOUNTS variable changes. -if [ -n ${RC_MOUNTS} ]; then -printf '%s\n' ${RC_MOUNTS} | -{ -while read -r mount; do -# Remove double quotes from ${mount} -new_mount=$(echo ${mount} | sed 's///g') - -if [[ ${new_mount} = RC_NO_UMOUNTS=${RC_NO_UMOUNTS} ]]; then -RESULTS=false -else -# Escape characters in ${mounts} for use in sed -mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') - -# Remove non matching pattern -sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf - -RESULTS=true -fi -done - -# no RC_NO_UMOUNTS match found -if ${RESULTS}; then return 1;fi -} -else -echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf -fi - -# An RC_NO_UMOUNTS was not found that matches our current one -if [ $? -eq 1 ]; then -echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf -fi +# Function to handle the RC_NO_UMOUNTS variable in ${CHROOT}/etc/rc.conf +conf_rc_no_umounts # Fstab change for aufs test ! $(grep -o ^aufs ${CHROOT}/etc/fstab)
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 064e285bbe80b527b6a53256382fd40beea0de5b Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:57:13 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=064e285b coding style changes defaults/linuxrc | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 281de8e..42749d6 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -1014,26 +1014,34 @@ verbose_kmsg if [ ${USE_AUFS_NORMAL} -eq '1' ] then - mkdir -p /${CHROOT}/.unions/memory - mount -o move /memory /${CHROOT}/.unions/memory +UNION_MEMORY=${CHROOT}/.unions/memory + + mkdir -p ${UNION_MEMORY} + mount --move ${MEMORY} ${UNION_MEMORY} test_success Failed to move aufs /memory into the system root -for i in mnt/gentoo mnt/livecd /mnt/overlay ${CDROOT_PATH} + +for i in /mnt/gentoo /mnt/livecd /mnt/overlay ${CDROOT_PATH} do - mkdir -p ${CHROOT}/$i - chmod 755 ${CHROOT}/$i + mkdir -p ${CHROOT}${i} + chmod 755 ${CHROOT}${i} done + # This will prevent from putting junk on the CHANGESDEV str= - for i in tmp var/tmp usr/portage/distfiles + for i in /tmp /var/tmp /usr/portage/distfiles do - mkdir -p ${CHROOT}/$i - chmod 755 ${CHROOT}/$i - mount -t tmpfs tmpfs ${CHROOT}/$i - str=${str} ${i} + mkdir -p ${CHROOT}${i} + chmod 755 ${CHROOT}${i} + + mount -t tmpfs tmpfs ${CHROOT}${i} + str=${i} ${str} done + warn_msg ${str}are mounted in ram warn_msg consider saving important files elsewhere - read -t 3 UNUSEDVAL + +sleep 2 + for i in ${CDROOT_PATH} ${overlay} ${static}; do mount --move ${NEW_ROOT}${i} ${CHROOT}${i} done
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 98da3645c1cd72895af0c9131db6024388f63af2 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Wed Jun 4 23:04:30 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Apr 29 17:31:45 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=98da3645 This introduces changes to former commits d8e2d4d 720a60f in which there are fstab changes and tmpfs mounts which are combined into one /etc/fstab instead. defaults/linuxrc | 32 +--- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index a6c4806..8b3ff87 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -794,9 +794,19 @@ then # Function to handle the RC_NO_UMOUNTS variable in ${CHROOT}/etc/rc.conf conf_rc_no_umounts -# Fstab change for aufs -test ! $(grep -o ^aufs ${CHROOT}/etc/fstab) -echo aufs / aufs defaults 0 0 ${CHROOT}/etc/fstab +# Fstab changes for aufs +if ! grep -q '^aufs' ${CHROOT}/etc/fstab 2/dev/null; then +for i in /var/tmp /tmp /usr/portage/distfiles; do +[ ! -d ${CHROOT}${i} ] mkdir -p ${CHROOT}${i} +done + +cat ${CHROOT}/etc/fstab FSTAB +aufs/ aufsdefaults0 0 +vartmp /var/tmptmpfs defaults0 0 +tmp /tmptmpfs defaults0 0 +distfiles /usr/portage/distfiles tmpfs defaults0 0 +FSTAB +fi if ${AUFS_MODULES}; then warn_msg Adding all modules in $MODULESD/modules/ @@ -990,22 +1000,6 @@ then chmod 755 ${CHROOT}${i} done - # This will prevent from putting junk on the CHANGESDEV - str= - for i in /tmp /var/tmp /usr/portage/distfiles - do - mkdir -p ${CHROOT}${i} - chmod 755 ${CHROOT}${i} - - mount -t tmpfs tmpfs ${CHROOT}${i} - str=${i} ${str} - done - - warn_msg ${str}are mounted in ram - warn_msg consider saving important files elsewhere - -sleep 2 - for i in ${CDROOT_PATH} ${overlay} ${static}; do mount --move ${NEW_ROOT}${i} ${CHROOT}${i} done
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 5e7ea7fce1b18ceadcf3cf3e7bc008d6fd537a0a Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Tue Sep 23 00:07:28 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Tue Sep 23 00:07:28 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=5e7ea7fc aufs changes saving automation The aufs code has the ability to save changes in a file, however, it requires the user to manually tell us where the file is. This code will automatically check for the file on $CDROOT, as well as automatically pick up the casper-rw file created by unetbooting for persistence. Additionally we add the option for aufs=search which will search all drives for livecd.aufs. Possible later enhancements include searching other partitions on the CDROOT_DEV for livecd.aufs automatically instead of needing aufs=search. Then again, possible later enhancements also include just always searching, it's shockingly fast to do the search... --- defaults/initrd.scripts | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index a834ed2..1cc9ff9 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -123,7 +123,7 @@ findmediamount() { fi good_msg Attempting to mount media: ${x} ${CRYPT_SILENT} - mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} /dev/null 21 + mount -t ${CDROOT_TYPE} ${x} ${mntcddir} /dev/null 21 if [ $? = '0' ] then if [ -n ${ISOBOOT} ]; then @@ -408,12 +408,29 @@ create_changefs() { setup_aufs() { bootstrapCD +if [ $aufs_dev = search ]; then +findmediamount aufs-dev $aufs_union_file \ +aufs_dev $aufs_dev_mnt $(devicelist) +aufs_mounted=1 +elif [ -z $aufs_dev ] [ -w $CDROOT_PATH/$aufs_union_file ]; then +aufs_dev=$REAL_ROOT +aufs_dev_mnt=$CDROOT_PATH +aufs_mounted=1 +fi +if [ -z $aufs_dev ] [ -w $CDROOT_PATH/casper-rw ]; then +aufs_dev=$REAL_ROOT +aufs_dev_mnt=$CDROOT_PATH +aufs_union_file=/casper-rw +aufs_mounted=1 +fi + if [ -n $aufs_dev ]; then if [ ! -b $aufs_dev ]; then bad_msg $aufs_dev is not a valid block device local invalidblk=1 unset aufs_dev -else + #skip this block when aufs_dev_mnt is already mounted +elif [ $aufs_mounted != 1 ]; then good_msg Mounting $aufs_dev to $aufs_memory for aufs support if ! mount -t auto $aufs_dev $aufs_dev_mnt /dev/null; then @@ -428,6 +445,9 @@ setup_aufs() { elif [ -n $aufs_dev ]; then while :; do if mount -t auto $aufs_dev_mnt$aufs_union_file $aufs_memory /dev/null; then +if [ $aufs_union_file = /casper-rw ];then +bad_msg Use of livecd.aufs preferred to casper-rw for changes saving, please rename the file. +fi break else bad_msg Mounting of changes file failed, Running e2fsck
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: f2c5c3b08c5a1930390840408b1526410d9442a4 Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Tue Sep 23 00:19:43 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Tue Sep 23 00:19:43 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=f2c5c3b0 /usr/portage/distfiles shouldn't be tmpfs It really doesn't make sense for /usr/portage/distfiles to be tmpfs, plus, if a user is using aufs and trying to save changes we don't want to lose these files. Only /tmp and /var/tmp should be tmpfs. --- defaults/linuxrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 951f5e1..19b9878 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -770,7 +770,7 @@ then # Fstab changes for aufs if ! grep -q '^aufs' $CHROOT/etc/fstab 2/dev/null; then -for dir in /var/tmp /tmp /usr/portage/distfiles; do +for dir in /var/tmp /tmp; do [ ! -d $CHROOT$dir ] mkdir -p $CHROOT$dir done @@ -782,7 +782,6 @@ then aufs/ aufsdefaults0 0 vartmp /var/tmptmpfs defaults0 0 tmp /tmptmpfs defaults0 0 -distfiles /usr/portage/distfiles tmpfs defaults0 0 FSTAB fi
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: d30bfb2e0028d37031b0a0c129cce7ced20d2cef Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Aug 4 01:23:02 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Aug 6 22:21:03 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=d30bfb2e Fixed a bug which prevented aufs.modules from functioning properly and changed the variables names to reflect the actual logic. --- defaults/initrd.defaults | 1 + defaults/initrd.scripts | 17 - defaults/linuxrc | 22 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 94b45cc..818e3b1 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -72,6 +72,7 @@ CDROOT_MARKER='/livecd' # AUFS variables aufs=0 aufs_union_file=/livecd.aufs +aufs_modules_dir=mnt/cdrom LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 5a01986..7d9497d 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -297,12 +297,12 @@ union_insert_dir() { union_insert_modules() { local module -for module in $NEW_ROOT/$1/modules/*.mo; do -union_mod $module || bad_msg Unable to load module: '$module' +for module in $1/modules/*.mo; do +union_mod $module || bad_msg Unable to insert module: '$module' done -for module in $NEW_ROOT/$1/modules/*.lzm; do -union_mod $module lzm || bad_msg Unable to load module: '$module' +for module in $1/modules/*.lzm; do +union_mod $module || bad_msg Unable to insert module: '$module' done } @@ -315,13 +315,12 @@ union_mod() { mod=${1##*/} mod=${mod%.*} -mkdir -p $aufs_memory/modules/$mod || return - -if [ lzm = $2 ]; then - mount -o loop,ro $1 $aufs_memory/modules/$mod +if [ ! -d $aufs_union/mnt/$mod ]; then +mkdir -p $aufs_union/mnt/modules/$mod || return fi -union_insert_dir $aufs_union $aufs_memory/modules/$mod +mount -o loop,ro $1 $aufs_union/mnt/modules/$mod +union_insert_dir $aufs_union $aufs_union/mnt/modules/$mod } # Implements RC_NO_UMOUNTS variable into $CHROOT/etc/rc.conf for a cleaner shutdown process diff --git a/defaults/linuxrc b/defaults/linuxrc index 3098866..951f5e1 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -265,7 +265,7 @@ do ;; # Allow user to specify the modules location aufs.modules\=*) - aufs_modules_dev=${x#*=} + aufs_modules_dir=${x#*=} aufs_modules=1 ;; unionfs) @@ -786,16 +786,20 @@ distfiles /usr/portage/distfiles tmpfs defaults0 0 FSTAB fi -# When aufs.modules= is used -if [ 1 = $aufs_modules ]; then -warn_msg Adding all modules in $aufs_modules_dev/modules/ +# When aufs.modules= is used or $CDROOT_PATH/modules +# directory is available +if [[ 1 = $aufs_modules || -d $CDROOT_PATH/modules ]]; then +warn_msg Adding all modules in $aufs_modules_dir/modules/ -if [ -z $aufs_modules_dev ]; then +if [ mnt/cdrom = $aufs_modules_dir ]; then union_insert_modules $CDROOT_PATH - else - mkdir $NEW_ROOT/mnt/modulesd - mount $aufs_modules_dev $NEW_ROOT/mnt/modulesd - union_insert_modules $NEW_ROOT/mnt/modulesd +elif [ ! -b $aufs_modules_dir ]; then +bad_msg $aufs_modules_dir is not a valid block device +bad_msg aborting modules insert into $aufs_union +else +mkdir /mnt/modules + mount $aufs_modules_dir /mnt/modules + union_insert_modules /mnt/modules fi fi
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: ed0deb0399d5bfe92decb7742da098b71724e0a8 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 24 22:36:40 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Tue Jun 24 22:36:40 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=ed0deb03 Reverting back old mknod permission settings for netboot compatibility --- defaults/initrd.scripts | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 26ed173..d87bb4e 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -205,10 +205,10 @@ bootstrapFS() { done [ ! -d ${CDROOT_PATH} ] mkdir -p ${CDROOT_PATH} -[ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 -[ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 660 ${NEW_ROOT}/dev/zero c 1 5 -[ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 -[ ! -e ${NEW_ROOT}/dev/ttyS0 ] mknod -m 600 ${NEW_ROOT}/dev/ttyS0 c 4 64 +[ ! -e ${NEW_ROOT}/dev/null ] mknod -m 666 ${NEW_ROOT}/dev/null c 1 3 +[ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 666 ${NEW_ROOT}/dev/zero c 1 5 +[ ! -e ${NEW_ROOT}/dev/console ] mknod -m 600 ${NEW_ROOT}/dev/console c 5 1 +[ ! -e ${NEW_ROOT}/dev/ttyS0 ] mknod -m 660 ${NEW_ROOT}/dev/ttyS0 c 4 64 # For SGI LiveCDs if [ ${LOOPTYPE} = sgimips ]; then
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: fc976d19b7e06465d755ac86559ef4bce82b4656 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:31:13 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=fc976d19 Wording changes, cosmetic crap --- defaults/initrd.scripts | 21 +++-- defaults/linuxrc| 7 --- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 1c9..22769bd 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -334,12 +334,12 @@ setup_aufs() { CHANGESDEV=${REAL_ROOT} else CHANGESDEV=${AUFS} - good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support + good_msg Mounting ${CHANGESDEV} to ${MEMORY} for aufs support mount -t auto ${CHANGESDEV} ${CHANGESMNT} /dev/null ret=$? if [ ${ret} -ne 0 ] then - bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs + bad_msg Mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs unset AUFS fi fi @@ -359,15 +359,15 @@ setup_aufs() { then if [ ${nbpass} -eq 0 ] then - bad_msg mounting of changes file failed, Running e2fsck + bad_msg Mounting of changes file failed, Running e2fsck e2fsck ${CHANGESMNT}/${AUFS_CHANGESFILE} nbpass=$((${nbpass} + 1)) else - bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs + bad_msg Mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs bad_msg your ${AUFS_CHANGESFILE} might be messed up, and I couldn't fix it bad_msg moving ${AUFS_CHANGESFILE} to ${AUFS_CHANGESFILE}.bad mv ${CHANGESMNT}/${AUFS_CHANGESFILE} ${CHANGESMNT}/${AUFS_CHANGESFILE}.bad - bad_msg try to fix it yourself with e2fsck later on, sorry for disturbing + bad_msg Try to fix it yourself with e2fsck break fi else @@ -383,19 +383,20 @@ setup_aufs() { # empty or we were not able to mount the storage device if [ ${CDROOT} -eq '1' -a ! -f ${CHANGESMNT}/${AUFS_CHANGESFILE} ] then +XINO=${MEMORY} umount ${MEMORY} /dev/null - bad_msg failed to find ${AUFS_CHANGESFILE} file on ${CHANGESDEV} - bad_msg create an ext2 ${AUFS_CHANGESFILE} file on this device if you wish to use it for aufs - bad_msg falling back to ramdisk based aufs for safety + bad_msg Failed to find ${AUFS_CHANGESFILE} file on ${CHANGESDEV} + bad_msg Create an ext2 ${AUFS_CHANGESFILE} file on this device if you wish to use it for aufs + bad_msg Falling back to ramdisk based aufs for safety +good_msg Mounting ramdisk to $MEMORY for aufs support mount -t tmpfs tmpfs ${MEMORY} - XINO=${MEMORY} else XINO=${MEMORY}/xino mkdir -p ${XINO} mount -t tmpfs tmpfs ${XINO} fi else - good_msg Mounting ramdisk to $MEMORY for aufs support... + good_msg Mounting ramdisk to $MEMORY for aufs support mount -t tmpfs tmpfs ${MEMORY} XINO=${MEMORY} fi diff --git a/defaults/linuxrc b/defaults/linuxrc index 894ec45..009b4c4 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -758,9 +758,10 @@ then do_rundebugshell } else - good_msg 'Mounting squashfs aufs filesystems' + good_msg 'Mounting squashfs filesystem' +
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 1ebd03691dd96f3fe952ada0ecf301e9f731cfa5 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu May 29 01:55:05 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=1ebd0369 Cleaner shutdown process preventing aufs related mounts from being umounted along with mnt/{livecd,cdrom} and others. Addition of a variable for aufs changes so that required directory can be create upon successful creation of the livecd image file. --- defaults/initrd.defaults | 3 +++ defaults/initrd.scripts | 1 + defaults/linuxrc | 20 +--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 3d6fe7e..5245959 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -65,6 +65,9 @@ CDROOT_PATH='/mnt/cdrom' # This is the file that the cdroot will be checked for as a # marker. It must exist RELATIVE to the cdroot. CDROOT_MARKER='/livecd' + +# AUFS variables +AUFS_CHANGES=false AUFS_CHANGESFILE=livecd.aufs LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index e81e5f2..dd3af37 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -285,6 +285,7 @@ create_changefs() { then good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2 mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} /dev/null +AUFS_CHANGES=true break else rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE} diff --git a/defaults/linuxrc b/defaults/linuxrc index 8620352..6d942a1 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -811,6 +811,15 @@ then # TODO: remounting all tmpfs as RO seems weird, can we be more specific? sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab + +# RC_NO_UMOUNTS variable for a clean shutdown/reboot +test ! $(grep 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/aufs|\ +/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|/.unions/\ +memory|/.unions/memory/xino' ${UNION}/etc/rc.conf) +echo RC_NO_UMOUNTS=\/newroot|/newroot/mnt/aufs|\ +/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|\ +/.unions/memory|/.unions/memory/xino\ ${UNION}/etc/rc.conf + warn_msg Adding all modules in $MODULESD/modules/ if [ -z ${MODULESD} ] then @@ -820,6 +829,10 @@ then mount ${MODULESD} ${NEW_ROOT}/mnt/modulesd union_insert_modules ${NEW_ROOT}/mnt/modulesd fi + +mkdir -p ${UNION}/newroot/mnt/aufs +test ${AUFS_CHANGES} test ! -d ${UNION}/newroot/mnt/changesdev +mkdir ${UNION}/newroot/mnt/changesdev fi # Unpacking additional packages from NFS mount @@ -975,9 +988,10 @@ verbose_kmsg if [ ${USE_AUFS_NORMAL} -eq '1' ] then - mkdir -p /${CHROOT}/.unions/memory 2/dev/null - mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!' - for i in mnt/gentoo mnt/livecd + mkdir -p /${CHROOT}/.unions/memory + mount -o move /memory /${CHROOT}/.unions/memory +test_success Failed to move aufs /memory into the system root +for i in mnt/gentoo mnt/livecd ${CDROOT_PATH} do mkdir -p ${CHROOT}/$i chmod 755 ${CHROOT}/$i
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: bada211da4c359c28056ac8cd57cd52ee25b470a Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu Jun 5 01:29:32 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=bada211d Fixes a bug introduced by 8405e23 that broke none AUFS boots --- defaults/initrd.defaults | 1 + 1 file changed, 1 insertion(+) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 1e1a539..d0efa28 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -68,6 +68,7 @@ CDROOT_PATH='/mnt/cdrom' CDROOT_MARKER='/livecd' # AUFS variables +USE_AUFS_NORMAL=0 AUFS_MODULES=false AUFS_CHANGES=false AUFS_CHANGESFILE=livecd.aufs
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 6351547bada320d82a8e5c09450d8a4783e948df Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Jun 2 15:19:23 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=6351547b This improves the way we handle RC_NO_UMOUNT variable in openrc so that future changes can scale and fixes previous bugs which didn't actually remove duplicates. --- defaults/linuxrc | 43 +-- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 42749d6..86b1954 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -816,24 +816,39 @@ then # RC_NO_UMOUNTS variable for a clean shutdown/reboot RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' ${CHROOT}/etc/rc.conf) -RESULTS=false # Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever # our RC_NO_UMOUNTS variable changes. -printf '%s\n' ${RC_MOUNTS} | while read -r mount; do -if [[ ${mount} = RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ]]; then -RESULTS=true -else -# Escape characters in ${mounts} for use in sed -mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') - -# Remove non matching pattern -sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf -fi -done +if [ -n ${RC_MOUNTS} ]; then +printf '%s\n' ${RC_MOUNTS} | +{ +while read -r mount; do +# Remove double quotes from ${mount} +new_mount=$(echo ${mount} | sed 's///g') + +if [[ ${new_mount} = RC_NO_UMOUNTS=${RC_NO_UMOUNTS} ]]; then +RESULTS=false +else +# Escape characters in ${mounts} for use in sed +mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') + +# Remove non matching pattern +sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf + +RESULTS=true +fi +done + +# no RC_NO_UMOUNTS match found +if ${RESULTS}; then return 1;fi +} +else +echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf +fi -if ! ${RESULTS}; then -echo 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' ${CHROOT}/etc/rc.conf +# An RC_NO_UMOUNTS was not found that matches our current one +if [ $? -eq 1 ]; then +echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf fi # Fstab change for aufs
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: f2e48df4ad02697915037dfbe5fe81411c1750fe Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 3 17:48:14 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=f2e48df4 Better implementation which was originally done in 946918e 7a38d63. --- defaults/initrd.scripts | 36 defaults/linuxrc| 38 ++ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 07890ec..52b18b3 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -310,6 +310,42 @@ union_insert_modules() { done } +# Implements RC_NO_UMOUNTS variable into ${CHROOT}/etc/rc.conf for a cleaner shutdown process +# This should really go into /etc/init.d/localmounts but until then we manually set this here +conf_rc_no_umounts() { +local conf nomount fnd +conf=${CHROOT}/etc/rc.conf +fnd=0 + +if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then +local i n data cmd IFS +IFS=' +' +set -- $nomount +unset IFS + +for i; do +n=${i%%:*}; i=${i#$n} +data=${i#*=} + +case $data in +\$RC_NO_UMOUNTS\|'$RC_NO_UMOUNTS') fnd=1;; +*) cmd=$cmd$n d; +esac +done + +if [ -n $cmd ]; then +sed -i ${cmd%;} $conf +test_success Unable to edit rc.conf +fi +fi + +if [ 0 -eq $fnd ]; then +printf 'RC_NO_UMOUNTS=%s\n' $RC_NO_UMOUNTS $conf +test_success Unable to write to rc.conf +fi +} + # Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint create_changefs() { local size diff --git a/defaults/linuxrc b/defaults/linuxrc index 0e40d16..a6c4806 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -791,42 +791,8 @@ then #sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new #mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab -# RC_NO_UMOUNTS variable for a clean shutdown/reboot -RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' ${CHROOT}/etc/rc.conf) - -# Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever -# our RC_NO_UMOUNTS variable changes. -if [ -n ${RC_MOUNTS} ]; then -printf '%s\n' ${RC_MOUNTS} | -{ -while read -r mount; do -# Remove double quotes from ${mount} -new_mount=$(echo ${mount} | sed 's///g') - -if [[ ${new_mount} = RC_NO_UMOUNTS=${RC_NO_UMOUNTS} ]]; then -RESULTS=false -else -# Escape characters in ${mounts} for use in sed -mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') - -# Remove non matching pattern -sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf - -RESULTS=true -fi -done - -# no RC_NO_UMOUNTS match found -if ${RESULTS}; then return 1;fi -} -else -echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf -fi - -# An RC_NO_UMOUNTS was not found that matches our current one -if [ $? -eq 1 ]; then -echo RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ${CHROOT}/etc/rc.conf -fi +# Function to handle the RC_NO_UMOUNTS variable in ${CHROOT}/etc/rc.conf +conf_rc_no_umounts # Fstab change for aufs test ! $(grep -o ^aufs ${CHROOT}/etc/fstab)
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 28b5ded8443847cf7f6fb877f54ecc887299e8fa Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 00:51:08 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=28b5ded8 Enhanced the shutdown process and changed from using ${UNION} to ${CHROOT} to better understand the logic behind things as CHROOT is set to ${UNION} anyways. RC_NO_UMOUNTS is more dynamic now and should scale up. --- defaults/initrd.defaults | 1 + defaults/linuxrc | 45 +++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 5245959..1f28883 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -58,6 +58,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' +RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' diff --git a/defaults/linuxrc b/defaults/linuxrc index 0a91c58..5d4d2a1 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -805,24 +805,38 @@ then if [ ${USE_AUFS_NORMAL} -eq '1' ] then - union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} + union_insert_dir ${CHROOT} ${NEW_ROOT}/${FS_LOCATION} # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on aufs dirs. # TODO: remounting all tmpfs as RO seems weird, can we be more specific? - sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new - mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab + #sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new + #mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab # RC_NO_UMOUNTS variable for a clean shutdown/reboot -test ! $(grep 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/aufs|\ -/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|/.unions/\ -memory|/.unions/memory/xino' ${UNION}/etc/rc.conf) -echo RC_NO_UMOUNTS=\/newroot|/newroot/mnt/aufs|\ -/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|\ -/.unions/memory|/.unions/memory/xino\ ${UNION}/etc/rc.conf +RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' ${CHROOT}/etc/rc.conf) +RESULTS=false + +# Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever +# our RC_NO_UMOUNTS variable changes. +printf '%s\n' ${RC_MOUNTS} | while read -r mount; do +if [[ ${mount} = RC_NO_UMOUNTS=\${RC_NO_UMOUNTS}\ ]]; then +RESULTS=true +else +# Escape characters in ${mounts} for use in sed +mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\/\\\/g') + +# Remove non matching pattern +sed -i /${mount_re}/d ${CHROOT}/etc/rc.conf +fi +done + +if ! ${RESULTS}; then +echo 'RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' ${CHROOT}/etc/rc.conf +fi # Fstab change for aufs -test ! $(grep aufs ${UNION}/etc/fstab) -echo aufs / aufs defaults 0 0 ${UNION}/etc/fstab +test ! $(grep -o ^aufs ${CHROOT}/etc/fstab) +echo aufs / aufs defaults 0 0 ${CHROOT}/etc/fstab warn_msg Adding all modules in $MODULESD/modules/ if [ -z ${MODULESD} ] @@ -834,9 +848,12 @@ memory|/.unions/memory/xino' ${UNION}/etc/rc.conf) union_insert_modules ${NEW_ROOT}/mnt/modulesd fi -mkdir -p ${UNION}/newroot/mnt/aufs -test ${AUFS_CHANGES} test ! -d ${UNION}/newroot/mnt/changesdev -mkdir ${UNION}/newroot/mnt/changesdev +# Create the directories for our new union mounts +test ! -d ${CHROOT}${NEW_ROOT} mkdir -p ${CHROOT}${NEW_ROOT} + +if ${AUFS_CHANGES} [ ! -d ${CHROOT}${NEW_ROOT}/mnt/changesdev ]; then +mkdir -p ${CHROOT}${NEW_ROOT}/mnt/changesdev +fi fi # Unpacking additional packages from NFS mount
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 137151956da638841b27e8faf3fb8401a3b37df6 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 3 01:36:28 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=13715195 A new bootstrapFS function has been added to cut on duplicate code use which both aufs and squashfs boot types use and this it's moved to the top of the boot process. --- defaults/initrd.scripts | 70 + defaults/linuxrc| 29 +++- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 22769bd..07890ec 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -177,6 +177,52 @@ devicelist(){ echo ${DEVICES} } +bootstrapFS() { +if [ ${USE_AUFS_NORMAL} -eq '1' ]; then +# Directories used for rw changes in union mount filesystem +UNION=/union MEMORY=/memory + +# Mountpoint for the changesdev +CHANGESMNT=${NEW_ROOT}/mnt/changesdev + +if [ -z $UID ]; then +CHANGES=${MEMORY}/aufs_changes/default +else +CHANGES=${MEMORY}/aufs_changes/${UID} +fi + +mkdir -p ${MEMORY} ${UNION} ${CHANGESMNT} +else +# Legacy SquashFS implementation +good_msg Making tmpfs for ${NEW_ROOT} +mount -n -t tmpfs tmpfs ${NEW_ROOT} +fi + +# Setup the filesystem nodes and directories +for i in ${CDROOT_PATH} /mnt/livecd /mnt/key /mnt/gentoo /tmp /tmp/.initrd /dev /proc /run /sys; do +mkdir -p ${NEW_ROOT}${i} +chmod 755 ${NEW_ROOT}${i} +done + +[ ! -d ${CDROOT_PATH} ] mkdir -p ${CDROOT_PATH} +[ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 +[ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 660 ${NEW_ROOT}/dev/zero c 1 5 +[ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 +[ ! -e ${NEW_ROOT}/dev/ttyS0 ] mknod -m 600 ${NEW_ROOT}/dev/ttyS0 c 4 64 + +# For SGI LiveCDs +if [ ${LOOPTYPE} = sgimips ]; then +[ ! -e ${NEW_ROOT}/dev/sr0 ] mknod ${NEW_ROOT}/dev/sr0 b 11 0 +[ ! -e ${NEW_ROOT}/dev/loop0 ] mknod ${NEW_ROOT}/dev/loop0 b 7 0 +fi + +# Required for splash to work. Not an issue with the initrd as this +# device isn't created there and is not needed. +for minor in 0 1 ; do +[ ! -e ${NEW_ROOT}/dev/$minor ] mknod -m 600 ${NEW_ROOT}/dev/tty$minor c 4 $minor +done +} + bootstrapCD() { local DEVICES= @@ -302,30 +348,8 @@ create_changefs() { } setup_aufs() { -# Directory used for rw changes in union mount filesystem - UNION=/union - MEMORY=/memory - # Mountpoint for the changesdev - CHANGESMNT=${NEW_ROOT}/mnt/changesdev - if [ -z $UID ] - then - CHANGES=${MEMORY}/aufs_changes/default - else - CHANGES=${MEMORY}/aufs_changes/${UID} - fi - - mkdir -p ${MEMORY} - mkdir -p ${UNION} - mkdir -p ${CHANGESMNT} - for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p ${NEW_ROOT}/${i} - chmod 755 ${NEW_ROOT}/${i} - done - [ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 - [ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 - bootstrapCD + if [ -n ${AUFS} ] then if [ ${AUFS} = detect ] diff --git a/defaults/linuxrc b/defaults/linuxrc index da88bf0..0e40d16 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -458,40 +458,17 @@ rundebugshell before setting up the root filesystem if [ ${CDROOT} = '1' ] then +# Setup the root filesystem +bootstrapFS + if [ ${USE_AUFS_NORMAL} -eq '1' ] then setup_aufs CHROOT=${UNION} else CHROOT=${NEW_ROOT} - good_msg Making tmpfs for ${NEW_ROOT} - mount -n -t tmpfs tmpfs ${NEW_ROOT} - - for i in dev mnt ${CDROOT_PATH} proc run mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p ${NEW_ROOT}/${i} - chmod 755 ${NEW_ROOT}/${i} - done - [ ! -d ${CDROOT_PATH} ] mkdir -p ${CDROOT_PATH} - [ ! -e ${NEW_ROOT}/dev/null ] mknod -m 666 ${NEW_ROOT}/dev/null c 1 3 - [ ! -e ${NEW_ROOT}/dev/zero ] mknod -m 666 ${NEW_ROOT}/dev/zero c 1 5 - [ ! -e ${NEW_ROOT}/dev/console ] mknod -m 600
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 854a835ede60717a9b4ac847b5e3e56877c35338 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu May 29 08:15:13 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=854a835e Removing --bind on some directories to prevent ${NEW_ROOT} path from existing in favor of --move. Got rid of the no longer required subshell call for aufs ${NEW_ROOT} overlay. --- defaults/initrd.scripts | 11 ++- defaults/linuxrc| 7 --- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index bf4124f..aded9ad 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1363,10 +1363,9 @@ getdvhoff() { } setup_squashfs_aufs() { - ( # Setup aufs directories and vars - local overlay=/mnt/overlay - local static=/mnt/livecd + overlay=/mnt/overlay + static=/mnt/livecd for i in ${overlay} ${static}; do [ ! -d ${i} ] mkdir -p ${i} @@ -1381,12 +1380,6 @@ setup_squashfs_aufs() { [ ! -d ${NEW_ROOT}${overlay} ] mkdir -p ${NEW_ROOT}${overlay} [ ! -d ${NEW_ROOT}${static} ] mkdir -p ${NEW_ROOT}${static} for i in ${overlay} ${static}; do mount --move ${i} ${NEW_ROOT}${i}; done - - # have handy /mnt/cdrom (CDROOT_PATH) as well - local new_cdroot=${NEW_ROOT}${CDROOT_PATH} - [ ! -d ${new_cdroot} ] mkdir -p ${new_cdroot} - mount --bind ${CDROOT_PATH} ${new_cdroot} - ) } setup_unionfs() { diff --git a/defaults/linuxrc b/defaults/linuxrc index d5b424c..0a91c58 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -995,7 +995,7 @@ then mkdir -p /${CHROOT}/.unions/memory mount -o move /memory /${CHROOT}/.unions/memory test_success Failed to move aufs /memory into the system root -for i in mnt/gentoo mnt/livecd ${CDROOT_PATH} +for i in mnt/gentoo mnt/livecd /mnt/overlay ${CDROOT_PATH} do mkdir -p ${CHROOT}/$i chmod 755 ${CHROOT}/$i @@ -1012,8 +1012,9 @@ then warn_msg ${str}are mounted in ram warn_msg consider saving important files elsewhere... read -t 3 UNUSEDVAL - mount --bind ${NEW_ROOT}${CDROOT_PATH} ${CHROOT}${CDROOT_PATH} - mount --bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd +for i in ${CDROOT_PATH} ${overlay} ${static}; do +mount --move ${NEW_ROOT}${i} ${CHROOT}${i} +done fi good_msg Booting (initramfs)
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: c7ae28126edd1fcf2144e93a6c73f7b07bd79c48 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Wed Jun 25 16:12:11 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu Jun 26 14:03:37 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c7ae2812 More coding style changes to two of the union_* functions. LC_COLLATE=C is introduced to allow globbing since we never want to parse ls. Introduced a helper function for union_insert_modules as well. --- defaults/initrd.defaults | 2 ++ defaults/initrd.scripts | 44 +--- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 67b0d28..93a40dd 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -12,6 +12,8 @@ BAD=\033[31;1m BOLD=\033[1m GOOD=\033[32;1m +# Sets the default collation order +LC_COLLATE=C # From KNOPPIX LINUXRC # Reset fb color mode RESET=]R diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index d87bb4e..3411c18 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -287,27 +287,41 @@ mount_sysfs() { # union_insert_dir() { # Always mount it over the precedent (add:1:) - mount -n -o remount,add:1:${2}=rr aufs ${1} - if [ $? = '0' ] - then - good_msg Addition of ${2} to ${1} successful + if mount -n -o remount,add:1:$2=rr aufs $1; then +good_msg Addition of $2 to $1 successful fi } # Insert all modules found in $1, usually ${CDROOT_PATH} # added to allow users to add their own apps. union_insert_modules() { - for module in $(ls ${NEW_ROOT}/${1}/modules/*.mo 2/dev/null| sort) - do - mkdir -p ${MEMORY}/modules/$(basename ${module} .mo) - union_insert_dir $UNION ${MEMORY}/modules/$(basename ${module} .mo) - done - for module in $(ls ${NEW_ROOT}/${1}/modules/*.lzm 2/dev/null| sort) - do - mkdir -p ${MEMORY}/modules/$(basename ${module} .lzm) - mount -o loop,ro ${module} ${MEMORY}/modules/$(basename ${module} .lzm) - union_insert_dir $UNION ${MEMORY}/modules/$(basename ${module} .lzm) - done +local module + +for module in $NEW_ROOT/$1/modules/*.mo; do +union_mod $module || bad_msg Unable to load module: '$module' +done + +for module in $NEW_ROOT/$1/modules/*.lzm; do +union_mod $module lzm || bad_msg Unable to load module: '$module' +done +} + +# Helper function for union_insert_modules() +union_mod() { +[ -e $1 ] || return 0 + +local mod + +mod=${1##*/} +mod=${mod%.*} + +mkdir -p $MEMORY/modules/$mod || return + +if [ lzm = $2 ]; then + mount -o loop,ro $1 $MEMORY/modules/$mod +fi + +union_insert_dir $UNION $MEMORY/modules/$mod } # Implements RC_NO_UMOUNTS variable into ${CHROOT}/etc/rc.conf for a cleaner shutdown process
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: fb87499d4a6ac506c9bb5af2f51461c860a05111 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:06:42 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=fb87499d Output cleaning --- defaults/initrd.scripts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 2fdfb4b..1c9 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -335,7 +335,7 @@ setup_aufs() { else CHANGESDEV=${AUFS} good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support - mount -t auto ${CHANGESDEV} ${CHANGESMNT} + mount -t auto ${CHANGESDEV} ${CHANGESMNT} /dev/null ret=$? if [ ${ret} -ne 0 ] then @@ -383,7 +383,7 @@ setup_aufs() { # empty or we were not able to mount the storage device if [ ${CDROOT} -eq '1' -a ! -f ${CHANGESMNT}/${AUFS_CHANGESFILE} ] then - umount ${MEMORY} + umount ${MEMORY} /dev/null bad_msg failed to find ${AUFS_CHANGESFILE} file on ${CHANGESDEV} bad_msg create an ext2 ${AUFS_CHANGESFILE} file on this device if you wish to use it for aufs bad_msg falling back to ramdisk based aufs for safety
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 2ee2cc3de904200d4e80fa61ef657a5717ab06f5 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Wed Jun 25 16:12:11 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Sun Jun 29 21:07:22 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=2ee2cc3d This is commit contains several changes summarized below. 1. Changed renaming of RC_NO_UMOUNTS directories 2. Upper to lowercase variables because this is the year 2014 3. Renamed aufs related variables for better readability 4. Fixed a typo in mke2fs command which was missing an 5. Cleaned up setup_squashfs_aufs() function 6. Fixed an issue with legacy squashfs implementation which caused /mnt/cdrom to be shown twice in 'mount' and removed the --bind and replaced this with --move 7. Restructured the union_* functions so that we don't parse 'ls' and enabled globbing 8. Coding style changes - rid of the unnecessary braces - fix a missing for mke2fs on livecd.aufs - renamed variables for more readabilit 9. Better error handling for changesfs() 10. Removed aufs.persistent since 'aufs' already mounts a tmpfs which uses half the available ram, and since this feature is not true persistent we remove it in favor of aufs=DEV --- defaults/initrd.defaults | 10 +-- defaults/initrd.scripts | 208 --- defaults/linuxrc | 151 +- 3 files changed, 185 insertions(+), 184 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 67b0d28..94b45cc 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -12,6 +12,8 @@ BAD=\033[31;1m BOLD=\033[1m GOOD=\033[32;1m +# Sets the default collation order +LC_COLLATE=C # From KNOPPIX LINUXRC # Reset fb color mode RESET=]R @@ -58,7 +60,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' -RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/rw_branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino +RC_NO_UMOUNTS='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' @@ -68,10 +70,8 @@ CDROOT_PATH='/mnt/cdrom' CDROOT_MARKER='/livecd' # AUFS variables -USE_AUFS_NORMAL=0 -AUFS_MODULES=false -AUFS_CHANGES=false -AUFS_CHANGESFILE=/livecd.aufs +aufs=0 +aufs_union_file=/livecd.aufs LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index d87bb4e..8a3d93e 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -178,20 +178,20 @@ devicelist(){ } bootstrapFS() { -if [ ${USE_AUFS_NORMAL} -eq '1' ]; then -# Directories used for rw changes in union mount filesystem -UNION=/union MEMORY=/memory +if [ 1 = $aufs ]; then +# Directories used for rw aufs mount filesystem +aufs_union=/union aufs_memory=/memory -# Mountpoint for the changesdev -CHANGESMNT=${NEW_ROOT}/mnt/changesdev +# Mountpoint for the aufs dev +aufs_dev_mnt=/mnt/aufs-dev -if [ -z $UID ]; then -CHANGES=${MEMORY}/aufs_changes/default +if [ -z $aufs_dev_uid ]; then +aufs_branch=$aufs_memory/aufs-branch/default else -CHANGES=${MEMORY}/aufs_changes/${UID} +aufs_branch=$aufs_memory/aufs-branch/$aufs_dev_uid fi -mkdir -p ${MEMORY} ${UNION} ${CHANGESMNT} +mkdir -p $aufs_memory $aufs_union $aufs_dev_mnt else # Legacy SquashFS implementation good_msg Making tmpfs for ${NEW_ROOT} @@ -280,37 +280,51 @@ mount_sysfs() { [ ${ret} -eq 0 ] || bad_msg Failed to mount /sys! } -# Insert a directory tree ${2} to an union specified by ${1} +# Insert a directory tree $2 to an union specified by $1 # Top-level read-write branch is specified by it's index 0 -# ${1} = union absolute path (starting with /) -# ${2} = path to data directory +# $1 = union absolute path (starting with /) +# $2 = path to data directory # union_insert_dir() { # Always mount it over the precedent (add:1:) - mount -n -o remount,add:1:${2}=rr aufs ${1} - if [ $? = '0' ] - then - good_msg Addition of ${2} to ${1} successful + if mount -n -o remount,add:1:$2=rr aufs $1; then +good_msg Addition of $2 to $1 successful fi } -# Insert all modules found in $1, usually ${CDROOT_PATH} +# Insert all modules found in $1, usually $CDROOT_PATH # added to allow users to add their own apps. union_insert_modules() { - for module in $(ls ${NEW_ROOT}/${1}/modules/*.mo 2/dev/null| sort) - do -
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 76f73d0380d01c4b2ee3474e0c09bb32c09f2211 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 01:03:37 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=76f73d03 Cleanup dd output from changes file creation --- defaults/initrd.scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index aded9ad..c5764f3 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -280,7 +280,7 @@ create_changefs() { then bad_msg Please give a size of at least 16 Mb else - dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} + dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} /dev/null if [ $? = '0' ] then good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 9385ede320e2b9cb6f6c86fa934516a03cf2ac37 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu May 29 02:40:18 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=9385ede3 This fixes /etc/fstab from not working while in setup_aufs function and instead includes it in the union path. --- defaults/initrd.scripts | 1 - defaults/linuxrc| 4 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index dd3af37..bf4124f 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1380,7 +1380,6 @@ setup_squashfs_aufs() { [ ! -d ${NEW_ROOT}${overlay} ] mkdir -p ${NEW_ROOT}${overlay} [ ! -d ${NEW_ROOT}${static} ] mkdir -p ${NEW_ROOT}${static} - echo aufs / aufs defaults 0 0 ${NEW_ROOT}/etc/fstab for i in ${overlay} ${static}; do mount --move ${i} ${NEW_ROOT}${i}; done # have handy /mnt/cdrom (CDROOT_PATH) as well diff --git a/defaults/linuxrc b/defaults/linuxrc index 6d942a1..d5b424c 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -820,6 +820,10 @@ memory|/.unions/memory/xino' ${UNION}/etc/rc.conf) /newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|\ /.unions/memory|/.unions/memory/xino\ ${UNION}/etc/rc.conf +# Fstab change for aufs +test ! $(grep aufs ${UNION}/etc/fstab) +echo aufs / aufs defaults 0 0 ${UNION}/etc/fstab + warn_msg Adding all modules in $MODULESD/modules/ if [ -z ${MODULESD} ] then
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 0e4c288f2435fca36705a6ea95f48edccefc6e26 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Jun 23 20:03:36 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=0e4c288f Introduced a new funtion to test for numeric values that that our changes_fs doesn't fail when non-numeric values are given, also the styling of changes_fs was changed to reflect new logic. --- defaults/initrd.scripts | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 5ca1203..26ed173 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -345,6 +345,18 @@ conf_rc_no_umounts() { fi } +# is_int $A [$B..] +# NOTE we consider a leading 0 false as it would be interpreted as octal +is_int(){ +local i +for i; do +case $i in +''|*[!0-9]*|0?*) return 1 ;; +*) : +esac +done +} + # Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint create_changefs() { local size @@ -352,11 +364,12 @@ create_changefs() { while :; do read -p ' Size of file (Press Enter for default 256 Mb): ' size -[ -n $size ] || size=256 - -size=$size +size=${size:-256} -if [ 15 -ge $size ]; then +if ! is_int $size; then +bad_msg Non numeric value given for size, try again +continue +elif [ 15 -ge $size ]; then bad_msg Please give a size of at least 16 Megabytes else if dd if=/dev/zero of=$CHANGESMNT$AUFS_CHANGESFILE bs=1M count=$size /dev/null; then
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 1409c54c01d3044be5d79697b2de14037cc0496a Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Wed Jun 4 23:04:30 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=1409c54c This introduces changes to former commits d8e2d4d 720a60f in which there are fstab changes and tmpfs mounts which are combined into one /etc/fstab instead. --- defaults/linuxrc | 32 +--- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index a6c4806..8b3ff87 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -794,9 +794,19 @@ then # Function to handle the RC_NO_UMOUNTS variable in ${CHROOT}/etc/rc.conf conf_rc_no_umounts -# Fstab change for aufs -test ! $(grep -o ^aufs ${CHROOT}/etc/fstab) -echo aufs / aufs defaults 0 0 ${CHROOT}/etc/fstab +# Fstab changes for aufs +if ! grep -q '^aufs' ${CHROOT}/etc/fstab 2/dev/null; then +for i in /var/tmp /tmp /usr/portage/distfiles; do +[ ! -d ${CHROOT}${i} ] mkdir -p ${CHROOT}${i} +done + +cat ${CHROOT}/etc/fstab FSTAB +aufs/ aufsdefaults0 0 +vartmp /var/tmptmpfs defaults0 0 +tmp /tmptmpfs defaults0 0 +distfiles /usr/portage/distfiles tmpfs defaults0 0 +FSTAB +fi if ${AUFS_MODULES}; then warn_msg Adding all modules in $MODULESD/modules/ @@ -990,22 +1000,6 @@ then chmod 755 ${CHROOT}${i} done - # This will prevent from putting junk on the CHANGESDEV - str= - for i in /tmp /var/tmp /usr/portage/distfiles - do - mkdir -p ${CHROOT}${i} - chmod 755 ${CHROOT}${i} - - mount -t tmpfs tmpfs ${CHROOT}${i} - str=${i} ${str} - done - - warn_msg ${str}are mounted in ram - warn_msg consider saving important files elsewhere - -sleep 2 - for i in ${CDROOT_PATH} ${overlay} ${static}; do mount --move ${NEW_ROOT}${i} ${CHROOT}${i} done
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 3ea3c267cd3b05c68b508f28b00efa5116850c09 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu Jul 10 01:53:07 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu Jul 31 19:19:33 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=3ea3c267 Changed to the dd command which creates the livecd.aufs image for the aufs writable branch to make the process faster we create a sparse file. Added a check for a block device so that we don't try mounting the aufs device some small comestic changes. --- defaults/initrd.scripts | 33 ++--- defaults/linuxrc| 3 ++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 8a3d93e..5a01986 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -376,7 +376,7 @@ create_changefs() { local size while :; do - read -p ' Size of file (Press Enter for default 256 Mb): ' size + read -p ' Size of file (Press Enter for default 256 MB): ' size size=${size:-256} @@ -386,13 +386,13 @@ create_changefs() { elif [ 15 -ge $size ]; then bad_msg Please give a size of at least 16 Megabytes else - if dd if=/dev/zero of=$aufs_dev_mnt$aufs_union_file bs=1M count=$size /dev/null; then - good_msg Creation of $aufs_union_file, ${size}Mb on $aufs_dev successful, formatting it ext2 + if dd if=/dev/zero of=$aufs_dev_mnt$aufs_union_file bs=1 seek=$sizeM count=0 /dev/null; then + good_msg Creation of $aufs_union_file, ${size}MB on $aufs_dev successful, formatting it ext2 mke2fs -F $aufs_dev_mnt$aufs_union_file /dev/null break else rm $aufs_dev_mnt$aufs_union_file - bad_msg Unable to create ${aufs_union_file#*/} on $aufs_dev of ${size}Mb + bad_msg Unable to create ${aufs_union_file#*/} on $aufs_dev of ${size}MB bad_msg Ensure your disk is not full or read-only read -p ' Type a to abort, anything else to continue : ' doabort @@ -410,13 +410,19 @@ create_changefs() { setup_aufs() { bootstrapCD - if [ -n $aufs_dev ]; then -good_msg Mounting $aufs_dev to $aufs_memory for aufs support +if [ -n $aufs_dev ]; then +if [ ! -b $aufs_dev ]; then +bad_msg $aufs_dev is not a valid block device +local invalidblk=1 +unset aufs_dev +else +good_msg Mounting $aufs_dev to $aufs_memory for aufs support - if ! mount -t auto $aufs_dev $aufs_dev_mnt /dev/null; then - bad_msg Mount of $aufs_dev failed, falling back to ramdisk based aufs - unset aufs_dev - fi +if ! mount -t auto $aufs_dev $aufs_dev_mnt /dev/null; then +bad_msg Mount of $aufs_dev failed, falling back to ramdisk based aufs +unset aufs_dev + fi +fi # Check and attempt to create the AUFS union file if [ ! -e $aufs_dev_mnt$aufs_union_file ] [ -n $aufs_dev ]; then @@ -455,7 +461,12 @@ setup_aufs() { aufs_xino=$aufs_memory umount $aufs_memory /dev/null -bad_msg Create an extfs ${aufs_union_file#*/} file on this device +if [ 1 = $invalidblk ]; then +bad_msg Verify that you've entered a valid device path +else +bad_msg Create an extfs ${aufs_union_file#*/} file on this device +fi + bad_msg if you wish to have aufs data persistency on reboots bad_msg Falling back to ramdisk based aufs good_msg Mounting ramdisk to $aufs_memory for aufs support diff --git a/defaults/linuxrc b/defaults/linuxrc index 276f150..3098866 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -786,6 +786,7 @@ distfiles /usr/portage/distfiles tmpfs defaults0 0 FSTAB fi +# When aufs.modules= is used if [ 1 = $aufs_modules ]; then warn_msg Adding all modules in $aufs_modules_dev/modules/ @@ -804,7 +805,7 @@ FSTAB cp /etc/sysconfig/keyboard $CHROOT/etc/sysconfig/
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 09dbf42096df79e6c0d9ba61972122f9ea0fbaca Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:02:30 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=09dbf420 Restructure the setup_aufs function, it had redundant code and moved the call to it further down the pipe. --- defaults/initrd.scripts | 181 +++- defaults/linuxrc| 2 +- 2 files changed, 89 insertions(+), 94 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index c5764f3..2fdfb4b 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -302,115 +302,110 @@ create_changefs() { } setup_aufs() { - if [ ${USE_AUFS_NORMAL} -eq '1' ] +# Directory used for rw changes in union mount filesystem + UNION=/union + MEMORY=/memory + # Mountpoint for the changesdev + CHANGESMNT=${NEW_ROOT}/mnt/changesdev + if [ -z $UID ] then - # Directory used for rw changes in union mount filesystem - UNION=/union - MEMORY=/memory - # Mountpoint for the changesdev - CHANGESMNT=${NEW_ROOT}/mnt/changesdev - if [ -z $UID ] - then - CHANGES=${MEMORY}/aufs_changes/default - else - CHANGES=${MEMORY}/aufs_changes/${UID} - fi + CHANGES=${MEMORY}/aufs_changes/default + else + CHANGES=${MEMORY}/aufs_changes/${UID} + fi - mkdir -p ${MEMORY} - mkdir -p ${UNION} - mkdir -p ${CHANGESMNT} - for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p ${NEW_ROOT}/${i} - chmod 755 ${NEW_ROOT}/${i} - done - [ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 - [ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 + mkdir -p ${MEMORY} + mkdir -p ${UNION} + mkdir -p ${CHANGESMNT} + for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys + do + mkdir -p ${NEW_ROOT}/${i} + chmod 755 ${NEW_ROOT}/${i} + done + [ ! -e ${NEW_ROOT}/dev/null ] mknod ${NEW_ROOT}/dev/null c 1 3 + [ ! -e ${NEW_ROOT}/dev/console ] mknod ${NEW_ROOT}/dev/console c 5 1 - bootstrapCD - if [ -n ${AUFS} ] + bootstrapCD + if [ -n ${AUFS} ] + then + if [ ${AUFS} = detect ] then - if [ ${AUFS} = detect ] + CHANGESMNT=${NEW_ROOT}${CDROOT_PATH} + CHANGESDEV=${REAL_ROOT} + else + CHANGESDEV=${AUFS} + good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support + mount -t auto ${CHANGESDEV} ${CHANGESMNT} + ret=$? + if [ ${ret} -ne 0 ] then - CHANGESMNT=${NEW_ROOT}${CDROOT_PATH} - CHANGESDEV=${REAL_ROOT} - else - CHANGESDEV=${AUFS} - good_msg mounting ${CHANGESDEV} to ${MEMORY} for aufs support - mount -t auto ${CHANGESDEV} ${CHANGESMNT} + bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs + unset AUFS + fi + fi + # Check and attempt to create the changesfile + if [ ! -e ${CHANGESMNT}/${AUFS_CHANGESFILE} ] [ -n ${AUFS} ] + then + create_changefs + mount -t auto ${CHANGESMNT}/${AUFS_CHANGESFILE} ${MEMORY} + elif [ -n ${AUFS} ] + then + local nbpass=0 + while [ 1 ] + do + mount -t auto ${CHANGESMNT}/${AUFS_CHANGESFILE} ${MEMORY} ret=$? if [ ${ret} -ne 0 ] then - bad_msg mount of ${CHANGESDEV} failed, falling back to ramdisk based aufs - unset AUFS - fi - fi - # Check and attempt to create the changesfile - if [ ! -e ${CHANGESMNT}/${AUFS_CHANGESFILE} ] [ -n ${AUFS} ] - then -
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 9c70e584e246785beabdbcff5407c9f1ac388ff6 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:57:13 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=9c70e584 coding style changes --- defaults/linuxrc | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 281de8e..42749d6 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -1014,26 +1014,34 @@ verbose_kmsg if [ ${USE_AUFS_NORMAL} -eq '1' ] then - mkdir -p /${CHROOT}/.unions/memory - mount -o move /memory /${CHROOT}/.unions/memory +UNION_MEMORY=${CHROOT}/.unions/memory + + mkdir -p ${UNION_MEMORY} + mount --move ${MEMORY} ${UNION_MEMORY} test_success Failed to move aufs /memory into the system root -for i in mnt/gentoo mnt/livecd /mnt/overlay ${CDROOT_PATH} + +for i in /mnt/gentoo /mnt/livecd /mnt/overlay ${CDROOT_PATH} do - mkdir -p ${CHROOT}/$i - chmod 755 ${CHROOT}/$i + mkdir -p ${CHROOT}${i} + chmod 755 ${CHROOT}${i} done + # This will prevent from putting junk on the CHANGESDEV str= - for i in tmp var/tmp usr/portage/distfiles + for i in /tmp /var/tmp /usr/portage/distfiles do - mkdir -p ${CHROOT}/$i - chmod 755 ${CHROOT}/$i - mount -t tmpfs tmpfs ${CHROOT}/$i - str=${str} ${i} + mkdir -p ${CHROOT}${i} + chmod 755 ${CHROOT}${i} + + mount -t tmpfs tmpfs ${CHROOT}${i} + str=${i} ${str} done + warn_msg ${str}are mounted in ram warn_msg consider saving important files elsewhere - read -t 3 UNUSEDVAL + +sleep 2 + for i in ${CDROOT_PATH} ${overlay} ${static}; do mount --move ${NEW_ROOT}${i} ${CHROOT}${i} done
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 993de46b0cc64c9dfca9fd2c56544b5c0b7b8325 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Tue Jun 3 00:46:43 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=993de46b dokeymap implementation for AUFS's union --- defaults/linuxrc | 6 ++ 1 file changed, 6 insertions(+) diff --git a/defaults/linuxrc b/defaults/linuxrc index 86b1954..da88bf0 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -868,6 +868,12 @@ then fi fi +# Copy user keymap file +if [ -e /etc/sysconfig/keyboard ]; then +[ ! -d ${CHROOT}/etc/sysconfig ] mkdir -p ${CHROOT}/etc/sysconfig +cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/ +fi + # Create the directories for our new union mounts test ! -d ${CHROOT}${NEW_ROOT} mkdir -p ${CHROOT}${NEW_ROOT}
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: c33f10738a4880cd6d9cf2048df4809eaf04b19a Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Sun Aug 17 00:18:36 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Sun Aug 17 00:18:36 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c33f1073 restructure no_umounts from being set in /etc/rc.conf to /etc/conf.d/localmount --- defaults/initrd.defaults | 2 +- defaults/initrd.scripts | 15 +++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 818e3b1..7e4803a 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -60,7 +60,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' -RC_NO_UMOUNTS='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' +no_umounts='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 7d9497d..7b8e52f 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -323,13 +323,12 @@ union_mod() { union_insert_dir $aufs_union $aufs_union/mnt/modules/$mod } -# Implements RC_NO_UMOUNTS variable into $CHROOT/etc/rc.conf for a cleaner shutdown process -# This should really go into /etc/init.d/localmounts but until then we manually set this here +# Implements no_umounts variable into $CHROOT/etc/conf.d/localmount for a cleaner shutdown process conf_rc_no_umounts() { local conf nomount fnd -conf=$CHROOT/etc/rc.conf fnd=0 +conf=$CHROOT/etc/conf.d/localmount fnd=0 -if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then +if nomount=$(grep -n '^[[:blank:]]*no_umounts=' $conf); then local i n data cmd IFS IFS=' ' @@ -341,20 +340,20 @@ conf_rc_no_umounts() { data=${i#*=} case $data in -\$RC_NO_UMOUNTS\|'$RC_NO_UMOUNTS') fnd=1;; +\$no_umounts\|'$no_umounts') fnd=1;; *) cmd=$cmd$n d; esac done if [ -n $cmd ]; then sed -i ${cmd%;} $conf -test_success Unable to edit rc.conf +test_success Unable to edit /etc/conf.d/localmount fi fi if [ 0 -eq $fnd ]; then -printf 'RC_NO_UMOUNTS=%s\n' $RC_NO_UMOUNTS $conf -test_success Unable to write to rc.conf +printf 'no_umounts=%s\n' $no_umounts $conf +test_success Unable to write to /etc/conf.d/localmount fi }
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 4de1a998da8b1d67a28c878085d6a7441566b95c Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Fri May 30 02:46:09 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=4de1a998 Better handle on if aufs.modules kernel parameter is used --- defaults/initrd.defaults | 1 + defaults/linuxrc | 22 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 1f28883..1e1a539 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -68,6 +68,7 @@ CDROOT_PATH='/mnt/cdrom' CDROOT_MARKER='/livecd' # AUFS variables +AUFS_MODULES=false AUFS_CHANGES=false AUFS_CHANGESFILE=livecd.aufs diff --git a/defaults/linuxrc b/defaults/linuxrc index 009b4c4..281de8e 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -284,6 +284,7 @@ do # Allow user to specify the modules location aufs.modules\=*) MODULESD=${x#*=} +AUFS_MODULES=true ;; unionfs) if [ ! -x /sbin/unionfs ] @@ -839,15 +840,18 @@ then test ! $(grep -o ^aufs ${CHROOT}/etc/fstab) echo aufs / aufs defaults 0 0 ${CHROOT}/etc/fstab - warn_msg Adding all modules in $MODULESD/modules/ - if [ -z ${MODULESD} ] - then - union_insert_modules ${CDROOT_PATH} - else - mkdir ${NEW_ROOT}/mnt/modulesd - mount ${MODULESD} ${NEW_ROOT}/mnt/modulesd - union_insert_modules ${NEW_ROOT}/mnt/modulesd - fi +if ${AUFS_MODULES}; then +warn_msg Adding all modules in $MODULESD/modules/ + +if [ -z ${MODULESD} ] +then + union_insert_modules ${CDROOT_PATH} + else + mkdir ${NEW_ROOT}/mnt/modulesd + mount ${MODULESD} ${NEW_ROOT}/mnt/modulesd + union_insert_modules ${NEW_ROOT}/mnt/modulesd +fi +fi # Create the directories for our new union mounts test ! -d ${CHROOT}${NEW_ROOT} mkdir -p ${CHROOT}${NEW_ROOT}
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 5d4766cd1b811a525f5b624fc1e8daf1207acac0 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Mon Jun 23 17:58:33 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Mon Jun 23 23:11:15 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=5d4766cd Coding style changes throughout all the AUFS related code. --- defaults/initrd.defaults | 4 +- defaults/initrd.scripts | 179 ++--- defaults/linuxrc | 227 +-- 3 files changed, 188 insertions(+), 222 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index d0efa28..67b0d28 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -58,7 +58,7 @@ KSUFF='.ko' REAL_ROOT='' CONSOLE='/dev/console' NEW_ROOT='/newroot' -RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino +RC_NO_UMOUNTS=/newroot|/newroot/mnt/changesdev|/mnt/rw_branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' @@ -71,7 +71,7 @@ CDROOT_MARKER='/livecd' USE_AUFS_NORMAL=0 AUFS_MODULES=false AUFS_CHANGES=false -AUFS_CHANGESFILE=livecd.aufs +AUFS_CHANGESFILE=/livecd.aufs LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 52b18b3..5ca1203 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -314,8 +314,7 @@ union_insert_modules() { # This should really go into /etc/init.d/localmounts but until then we manually set this here conf_rc_no_umounts() { local conf nomount fnd -conf=${CHROOT}/etc/rc.conf -fnd=0 +conf=$CHROOT/etc/rc.conf fnd=0 if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then local i n data cmd IFS @@ -350,33 +349,28 @@ conf_rc_no_umounts() { create_changefs() { local size - while [ 1 ] - do + while :; do read -p ' Size of file (Press Enter for default 256 Mb): ' size - if [ -z ${size} ]; then - size=256 - fi - size=${size} -if [ ${size} -lt 16 ] - then - bad_msg Please give a size of at least 16 Mb +[ -n $size ] || size=256 + +size=$size + +if [ 15 -ge $size ]; then +bad_msg Please give a size of at least 16 Megabytes else - dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} /dev/null - if [ $? = '0' ] - then - good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2 - mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} /dev/null + if dd if=/dev/zero of=$CHANGESMNT$AUFS_CHANGESFILE bs=1M count=$size /dev/null; then + good_msg Creation of $AUFS_CHANGESFILE, ${size}Mb on $CHANGESDEV successful, formatting it ext2 + mke2fs -F $CHANGESMNT$AUFS_CHANGESFILE /dev/null AUFS_CHANGES=true break else - rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE} - bad_msg Unable to create ${AUFS_CHANGESFILE} on ${CHANGESDEV} of ${size} Mb + rm -f $CHANGESMNT$AUFS_CHANGESFILE + bad_msg Unable to create ${AUFS_CHANGESFILE#*/} on $CHANGESDEV of ${size}Mb bad_msg Ensure your disk is not full or read-only + read -p ' Type a to abort, anything else to continue : ' doabort - if [ ${doabort} = a ]; then - return 1 - fi + if [ a = $doabort ]; then return 1; fi fi fi done @@ -386,87 +380,80 @@ create_changefs() { setup_aufs() { bootstrapCD - if [ -n ${AUFS} ] - then - if [ ${AUFS} = detect ] - then - CHANGESMNT=${NEW_ROOT}${CDROOT_PATH} - CHANGESDEV=${REAL_ROOT} + if [ -n $AUFS ]; then + if [ detect = $AUFS ]; then + CHANGESMNT=$NEW_ROOT$CDROOT_PATH + CHANGESDEV=$REAL_ROOT else - CHANGESDEV=${AUFS} - good_msg Mounting ${CHANGESDEV} to ${MEMORY} for aufs support - mount -t auto
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 4f5ea0f2e9767728001f5f84eb5afbcb814d0818 Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Fri Sep 5 16:11:48 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Fri Sep 5 16:11:48 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=4f5ea0f2 change default aufs branch naming likewhoa didn't like my default naming, and I don't like his, so we compromised on aufs-rw-branch so no one is happy :-) --- defaults/initrd.scripts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 7b8e52f..a834ed2 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -186,9 +186,9 @@ bootstrapFS() { aufs_dev_mnt=/mnt/aufs-dev if [ -z $aufs_dev_uid ]; then -aufs_branch=$aufs_memory/aufs-branch/default +aufs_branch=$aufs_memory/aufs-rw-branch/default else -aufs_branch=$aufs_memory/aufs-branch/$aufs_dev_uid +aufs_branch=$aufs_memory/aufs-rw-branch/$aufs_dev_uid fi mkdir -p $aufs_memory $aufs_union $aufs_dev_mnt
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 2771684e276559e5c8846262a6d89df74ed0671b Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu May 22 20:52:30 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 20:57:14 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=2771684e Fix kernel line argument handling. Fix kernel line argument handling since it's using old deprecated function. --- defaults/linuxrc | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index aaf27ad..8620352 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -255,35 +255,35 @@ do ;; aufs\=*) USE_AUFS_NORMAL=1 - CMD_AUFS=$(parse_opt ${x}) - echo ${CMD_AUFS}|grep , /dev/null 21 + echo ${x#*=} | grep , /dev/null + if [ $? -eq '0' ] then - UID=$(echo ${CMD_AUFS#*,}) - AUFS=$(echo ${CMD_AUFS%,*}) + UID=${x#*,} + AUFS=${x%,*} else - AUFS=${CMD_AUFS} + AUFS=${x#*=} fi ;; aufs.changes\=*) - USE_AUFS_NORMAL=1 - CMD_AUFS=$(parse_opt ${x}) - echo ${CMD_AUFS}|grep , /dev/null 21 - if [ $? -eq '0' ] - then - UID=$(echo ${CMD_AUFS#*,}) - AUFS=$(echo ${CMD_AUFS%,*}) - else - AUFS=${CMD_AUFS} - fi - ;; +USE_AUFS_NORMAL=1 +echo ${x#*=} | grep , /dev/null + +if [ $? -eq '0' ] +then +UID=${x#*,} +AUFS=${x%,*} +else +AUFS=${x#*=} +fi +;; aufs.persistent) USE_AUFS_NORMAL=1 AUFS=detect ;; # Allow user to specify the modules location aufs.modules\=*) - MODULESD=$(parse_opt ${x}) + MODULESD=${x#*=} ;; unionfs) if [ ! -x /sbin/unionfs ]
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 476ad3514fd5571bafbc233dc23ce8688067447a Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Thu May 22 21:11:10 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 21:11:10 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=476ad351 remove pointless changes size warning a check has been added rendering this warning obsolete --- defaults/initrd.scripts | 1 - 1 file changed, 1 deletion(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 57dc2cb..e81e5f2 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -289,7 +289,6 @@ create_changefs() { else rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE} bad_msg Unable to create ${AUFS_CHANGESFILE} on ${CHANGESDEV} of ${size} Mb - bad_msg Please give a size of at least 16 Mb bad_msg Ensure your disk is not full or read-only read -p ' Type a to abort, anything else to continue : ' doabort if [ ${doabort} = a ]; then
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 0c5afac7e01272f864a5e1b53f4796dd624da636 Author: Fernando Reyes (likewhoa) design AT missionaccomplish DOT com AuthorDate: Thu May 22 21:10:12 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 21:10:12 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=0c5afac7 Removing use of 'let' and cleaner output of dd command, plus minor cosmetic --- defaults/initrd.scripts | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 6b31095..57dc2cb 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -267,14 +267,16 @@ union_insert_modules() { # Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint create_changefs() { local size + while [ 1 ] do - read -p ' Size of file (Enter for default 256 Mb): ' size + read -p ' Size of file (Press Enter for default 256 Mb): ' size if [ -z ${size} ]; then - let size=256 + size=256 fi - let size=${size} - if [ ${size} -lt 16 ] + size=${size} + +if [ ${size} -lt 16 ] then bad_msg Please give a size of at least 16 Mb else @@ -282,13 +284,13 @@ create_changefs() { if [ $? = '0' ] then good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2 - mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} + mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} /dev/null break else rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE} bad_msg Unable to create ${AUFS_CHANGESFILE} on ${CHANGESDEV} of ${size} Mb bad_msg Please give a size of at least 16 Mb - bad_msg Also check if your disk is full or read-only ? + bad_msg Ensure your disk is not full or read-only read -p ' Type a to abort, anything else to continue : ' doabort if [ ${doabort} = a ]; then return 1
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: c7abfb38a783e2cbfa8ccfe01fc7f257c19bca3c Author: Robin H. Johnson robbat2 AT gentoo DOT org AuthorDate: Mon Mar 17 19:38:09 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 20:05:35 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c7abfb38 Document the very large if structure for AUFS. Signed-off-by: Robin H. Johnson robbat2 AT gentoo.org --- defaults/linuxrc | 35 ++- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index b4ce21d..aaf27ad 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -733,7 +733,7 @@ then test_success 'Mount filesystem' FS_LOCATION='mnt/livecd' # Setup the loopback mounts, if unencrypted - else + else # if [ -n ${CRYPT_ROOT} ] if [ ${LOOPTYPE} = 'normal' ] then good_msg 'Mounting loop filesystem' @@ -801,13 +801,14 @@ then test_success 'mount /dev/loop0 /' FS_LOCATION='mnt/livecd' fi - fi + fi # if [ -n ${CRYPT_ROOT} ] if [ ${USE_AUFS_NORMAL} -eq '1' ] then union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on aufs dirs. + # TODO: remounting all tmpfs as RO seems weird, can we be more specific? sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab /${UNION}/etc/fstab.new mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab warn_msg Adding all modules in $MODULESD/modules/ @@ -843,7 +844,7 @@ then setup_unionfs ${NEW_ROOT} /${FS_LOCATION} CHROOT=/union else - #XXX Note to potential reviewers. diff formats this section very very oddly. Be sure to review this hunk after applied, do NOT simply read the diff + #XXX Note to potential reviewers. diff formats this section very very oddly. Be sure to review this hunk after applied, do NOT simply read the diff if [ ! ${USE_AUFS_NORMAL} -eq '1' ] then good_msg Copying read-write image contents to tmpfs @@ -887,22 +888,22 @@ then # It does not exist, make a link to the livecd ln -s /${FS_LOCATION}/${directory} ${directory} 2/dev/null current_parent=${directory} - fi - done - fi - done + fi # if [ -e /${NEW_ROOT}/${directory} ] ... else + done # while read directory + fi # if [ -L ${NEW_ROOT}/${FS_LOCATION}/${x} ] ... else + done # for x in ${ROOT_LINKS} mkdir -p initramfs proc tmp run sys 2/dev/null chmod 1777 tmp - fi - #XXX: end extremely confusing hunk + fi # if [ ! ${USE_AUFS_NORMAL} -eq '1' ] + #XXX: end extremely confusing hunk - # have handy /mnt/cdrom (CDROOT_PATH) as well - _new_cdroot=${NEW_ROOT}${CDROOT_PATH} - [ ! -d ${_new_cdroot} ] mkdir -p ${_new_cdroot} - mount --bind ${CDROOT_PATH} ${_new_cdroot} + # have handy /mnt/cdrom (CDROOT_PATH) as well + _new_cdroot=${NEW_ROOT}${CDROOT_PATH} + [ ! -d ${_new_cdroot} ] mkdir -p ${_new_cdroot} + mount --bind ${CDROOT_PATH} ${_new_cdroot} - fi + fi # if [ ${USE_UNIONFS_NORMAL} = '1' ] ... else #UML=$(cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||') #if [ ${UML} = 'UML' ] @@ -914,7 +915,7 @@ then # Let Init scripts know that we booted from CD export CDBOOT CDBOOT=1 -else +else # if [ ${CDROOT} = '1' ] if [ ${USE_UNIONFS_NORMAL} = '1' ] then mkdir /union_changes @@ -928,7 +929,7 @@ else mkdir -p ${UNION}/tmp/.initrd fi -fi +fi # if [ ${CDROOT} = '1' ] # Mount the additional things as required by udev systemd if [ -f ${NEW_ROOT}/etc/initramfs.mounts ]; then @@ -959,7 +960,7 @@ for fs in $fslist; do if ! $cmd; then bad_msg Unable to mount $dev for $fs fi -done +done # for fs in $fslist; do # Execute script on the cdrom just before boot to update things if necessary cdupdate
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 6df308a1f51e423d7378147610562459538249ec Author: Rick Farina (Zero_Chaos) zerochaos AT gentoo DOT org AuthorDate: Thu May 9 02:24:51 2013 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 20:03:46 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=6df308a1 Proper AUFS support This patch is what we have been using for the Pentoo LiveCDs for about 5 years with the changes suggested by lxnay merged in. As much as possible has been addressed (with the exception of the man page documentation). Please review this code as the next version will likely be suggested for inclusion (once I write the documentation for the new features). Signed-off-by: Rick Farina (Zero_Chaos) zerochaos AT gentoo.org --- defaults/initrd.defaults | 1 + defaults/initrd.scripts | 180 +++ defaults/linuxrc | 194 ++- 3 files changed, 321 insertions(+), 54 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index cbf18f3..3d6fe7e 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -65,6 +65,7 @@ CDROOT_PATH='/mnt/cdrom' # This is the file that the cdroot will be checked for as a # marker. It must exist RELATIVE to the cdroot. CDROOT_MARKER='/livecd' +AUFS_CHANGESFILE=livecd.aufs LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 5ef5d0b..6b31095 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -234,6 +234,186 @@ mount_sysfs() { [ ${ret} -eq 0 ] || bad_msg Failed to mount /sys! } +# Insert a directory tree ${2} to an union specified by ${1} +# Top-level read-write branch is specified by it's index 0 +# ${1} = union absolute path (starting with /) +# ${2} = path to data directory +# +union_insert_dir() { + # Always mount it over the precedent (add:1:) + mount -n -o remount,add:1:${2}=rr aufs ${1} + if [ $? = '0' ] + then + good_msg Addition of ${2} to ${1} successful + fi +} + +# Insert all modules found in $1, usually ${CDROOT_PATH} +# added to allow users to add their own apps. +union_insert_modules() { + for module in $(ls ${NEW_ROOT}/${1}/modules/*.mo 2/dev/null| sort) + do + mkdir -p ${MEMORY}/modules/$(basename ${module} .mo) + union_insert_dir $UNION ${MEMORY}/modules/$(basename ${module} .mo) + done + for module in $(ls ${NEW_ROOT}/${1}/modules/*.lzm 2/dev/null| sort) + do + mkdir -p ${MEMORY}/modules/$(basename ${module} .lzm) + mount -o loop,ro ${module} ${MEMORY}/modules/$(basename ${module} .lzm) + union_insert_dir $UNION ${MEMORY}/modules/$(basename ${module} .lzm) + done +} + +# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint +create_changefs() { + local size + while [ 1 ] + do + read -p ' Size of file (Enter for default 256 Mb): ' size + if [ -z ${size} ]; then + let size=256 + fi + let size=${size} + if [ ${size} -lt 16 ] + then + bad_msg Please give a size of at least 16 Mb + else + dd if=/dev/zero of=${CHANGESMNT}/${AUFS_CHANGESFILE} bs=1M count=${size} + if [ $? = '0' ] + then + good_msg Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2 + mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} + break + else + rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE} + bad_msg Unable to create ${AUFS_CHANGESFILE} on ${CHANGESDEV} of ${size} Mb + bad_msg Please give a size of at least 16 Mb + bad_msg Also check if your disk is full or read-only ? + read -p ' Type a to abort, anything else to continue : ' doabort + if [ ${doabort} = a ]; then + return 1 + fi + fi + fi + done + return 0 +} + +setup_aufs() { + if [ ${USE_AUFS_NORMAL} -eq '1' ] + then + # Directory used for rw changes in union mount filesystem + UNION=/union + MEMORY=/memory + # Mountpoint for the changesdev + CHANGESMNT=${NEW_ROOT}/mnt/changesdev + if [ -z $UID ] + then + CHANGES=${MEMORY}/aufs_changes/default + else +
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 14205a0732037164dc34e7ff0b34209e2c3f0830 Author: Robin H. Johnson robbat2 AT gentoo DOT org AuthorDate: Mon Mar 17 19:20:40 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 20:05:34 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=14205a07 cleanup: these directories were dropped in the aufs patch. Signed-off-by: Robin H. Johnson robbat2 AT gentoo.org --- defaults/linuxrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index e2e1b6f..8b474aa 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -891,7 +891,7 @@ then done fi done - mkdir initramfs proc tmp sys 2/dev/null + mkdir -p initramfs proc tmp run sys 2/dev/null chmod 1777 tmp fi
[gentoo-commits] proj/genkernel:aufs commit in: defaults/
commit: 3c53f403be48c44608938a85c0502fd1614eace9 Author: Robin H. Johnson robbat2 AT gentoo DOT org AuthorDate: Mon Mar 17 19:32:04 2014 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Thu May 22 20:05:34 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=3c53f403 Refactor tmpfs creation to aufs env. Signed-off-by: Robin H. Johnson robbat2 AT gentoo.org --- defaults/linuxrc | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 8b474aa..b4ce21d 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -976,17 +976,21 @@ if [ ${USE_AUFS_NORMAL} -eq '1' ] then mkdir -p /${CHROOT}/.unions/memory 2/dev/null mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!' - for i in tmp var/tmp mnt/gentoo mnt/livecd + for i in mnt/gentoo mnt/livecd do mkdir -p ${CHROOT}/$i chmod 755 ${CHROOT}/$i done # This will prevent from putting junk on the CHANGESDEV - mkdir -p ${CHROOT}/usr/portage/distfiles - mount -t tmpfs tmpfs ${CHROOT}/var/tmp - mount -t tmpfs tmpfs ${CHROOT}/tmp - mount -t tmpfs tmpfs ${CHROOT}/usr/portage/distfiles - warn_msg /tmp /var/tmp /usr/portage/distfiles are mounted in ram + str= + for i in tmp var/tmp usr/portage/distfiles + do + mkdir -p ${CHROOT}/$i + chmod 755 ${CHROOT}/$i + mount -t tmpfs tmpfs ${CHROOT}/$i + str=${str} ${i} + done + warn_msg ${str}are mounted in ram warn_msg consider saving important files elsewhere... read -t 3 UNUSEDVAL mount --bind ${NEW_ROOT}${CDROOT_PATH} ${CHROOT}${CDROOT_PATH}