Gentoo Archives: gentoo-commits

From: Richard Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:aufs commit in: defaults/
Date: Wed, 29 Apr 2015 19:04:29
Message-Id: 1430328784.4e55218f080fab85514112a38e6fe6aee6a922ba.zerochaos@gentoo
1 commit: 4e55218f080fab85514112a38e6fe6aee6a922ba
2 Author: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 23 00:07:28 2014 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 29 17:33:04 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=4e55218f
7
8 aufs changes saving automation
9
10 The aufs code has the ability to save changes in a file, however, it
11 requires the user to manually tell us where the file is. This code will
12 automatically check for the file on $CDROOT, as well as automatically
13 pick up the casper-rw file created by unetbooting for persistence.
14 Additionally we add the option for aufs=search which will search all
15 drives for livecd.aufs. Possible later enhancements include searching
16 other partitions on the CDROOT_DEV for livecd.aufs automatically instead
17 of needing aufs=search. Then again, possible later enhancements also
18 include just always searching, it's shockingly fast to do the search...
19
20 defaults/initrd.scripts | 24 ++++++++++++++++++++++--
21 1 file changed, 22 insertions(+), 2 deletions(-)
22
23 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
24 index d8142a2..e05809c 100644
25 --- a/defaults/initrd.scripts
26 +++ b/defaults/initrd.scripts
27 @@ -123,7 +123,7 @@ findmediamount() {
28 fi
29 good_msg "Attempting to mount media: ${x}" ${CRYPT_SILENT}
30
31 - mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
32 + mount -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
33 if [ "$?" = '0' ]
34 then
35 if [ -n "${ISOBOOT}" ]; then
36 @@ -408,12 +408,29 @@ create_changefs() {
37 setup_aufs() {
38 bootstrapCD
39
40 + if [ "$aufs_dev" = "search" ]; then
41 + findmediamount "aufs-dev" "$aufs_union_file" \
42 + "aufs_dev" "$aufs_dev_mnt" $(devicelist)
43 + aufs_mounted="1"
44 + elif [ -z $aufs_dev ] && [ -w "$CDROOT_PATH/$aufs_union_file" ]; then
45 + aufs_dev="$REAL_ROOT"
46 + aufs_dev_mnt="$CDROOT_PATH"
47 + aufs_mounted="1"
48 + fi
49 + if [ -z $aufs_dev ] && [ -w "$CDROOT_PATH/casper-rw" ]; then
50 + aufs_dev="$REAL_ROOT"
51 + aufs_dev_mnt="$CDROOT_PATH"
52 + aufs_union_file="/casper-rw"
53 + aufs_mounted="1"
54 + fi
55 +
56 if [ -n "$aufs_dev" ]; then
57 if [ ! -b $aufs_dev ]; then
58 bad_msg "$aufs_dev is not a valid block device"
59 local invalidblk=1
60 unset aufs_dev
61 - else
62 + #skip this block when aufs_dev_mnt is already mounted
63 + elif [ "$aufs_mounted" != "1" ]; then
64 good_msg "Mounting $aufs_dev to $aufs_memory for aufs support"
65
66 if ! mount -t auto "$aufs_dev" "$aufs_dev_mnt" &>/dev/null; then
67 @@ -428,6 +445,9 @@ setup_aufs() {
68 elif [ -n "$aufs_dev" ]; then
69 while :; do
70 if mount -t auto "$aufs_dev_mnt$aufs_union_file" "$aufs_memory" &>/dev/null; then
71 + if [ "$aufs_union_file" = "/casper-rw" ];then
72 + bad_msg "Use of livecd.aufs preferred to casper-rw for changes saving, please rename the file."
73 + fi
74 break
75 else
76 bad_msg "Mounting of changes file failed, Running e2fsck"