From: "Richard Farina" <zerochaos@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:aufs commit in: defaults/
Date: Wed, 29 Apr 2015 19:04:08 +0000 (UTC) [thread overview]
Message-ID: <1430328705.b4d40c20a5cb327540ea2f7d84f818b39b8657dc.zerochaos@gentoo> (raw)
commit: b4d40c20a5cb327540ea2f7d84f818b39b8657dc
Author: Fernando Reyes (likewhoa) <design <AT> missionaccomplish <DOT> com>
AuthorDate: Wed Jun 25 16:12:11 2014 +0000
Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Wed Apr 29 17:31:45 2015 +0000
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
- 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
}
-# Implements RC_NO_UMOUNTS variable into ${CHROOT}/etc/rc.conf for a cleaner shutdown process
+# Helper function for union_insert_modules()
+union_mod() {
+ [ -e "$1" ] || return 0
+
+ local 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"
+ fi
+
+ union_insert_dir "$aufs_union" "$aufs_memory/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
conf_rc_no_umounts() {
local conf nomount fnd
@@ -357,7 +371,7 @@ is_int(){
done
}
-# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
+# Function to create an ext2 fs on $aufs_dev, $aufs_dev_mnt mountpoint
create_changefs() {
local size
@@ -372,102 +386,98 @@ 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=$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
+ 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"
+ mke2fs -F "$aufs_dev_mnt$aufs_union_file" &>/dev/null
break
else
- rm -f "$CHANGESMNT$AUFS_CHANGESFILE"
- bad_msg "Unable to create ${AUFS_CHANGESFILE#*/} on $CHANGESDEV of ${size}Mb"
+ rm "$aufs_dev_mnt$aufs_union_file"
+ 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
- if [ a = "$doabort" ]; then return 1; fi
+ if [ a = "$doabort" ]; then
+ bad_msg "Aborting creation of $aufs_union_file!"
+ umount "$aufs_dev" && rmdir "$aufs_dev_mnt"
+ return 1
+ fi
fi
fi
done
- return 0
+ return $?
}
setup_aufs() {
bootstrapCD
- 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"
+ if [ -n "$aufs_dev" ]; then
+ good_msg "Mounting $aufs_dev to $aufs_memory for aufs support"
- if ! mount -t auto "$CHANGESDEV" "$CHANGESMNT" &>/dev/null; then
- bad_msg "Mount of $CHANGESDEV failed, falling back to ramdisk based aufs"
- unset AUFS
- 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
- # 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
- while :; do
- if mount -t auto "$CHANGESMNT$AUFS_CHANGESFILE" "$MEMORY" &>/dev/null; then
+ # Check and attempt to create the AUFS union file
+ if [ ! -e $aufs_dev_mnt$aufs_union_file ] && [ -n "$aufs_dev" ]; then
+ create_changefs && mount -t auto "$aufs_dev_mnt$aufs_union_file" "$aufs_memory"
+ elif [ -n "$aufs_dev" ]; then
+ while :; do
+ if mount -t auto "$aufs_dev_mnt$aufs_union_file" "$aufs_memory" &>/dev/null; then
break
else
bad_msg "Mounting of changes file failed, Running e2fsck"
if ! hash e2fsck &>/dev/null; then
bad_msg "/sbin/e2fsck not found! aborting filesystem check"
- bad_msg "Moving ${AUFS_CHANGESFILE#*/} to ${AUFS_CHANGESFILE#*/}.bad"
+ bad_msg "Moving ${aufs_union_file#*/} to ${aufs_union_file#*/}.bad"
- mv "$CHANGESMNT$AUFS_CHANGESFILE" "$CHANGESMNT$AUFS_CHANGESFILE.bad"
+ mv "$aufs_dev_mnt$aufs_union_file" "$aufs_dev_mnt$aufs_union_file.bad"
break
-
fi
- if e2fsck "$CHANGESMNT$AUFS_CHANGESFILE" &>/dev/null; then
+ if e2fsck "$aufs_dev_mnt$aufs_union_file" &>/dev/null; then
good_msg "e2fsck ran successfully. Please verify data after bootup"
else
- bad_msg "Your ${AUFS_CHANGESFILE#*/} image might be corrupted"
- bad_msg "moving ${AUFS_CHANGESFILE#*/} to ${AUFS_CHANGESFILE#*/}.bad"
+ bad_msg "Your ${aufs_union_file#*/} image might be corrupted"
+ bad_msg "moving ${aufs_union_file#*/} to ${aufs_union_file#*/}.bad"
- mv "$CHANGESMNT$AUFS_CHANGESFILE" "$CHANGESMNT$AUFS_CHANGESFILE.bad"
- break
- fi
- fi
- done
- fi
- # mount tmpfs only in the case when changes= boot parameter was
- # empty or we were not able to mount the storage device
- if [ 1 = "$CDROOT" ] && [ ! -f "$CHANGESMNT$AUFS_CHANGESFILE" ]; then
- XINO=$MEMORY
- umount "$MEMORY" &>/dev/null
+ mv "$aufs_dev_mnt$aufs_union_file" "$aufs_dev_mnt$aufs_union_file.bad"
+ break
+ fi
+ fi
+ done
+ fi
+
+ # Mount tmpfs only in the case when aufs= boot parameter was
+ # empty or we were not able to mount the storage device
+ if [ 1 = "$CDROOT" ] && [ ! -f "$aufs_dev_mnt$aufs_union_file" ]; then
+ aufs_xino=$aufs_memory
+ umount "$aufs_memory" &>/dev/null
- bad_msg "Create an extfs ${AUFS_CHANGESFILE#*/} file on this device"
+ bad_msg "Create an extfs ${aufs_union_file#*/} file on this device"
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 $MEMORY for aufs support"
+ bad_msg "Falling back to ramdisk based aufs"
+ good_msg "Mounting ramdisk to $aufs_memory for aufs support"
- mount -t tmpfs tmpfs "$MEMORY"
- else
- XINO=$MEMORY/xino
+ mount -t tmpfs tmpfs "$aufs_memory"
+ else
+ aufs_xino=$aufs_memory/xino
- mkdir -p "$XINO"
- mount -t tmpfs aufs-xino "$XINO"
- fi
- else
- XINO=$MEMORY
+ mkdir -p "$aufs_xino"
+ mount -t tmpfs aufs-xino "$aufs_xino"
+ fi
+ else
+ aufs_xino=$aufs_memory
- good_msg "Mounting ramdisk to $MEMORY for aufs support"
- mount -t tmpfs tmpfs "$MEMORY"
- fi
+ good_msg "Mounting ramdisk to $aufs_memory for aufs support"
+ mount -t tmpfs tmpfs "$aufs_memory"
+ fi
- mkdir -p "$CHANGES"
- if ! mount -t aufs -n -o "nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw" aufs "$UNION"; then
- bad_msg "Can't setup union $UNION in directory!"
- USE_AUFS_NORMAL=0
+ mkdir -p "$aufs_branch"
+ if ! mount -t aufs -n -o "nowarn_perm,udba=none,xino=$aufs_xino/.aufs.xino,br:$aufs_branch=rw" aufs "$aufs_union"; then
+ bad_msg "Can't setup union $aufs_union in directory!"
+ aufs=0
fi
}
@@ -1420,24 +1430,18 @@ getdvhoff() {
setup_squashfs_aufs() {
# Setup aufs directories and vars
- rw_branch=/mnt/rw_branch ro_branch=/mnt/livecd
+ aufs_rw_branch=/mnt/aufs-rw-branch aufs_ro_branch=/mnt/livecd
- for dir in $rw_branch $ro_branch; do
+ for dir in $aufs_rw_branch $aufs_ro_branch; do
[ ! -d $dir ] && mkdir -p "$dir"
done
good_msg "Loading aufs module ..."
modprobe aufs &>/dev/null
- mount -t squashfs -o loop,ro "$CDROOT_PATH/$LOOPEXT$LOOP" "$ro_branch"
- mount -t tmpfs none "$rw_branch"
- mount -t aufs -o "br:$rw_branch:$ro_branch" aufs "$NEW_ROOT"
-
- [ ! -d $NEW_ROOT$rw_branch ] && mkdir -p "$NEW_ROOT$rw_branch"
- [ ! -d $NEW_ROOT$ro_branch ] && mkdir -p "$NEW_ROOT$ro_branch"
- for mount in $rw_branch $ro_branch; do
- mount --move "$mount" "$NEW_ROOT$mount"
- done
+ mount -t squashfs -o loop,ro "$CDROOT_PATH/$LOOPEXT$LOOP" "$aufs_ro_branch"
+ mount -t tmpfs none "$aufs_rw_branch"
+ mount -t aufs -o "br:$aufs_rw_branch:$aufs_ro_branch" aufs "$NEW_ROOT"
}
setup_unionfs() {
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 5a341af..276f150 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -251,26 +251,22 @@ do
keymap=${x#*=}
;;
aufs)
- USE_AUFS_NORMAL=1
+ aufs=1
;;
aufs\=*)
- USE_AUFS_NORMAL=1
+ aufs=1
if echo "${x#*=}" | grep , &>/dev/null; then
- UID=${x#*,}
- AUFS=${x%,*}
+ aufs_dev_uid=${x#*,}
+ aufs_dev=${x%,*}
else
- AUFS=${x#*=}
+ aufs_dev=${x#*=}
fi
;;
- aufs.persistent)
- USE_AUFS_NORMAL=1
- AUFS=detect
- ;;
# Allow user to specify the modules location
aufs.modules\=*)
- MODULESD=${x#*=}
- AUFS_MODULES=true
+ aufs_modules_dev=${x#*=}
+ aufs_modules=1
;;
unionfs)
if [ ! -x /sbin/unionfs ]
@@ -447,14 +443,14 @@ then
# Setup the root filesystem
bootstrapFS
- if [ 1 = "$USE_AUFS_NORMAL" ]; then
+ if [ 1 = "$aufs" ]; then
setup_aufs
- CHROOT=$UNION
+ CHROOT=$aufs_union
else
CHROOT=${NEW_ROOT}
fi
- if [ /dev/nfs != "$REAL_ROOT" ] && [ sgimips != "$LOOPTYPE" ] && [ 1 != "$USE_AUFS_NORMAL" ]; then
+ if [ /dev/nfs != "$REAL_ROOT" ] && [ sgimips != "$LOOPTYPE" ] && [ 1 != "$aufs" ]; then
bootstrapCD
fi
@@ -704,7 +700,7 @@ then
FS_LOCATION='mnt/livecd'
elif [ "${LOOPTYPE}" = 'squashfs' ]
then
- if [ 1 != "$USE_AUFS_NORMAL" ]; then
+ if [ 1 != "$aufs" ]; then
good_msg 'Mounting squashfs filesystem'
_CACHED_SQUASHFS_PATH="${NEW_ROOT}/mnt/${LOOP}"
_squashfs_path="${CDROOT_PATH}/${LOOPEXT}${LOOP}" # Default to uncached
@@ -766,10 +762,10 @@ then
fi
fi # if [ -n "${CRYPT_ROOT}" ]
- if [ 1 = "$USE_AUFS_NORMAL" ]; then
- union_insert_dir "$CHROOT" "$NEW_ROOT/$FS_LOCATION"
+ if [ 1 = "$aufs" ]; then
+ union_insert_dir "$CHROOT" "$aufs_ro_branch"
- # Function to handle the RC_NO_UMOUNTS variable in ${CHROOT}/etc/rc.conf
+ # Function to handle the RC_NO_UMOUNTS variable in $CHROOT/etc/rc.conf
conf_rc_no_umounts
# Fstab changes for aufs
@@ -780,7 +776,7 @@ then
cat > "$CHROOT/etc/fstab" << FSTAB
####################################################
-## ATTENTION: THIS IS THE FSTAB ON THE LIVECD ##
+## ATTENTION: THIS IS THE FSTAB ON THE LIVECD ##
## PLEASE EDIT THE FSTAB at /mnt/gentoo/etc/fstab ##
####################################################
aufs / aufs defaults 0 0
@@ -790,14 +786,14 @@ distfiles /usr/portage/distfiles tmpfs defaults 0 0
FSTAB
fi
- if $AUFS_MODULES; then
- warn_msg "Adding all modules in $MODULESD/modules/"
+ if [ 1 = "$aufs_modules" ]; then
+ warn_msg "Adding all modules in $aufs_modules_dev/modules/"
- if [ -z "$MODULESD" ]; then
+ if [ -z "$aufs_modules_dev" ]; then
union_insert_modules "$CDROOT_PATH"
else
mkdir "$NEW_ROOT/mnt/modulesd"
- mount "$MODULESD" "$NEW_ROOT/mnt/modulesd"
+ mount "$aufs_modules_dev" "$NEW_ROOT/mnt/modulesd"
union_insert_modules "$NEW_ROOT/mnt/modulesd"
fi
fi
@@ -808,11 +804,13 @@ FSTAB
cp /etc/sysconfig/keyboard "$CHROOT/etc/sysconfig/"
fi
- # Create the directories for our new union mounts
+ # Create the diuectories for our new union mounts
[ ! -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"
+ # Check to see if we successfully mounted $aufs_dev
+ if [ -n "$aufs_dev" ] && grep $aufs_dev /etc/mtab 1>/dev/null; then
+ [ ! -d $CHROOT$aufs_dev_mnt ] && mkdir -p "$CHROOT$aufs_dev_mnt"
+ mount --move "$aufs_dev_mnt" "$CHROOT$aufs_dev_mnt"
fi
fi
@@ -833,31 +831,30 @@ FSTAB
fi
- if [ "${USE_UNIONFS_NORMAL}" = '1' ]
- then
+ if [ "${USE_UNIONFS_NORMAL}" = '1' ]; 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
- if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
- then
- good_msg "Copying read-write image contents to tmpfs"
- # Copy over stuff that should be writable
- (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}") || {
- bad_msg "Copying failed, dropping into a shell."
- do_rundebugshell
- }
-
- # Now we do the links.
- for x in ${ROOT_LINKS}
- do
- if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
- then
- ln -s "$(readlink ${NEW_ROOT}/${FS_LOCATION}/${x})" "${x}" 2>/dev/null
- else
- # List all subdirectories of x
- find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
- do
+ elif [ 1 != "$aufs" ]; then
+ good_msg "Copying read-write image contents to tmpfs"
+
+ # Copy over stuff that should be writable
+ (
+ cd "${NEW_ROOT}/${FS_LOCATION}"
+ cp -a ${ROOT_TREES} "${NEW_ROOT}"
+ ) ||
+ {
+ bad_msg "Copying failed, dropping into a shell."
+ do_rundebugshell
+ }
+
+ # Now we do the links.
+ for x in ${ROOT_LINKS}; do
+ if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]; then
+ ln -s "$(readlink ${NEW_ROOT}/${FS_LOCATION}/${x})" "${x}" 2>/dev/null
+ else
+ # List all subdirectories of x
+ find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null |
+ while read directory; do
# Strip the prefix of the FS_LOCATION
directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
@@ -869,11 +866,9 @@ FSTAB
fi
fi
# Test if the directory exists already
- if [ -e "/${NEW_ROOT}/${directory}" ]
- then
+ if [ -e "/${NEW_ROOT}/${directory}" ]; then
# It does exist, link all the individual files
- for file in $(ls /${NEW_ROOT}/${FS_LOCATION}/${directory})
- do
+ for file in $(ls /${NEW_ROOT}/${FS_LOCATION}/${directory}); do
if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
fi
@@ -882,22 +877,24 @@ FSTAB
# It does not exist, make a link to the livecd
ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
current_parent="${directory}"
- 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
+ done
+ fi
+ done
- fi # if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
- #XXX: end extremely confusing hunk
+ mkdir -p initramfs proc tmp run sys 2>/dev/null
+ chmod 1777 tmp
- # 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
+ # Have handy /mnt/cdrom (CDROOT_PATH) as well
+ if [ 1 = "$aufs" ]; then
+ [ ! -d "$CHROOT$CDROOT_PATH" ] && mkdir "$CHROOT$CDROOT_PATH"
+ mount --move "$CDROOT_PATH" "$CHROOT$CDROOT_PATH"
+ else
+ [ ! -d "$NEW_ROOT$CDROOT_PATH" ] && mkdir -p "$NEW_ROOT$CDROOT_PATH"
+ mount --move "$CDROOT_PATH" "$NEW_ROOT$CDROOT_PATH"
+ fi
#UML=$(cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||')
#if [ "${UML}" = 'UML' ]
@@ -916,9 +913,9 @@ else
mount -t tmpfs tmpfs /union_changes
setup_unionfs /union_changes ${NEW_ROOT}
mkdir -p ${UNION}/tmp/.initrd
- elif [ 1 = "$USE_AUFS_NORMAL" ]; then
- union_insert_dir "$UNION" "$NEW_ROOT"
- mkdir -p "$UNION/tmp/.initrd"
+ elif [ 1 = "$aufs" ]; then
+ union_insert_dir "$aufs_union" "$NEW_ROOT"
+ mkdir -p "$aufs_union/tmp/.initrd"
fi
fi # if [ "${CDROOT}" = '1' ]
@@ -965,20 +962,20 @@ fi
verbose_kmsg
-if [ 1 = "$USE_AUFS_NORMAL" ]; then
- UNION_MEMORY=$CHROOT/.unions/memory
+if [ 1 = "$aufs" ]; then
+ aufs_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"
+ mkdir -p "$aufs_union_memory"
+ mount --move "$aufs_memory" "$aufs_union_memory"
+ test_success "Failed to move aufs $aufs_memory into the system root"
- for dir in /mnt/gentoo $rw_branch $ro_branch $CDROOT_PATH; do
+ for dir in /mnt/gentoo $aufs_rw_branch $aufs_ro_branch; do
mkdir -p "$CHROOT$dir"
chmod 755 "$CHROOT$dir"
done
- for dir in $CDROOT_PATH $rw_branch $ro_branch; do
- mount --move "$NEW_ROOT$dir" "$CHROOT$dir"
+ for mount in $aufs_rw_branch $aufs_ro_branch; do
+ mount --move "$mount" "$CHROOT$mount"
done
fi
next reply other threads:[~2015-04-29 19:04 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 19:04 Richard Farina [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-04-29 19:04 [gentoo-commits] proj/genkernel:aufs commit in: defaults/ Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2015-04-29 19:04 Richard Farina
2014-09-23 0:21 Richard Farina
2014-09-23 0:21 Richard Farina
2014-09-05 16:11 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-09-05 16:09 Richard Farina
2014-05-24 21:35 Richard Farina
2014-05-24 21:35 Richard Farina
2014-05-24 21:35 Richard Farina
2014-05-22 20:28 Richard Farina
2014-05-22 20:28 Richard Farina
2014-05-22 20:28 Richard Farina
2014-05-22 20:28 Richard Farina
2014-03-17 19:38 Robin H. Johnson
2014-03-17 19:32 Robin H. Johnson
2014-03-17 19:20 Robin H. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430328705.b4d40c20a5cb327540ea2f7d84f818b39b8657dc.zerochaos@gentoo \
--to=zerochaos@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox