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.aa073bf7ee057fa5d7b1643ccb25618162c2bbd6.zerochaos@gentoo> (raw)
commit: aa073bf7ee057fa5d7b1643ccb25618162c2bbd6
Author: Fernando Reyes (likewhoa) <design <AT> missionaccomplish <DOT> com>
AuthorDate: Tue Jun 3 17:48:14 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=aa073bf7
Better implementation which was originally done in 946918e & 7a38d63.
defaults/initrd.scripts | 36 ++++++++++++++++++++++++++++++++++++
defaults/linuxrc | 38 ++------------------------------------
2 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index eb5ed6a..91056b1 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -310,6 +310,42 @@ union_insert_modules() {
done
}
+# 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
+ conf="${CHROOT}/etc/rc.conf"
+ fnd=0
+
+ if nomount=$(grep -n '^[[:blank:]]*RC_NO_UMOUNTS=' $conf); then
+ local i n data cmd IFS
+ IFS='
+'
+ set -- $nomount
+ unset IFS
+
+ for i; do
+ n=${i%%:*}; i=${i#"$n"}
+ data=${i#*=}
+
+ case $data in
+ "\"$RC_NO_UMOUNTS\""|"'$RC_NO_UMOUNTS'") fnd=1;;
+ *) cmd="$cmd$n d;"
+ esac
+ done
+
+ if [ -n "$cmd" ]; then
+ sed -i "${cmd%;}" $conf
+ test_success "Unable to edit rc.conf"
+ fi
+ fi
+
+ if [ 0 -eq "$fnd" ]; then
+ printf 'RC_NO_UMOUNTS="%s"\n' "$RC_NO_UMOUNTS" >> $conf
+ test_success "Unable to write to rc.conf"
+ fi
+}
+
# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
create_changefs() {
local size
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 0e40d16..a6c4806 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -791,42 +791,8 @@ then
#sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new
#mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
- # RC_NO_UMOUNTS variable for a clean shutdown/reboot
- RC_MOUNTS=$(grep 'RC_NO_UMOUNTS' "${CHROOT}"/etc/rc.conf)
-
- # Iterate through ${RC_MOUNTS} to find our duplicate(s) and or remove obsolete lines when ever
- # our RC_NO_UMOUNTS variable changes.
- if [ -n "${RC_MOUNTS}" ]; then
- printf '%s\n' ${RC_MOUNTS} |
- {
- while read -r mount; do
- # Remove double quotes from ${mount}
- new_mount=$(echo ${mount} | sed 's/"//g')
-
- if [[ "${new_mount}" = "RC_NO_UMOUNTS="${RC_NO_UMOUNTS}"" ]]; then
- RESULTS=false
- else
- # Escape characters in ${mounts} for use in sed
- mount_re=$(echo ${mount} | sed -e 's/\//\\\//g' -e 's/\&/\\\&/g')
-
- # Remove non matching pattern
- sed -i "/${mount_re}/d" "${CHROOT}"/etc/rc.conf
-
- RESULTS=true
- fi
- done
-
- # no RC_NO_UMOUNTS match found
- if ${RESULTS}; then return 1;fi
- }
- else
- echo "RC_NO_UMOUNTS=\"${RC_NO_UMOUNTS}\"">> "${CHROOT}"/etc/rc.conf
- fi
-
- # An RC_NO_UMOUNTS was not found that matches our current one
- if [ $? -eq 1 ]; then
- echo "RC_NO_UMOUNTS=\"${RC_NO_UMOUNTS}\"">> "${CHROOT}"/etc/rc.conf
- fi
+ # Function to handle the RC_NO_UMOUNTS variable in ${CHROOT}/etc/rc.conf
+ conf_rc_no_umounts
# Fstab change for aufs
test ! $(grep -o ^aufs "${CHROOT}"/etc/fstab) &&
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.aa073bf7ee057fa5d7b1643ccb25618162c2bbd6.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