--- host-setup-4.0.1.txt 2012-01-03 19:21:54.000327000 +0000 +++ host-setup-4.0.2.txt 2012-01-27 06:53:47.000700000 +0000 @@ -2,9 +2,9 @@ # -*- tab-width: 4 -*- ;; Emacs # vi: set tabstop=4 :: Vi/ViM # -# Revision: 4.0.1 +# Revision: 4.0.2 # Created: September 21st, 2010 -# Last Modified: January 3rd, 2012 +# Last Modified: January 26th, 2012 ############################################################ COPYRIGHT # # Devin Teske (c)2006-2012. All Rights Reserved. @@ -728,7 +728,8 @@ sysrc_set() if [ "$RC_CONFS" ]; then file="${RC_CONFS%%[$IFS]*}" else - file=$( sysrc_get "rc_conf_files%%[$IFS]*" ) + file=$( sysrc_get rc_conf_files ) + file="${file%%[$IFS]*}" fi fi @@ -761,14 +762,18 @@ sysrc_set() # temporary file over the destination, the destination will inherit the # permissions from the temporary file). # - chmod "$( stat -f '%#Lp' "$file" )" "$tmpfile" 2> /dev/null + local mode + mode=$( stat -f '%#Lp' "$file" 2> /dev/null ) + quietly chmod "${mode:-0644}" "$tmpfile" # # Fixup ownership. The destination file _is_ writable (we tested # earlier above). However, this will fail if we don't have sufficient # permissions (so we throw stderr into the bit-bucket). # - chown "$( stat -f '%u:%g' "$file" )" "$tmpfile" 2> /dev/null + local owner + owner=$( stat -f '%u:%g' "$file" 2> /dev/null ) + quietly chown "${owner:-root:wheel}" "$tmpfile" # # Operate on the matching file, replacing only the last occurrence. @@ -841,6 +846,8 @@ sysrc_delete() # Operate on each of the specified files # for file in ${RC_CONFS:-$( sysrc_get rc_conf_files )}; do + [ -e "$file" ] || continue + # # Create a new temporary file to write to. # @@ -851,8 +858,11 @@ sysrc_delete() # Fixup permissions and ownership (mktemp(1) defaults to 0600 # permissions) to instead match the destination file. # - chmod "$( stat -f '%#Lp' "$file" )" "$tmpfile" 2> /dev/null - chown "$( stat -f '%u:%g' "$file" )" "$tmpfile" 2> /dev/null + local mode owner + mode=$( stat -f '%#Lp' "$file" 2> /dev/null ) + owner=$( stat -f '%u:%g' "$file" 2> /dev/null ) + quietly chmod "${mode:-0644}" "$tmpfile" + quietly chown "${owner:-root:wheel}" "$tmpfile" # # Operate on the file, removing all occurrences, saving the @@ -2500,8 +2510,11 @@ dialog_input_nameserver() # # Quietly fixup permissions and ownership # - quietly chmod "$( stat -f '%#Lp' "$RESOLV_CONF" )" "$tmpfile" - quietly chown "$( stat -f '%u:%g' "$RESOLV_CONF" )" "$tmpfile" + local mode owner + mode=$( stat -f '%#Lp' "$RESOLV_CONF" 2> /dev/null ) + owner=$( stat -f '%u:%g' "$RESOLV_CONF" 2> /dev/null ) + quietly chmod "${mode:-0644}" "$tmpfile" + quietly chown "${owner:-root:wheel}" "$tmpfile" # # Operate on resolv.conf(5) @@ -3608,7 +3621,7 @@ exit $SUCCESS # # $Header$ # -# $Copyright: 2006-2011. Devin Teske. All Rights Reserved. $ +# $Copyright: 2006-2012. Devin Teske. All Rights Reserved. $ # # $Log$ #