summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-01-20 17:48:56 +0000
committerdteske <dteske@FreeBSD.org>2013-01-20 17:48:56 +0000
commitdfd83d50c447f9473cc6dbfcca8d5b14f455c390 (patch)
tree73af954f908122cbf65f9d55d74559d2180ed193 /usr.sbin
parentcbc4c398d44760649fc29143cd80d3d2b15442ed (diff)
downloadFreeBSD-src-dfd83d50c447f9473cc6dbfcca8d5b14f455c390.zip
FreeBSD-src-dfd83d50c447f9473cc6dbfcca8d5b14f455c390.tar.gz
Backward compatibility fix: treat cmds loaded as a script as nonInteractive
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bsdconfig/share/script.subr19
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/bsdconfig/share/script.subr b/usr.sbin/bsdconfig/share/script.subr
index d5a2e93..84d1cab 100644
--- a/usr.sbin/bsdconfig/share/script.subr
+++ b/usr.sbin/bsdconfig/share/script.subr
@@ -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
OpenPOWER on IntegriCloud