From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-827938-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 806811397D4
	for <garchives@archives.gentoo.org>; Tue, 11 Aug 2015 18:38:23 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7754914241;
	Tue, 11 Aug 2015 18:38:10 +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 C468114241
	for <gentoo-commits@lists.gentoo.org>; Tue, 11 Aug 2015 18:38:04 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id AACA9340B8D
	for <gentoo-commits@lists.gentoo.org>; Tue, 11 Aug 2015 18:37:58 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id DF65A164
	for <gentoo-commits@lists.gentoo.org>; Tue, 11 Aug 2015 18:37:53 +0000 (UTC)
From: "Richard Farina" <zerochaos@gentoo.org>
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" <zerochaos@gentoo.org>
Message-ID: <1439317276.9dc3dfc0e09e75a3f83c94f28c6d60fb36abab2e.zerochaos@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/
X-VCS-Repository: proj/genkernel
X-VCS-Files: defaults/initrd.scripts
X-VCS-Directories: defaults/
X-VCS-Committer: zerochaos
X-VCS-Committer-Name: Richard Farina
X-VCS-Revision: 9dc3dfc0e09e75a3f83c94f28c6d60fb36abab2e
X-VCS-Branch: master
Date: Tue, 11 Aug 2015 18:37:53 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: bb25db49-6f8b-4643-9dae-22bddcfa1e35
X-Archives-Hash: 4b122700c53117dcfcf10d2539b7e0b5

commit:     9dc3dfc0e09e75a3f83c94f28c6d60fb36abab2e
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 23 00:07:28 2014 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 18:21:16 2015 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9dc3dfc0

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 2>&1
+				mount -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
 				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"