Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jan 2013 17:48:56 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245695 - head/usr.sbin/bsdconfig/share
Message-ID:  <201301201748.r0KHmuuF058616@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301201748.r0KHmuuF058616>