2 * The new sysinstall program.
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated for what's essentially a complete rewrite.
8 * Jordan Hubbard. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer,
15 * verbatim and that no modifications are made prior to this
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include "sysinstall.h"
39 * This is called from the main menu. Try to find a copy of Lynx from somewhere
40 * and fire it up on the first copy of the handbook we can find.
43 docBrowser(dialogMenuItem *self)
46 char *browser = variable_get(VAR_BROWSER_PACKAGE);
48 if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
49 msgConfirm("This option may only be used after the system is installed, sorry!");
53 /* First, make sure we have whatever browser we've chosen is here */
54 if (!package_installed(browser)) {
55 ret = package_add(browser);
56 if (DITEM_STATUS(ret) != DITEM_SUCCESS) {
57 msgConfirm("Unable to install the %s HTML browser package. You may\n"
58 "wish to verify that your media is configured correctly and\n"
59 "try again.", browser);
64 if (!file_executable(variable_get(VAR_BROWSER_BINARY))) {
65 if (!msgYesNo("Hmmm. The %s package claims to have installed, but I can't\n"
66 "find its binary in %s! You may wish to try a different\n"
67 "location to load the package from (go to Media menu) and see if that\n"
68 "makes a difference.\n\n"
69 "I suggest that we remove the version that was extracted since it does\n"
70 "not appear to be correct. Would you like me to do that now?",
71 browser, variable_get(VAR_BROWSER_BINARY)))
72 vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser);
76 /* Run browser on the appropriate doc */
77 if (dmenuOpenSimple(&MenuHTMLDoc, FALSE))
83 /* Try to show one of the documents requested from the HTML doc menu */
85 docShowDocument(dialogMenuItem *self)
87 char tmp[512], target[512];
88 char *where, *browser = variable_get(VAR_BROWSER_BINARY);
89 char *str = self->prompt;
91 if (!file_executable(browser)) {
92 msgConfirm("Can't find the browser in %s! Please ensure that it's\n"
93 "properly set in the Options editor.", browser);
97 where = strcpy(target, "http://www.freebsd.org");
98 if (strstr(str, "Other")) {
99 where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit.");
101 strcpy(target, where);
103 else if (strstr(str, "FAQ")) {
104 where = strcpy(target, "/usr/local/share/doc/freebsd/faq/index.html");
105 if (!file_readable(target))
106 where = strcpy(target, "http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq");
108 else if (strstr(str, "Handbook")) {
109 where = strcpy(target, "/usr/local/share/doc/freebsd/handbook/index.html");
110 if (!file_readable(target))
111 where = strcpy(target, "http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook");
114 sprintf(tmp, "%s %s", browser, target);
116 return DITEM_SUCCESS;
119 msgConfirm("Hmmmmm! I can't seem to access the documentation you selected!\n"
120 "Have you installed the english documentation? Is your network connected?");
121 return DITEM_FAILURE;