summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/share/media/usb.subr
Commit message (Collapse)AuthorAgeFilesLines
* MFC r264840: Implement GEOM based media device classification.dteske2014-05-171-16/+12
|
* MFC r259054:dteske2014-01-151-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Introduce centralized [X]dialog(1) exit codes to `dialog.subr' and make-usedteske2013-10-091-1/+1
| | | | | | | | | | throughout the bsdconfig(8) code. While we're here, add an explicit argument to lvalue-seeking invocations of "return" that previously had no argument. Also, consolidate a single instance of double-newline and remove some comments that are no longer required (given increased readability with new exit codes). Approved by: re (glebius)
* Re-implement $probe_only aspect of f_media_get_TYPE() (where TYPE is cdrom,dteske2013-07-141-7/+9
| | | | | | | | | | | | | | | | | | | | | | | nfs, ftp, http, httpproxy, etc.) and f_device_get() (abstract method for calling aforementioned f_media_get_TYPE()). Previously, if $probe_only was present and non-NULL, the TYPE functions would check for $file and exit with an appropriate error status (success if the file exists and readable, failure otherwise). While this has been retained, a pair of globals has been introduced: $PROBE_EXIST and $PROBE_SIZE (see `/usr/share/bsdconfig/media/common.subr') The $PROBE_EXIST global can be used where you need the functionality of simply testing for existence (previously the _only_ functionality). Meanwhile, the new $PROBE_SIZE global can be used to cause the TYPE function to print the size of the file (in bytes) on standard-out (or -1) if not found or an error occurs. NOTE: If an error occurs, it is logged with the dprintf function, which is visible with `-d' flag or debug=1. In many cases, where you need to get the size of a file _and_ check for its existence, you can use the return status of a $PROBE_SIZE call.
* Fix typos in the BSD License.dteske2013-07-071-2/+2
|
* Be consistent with other usr.sbin programs w/respect to the copyrightdteske2013-07-071-1/+1
| | | | wording ("All rights reserved."); I had the casing wrong on many instances.
* Use f_show_msg() instead of f_dialog_msgbox() where appropriate. The maindteske2013-07-051-1/+1
| | | | | | | | | | | | difference between these two functions: Usage: f_show_msg() $format_string [ $format_args ... ] Usage: f_dialog_msgbox() $text [ $hline ] The former lends itself well to displaying the $msg_* i18n text, prompts, etc. While the latter is better for text you do not control (error strings captured as a response from external commands) -- or if you have to control the hline.
* Implement $probe_only for the media access modules. sysinstall(8) wasdteske2013-07-041-2/+2
| | | | | | | | | | | | | | | | allowed to ignore the probe_only argument of its member functions solely because in the C language, the file accessor methods open and return a file descriptor and reading of the data is optional. In shell, the file accessor methods return data on stdout and that data should not be ignored (large files could block execution). So, we must adhere to the probe_only flags and in some cases (in the case of FTP, for example) change the `get' strategy to simply test existence and return an appropriate status. This was required because the up-coming package management stuff makes heavy use of the probe_only argument to try different package suffixes. Every media access module must implement $probe_only for the `get' accessor.
* Alphabetize library includes.dteske2013-06-211-2/+2
|
* Import media selection/preparation framework (sysinstall inspired). Makesdteske2013-02-251-0/+174
accessing files from various types of media nice and abstracted away from the wet-work involved in preparing, validating, and initializing those types of media. This will be used for the package management system module and other modules that need access to files and want to allow the user to decide where those files come from (either in a scripted fashion, prompted fashion, or any combination thereof). Heavily inspired by sysinstall and even uses the same reserved words so that scripts are portable. Coded over months, tested continuously through- out, and reviewed several times. Some notes about the changes: - Move network-setting acquisition/validation routines to media/tcpip.subr - The options screen from sysinstall has been converted to a dialog menu - The "UFS" media choice is renamed to "Directory" to reflect how sysinstall treats the choice and a new [true] "UFS" media choice has been added that acts on real UFS partitions (such as external disks with disklabels). - Many more help files have been resurrected from sysinstall (I noticed that some of the content seems a bit dated; I gave them a once-over but they could really use an update). - A total of 10 media choices are presented (via mediaGetType) including: CD/DVD, FTP, FTP Passive, HTTP Proxy, Directory, NFS, DOS, UFS, Floppy, USB - Novel struct/device management layer for managing the issue of passing more information than can comfortably fit in an argument list.
OpenPOWER on IntegriCloud