diff options
author | Fernando Reyes (likewhoa) <design@missionaccomplish.com> | 2014-08-04 03:23:02 +0200 |
---|---|---|
committer | Rick Farina (Zero_Chaos) <zerochaos@gentoo.org> | 2015-08-11 14:21:16 -0400 |
commit | f3b1c95130892ec98e233efced096a876ac8e4f6 (patch) | |
tree | 6e7c34ba4ca0f9853afae266f6267f34f2669937 /defaults | |
parent | Changed to the dd command which creates the livecd.aufs image for (diff) | |
download | genkernel-f3b1c95130892ec98e233efced096a876ac8e4f6.tar.gz genkernel-f3b1c95130892ec98e233efced096a876ac8e4f6.tar.bz2 genkernel-f3b1c95130892ec98e233efced096a876ac8e4f6.zip |
Fixed a bug which prevented aufs.modules from functioning properly
and changed the variables names to reflect the actual logic.
Diffstat (limited to 'defaults')
-rwxr-xr-x | defaults/initrd.defaults | 1 | ||||
-rw-r--r-- | defaults/initrd.scripts | 17 | ||||
-rw-r--r-- | defaults/linuxrc | 22 |
3 files changed, 22 insertions, 18 deletions
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 782fd14f..f2cb42ab 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 5c7703ba..d168b94f 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 3098866b..951f5e12 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 defaults 0 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 |