From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A96DB139737 for ; Tue, 11 Aug 2015 18:38:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9B3AB1420D; Tue, 11 Aug 2015 18:38:00 +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 B5A97141AD for ; Tue, 11 Aug 2015 18:37:58 +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 D9AB2340D30 for ; Tue, 11 Aug 2015 18:37:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1C017159 for ; Tue, 11 Aug 2015 18:37:53 +0000 (UTC) From: "Richard Farina" 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" Message-ID: <1439317276.22fc4406486edd0f7a82b117d5884c8f2cf7487e.zerochaos@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.scripts defaults/linuxrc X-VCS-Directories: defaults/ X-VCS-Committer: zerochaos X-VCS-Committer-Name: Richard Farina X-VCS-Revision: 22fc4406486edd0f7a82b117d5884c8f2cf7487e X-VCS-Branch: master Date: Tue, 11 Aug 2015 18:37:53 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ffec4d9d-fe06-45fb-beb2-da14b1e71677 X-Archives-Hash: 3fba13ef0e570317283d38d560c9eee8 commit: 22fc4406486edd0f7a82b117d5884c8f2cf7487e Author: Fernando Reyes (likewhoa) missionaccomplish com> AuthorDate: Tue Jun 3 17:48:14 2014 +0000 Commit: Richard Farina gentoo org> CommitDate: Tue Aug 11 18:21:16 2015 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=22fc4406 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) &&