script.subr (245695) | script.subr (247280) |
---|---|
1if [ ! "$_SCRIPT_SUBR" ]; then _SCRIPT_SUBR=1 2# | 1if [ ! "$_SCRIPT_SUBR" ]; then _SCRIPT_SUBR=1 2# |
3# Copyright (c) 2012 Devin Teske | 3# Copyright (c) 2012-2013 Devin Teske |
4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/script.subr 245695 2013-01-20 17:48:56Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/script.subr 247280 2013-02-25 19:55:32Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." script.subr | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." script.subr |
34f_include $BSDCFG_SHARE/device.subr |
|
34f_include $BSDCFG_SHARE/variable.subr | 35f_include $BSDCFG_SHARE/variable.subr |
36f_include $BSDCFG_SHARE/media/any.subr 37f_include $BSDCFG_SHARE/media/tcpip.subr |
|
35 36############################################################ GLOBALS 37 38RESWORDS= 39 40############################################################ FUNCTIONS 41 42# f_resword_new $resword $function --- 27 unchanged lines hidden (view full) --- 70# 71# NOTE: $noError is unset after every call. 72# 73f_dispatch() 74{ 75 local func="$1" resword="${2:-$1}" 76 f_dprintf "f_dispatch: calling resword \`%s'" "$resword" 77 eval $func | 38 39############################################################ GLOBALS 40 41RESWORDS= 42 43############################################################ FUNCTIONS 44 45# f_resword_new $resword $function --- 27 unchanged lines hidden (view full) --- 73# 74# NOTE: $noError is unset after every call. 75# 76f_dispatch() 77{ 78 local func="$1" resword="${2:-$1}" 79 f_dprintf "f_dispatch: calling resword \`%s'" "$resword" 80 eval $func |
78 local retval=$? _ignore_this_error 79 f_getvar $VAR_NO_ERROR _ignore_this_error 80 [ $retval -eq $SUCCESS ] || | 81 local retval=$? 82 if [ $retval -ne $SUCCESS ]; then 83 local _ignore_this_error 84 f_getvar $VAR_NO_ERROR _ignore_this_error |
81 [ "$_ignore_this_error" ] || f_die $retval \ | 85 [ "$_ignore_this_error" ] || f_die $retval \ |
82 "$msg_command_failed_rest_of_script_aborted" "$resword" | 86 "$msg_command_failed_rest_of_script_aborted" "$resword" 87 fi |
83 unset $VAR_NO_ERROR 84} 85 86# f_script_load [$file] 87# 88# Load a script (usually filled with reswords). If $file is missing or NULL, 89# use one of the following instead (in order): 90# --- 50 unchanged lines hidden (view full) --- 141 return $retval 142} 143 144############################################################ MAIN 145 146# 147# Reserved words meant for scripting 148# | 88 unset $VAR_NO_ERROR 89} 90 91# f_script_load [$file] 92# 93# Load a script (usually filled with reswords). If $file is missing or NULL, 94# use one of the following instead (in order): 95# --- 50 unchanged lines hidden (view full) --- 146 return $retval 147} 148 149############################################################ MAIN 150 151# 152# Reserved words meant for scripting 153# |
154f_resword_new deviceRescan f_device_rescan |
|
149f_resword_new dumpVariables f_dump_variables 150f_resword_new loadConfig f_script_load | 155f_resword_new dumpVariables f_dump_variables 156f_resword_new loadConfig f_script_load |
157f_resword_new mediaClose f_media_close 158f_resword_new mediaGetType f_media_get_type 159f_resword_new mediaOpen f_media_open 160f_resword_new mediaSetCDROM f_media_set_cdrom 161f_resword_new mediaSetDOS f_media_set_dos 162f_resword_new mediaSetFTP f_media_set_ftp 163f_resword_new mediaSetFTPActive f_media_set_ftp_active 164f_resword_new mediaSetFTPPassive f_media_set_ftp_passive 165f_resword_new mediaSetFTPUserPass f_media_set_ftp_userpass 166f_resword_new mediaSetFloppy f_media_set_floppy 167f_resword_new mediaSetHTTP f_media_set_http_proxy 168f_resword_new mediaSetHTTPProxy f_media_set_http_proxy 169f_resword_new mediaSetNFS f_media_set_nfs 170f_resword_new mediaSetUFS f_media_set_ufs 171f_resword_new mediaSetUSB f_media_set_usb 172f_resword_new optionsEditor f_media_options_menu 173f_resword_new tcpMenuSelect f_dialog_menu_select_tcp |
|
151 152f_dprintf "%s: Successfully loaded." script.subr 153 154fi # ! $_SCRIPT_SUBR | 174 175f_dprintf "%s: Successfully loaded." script.subr 176 177fi # ! $_SCRIPT_SUBR |