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:10:01
Message-Id: 1403565075.6351547bada320d82a8e5c09450d8a4783e948df.zerochaos@gentoo
1 commit: 6351547bada320d82a8e5c09450d8a4783e948df
2 Author: Fernando Reyes (likewhoa) <design <AT> missionaccomplish <DOT> com>
3 AuthorDate: Mon Jun 2 15:19:23 2014 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 23 23:11:15 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=6351547b
7
8 This improves the way we handle RC_NO_UMOUNT variable in openrc so that
9 future changes can scale and fixes previous bugs which didn't actually
10 remove duplicates.
11
12 ---
13 defaults/linuxrc | 43 +++++++++++++++++++++++++++++--------------
14 1 file changed, 29 insertions(+), 14 deletions(-)
15
16 diff --git a/defaults/linuxrc b/defaults/linuxrc
17 index 42749d6..86b1954 100644
18 --- a/defaults/linuxrc
19 +++ b/defaults/linuxrc
20 @@ -816,24 +816,39 @@ then
21
22 # RC_NO_UMOUNTS variable for a clean shutdown/reboot
23 RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' "${CHROOT}"/etc/rc.conf)
24 - RESULTS=false
25
26 # Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever
27 # our RC_NO_UMOUNTS variable changes.
28 - printf '%s\n' ${RC_MOUNTS} | while read -r mount; do
29 - if [[ "${mount}" = "RC_NO_UMOUNTS=\"${RC_NO_UMOUNTS}\"" ]]; then
30 - RESULTS=true
31 - else
32 - # Escape characters in ${mounts} for use in sed
33 - mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\&/\\\&/g')
34 -
35 - # Remove non matching pattern
36 - sed -i "/${mount_re}/d" "${CHROOT}"/etc/rc.conf
37 - fi
38 - done
39 + if [ -n "${RC_MOUNTS}" ]; then
40 + printf '%s\n' ${RC_MOUNTS} |
41 + {
42 + while read -r mount; do
43 + # Remove double quotes from ${mount}
44 + new_mount=$(echo ${mount} | sed 's/"//g')
45 +
46 + if [[ "${new_mount}" = "RC_NO_UMOUNTS="${RC_NO_UMOUNTS}"" ]]; then
47 + RESULTS=false
48 + else
49 + # Escape characters in ${mounts} for use in sed
50 + mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\&/\\\&/g')
51 +
52 + # Remove non matching pattern
53 + sed -i "/${mount_re}/d" "${CHROOT}"/etc/rc.conf
54 +
55 + RESULTS=true
56 + fi
57 + done
58 +
59 + # no RC_NO_UMOUNTS match found
60 + if ${RESULTS}; then return 1;fi
61 + }
62 + else
63 + echo "RC_NO_UMOUNTS=\"${RC_NO_UMOUNTS}\"">> "${CHROOT}"/etc/rc.conf
64 + fi
65
66 - if ! ${RESULTS}; then
67 - echo 'RC_NO_UMOUNTS="/newroot|/newroot/mnt/changesdev|/mnt/overlay|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino"'>> "${CHROOT}"/etc/rc.conf
68 + # An RC_NO_UMOUNTS was not found that matches our current one
69 + if [ $? -eq 1 ]; then
70 + echo "RC_NO_UMOUNTS=\"${RC_NO_UMOUNTS}\"">> "${CHROOT}"/etc/rc.conf
71 fi
72
73 # Fstab change for aufs