From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id AF2A9138C9D for ; Wed, 29 Apr 2015 19:04:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 12524E08A2; Wed, 29 Apr 2015 19:04:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9E515E08A2 for ; Wed, 29 Apr 2015 19:04:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5DB7F3408A0 for ; Wed, 29 Apr 2015 19:04:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DCA889BC for ; Wed, 29 Apr 2015 19:04:08 +0000 (UTC) From: "Richard Farina" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Richard Farina" Message-ID: <1430328784.a5f4045080278ac43d13ff79bfbad388055867c5.zerochaos@gentoo> Subject: [gentoo-commits] proj/genkernel:aufs commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.defaults defaults/initrd.scripts defaults/linuxrc X-VCS-Directories: defaults/ X-VCS-Committer: zerochaos X-VCS-Committer-Name: Richard Farina X-VCS-Revision: a5f4045080278ac43d13ff79bfbad388055867c5 X-VCS-Branch: aufs Date: Wed, 29 Apr 2015 19:04:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 0906c8b2-a39e-4f52-8058-76be36deca92 X-Archives-Hash: e23d5f6f1113d5279b721b5c5cee21aa commit: a5f4045080278ac43d13ff79bfbad388055867c5 Author: Fernando Reyes (likewhoa) missionaccomplish com> AuthorDate: Mon Aug 4 01:23:02 2014 +0000 Commit: Richard Farina gentoo org> CommitDate: Wed Apr 29 17:33:04 2015 +0000 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 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