From fa168b92773d44cb97cff05a47c53ed899315120 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 6 Apr 2012 12:15:53 -0400 Subject: functions: use a pipe for umount_all instead of a PE We don't care about the side effects of the subshell created by the pipe since everything is localized within this function. Use the more "canonical" syntax. This should stop the recurring bug reports that we seem to get from people who think they understand Bash syntax, e.g. FS#27203 FS#28331 FS#29145 FS#28582 FS#27098 FS#29496 Signed-off-by: Dave Reisner --- functions | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/functions b/functions index 3096aaa..7516345 100644 --- a/functions +++ b/functions @@ -549,32 +549,31 @@ mount_all() { umount_all() { # $1: restrict to fstype - local mounts + findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | { + while read -r target fstype options; do + # match only targetted fstypes + if [[ $1 && $1 != "$fstype" ]]; then + continue + fi - while read -r target fstype options; do + # don't unmount API filesystems + if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then + continue + fi - # match only targetted fstypes - if [[ $1 && $1 != "$fstype" ]]; then - continue - fi + # avoid networked devices + IFS=, read -ra opts <<< "$options" + if in_array _netdev "${opts[@]}"; then + continue + fi - # don't unmount API filesystems - if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then - continue - fi + mounts=("$target" "${mounts[@]}") + done - # avoid networked devices - IFS=, read -ra opts <<< "$options" - if in_array _netdev "${opts[@]}"; then - continue + if (( ${#mounts[*]} )); then + umount -r "${mounts[@]}" fi - - mounts=("$target" "${mounts[@]}") - done < <(findmnt -mrunRo TARGET,FSTYPE,OPTIONS /) - - if (( ${#mounts[*]} )); then - umount -r "${mounts[@]}" - fi + } } -- cgit v1.2.3 From 4d6178953060b79af0b2aa14d36c972989662d35 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 28 Apr 2012 20:10:01 -0400 Subject: locale.sh: try harder to ensure locale is set If LANG is never set by /etc/locale.conf or /etc/rc.conf, ensure that we fall back on LANG=C. Signed-off-by: Dave Reisner --- locale.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/locale.sh b/locale.sh index fe82378..c465f6f 100644 --- a/locale.sh +++ b/locale.sh @@ -4,16 +4,12 @@ if [ -s /etc/locale.conf ]; then . /etc/locale.conf fi -if [ -n "$LANG" ]; then - export LANG -else - if [ -s /etc/rc.conf ]; then - export LANG=$(. /etc/rc.conf 2> /dev/null ; echo "$LOCALE") - else - export LANG="C" - fi +if [ -z "$LANG" ] && [ -s /etc/rc.conf ]; then + LANG=$(. /etc/rc.conf 2>/dev/null; echo "$LOCALE") fi +export LANG=${LANG:-C} + if [ -n "$LC_CTYPE" ]; then export LC_CTYPE else -- cgit v1.2.3