From owner-svn-src-all@FreeBSD.ORG Sun Jan 20 17:48:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0FBC1D41; Sun, 20 Jan 2013 17:48:57 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EA6E2DA1; Sun, 20 Jan 2013 17:48:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0KHmuF9058617; Sun, 20 Jan 2013 17:48:56 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0KHmuuF058616; Sun, 20 Jan 2013 17:48:56 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201301201748.r0KHmuuF058616@svn.freebsd.org> From: Devin Teske Date: Sun, 20 Jan 2013 17:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245695 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jan 2013 17:48:57 -0000 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