Commit Graph

148 Commits

Author SHA1 Message Date
dteske
7c4460149d Centralize standard getopts arguments, both for convenience and to correct
a bug in which certain combinations of arguments produced unexpected results
such as `-dX' (now properly produces debugging and X11), `-XS' (now properly
produces X11 in secure mode), `-df-' (enables debugging when reading a
script from standard-input, etc. Multi-word variations such as `-d -X',
`-X -S', `-d -f-', `-d -f -', etc. also work as expected. Also tested were
variations in argument order, which are now working as expected.
2013-05-14 03:21:13 +00:00
dteske
df35570eb7 Comment. 2013-05-12 00:50:18 +00:00
dteske
98359e968c Fix i18n violations in the package management module. A few words like
`packages', `installed', and `selected' were not internationalized.
2013-05-12 00:46:18 +00:00
dteske
04e3ea4515 Remove duplicated string. 2013-05-12 00:44:40 +00:00
dteske
8eca6f86f2 Comments. 2013-05-12 00:40:49 +00:00
dteske
1cc44f2008 Whitespace. 2013-05-12 00:39:25 +00:00
dteske
ce591b770b Fix a bug that would cause the category menu to display the wrong value
for number of packages available in the "All" category. Problem caused by
re-using a variable that was still needed; fixed by variable name change.
2013-05-09 16:09:39 +00:00
dteske
01469a1863 Commit first portion of package module -- this includes the ability to view
categories, view packages, mark packages for installation, de-installation,
or re-installation, calculate and track dependencies, as well as ability to
review selections.

Still to come is the actual processing of selections (performing the
various actions associated with the user's selections, such as installing
dependencies first, then selections, etc.).
2013-05-07 05:40:20 +00:00
dteske
10fa20ef4f Explicitly track "script.subr" which wasn't showing up in the graph because
it's not used by anything within bsdconfig nor any modules (rather, the
script.subr include is designed to be used externally -- nonetheless we
want to track it in the modular graph outputs showing includes).
2013-05-07 04:47:56 +00:00
dteske
dd7d8328e3 Recursively calculate includes. This solves the problem of some includes
missing from the graph, but it also unfortunately forces yet another bug
in graphviz dot(1) to appear. When edge labels are enabled (using '\T')
with this many edges, dot(1) will do bad things in init_rank() and often
crash. So while we're here, let's disable edge labels for the include-
relationship graph feature.
2013-05-07 04:46:08 +00:00
dteske
3876e4f11c Remove unused variables. 2013-05-07 04:40:57 +00:00
dteske
428a9704d2 Alphabetize strings by variable names. 2013-05-07 04:23:50 +00:00
dteske
242810308a Re-organize and add missing installVarDefaults and mediaSetDirectory. 2013-05-07 04:03:59 +00:00
dteske
26fb28c83e Add f_isset() utility subroutine for checking if a variable is set but in
a more readable fashion.
2013-05-07 03:57:45 +00:00
dteske
d1ece6874f Properly sanitize --menu results (guards against Gtk library warnings from
X11 side of things from bleeding into Xdialog(1) stderr output). It should
be duely noted that such errors are not a by-product of anything in the
Xdialog(1) utility or API, but optional libraries that it can link against
(such as Gtk1 versus Gtk2; if you compile xdialog from ports against Gtk2
AND misconfigure your fonts or generally make Gtk2 unhappy, these warning
messages can bleed into the captured stderr -- that is we we sanitize!).
2013-04-26 21:28:24 +00:00
dteske
8d0cd52a54 Comments. 2013-04-26 21:19:05 +00:00
dteske
a574fde5d5 Fix copy/paste error. 2013-04-24 03:15:55 +00:00
dteske
aed82e9e48 Add missing include. 2013-04-23 22:55:59 +00:00
dteske
7d6b520e24 Prevent device.subr from auto-loading in the nameservers module.
This module doesn't need device support (but device.subr is loaded
indirectly through media/tcpip.subr which contains resolv stuff).
2013-04-23 00:10:33 +00:00
dteske
198c9cae20 Preserve debugFile preference across the exec boundary. 2013-04-22 21:19:44 +00:00
dteske
68006a3d42 Partially uncommit r249779. The changes to share/common.subr were good
while the remaining changes were part of a much larger ``secret sauce''
involved in an up-coming commit that I'm still laboring on.
2013-04-22 21:11:27 +00:00
dteske
1a05c430de Fix "-D file" to automagically enable debugging if not explicitly disabled. 2013-04-22 21:03:44 +00:00
dteske
8e151bb482 Clarify to the user the amount of time required to load the menus for
each view in the details dialog.
2013-04-22 06:30:29 +00:00
dteske
f87348f820 New helper functions for common widgets. 2013-04-22 06:28:45 +00:00
dteske
55ba192b5b Proper fix for copy/paste error (first attempt r249756). 2013-04-22 06:27:14 +00:00
dteske
6b10ce1ca9 Fix a copy/paste error. 2013-04-22 06:20:34 +00:00
dteske
bd5972fc3a Update comment for accuracy. 2013-04-22 06:13:30 +00:00
dteske
41ba2f30cd Style nit (to be consistent across project). 2013-04-22 06:12:22 +00:00
dteske
6776c629e5 Fix two bugs when setting up a plip interface. First, dhcp status was not
being properly cleared each iteration of the loop. Second, values weren't
properly quoted when sent to the editor function.
2013-04-22 06:10:27 +00:00
dteske
8f385d0e89 UI improvements. First, implement --default-item whenever and wherever
possible to save keystrokes. Second, overhaul startup/rcdelete for much
improved performance. Last, but not least, kill-off useage of --clear
and implement --keep-tite in harmony to minimize jarring transitions.
Also, fix local variable names where necessary while we're here with
other minor comment-enhancements/typo-corrections.
2013-04-22 05:52:06 +00:00
dteske
2cbbbe9342 Use new f_getvar for clarity and general code follow-up to r249746. 2013-04-22 05:32:27 +00:00
dteske
6089bf07c7 Add new flags -d' (sets debug=1) and -D file' (sets debugFile) and
improve debugging initialization. Also fixup USAGE statements while we're
here. Also, change initialization of main program to _not_ change working
directory, allowing the debugFile to be relative without confusion.
2013-04-22 05:02:34 +00:00
mav
e24314009c Remove some more references to legacy ATA.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2013-04-04 12:03:30 +00:00
dteske
1f658c88be Import media selection/preparation framework (sysinstall inspired). Makes
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.
2013-02-25 19:55:32 +00:00
dteske
7d5f9c1825 Fix typo and update copyright. 2013-02-25 19:14:06 +00:00
dteske
df32e67985 Remove NO_OBJ from Makefiles that generate manuals because this causes the
GZIP compressed manuals to appear in ./src instead of the appropriate obj dir.

PR:		conf/175844
Submitted by:	Dominique Goncalves <dominique.goncalves@gmail.com>
2013-02-08 11:14:01 +00:00
dteske
dfd83d50c4 Backward compatibility fix: treat cmds loaded as a script as nonInteractive 2013-01-20 17:48:56 +00:00
dteske
9bcfc5995d Don't use f_show_msg() unless printf(1) syntax is required (this reduces the
number of unnecessary forks).
2013-01-14 21:03:34 +00:00
dteske
45e98a4654 Add new f_yesno/f_noyes wrapper functions (which take printf(1) syntax). 2013-01-14 01:15:25 +00:00
dteske
1e25b1497a Add missing dialog(1) arguments to internationalize "Help"-button label. 2013-01-14 01:09:23 +00:00
dteske
46b98d7f74 Update copyright following last commit. 2013-01-07 00:18:03 +00:00
dteske
b9b77b44df Add nonInteractive support to f_dialog_yesno/noyes(). 2013-01-07 00:15:52 +00:00
dteske
90eed83cac Update copyrights and dates following last commit. 2013-01-06 18:18:09 +00:00
dteske
57018d79b2 Add support for scripting (sysinstall style).
Reviewed by:	jilles
2013-01-05 02:08:47 +00:00
dteske
d69819c426 Comments. 2013-01-03 15:48:00 +00:00
dteske
5a7a099d47 Comments. 2012-12-29 00:30:30 +00:00
dteske
d79ae35098 Add missing enforcement of height restriction after minor adjustment. 2012-12-29 00:06:26 +00:00
dteske
7b627c0586 Add support for running without a controlling terminal (for example, when
running as an rvalue to a pipe).
2012-12-29 00:01:24 +00:00
dteske
34882b31ed Allow debug output to be logged to a file (set $debugFile to target pathname)
or both stdout and a file (precede $debugFile pathname with a plus-sign, `+').
2012-12-28 23:49:17 +00:00
dteske
b91b6fc81b Whitespace. 2012-12-28 23:40:13 +00:00
dteske
ff855cec66 Fix incorrect function name. s/[[:<:]]dialog_clear/f_&/ 2012-12-28 23:27:17 +00:00
dteske
29c6e27591 Comments and fit to 80-columns. 2012-12-27 07:52:50 +00:00
dteske
aa703b25c0 Add more debugging to help with diagnosis of program-flow when needed. 2012-12-25 10:47:45 +00:00
dteske
2646f7c5d8 Remove unnecessary duplicate initialization of the dialog(1) API (automatically
bootstrapped on-include unless DIALOG_SELF_INITIALIZE is set to NO before-hand)
2012-12-25 09:30:25 +00:00
dteske
777c7fa05d Split dialog(1)-based validators for hostname/netmask into two, providing
transparent validators that can be used free of dialog(1) where needed.

Syntax/return of the original dialog(1)-based validators remains unchanged.
2012-12-21 21:33:47 +00:00
dteske
ddf809931f Remove unused include. 2012-12-21 21:03:34 +00:00
dteske
9f0941e667 Change axiom for initialization. Including script can disable (default)
automatic initialization by setting appropriate variable to particular value.
2012-12-21 20:46:58 +00:00
dteske
2bedb4fa3d Remove erroneous use of "local" (not in a function). 2012-12-21 20:36:12 +00:00
dteske
ea3604ca08 New f_show_info() function for dialog(1) --infobox using printf(1) syntax. 2012-12-21 20:29:28 +00:00
dteske
9edf4bc88d Use f_show_help() where printf(1) syntax is desired. 2012-12-21 20:11:41 +00:00
dteske
10fd5103d0 Improve the debugging abilities and clean up debug messages. In most cases,
all one has to do is set the environment variable DEBUGGING to get the debug
messages to appear on the console.
2012-12-21 19:26:17 +00:00
dteske
5e7ea05b1a Add much-needed dialog(1) --inputbox function for simplifying the process of
requesting input from the user.
2012-12-21 18:58:19 +00:00
dteske
72035ea1e4 Allow setting of NULL titles with f_dialog_[back]title().
Approved by:	adrian (co-mentor) (implicit)
2012-11-27 22:14:22 +00:00
dteske
996ec077c4 Change self-initialization to occur when loaded versus the previous behavior
which was to self-initialize during the first function-call. This didn't work
so well because the first call was may or may-not be within a sub-shell
(which prevented proper setup of the pass-thru file descriptor, resulting in
dialogs that would not display).

Approved by:	adrian (co-mentor) (implicit)
2012-11-27 22:11:53 +00:00
dteske
f0cd99e6f6 Comments.
Approved by:	adrian (co-mentor) (implicit)
2012-11-27 22:05:01 +00:00
dteske
048b913826 Split IP address validation routines and improve error detection for dotted-
quad notation in IPv6 addresses.

Approved by:	adrian (co-mentor) (implicit)
2012-11-25 10:37:10 +00:00
dteske
1b9b8a999d Whitespace.
Approved by:	adrian (co-mentor) (implicit)
2012-11-24 07:02:31 +00:00
dteske
4df3510526 Add IPv6 address-validation routine.
Approved by:	adrian (co-mentor) (implicit)
2012-11-24 06:27:46 +00:00
dteske
71e5cb8556 Replicate a feature from sysinstall documented in
stable/9/usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):

If /usr/sbin/sysinstall is linked to another filename, say
`/usr/local/bin/configPackages', then the basename will be used
as an implicit command name.

To get a list of modules you can link to, see `bsdconfig -h' output.

Approved by:	adrian (co-mentor) (implicit)
2012-11-16 00:59:11 +00:00
dteske
61892356da Resurrect and integrate stable/9/usr.sbin/sysinstall/help/usermgmt.hlp
Approved by:	adrian (co-mentor) (implicit)
2012-10-26 03:20:04 +00:00
dteske
713eda73ba Remove unnecessary quotation to clean things up.
Approved by:	adrian (co-mentor) (implicit)
2012-10-26 02:50:14 +00:00
dteske
66f986a463 Don't mask fwe(4) lp(4) or plip(4) devices from ifconfig(8) list.
Approved by:	adrian (co-mentor) (implicit)
2012-10-26 02:49:12 +00:00
dteske
48d14074ad Resurrect and integrate stable/9/sysinstall/help/tcp.hlp
Approved by:	adrian (co-mentor) (implicit)
2012-10-26 02:45:29 +00:00
dteske
5bb808b28d Tighten-up displays that use a NULL prompt (e.g., networking and usermgmt).
Approved by:	adrian (co-mentor) (implicit)
2012-10-26 01:47:59 +00:00
dteske
0f431e422c Fix copy/paste error.
Approved by:	adrian (co-mentor) (implicit)
2012-10-26 00:46:09 +00:00
dteske
28676bbae2 Switch from using a msgbox to display help files to a textbox instead. The
problem with using a msgbox was one of truncation in the case of Xdialog(1)
and lack of screen real-estate (since the msgbox is not scrollable in X11
while a textbox is).

The textbox renders the text much better and is more appropriate for this
type of data display.

Approved by:	adrian (co-mentor) (implicit)
2012-10-26 00:31:25 +00:00
dteske
6e396e7bb6 When Xdialog(1) is passed a NULL argument to its `--help' option, Xdialog(1)
acts like dialog(1) in that it returns exit status 2 when the help button is
chosen.

Approved by:	adri (co-mentor) (implicit)
2012-10-25 21:04:11 +00:00
dteske
83ab66c211 Resurrect usage.hlp and securelevel.hlp from sysinstall(8) and integrate them
into bsdconfig(8).

Approved by:	adrian (co-mentor) (implicit)
2012-10-22 18:01:38 +00:00
dteske
2b4f8b4cff More-accurately replicate the help system from sysinstall(8). However, also
improve upon the system by giving the user a "Help" button instead of requiring
the user to press F1.

NOTE: In FreeBSD-9 and higher, dialog(1) does not support the F1 hook, so the
      mechanism for providing help to the user had to be changed to a button.

This now means we can resurrect *.hlp files from usr.sbin/sysinstall/help/ as-
is and reusing them as-needed in bsdconfig (holding to the goal of losing as
little functionality from sysinstall as possible).

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-18 18:43:54 +00:00
dteske
08df5b7fb0 Fix a bug where blank lines were not being counted (because awk's split()
function returns zero when $0 is the NULL string).

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-18 17:09:45 +00:00
dteske
5427f0b2a0 Fix typo.
Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-18 07:55:09 +00:00
dteske
6defc54cbd Ask to become root via sudo(8) and give user ability to save this preference.
Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-17 21:48:45 +00:00
dteske
1388f55af3 SVN r240684 broke the ability of the dot module to map include dependencies.
Teach the dot module about the new location these includes moved to (as part
of r240684) and clean things up a bit.

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-13 03:56:33 +00:00
joel
e9b754bcb5 Minor mdoc fixes. 2012-10-07 19:53:04 +00:00
dteske
ae42961686 Import sysutils/sysrc from the ports tree (current version 5.1). Importing
disconnected under the WITH_BSDCONFIG flag (a good idea since this version of
sysrc(8) indeed requires the `sysrc.subr' module installed by bsdconfig(8)).

Multiple reasons sysrc should not simply continue to live in ports. The most
important being that it is tightly coupled with the base.

Approved by:	adrian (co-mentor)
2012-10-03 02:32:47 +00:00
dteske
e094bc67f5 Allow deferred word-splitting via f_sysrc_get() by allowing $IFS in the
"clean-room" environment used to query rc.conf(5) parameters.

This brings bsdconfig(8)'s sysrc.subr in-line with both the sysrc(8) manual
[provided by sysutils/sysrc] and sysrc(8)'s own sysrc.subr (now identical to
bsdconfig(8)'s sysrc.subr as of this patch).

Finally, this will allow a clean import of sysutils/sysrc (sans sysrc.subr,
already provided here).

Reviewed by:	jilles
Approved by:	adrian (co-mentor)
2012-09-29 03:41:21 +00:00
dteske
8f5dd3a88f Sanitize varname argument in f_sysrc_find. This is as much for security as it
is for sanity.

Reviewed by:	jilles
Approved by:	adrian (co-mentor)
2012-09-28 01:39:25 +00:00
dteske
5a93cdb01d Always use RC_CONFS when set, even if NULL. Previously only used if non-NULL.
Reviewed by:	jilles, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-09-23 17:47:01 +00:00
dteske
ec17dd03e0 jilles accurately advises that, in the context of shell redirection, the `:'
builtin is processed specially and thus the `: > file' syntax for example
will cause premature termination of the current shell on redirection-error.

The `true' builtin on the other-hand is not included in this special
processing (for compatibility reasons to satisfy legacy scripts programmed
for systems where `true' is not a builtin).

Change bare `: > file' syntax into `true > file' syntax to prevent premature
shell termination in the event of redirection-error.

NOTE: Instances of `: > file' that appear within a sub-shell have been left
unmodified as these will not cause premature termination of the main script.

Reviewed by:	jilles, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-09-22 22:16:07 +00:00
dteske
a74ee85809 Replace "( : ${var?} )" syntax with better "[ ${var+set} ]" syntax.
Reviewed by:	jilles, adrian (co-mentor)
Approved by:	jilles, adrian (co-mentor)
2012-09-22 04:04:02 +00:00
dteske
0552e7d2c3 Spelling and whitespace corrections.
Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-09-22 03:11:35 +00:00
dteske
5bd90f70ae Reverse SVN r240770 -- jilles@ made a suggestion that allowed us to redesign
our embedded rescue environment to support /dev/null making r240770 obsolete.

Reviewed by:	jilles, adrian (co-mentor)
Approved by:	jilles, adrian (co-mentor)
2012-09-21 19:03:25 +00:00
dteske
36137540d6 Replace redirections to /dev/null with "close file-descriptor" syntax (>&-).
Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-09-21 01:36:20 +00:00
dteske
f628c47944 Change all invocations of dialog(1) to no-longer require temporary files.
This allows bsdconfig to -- like bsdinstall -- operate from read-only media.

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-09-20 23:44:13 +00:00
dteske
282d6b7f2c Move major includes into /usr/share/bsdconfig for easy external access.
Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-09-18 22:28:42 +00:00
eadler
8600cbb5b6 Correct double "the the"
Approved by:	cperciva
MFC after:	3 days
2012-09-14 21:28:56 +00:00
joel
197aac3869 Mdoc and whitespace fixes. 2012-07-14 06:17:17 +00:00
dteske
3981b9b76a Import bsdconfig(8) as a replacement for the post-install abilities of
deprecated sysinstall(8). NOTE: WITH_BSDCONFIG is currently required.

Submitted by:	Devin Teske (dteske), Ron McDowell <rcm@fuzzwad.org>
Reviewed by:	Ron McDowell <rcm@fuzzwad.org>
Approved by:	Ed Maste (emaste)
2012-07-14 03:16:57 +00:00