Commit Graph

315 Commits

Author SHA1 Message Date
gjb
4a6e65ab03 Export 'REPOS_DIR' when the selected source medium for package
installation is cdrom.  This enables bsdconfig(8) to make use
of the on-disc pkg(8) repository configuration, which fixes
package selection and installation from the dvd installer.

MFC after:	3 days
M-MFC-With:	r259426
X-MFC-Before:	-RC3
Sponsored by:	The FreeBSD Foundation
2013-12-15 20:47:27 +00:00
dteske
743b336f11 Fix failed attempt to send pkg(8) stderr to /dev/null
MFC after:	3 days
2013-12-09 01:30:20 +00:00
dteske
ea67b8239d Performance and debugging enhancements:
+ Remove UNAME_P=$(...) from startup/misc -- already supplied by common.subr
+ Use f_getvar instead of $(eval echo \$$var) -- f_getvar is sub-shell free
+ Add `-e' and `-k var' options to f_eval_catch -- increasing use-cases
+ Use f_eval_catch to display errors on failure -- reducing duplicated code
+ Use f_eval_catch when we need output from a command -- improving debugging
+ Optimize f_isinter of strings.subr for performance -- now sub-shell free
+ Improve error checking on pidfiles -- using f_eval_catch and f_isinteger
+ Use $var_to_set arg of f_ifconfig_{inet,netmask} -- eliminate sub-shells
+ Use f_sprintf instead of $(printf ...) -- consolidate sub-shells
+ Use $var_to_set arg of f_route_get_default -- eliminate sub-shells
+ Add f_count to replace $(set -- ...;echo $#) -- eliminate sub-shells
+ Add f_count_ifs to replace $(IFS=x;set -- ...;echo $#) -- no sub-shells
+ Replace var="$var${var:+ }..." in loops with var="$var ..." with a follow-
  up var="${var# }" to trim leading whitespace -- optimize loops
+ Use $var_to_set arg of f_resolv_conf_nameservers -- eliminate sub-shells
+ Comments for the f_eval_catch function
+ Remove a duplicate `local ... desc ...' in f_device_get_all of device.subr
+ Use $var_to_set arg of f_device_capacity -- eliminate sub-shells
+ Whitespace fixes in f_dialog_init of dialog.subr
+ Optimize f_inet_atoi of media/tcpip.subr for performance -- sub-shell free
+ In several cases, send stderr to /dev/null -- clean up runtime execution
+ Change f_err of common.subr to go to program stderr not terminal stderr,
  allowing redirection of output from functions that use f_err
+ Disable debugging when using f_getvar to get variable argument to
  f_startup_rcconf_map_expand of startup/rcconf.subr
+ Use f_replace_all instead of $(echo ... | tr | sed) -- performance
+ Add a $var_to_set option to f_index_{file,menusel_{command,keyword}} of
  common.subr -- centralize sub-shells
2013-12-07 00:31:01 +00:00
gjb
e38b641695 Fix PKG_ABI detection in bsdconfig(8) after pkg-1.2 is released, since
the format of 'pkg -vv' output has changed.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-12-02 19:02:58 +00:00
dteske
9a51d4481d Sort function output on name of the function. 2013-11-30 23:47:18 +00:00
dteske
2ce888629f Fix an issue where additional lines of a function definition didn't line
up with the primary (leading) line of syntax.
2013-11-29 04:09:25 +00:00
dteske
a0414c7f8e Fix an issue where the leading `+' sign before a function name was not
displayed unless color was requested.
2013-11-29 04:08:21 +00:00
dteske
648f0dc2b1 Sort messages. 2013-11-25 20:37:53 +00:00
dteske
94f555fd4f Add missing newline to printf format string. 2013-11-25 20:29:26 +00:00
dteske
765987f58b Add missing $' before variable name pgm'. Unnoticed unless running
parallel concurrent copies of `bsdconfig syscons_ttys'.
2013-11-25 20:28:39 +00:00
dteske
62d9fef816 Improve network device scanning in the netdev module. First, make it use the
`device.subr' framework (improving performane and reducing sub-shells). Next
improve the `device.subr' framework itself. Make use of the `flags' device
struct member for network interfaces to indicate if an interface is Active,
Wired Ethernet, or 802.11 Wireless. Functions have been added to make checks
against the `flags' bit-field quick and efficient. Last, add function for
rescanning the network to update the device registers. Remove an unnecessary
local (ifn) while we're here (use already provided local `if').
2013-11-22 00:32:32 +00:00
dteske
a3300300c5 f_die() (see `bsdconfig includes -dF die') uses a dialog box (and has been
documented as such; I just forgot). These utilities are command-line only
and as such should stick to either using f_die without arguments or printf)
2013-11-21 19:43:45 +00:00
dteske
94a01d687e Remove unused line -- cruft left over from SVN r258360. 2013-11-21 17:49:56 +00:00
dteske
1a9d70f77c Quote the interface name for good measure. 2013-11-21 03:22:13 +00:00
dteske
2ca200e7c5 Update function description for API tool:
bsdconfig includes -dF f_validate_hostname
2013-11-20 22:12:21 +00:00
dteske
c1a5bcc9fd Make -d' implicitly enable -f' for simplification. 2013-11-20 22:11:42 +00:00
dteske
05ae219f76 Add a `-d' flag for printing the description of each function. 2013-11-20 21:05:33 +00:00
dteske
f30f059959 Add new `includes' module for exploring the bsdconfig(8) API. 2013-11-20 20:37:21 +00:00
dteske
f5ceacf868 Whitespace, style, sub-shells, and standardize variable name
(s/interfaces/menu_list/).
2013-11-20 00:17:57 +00:00
trhodes
a5932a7cd3 "Tim trailing" -> "Trim trailing" 2013-11-19 19:55:41 +00:00
dteske
04077d5c5d Fix package installation from physical media such as DVD.
Discussed with:	re (gjb)
MFC after:	3 days
2013-11-17 17:53:55 +00:00
dteske
358285463c Always shutdown the media when we're exiting the packages module (prevents
errors on re-entry for physical media). Also, while we're here, stop
ejecting the CDROM when we're done with it (but leave the functions for
later use so that we could perhaps -- from the installer standpoint -- use
it to eject the media after an install).

MFC after:	3 days
2013-11-17 17:48:55 +00:00
dteske
f5e406a2b5 Improve debugging with f_eval_catch() introduced by SVN r257784 and also
fix a bug where "pkg update" was not getting the value of PACKAGESITE.
NB: PACKAGESITE needs to be explicitly exported in support of children.

MFC after:	3 days
2013-11-17 17:42:15 +00:00
dteske
23a2aa8b48 Kick an unused orphan to the curb ;) 2013-11-17 17:35:51 +00:00
dteske
7d9ef1b961 Move function name declaration to top of function (where it is closest to
the value it needs to be), s/fname/funcname/g, and move function name usage
to within printf format string.

MFC after:	3 days
2013-11-17 17:31:07 +00:00
dteske
6d2ad19653 Comments. 2013-11-12 04:02:51 +00:00
dteske
34ec6f44ca Remove the env(1) but keep the var. 2013-11-11 02:02:05 +00:00
gjb
c7e17b4285 Unbreak the installer on head/:
When bsdinstall(8) sources the bsdconfig(8) common.subr file,
  PKG_ABI is set by calling 'pkg -vv' and searching for the ABI
  pkg(8) will use.

  When pkg(8) is run for the first time, the bootstrap process
  is run, which prompts for 'y/N' input from stdin if running with
  TERM set.

  Since TERM is set and it is the first time pkg(8) is run, which
  happens automatically, bsdinstall(8) hangs waiting for user input
  which is never displayed since a specific line is expected by
  awk(1), and stdin is expected by pkg(8).

  Set ASSUME_ALWAYS_YES=1, which will cause pkg(8) to assume the
  '-y' flag is also used for the bootstrap process, allowing
  bsdinstall(8) to proceed to the keymap lookup, otherwise
  bsdinstall(8) appears to hang after selecting 'Install' from the
  menu on first boot from CDROM.
2013-11-11 01:42:59 +00:00
dteske
77f96c6225 Use `pkg -vv' to obtain ABI for validating a chosen media server (done
prior to diving head-long into a pkg-update(8), et. al). This should
also be more future-proof than what was being done just before this.
2013-11-07 21:38:46 +00:00
dteske
1d85ee309f Fix cosmetic typos (since the typo's in the variable names were copied
and pasted, it wasn't noticed).
2013-11-07 21:16:32 +00:00
dteske
1582887770 Replace pkg-tools with pkgng. 2013-11-07 12:40:42 +00:00
dteske
e95575f2d0 Fix an off-by-one error that was causing menus to look funny. 2013-11-07 11:20:50 +00:00
dteske
452ab4534d Comments. 2013-11-07 10:48:00 +00:00
dteske
8207da2a55 Add f_sprintf() and f_vsprintf() to go along with previously added
f_snprintf() and f_vsnprintf() (size-constraint) functions.
2013-11-07 10:47:12 +00:00
dteske
5d865ae5b7 Fix a bug where a format with leading `-' could be mistaken for printf
getopts argument(s).
2013-11-07 10:45:25 +00:00
dteske
e2c65ece90 Comments. 2013-11-07 10:44:24 +00:00
dteske
a6546392d4 Add some helpful debugging (showing the resolved host address). 2013-11-07 10:40:19 +00:00
dteske
8401fded17 Fix a silly bug that would result in attempting to fetch (literally) the
URI "httpDirectory" (oops).
2013-11-07 10:36:24 +00:00
dteske
12ce64e99c Use dialog(1) to obtain maximum-size; stty fails when running in a pipe-
chain. This allows dialogs to reach full size even when executed as an
rvalue operand to a pipe (e.g., cat file | bsdconfig -f-).
2013-11-07 10:30:20 +00:00
dteske
ddc2ccec80 Add an f_eval_catch() function for debugging individual commands in a
series of commands. Accepts the `-d' flag as a first argument to skip
displaying messages in a dialog box. The command is logged as it
appears to the shell prior to the first pass of parameter expansion to
allow copy/pasting into a real shell (opposed to simply echo'ing the
command which would produce debug output that has undergone at least one
pass of parameter expansion, thus no-longer copacetic for copy/paste).
Takes printf(1) style syntax and a utility identifier for error messages.
2013-11-07 10:28:12 +00:00
dteske
209f30e060 Add an f_show_err() function -- acts pretty much the same as f_show_msg()
except it stylizes the msgbox widget to indicate an Error has occurred by
setting an appropriate title and default message.
2013-11-07 10:23:37 +00:00
dteske
4bd843efbd Add global DEBUG_INITIALIZE_FILE environment variable for controlling
whether the debugFile is truncated upon initialization (useful for when
children implicitly re-initialize debugging and you want children to
append to your existing debugFile).
2013-11-07 10:20:19 +00:00
dteske
5a453bc0fc Comments. Replace a funny syntax with f_isset() while here. 2013-11-07 10:14:40 +00:00
dteske
a6fcf67992 Whitespace. 2013-11-07 10:09:01 +00:00
dteske
1070afa220 Fix a bug that resulted in spurious error message "f_media_shutdown_http:
not found" from /usr/libexec/bsdconfig/030.packages/packages.
2013-11-06 18:43:16 +00:00
dteske
c6bf517ec1 Add support for dereferencing SRV records via f_host_lookup(). Takes the
media choice into consideration for determining the appropriate SRV records
to query (e.g., _http._tcp, _ftp._tcp, _nfs.tcp, _nfs.udp, etc.).
2013-11-06 18:26:38 +00:00
dteske
7354418b37 Fix signed integer overflow detection in f_expand_number() of strings.subr.
Approved by:	re (glebius)
2013-10-12 19:52:27 +00:00
dteske
6c0de4cabf Add new f_expand_number() (shadowing expand_number(3)).
Approved by:	re (glebius)
2013-10-11 20:12:30 +00:00
dteske
6a1ba7cf53 Store descriptions for DEVICE_TYPE_DISK and fix static-defaults mapping.
Add a default description for bhyve block disk device while we're here.

Approved by:	re (glebius)
2013-10-11 20:10:41 +00:00
dteske
b4442e2574 Add $VAR_ZFSINTERACTIVE (zfsInteractive) and new f_zfsinteractive() for
determining when a script wants to be nonInteractive but selectively
wants ZFS operations to be *interactive* (this is analgous to already
existing $VAR_NETINTERACTIVE (netInteractive) and f_netinteractive()
used for the same purpose (script wants to be nonInteractive but wants
network operations to be *interactive*).

Approved by:	re (glebius)
2013-10-11 20:08:34 +00:00