From owner-svn-src-stable@FreeBSD.ORG Fri Mar 15 05:00:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4664971A; Fri, 15 Mar 2013 05:00:54 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 20A1CF8D; Fri, 15 Mar 2013 05:00:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2F50saT069630; Fri, 15 Mar 2013 05:00:54 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2F50qfi069615; Fri, 15 Mar 2013 05:00:52 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303150500.r2F50qfi069615@svn.freebsd.org> From: Devin Teske Date: Fri, 15 Mar 2013 05:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r248313 - in stable/9/usr.sbin/sysinstall: . help X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Mar 2013 05:00:54 -0000 Author: dteske Date: Fri Mar 15 05:00:51 2013 New Revision: 248313 URL: http://svnweb.freebsd.org/changeset/base/248313 Log: Add support for installation directly via HTTP. Submitted by: Rick Miller Reviewed by: jkh Added: stable/9/usr.sbin/sysinstall/httpdirect.c (contents, props changed) Modified: stable/9/usr.sbin/sysinstall/Makefile stable/9/usr.sbin/sysinstall/dispatch.c stable/9/usr.sbin/sysinstall/help/media.hlp stable/9/usr.sbin/sysinstall/http.c stable/9/usr.sbin/sysinstall/media.c stable/9/usr.sbin/sysinstall/menus.c stable/9/usr.sbin/sysinstall/options.c stable/9/usr.sbin/sysinstall/sysinstall.8 stable/9/usr.sbin/sysinstall/sysinstall.h Modified: stable/9/usr.sbin/sysinstall/Makefile ============================================================================== --- stable/9/usr.sbin/sysinstall/Makefile Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/Makefile Fri Mar 15 05:00:51 2013 (r248313) @@ -8,9 +8,9 @@ PROG= sysinstall MAN= sysinstall.8 SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c \ disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \ - ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \ - label.c main.c makedevs.c media.c menus.c misc.c modules.c \ - mouse.c msg.c network.c nfs.c options.c package.c \ + ftp.c globals.c http.c httpdirect.c index.c install.c \ + installUpgrade.c keymap.c label.c main.c makedevs.c media.c menus.c \ + misc.c modules.c mouse.c msg.c network.c nfs.c options.c package.c \ system.c tcpip.c termcap.c ttys.c ufs.c usb.c user.c \ variable.c ${_wizard} keymap.h countries.h Modified: stable/9/usr.sbin/sysinstall/dispatch.c ============================================================================== --- stable/9/usr.sbin/sysinstall/dispatch.c Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/dispatch.c Fri Mar 15 05:00:51 2013 (r248313) @@ -103,6 +103,7 @@ static struct _word { { "mediaSetFTPActive", mediaSetFTPActive }, { "mediaSetFTPPassive", mediaSetFTPPassive }, { "mediaSetHTTP", mediaSetHTTP }, + { "mediaSetHTTPDirect", mediaSetHTTPDirect }, { "mediaSetUFS", mediaSetUFS }, { "mediaSetNFS", mediaSetNFS }, { "mediaSetFTPUserPass", mediaSetFTPUserPass }, Modified: stable/9/usr.sbin/sysinstall/help/media.hlp ============================================================================== --- stable/9/usr.sbin/sysinstall/help/media.hlp Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/help/media.hlp Fri Mar 15 05:00:51 2013 (r248313) @@ -41,6 +41,14 @@ You can install from the following types Options screen. + HTTP Direct + Get the distribution files directly from an HTTP server. + + If you chose to enter your own URL in the HTTP Direct menu, + please note that all paths are *relative* to the root + directory of the web server. + + NFS Get the distribution files from an NFS server somewhere (make sure that permissions on the server allow this!). If this install method hangs on you or refuses to work Modified: stable/9/usr.sbin/sysinstall/http.c ============================================================================== --- stable/9/usr.sbin/sysinstall/http.c Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/http.c Fri Mar 15 05:00:51 2013 (r248313) @@ -36,18 +36,9 @@ extern const char *ftp_dirs[]; /* defined in ftp.c */ -static Boolean -checkAccess(Boolean proxyCheckOnly) +Boolean +checkAccess(Boolean connectCheckOnly, Boolean isProxy) { -/* - * Some proxies fetch files with certain extensions in "ascii mode" instead - * of "binary mode" for FTP. The FTP server then translates all LF to CRLF. - * - * You can force Squid to use binary mode by appending ";type=i" to the URL, - * which is what I do here. For other proxies, the LF->CRLF substitution - * is reverted in distExtract(). - */ - int rv, s, af; bool el, found=FALSE; /* end of header line */ char *cp, buf[PATH_MAX], req[BUFSIZ]; @@ -76,18 +67,26 @@ checkAccess(Boolean proxyCheckOnly) } freeaddrinfo(res0); if (s == -1) { - msgConfirm("Couldn't connect to proxy %s:%s", - variable_get(VAR_HTTP_HOST),variable_get(VAR_HTTP_PORT)); + if (isProxy) { + msgConfirm("Couldn't connect to proxy %s:%s", + variable_get(VAR_HTTP_HOST),variable_get(VAR_HTTP_PORT)); + } else { + msgConfirm("Couldn't connect to server http://%s:%s/", + variable_get(VAR_HTTP_HOST),variable_get(VAR_HTTP_PORT)); + } variable_unset(VAR_HTTP_HOST); return FALSE; } - if (proxyCheckOnly) { + if (connectCheckOnly) { close(s); return TRUE; } msgNotify("Checking access to\n %s", variable_get(VAR_HTTP_PATH)); - sprintf(req,"GET %s/ HTTP/1.0\r\n\r\n", variable_get(VAR_HTTP_PATH)); + if (isProxy) + sprintf(req,"GET %s/ HTTP/1.0\r\n\r\n", variable_get(VAR_HTTP_PATH)); + else + sprintf(req,"GET /%s/ HTTP/1.0\r\n\r\n", variable_get(VAR_HTTP_PATH)); write(s,req,strlen(req)); /* * scan the headers of the response @@ -108,7 +107,16 @@ checkAccess(Boolean proxyCheckOnly) } } - if (!strncmp(buf,"Server: ",8)) { + /* + * Some proxies fetch files with certain extensions in "ascii mode" + * instead of "binary mode" for FTP. The FTP server then translates + * all LF to CRLF. + * + * You can force Squid to use binary mode by appending ";type=i" to + * the URL, which is what I do here. For other proxies, the + * LF->CRLF substitution is reverted in distExtract(). + */ + if (isProxy && !strncmp(buf,"Server: ",8)) { if (!strncmp(buf,"Server: Squid",13)) { variable_set2(VAR_HTTP_FTP_MODE,";type=i",0); } else { @@ -143,11 +151,11 @@ mediaInitHTTP(Device *dev) /* * First verify the proxy access */ - checkAccess(TRUE); + checkAccess(TRUE, TRUE); while (variable_get(VAR_HTTP_HOST) == NULL) { if (DITEM_STATUS(mediaSetHTTP(NULL)) == DITEM_FAILURE) return FALSE; - checkAccess(TRUE); + checkAccess(TRUE, TRUE); } again: /* If the release is specified as "__RELEASE" or "any", then just @@ -163,14 +171,14 @@ again: sprintf(req, "%s/%s/%s", variable_get(VAR_FTP_PATH), ftp_dirs[fdir], rel); variable_set2(VAR_HTTP_PATH, req, 0); - if (checkAccess(FALSE)) { + if (checkAccess(FALSE, TRUE)) { found = TRUE; break; } } } else { variable_set2(VAR_HTTP_PATH, variable_get(VAR_FTP_PATH), 0); - found = checkAccess(FALSE); + found = checkAccess(FALSE, TRUE); } if (!found) { msgConfirm("No such directory: %s\n" Added: stable/9/usr.sbin/sysinstall/httpdirect.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/sysinstall/httpdirect.c Fri Mar 15 05:00:51 2013 (r248313) @@ -0,0 +1,182 @@ +/* + * Copyright (c) 1999 + * Philipp Mergenthaler + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "sysinstall.h" +#include +#include +#include +#include +#include + +extern const char *ftp_dirs[]; /* defined in ftp.c */ + +Boolean +mediaInitHTTPDirect(Device *dev) +{ + bool found=FALSE; /* end of header line */ + char *rel, req[BUFSIZ]; + int fdir; + + /* + * First verify basic access + */ + checkAccess(TRUE, FALSE); + while (variable_get(VAR_HTTP_HOST) == NULL) { + if (DITEM_STATUS(mediaSetHTTPDirect(NULL)) == DITEM_FAILURE) + return FALSE; + checkAccess(TRUE, FALSE); + } +again: + /* If the release is specified as "__RELEASE" or "any", then just + * assume that the path the user gave is ok. + */ + rel = variable_get(VAR_RELNAME); + /* + msgConfirm("rel: -%s-", rel); + */ + + if (strcmp(rel, "__RELEASE") && strcmp(rel, "any")) { + for (fdir = 0; ftp_dirs[fdir]; fdir++) { + sprintf(req, "%s/%s/%s", variable_get(VAR_HTTP_DIR), + ftp_dirs[fdir], rel); + variable_set2(VAR_HTTP_PATH, req, 0); + if (checkAccess(FALSE, FALSE)) { + found = TRUE; + break; + } + } + } else { + variable_set2(VAR_HTTP_PATH, variable_get(VAR_HTTP_DIR), 0); + found = checkAccess(FALSE, FALSE); + } + if (!found) { + msgConfirm("No such directory: %s\n" + "please check the URL and try again.", variable_get(VAR_HTTP_PATH)); + variable_unset(VAR_HTTP_PATH); + dialog_clear_norefresh(); + clear(); + if (DITEM_STATUS(mediaSetHTTPDirect(NULL)) != DITEM_FAILURE) goto again; + } + return found; +} + +FILE * +mediaGetHTTPDirect(Device *dev, char *file, Boolean probe) +{ + FILE *fp; + int rv, s, af; + bool el; /* end of header line */ + char *cp, buf[PATH_MAX], req[BUFSIZ]; + struct addrinfo hints, *res, *res0; + + af = variable_cmp(VAR_IPV6_ENABLE, "YES") ? AF_INET : AF_UNSPEC; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = af; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; + if ((rv = getaddrinfo(variable_get(VAR_HTTP_HOST), + variable_get(VAR_HTTP_PORT), &hints, &res0)) != 0) { + msgConfirm("%s", gai_strerror(rv)); + return NULL; + } + s = -1; + for (res = res0; res; res = res->ai_next) { + if ((s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol)) < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) + break; + close(s); + s = -1; + } + freeaddrinfo(res0); + if (s == -1) { + msgConfirm("Couldn't connect to http://%s:%s/", + variable_get(VAR_HTTP_HOST),variable_get(VAR_HTTP_PORT)); + return NULL; + } + + sprintf(req,"GET /%s/%s HTTP/1.0\r\n\r\n", + variable_get(VAR_HTTP_PATH), file); + + if (isDebug()) { + msgDebug("sending http request: %s\n",req); + } + write(s,req,strlen(req)); + +/* + * scan the headers of the response + * this is extremely quick'n dirty + * + */ + cp=buf; + el=FALSE; + rv=read(s,cp,1); + while (rv>0) { + if ((*cp == '\012') && el) { + /* reached end of a header line */ + if (!strncmp(buf,"HTTP",4)) { + rv=strtol((char *)(buf+9),0,0); + *(cp-1)='\0'; /* chop the CRLF off */ + if (probe && (rv != 200)) { + return NULL; + } else if (rv >= 500) { + msgConfirm("Server error %s when sending %s, you could try an other server",buf, req); + return NULL; + } else if (rv == 404) { + msgConfirm("%s was not found, maybe directory or release-version are wrong?",req); + return NULL; + } else if (rv >= 400) { + msgConfirm("Client error %s, you could try an other server",buf); + return NULL; + } else if (rv >= 300) { + msgConfirm("Error %s",buf); + return NULL; + } else if (rv != 200) { + msgConfirm("Error %s when sending %s, you could try an other server",buf, req); + return NULL; + } + } + /* ignore other headers */ + /* check for "\015\012" at beginning of line, i.e. end of headers */ + if ((cp-buf) == 1) + break; + cp=buf; + rv=read(s,cp,1); + } else { + el=FALSE; + if (*cp == '\015') + el=TRUE; + cp++; + rv=read(s,cp,1); + } + } + fp=fdopen(s,"r"); + return fp; +} Modified: stable/9/usr.sbin/sysinstall/media.c ============================================================================== --- stable/9/usr.sbin/sysinstall/media.c Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/media.c Fri Mar 15 05:00:51 2013 (r248313) @@ -52,6 +52,7 @@ static Boolean got_intr = FALSE; static Boolean ftp_skip_resolve = FALSE; +static Boolean http_skip_resolve = FALSE; /* timeout handler */ static void @@ -508,6 +509,139 @@ int mediaSetHTTP(dialogMenuItem *self) mediaDevice->shutdown = dummyShutdown; return DITEM_SUCCESS | DITEM_LEAVE_MENU | what; } + +/* + * Return 0 if we successfully found and set the installation type to + * be an http server + */ +int +mediaSetHTTPDirect(dialogMenuItem *self) +{ + static Device httpDevice; + char *cp, hbuf[MAXPATHLEN], *hostname, *dir; + struct addrinfo hints, *res; + int af; + size_t urllen; + int HttpPort; + static Device *networkDev = NULL; + + mediaClose(); + cp = variable_get(VAR_HTTP_PATH); + /* If we've been through here before ... */ + if (networkDev && cp && msgYesNo("Re-use old HTTP site selection values?")) + cp = NULL; + if (!cp) { + if (!dmenuOpenSimple(&MenuMediaHTTPDirect, FALSE)) + return DITEM_FAILURE; + else + cp = variable_get(VAR_HTTP_PATH); + } + if (!cp) + return DITEM_FAILURE; + else if (!strcmp(cp, "other")) { + variable_set2(VAR_HTTP_PATH, "http://", 0); + cp = variable_get_value(VAR_HTTP_PATH, "Please specify the URL of a FreeBSD distribution on a\n" + "remote http site.\n" + "A URL looks like this: http:///", 0); + if (!cp || !*cp || !strcmp(cp, "http://")) { + variable_unset(VAR_HTTP_PATH); + return DITEM_FAILURE; + } + urllen = strlen(cp); + if (urllen >= sizeof(httpDevice.name)) { + msgConfirm("Length of specified URL is %zu characters. Allowable maximum is %zu.", + urllen,sizeof(httpDevice.name)-1); + variable_unset(VAR_HTTP_PATH); + return DITEM_FAILURE; + } + } + if (strncmp("http://", cp, 7)) { + msgConfirm("Sorry, %s is an invalid URL!", cp); + variable_unset(VAR_HTTP_PATH); + return DITEM_FAILURE; + } + SAFE_STRCPY(httpDevice.name, cp); + SAFE_STRCPY(hbuf, cp + 7); + hostname = hbuf; + + if (!networkDev || msgYesNo("You've already done the network configuration once,\n" + "would you like to skip over it now?") != 0) { + if (networkDev) + DEVICE_SHUTDOWN(networkDev); + if (!(networkDev = tcpDeviceSelect())) { + variable_unset(VAR_HTTP_PATH); + return DITEM_FAILURE; + } + } + if (!DEVICE_INIT(networkDev)) { + if (isDebug()) + msgDebug("mediaSetHTTPDirect: Net device init failed.\n"); + variable_unset(VAR_HTTP_PATH); + return DITEM_FAILURE; + } + if (*hostname == '[' && (cp = index(hostname + 1, ']')) != NULL && + (*++cp == '\0' || *cp == '/' || *cp == ':')) { + ++hostname; + *(cp - 1) = '\0'; + } + else + cp = index(hostname, ':'); + if (cp != NULL && *cp == ':') { + *(cp++) = '\0'; + HttpPort = strtol(cp, 0, 0); + } + else + HttpPort = 80; + if ((dir = index(cp ? cp : hostname, '/')) != NULL) + *(dir++) = '\0'; + if (isDebug()) { + msgDebug("hostname = `%s'\n", hostname); + msgDebug("dir = `%s'\n", dir ? dir : "/"); + msgDebug("port # = `%d'\n", HttpPort); + } + if (!http_skip_resolve && variable_get(VAR_NAMESERVER)) { + msgNotify("Looking up host %s.", hostname); + if (isDebug()) + msgDebug("Starting DNS.\n"); + kickstart_dns(); + if (isDebug()) + msgDebug("Looking up hostname, %s, using getaddrinfo(AI_NUMERICHOST).\n", hostname); + af = variable_cmp(VAR_IPV6_ENABLE, "YES") ? AF_INET : AF_UNSPEC; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = af; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; + if (getaddrinfo(hostname, NULL, &hints, &res) != 0) { + if (isDebug()) + msgDebug("Looking up hostname, %s, using getaddrinfo().\n", + hostname); + hints.ai_flags = AI_PASSIVE; + if (getaddrinfo(hostname, NULL, &hints, &res) != 0) { + msgConfirm("Cannot resolve hostname `%s'! Are you sure that" + " your\nname server, gateway and network interface are" + " correctly configured?", hostname); + if (networkDev) + DEVICE_SHUTDOWN(networkDev); + networkDev = NULL; + variable_unset(VAR_HTTP_PATH); + return DITEM_FAILURE; + } + } + freeaddrinfo(res); + if (isDebug()) + msgDebug("Found DNS entry for %s successfully..\n", hostname); + } + variable_set2(VAR_HTTP_HOST, hostname, 0); + variable_set2(VAR_HTTP_DIR, dir ? dir : "/", 0); + variable_set2(VAR_HTTP_PORT, itoa(HttpPort), 0); + httpDevice.type = DEVICE_TYPE_HTTP_DIRECT; + httpDevice.init = mediaInitHTTPDirect; + httpDevice.get = mediaGetHTTPDirect; + httpDevice.shutdown = dummyShutdown; + httpDevice.private = networkDev; + mediaDevice = &httpDevice; + return DITEM_SUCCESS | DITEM_LEAVE_MENU | DITEM_RESTORE; +} int Modified: stable/9/usr.sbin/sysinstall/menus.c ============================================================================== --- stable/9/usr.sbin/sysinstall/menus.c Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/menus.c Fri Mar 15 05:00:51 2013 (r248313) @@ -213,7 +213,8 @@ DMenu MenuIndex = { { " Media, UFS", "Select UFS installation media.", NULL, mediaSetUFS }, { " Media, FTP", "Select FTP installation media.", NULL, mediaSetFTP }, { " Media, FTP Passive", "Select passive FTP installation media.", NULL, mediaSetFTPPassive }, - { " Media, HTTP", "Select FTP via HTTP proxy install media.", NULL, mediaSetHTTP }, + { " Media, HTTP Proxy", "Select FTP via HTTP proxy install media.", NULL, mediaSetHTTP }, + { " Media, HTTP Direct", "Select HTTP direct installation media.", NULL, mediaSetHTTPDirect }, { " Network Interfaces", "Configure network interfaces", NULL, tcpMenuSelect }, { " Networking Services", "The network services menu.", NULL, dmenuSubmenu, NULL, &MenuNetworking }, { " NFS, client", "Set NFS client flag.", dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client_enable=YES" }, @@ -881,6 +882,21 @@ DMenu MenuMediaFTP = { { NULL } } }; +DMenu MenuMediaHTTPDirect = { + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, + "Please select a FreeBSD HTTP distribution site", + "Please select the site closest to you or \"other\" if you'd like to\n" + "specify a different choice. Also note that not every site listed here\n" + "carries more than the base distribution kits. Only Primary sites are\n" + "guaranteed to carry the full range of possible distributions.", + "Select a site that's close!", + NULL, + { { "URL", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, + VAR_HTTP_PATH "=other" }, + + { NULL } } +}; + DMenu MenuNetworkDevice = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Network interface information required", @@ -926,12 +942,13 @@ DMenu MenuMedia = { { { "1 CD/DVD", "Install from a FreeBSD CD/DVD", NULL, mediaSetCDROM }, { "2 FTP", "Install from an FTP server", NULL, mediaSetFTPActive }, { "3 FTP Passive", "Install from an FTP server through a firewall", NULL, mediaSetFTPPassive }, - { "4 HTTP", "Install from an FTP server through a http proxy", NULL, mediaSetHTTP }, - { "5 DOS", "Install from a DOS partition", NULL, mediaSetDOS }, - { "6 NFS", "Install over NFS", NULL, mediaSetNFS }, - { "7 File System", "Install from an existing filesystem", NULL, mediaSetUFS }, - { "8 Floppy", "Install from a floppy disk set", NULL, mediaSetFloppy }, - { "9 USB", "Install from a USB drive", NULL, mediaSetUSB }, + { "4 HTTP Proxy", "Install from an FTP server through a http proxy", NULL, mediaSetHTTP }, + { "5 HTTP Direct", "Install from an HTTP server", NULL, mediaSetHTTPDirect }, + { "6 DOS", "Install from a DOS partition", NULL, mediaSetDOS }, + { "7 NFS", "Install over NFS", NULL, mediaSetNFS }, + { "8 File System", "Install from an existing filesystem", NULL, mediaSetUFS }, + { "9 Floppy", "Install from a floppy disk set", NULL, mediaSetFloppy }, + { "A USB", "Install from a USB drive", NULL, mediaSetUSB }, { "X Options", "Go to the Options screen", NULL, optionsEditor }, { NULL } }, }; Modified: stable/9/usr.sbin/sysinstall/options.c ============================================================================== --- stable/9/usr.sbin/sysinstall/options.c Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/options.c Fri Mar 15 05:00:51 2013 (r248313) @@ -78,6 +78,9 @@ mediaCheck(Option *opt) case DEVICE_TYPE_HTTP: return "HTTP Proxy"; + case DEVICE_TYPE_HTTP_DIRECT: + return "HTTP Direct"; + case DEVICE_TYPE_CDROM: return "CDROM"; Modified: stable/9/usr.sbin/sysinstall/sysinstall.8 ============================================================================== --- stable/9/usr.sbin/sysinstall/sysinstall.8 Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/sysinstall.8 Fri Mar 15 05:00:51 2013 (r248313) @@ -684,6 +684,8 @@ plus .Bl -tag -width indent .It _httpPath The proxy to use (host:port) (non-optional). +.It httpDirectory +The path from http root. .El .It mediaSetUFS Select an existing UFS partition (mounted with the label editor) as Modified: stable/9/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- stable/9/usr.sbin/sysinstall/sysinstall.h Fri Mar 15 04:43:27 2013 (r248312) +++ stable/9/usr.sbin/sysinstall/sysinstall.h Fri Mar 15 05:00:51 2013 (r248313) @@ -118,6 +118,7 @@ #define VAR_FTP_STATE "ftpState" #define VAR_FTP_USER "ftpUser" #define VAR_FTP_HOST "ftpHost" +#define VAR_HTTP_DIR "httpDirectory" #define VAR_HTTP_PATH "_httpPath" #define VAR_HTTP_PROXY "httpProxy" #define VAR_HTTP_PORT "httpPort" @@ -273,6 +274,7 @@ typedef enum { DEVICE_TYPE_NFS, DEVICE_TYPE_ANY, DEVICE_TYPE_HTTP, + DEVICE_TYPE_HTTP_DIRECT, } DeviceType; /* CDROM mount codes */ @@ -443,6 +445,7 @@ extern DMenu MenuMediaUSB; /* USB medi extern DMenu MenuMediaDOS; /* DOS media menu */ extern DMenu MenuMediaFloppy; /* Floppy media menu */ extern DMenu MenuMediaFTP; /* FTP media menu */ +extern DMenu MenuMediaHTTPDirect; /* HTTP Direct media menu */ extern DMenu MenuNetworkDevice; /* Network device menu */ extern DMenu MenuNTP; /* NTP time server menu */ extern DMenu MenuSecurity; /* System security options menu */ @@ -650,9 +653,14 @@ extern FILE *mediaGetFTP(Device *dev, ch extern void mediaShutdownFTP(Device *dev); /* http.c */ +extern Boolean checkAccess(Boolean connectCheckOnly, Boolean isProxy); extern Boolean mediaInitHTTP(Device *dev); extern FILE *mediaGetHTTP(Device *dev, char *file, Boolean probe); +/* httpdirect.c */ +extern Boolean mediaInitHTTPDirect(Device *dev); +extern FILE *mediaGetHTTPDirect(Device *dev, char *file, Boolean probe); + /* globals.c */ extern void globalsInit(void); @@ -726,6 +734,7 @@ extern int mediaSetFTP(dialogMenuItem *s extern int mediaSetFTPActive(dialogMenuItem *self); extern int mediaSetFTPPassive(dialogMenuItem *self); extern int mediaSetHTTP(dialogMenuItem *self); +extern int mediaSetHTTPDirect(dialogMenuItem *self); extern int mediaSetUFS(dialogMenuItem *self); extern int mediaSetNFS(dialogMenuItem *self); extern int mediaSetFTPUserPass(dialogMenuItem *self);