Author: dteske
Date: Sun Jan 20 17:48:56 2013
New Revision: 245695
URL: http://svnweb.freebsd.org/changeset/base/245695

Log:
  Backward compatibility fix: treat cmds loaded as a script as nonInteractive

Modified:
  head/usr.sbin/bsdconfig/share/script.subr

Modified: head/usr.sbin/bsdconfig/share/script.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/script.subr   Sun Jan 20 16:23:37 2013        
(r245694)
+++ head/usr.sbin/bsdconfig/share/script.subr   Sun Jan 20 17:48:56 2013        
(r245695)
@@ -100,7 +100,7 @@ f_dispatch()
 #
 f_script_load()
 {
-       local script="$1" config_file
+       local script="$1" config_file retval=$SUCCESS
 
        f_dprintf "f_script_load: script=[%s]" "$script"
        if [ ! "$script" ]; then
@@ -113,9 +113,18 @@ f_script_load()
                ; do
                        [ -e "$script" ] && break
                done
-       elif [ "$script" = "-" ]; then
+       fi
+
+       local old_interactive=
+       f_getvar $VAR_NONINTERACTIVE old_interactive # save a copy
+
+       # Hint to others that we're running from a script, should they care
+       setvar $VAR_NONINTERACTIVE yes
+
+       if [ "$script" = "-" ]; then
                f_dprintf "f_script_load: Loading script from stdin"
                eval "$( cat )"
+               retval=$?
        else
                f_dprintf "f_script_load: Loading script \`%s'" "$script"
                if [ ! -e "$script" ]; then
@@ -123,7 +132,13 @@ f_script_load()
                        return $FAILURE
                fi
                . "$script"
+               retval=$?
        fi
+
+       [ "$old_interactive" ] &&
+               setvar $VAR_NONINTERACTIVE "$old_interactive"
+
+       return $retval
 }
 
 ############################################################ MAIN
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to