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: Fri, 05 Sep 2014 16:09:55
Message-Id: 1403565074.1ebd03691dd96f3fe952ada0ecf301e9f731cfa5.zerochaos@gentoo
1 commit: 1ebd03691dd96f3fe952ada0ecf301e9f731cfa5
2 Author: Fernando Reyes (likewhoa) <design <AT> missionaccomplish <DOT> com>
3 AuthorDate: Thu May 29 01:55:05 2014 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 23 23:11:14 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=1ebd0369
7
8 Cleaner shutdown process preventing aufs related mounts from
9 being umounted along with mnt/{livecd,cdrom} and others.
10
11 Addition of a variable for aufs changes so that required
12 directory can be create upon successful creation of the livecd
13 image file.
14
15 ---
16 defaults/initrd.defaults | 3 +++
17 defaults/initrd.scripts | 1 +
18 defaults/linuxrc | 20 +++++++++++++++++---
19 3 files changed, 21 insertions(+), 3 deletions(-)
20
21 diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
22 index 3d6fe7e..5245959 100755
23 --- a/defaults/initrd.defaults
24 +++ b/defaults/initrd.defaults
25 @@ -65,6 +65,9 @@ CDROOT_PATH='/mnt/cdrom'
26 # This is the file that the cdroot will be checked for as a
27 # marker. It must exist RELATIVE to the cdroot.
28 CDROOT_MARKER='/livecd'
29 +
30 +# AUFS variables
31 +AUFS_CHANGES=false
32 AUFS_CHANGESFILE=livecd.aufs
33
34 LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
35
36 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
37 index e81e5f2..dd3af37 100644
38 --- a/defaults/initrd.scripts
39 +++ b/defaults/initrd.scripts
40 @@ -285,6 +285,7 @@ create_changefs() {
41 then
42 good_msg "Creation of ${AUFS_CHANGESFILE}, ${size} Mb on ${CHANGESDEV} successful, formatting it ext2"
43 mke2fs -F ${CHANGESMNT}/${AUFS_CHANGESFILE} &>/dev/null
44 + AUFS_CHANGES=true
45 break
46 else
47 rm -f ${CHANGESMNT}/${AUFS_CHANGESFILE}
48
49 diff --git a/defaults/linuxrc b/defaults/linuxrc
50 index 8620352..6d942a1 100644
51 --- a/defaults/linuxrc
52 +++ b/defaults/linuxrc
53 @@ -811,6 +811,15 @@ then
54 # TODO: remounting all tmpfs as RO seems weird, can we be more specific?
55 sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new
56 mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
57 +
58 + # RC_NO_UMOUNTS variable for a clean shutdown/reboot
59 + test ! $(grep 'RC_NO_UMOUNTS="/newroot|/newroot/mnt/aufs|\
60 +/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|/.unions/\
61 +memory|/.unions/memory/xino"' "${UNION}"/etc/rc.conf) &&
62 + echo "RC_NO_UMOUNTS=\"/newroot|/newroot/mnt/aufs|"\
63 +"/newroot/mnt/changesdev|/mnt/livecd|/mnt/cdrom|"\
64 +"/.unions/memory|/.unions/memory/xino\"">> "${UNION}"/etc/rc.conf
65 +
66 warn_msg "Adding all modules in $MODULESD/modules/"
67 if [ -z "${MODULESD}" ]
68 then
69 @@ -820,6 +829,10 @@ then
70 mount "${MODULESD}" ${NEW_ROOT}/mnt/modulesd
71 union_insert_modules ${NEW_ROOT}/mnt/modulesd
72 fi
73 +
74 + mkdir -p "${UNION}"/newroot/mnt/aufs
75 + test ${AUFS_CHANGES} && test ! -d "${UNION}"/newroot/mnt/changesdev &&
76 + mkdir "${UNION}"/newroot/mnt/changesdev
77 fi
78
79 # Unpacking additional packages from NFS mount
80 @@ -975,9 +988,10 @@ verbose_kmsg
81
82 if [ "${USE_AUFS_NORMAL}" -eq '1' ]
83 then
84 - mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
85 - mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!'
86 - for i in mnt/gentoo mnt/livecd
87 + mkdir -p /${CHROOT}/.unions/memory
88 + mount -o move /memory /${CHROOT}/.unions/memory
89 + test_success "Failed to move aufs /memory into the system root"
90 + for i in mnt/gentoo mnt/livecd ${CDROOT_PATH}
91 do
92 mkdir -p ${CHROOT}/$i
93 chmod 755 ${CHROOT}/$i