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 5CC6E138C9D for ; Wed, 29 Apr 2015 19:04:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 42290E08C6; Wed, 29 Apr 2015 19:04:22 +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 9CB0EE08C6 for ; Wed, 29 Apr 2015 19:04:21 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9756B340CA1 for ; Wed, 29 Apr 2015 19:04:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 520939B4 for ; Wed, 29 Apr 2015 19:04:08 +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: <1430328705.aa073bf7ee057fa5d7b1643ccb25618162c2bbd6.zerochaos@gentoo> Subject: [gentoo-commits] proj/genkernel:aufs 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: aa073bf7ee057fa5d7b1643ccb25618162c2bbd6 X-VCS-Branch: aufs Date: Wed, 29 Apr 2015 19:04:08 +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: 464aa7a2-562c-42f7-bf03-f1dc692ee162 X-Archives-Hash: 28d2769a53e72e26c76d5c894e88c73e commit: aa073bf7ee057fa5d7b1643ccb25618162c2bbd6 Author: Fernando Reyes (likewhoa) missionaccomplish com> AuthorDate: Tue Jun 3 17:48:14 2014 +0000 Commit: Richard Farina gentoo 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) &&