Deleted Added
full compact
variable.subr (245437) variable.subr (247280)
1if [ ! "$_VARIABLE_SUBR" ]; then _VARIABLE_SUBR=1
2#
1if [ ! "$_VARIABLE_SUBR" ]; then _VARIABLE_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/variable.subr 245437 2013-01-14 21:03:34Z dteske $
27# $FreeBSD: head/usr.sbin/bsdconfig/share/variable.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..." variable.subr
34f_include $BSDCFG_SHARE/dialog.subr
35

--- 68 unchanged lines hidden (view full) ---

104#
105# Installs sensible defaults for registered/advertised variables.
106#
107f_variable_set_defaults()
108{
109 #
110 # Initialize various user-edittable values to their defaults
111 #
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." variable.subr
34f_include $BSDCFG_SHARE/dialog.subr
35

--- 68 unchanged lines hidden (view full) ---

104#
105# Installs sensible defaults for registered/advertised variables.
106#
107f_variable_set_defaults()
108{
109 #
110 # Initialize various user-edittable values to their defaults
111 #
112 setvar $VAR_RELNAME "$UNAME_R"
112 setvar $VAR_EDITOR "${EDITOR:-/usr/bin/ee}"
113 setvar $VAR_FTP_STATE "passive"
114 setvar $VAR_FTP_USER "ftp"
115 setvar $VAR_HOSTNAME "$( hostname )"
116 setvar $VAR_MEDIA_TIMEOUT "300"
117 setvar $VAR_NFS_SECURE "NO"
118 setvar $VAR_NFS_TCP "NO"
119 setvar $VAR_NFS_V3 "YES"
120 setvar $VAR_RELNAME "$UNAME_R"
113
114 f_dprintf "f_variable_set_defaults: Defaults initialized."
115}
116
117# f_dump_variables
118#
119# Dump a list of registered/advertised variables and their respective values to
120# $VARIABLE_DUMPFILE. Returns success unless the file couldn't be written. If

--- 32 unchanged lines hidden (view full) ---

153# NULL, otherwise return success.
154#
155f_interactive()
156{
157 local value
158 ! f_getvar $VAR_NONINTERACTIVE value || [ ! "$value" ]
159}
160
121
122 f_dprintf "f_variable_set_defaults: Defaults initialized."
123}
124
125# f_dump_variables
126#
127# Dump a list of registered/advertised variables and their respective values to
128# $VARIABLE_DUMPFILE. Returns success unless the file couldn't be written. If

--- 32 unchanged lines hidden (view full) ---

161# NULL, otherwise return success.
162#
163f_interactive()
164{
165 local value
166 ! f_getvar $VAR_NONINTERACTIVE value || [ ! "$value" ]
167}
168
169# f_netinteractive()
170#
171# Has the user specifically requested the network-portion of configuration and
172# setup to be performed interactively? Returns success if the user has asked
173# for the network configuration to be done interactively even if perhaps over-
174# all non-interactive mode has been requested (by setting nonInteractive).
175#
176# Returns success if $netInteractive is set and non-NULL.
177#
178f_netinteractive()
179{
180 local value
181 f_getvar $VAR_NETINTERACTIVE value && [ "$value" ]
182}
183
161############################################################ MAIN
162
163#
164# Variables that can be tweaked from config files
165#
184############################################################ MAIN
185
186#
187# Variables that can be tweaked from config files
188#
189# Handle Variable Name
166f_variable_new VAR_CONFIG_FILE configFile
167f_variable_new VAR_DEBUG debug
168f_variable_new VAR_DEBUG_FILE debugFile
190f_variable_new VAR_CONFIG_FILE configFile
191f_variable_new VAR_DEBUG debug
192f_variable_new VAR_DEBUG_FILE debugFile
169f_variable_new VAR_NO_ERROR noError
193f_variable_new VAR_DIRECTORY_PATH _directoryPath
194f_variable_new VAR_DOMAINNAME domainname
195f_variable_new VAR_EDITOR editor
196f_variable_new VAR_EXTRAS ifconfig_
197f_variable_new VAR_FTP_DIR ftpDirectory
198f_variable_new VAR_FTP_HOST ftpHost
199f_variable_new VAR_FTP_PASS ftpPass
200f_variable_new VAR_FTP_PATH _ftpPath
201f_variable_new VAR_FTP_PORT ftpPort
202f_variable_new VAR_FTP_STATE ftpState
203f_variable_new VAR_FTP_USER ftpUser
204f_variable_new VAR_GATEWAY defaultrouter
205f_variable_new VAR_HOSTNAME hostname
206f_variable_new VAR_HTTP_FTP_MODE httpFtpMode
207f_variable_new VAR_HTTP_PROXY httpProxy
208f_variable_new VAR_HTTP_PROXY_HOST httpProxyHost
209f_variable_new VAR_HTTP_PROXY_PATH _httpProxyPath
210f_variable_new VAR_HTTP_PROXY_PORT httpProxyPort
211f_variable_new VAR_IFCONFIG ifconfig_
212f_variable_new VAR_IPADDR ipaddr
213f_variable_new VAR_IPV6ADDR ipv6addr
214f_variable_new VAR_IPV6_ENABLE ipv6_activate_all_interfaces
215f_variable_new VAR_MEDIA_TIMEOUT MEDIA_TIMEOUT
216f_variable_new VAR_MEDIA_TYPE mediaType
217f_variable_new VAR_NAMESERVER nameserver
218f_variable_new VAR_NETINTERACTIVE netInteractive
219f_variable_new VAR_NETMASK netmask
220f_variable_new VAR_NETWORK_DEVICE netDev
221f_variable_new VAR_NFS_HOST nfsHost
222f_variable_new VAR_NFS_PATH nfsPath
223f_variable_new VAR_NFS_SECURE nfs_reserved_port_only
224f_variable_new VAR_NFS_TCP nfs_use_tcp
225f_variable_new VAR_NFS_V3 nfs_use_v3
170f_variable_new VAR_NONINTERACTIVE nonInteractive
226f_variable_new VAR_NONINTERACTIVE nonInteractive
227f_variable_new VAR_NO_ERROR noError
228f_variable_new VAR_NO_INET6 noInet6
171f_variable_new VAR_RELNAME releaseName
229f_variable_new VAR_RELNAME releaseName
230f_variable_new VAR_SLOW_ETHER slowEthernetCard
231f_variable_new VAR_TRY_DHCP tryDHCP
232f_variable_new VAR_TRY_RTSOL tryRTSOL
233f_variable_new VAR_UFS_PATH ufs
172
173#
174# Self-initialize unless requested otherwise
175#
176f_dprintf "%s: VARIABLE_SELF_INITIALIZE=[%s]" \
177 variable.subr "$VARIABLE_SELF_INITIALIZE"
178case "$VARIABLE_SELF_INITIALIZE" in
179""|0|[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) : do nothing ;;
180*) f_variable_set_defaults
181esac
182
183f_dprintf "%s: Successfully loaded." variable.subr
184
185fi # ! $_VARIABLE_SUBR
234
235#
236# Self-initialize unless requested otherwise
237#
238f_dprintf "%s: VARIABLE_SELF_INITIALIZE=[%s]" \
239 variable.subr "$VARIABLE_SELF_INITIALIZE"
240case "$VARIABLE_SELF_INITIALIZE" in
241""|0|[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) : do nothing ;;
242*) f_variable_set_defaults
243esac
244
245f_dprintf "%s: Successfully loaded." variable.subr
246
247fi # ! $_VARIABLE_SUBR