summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>2000-01-04 04:50:07 +0000
committerjkh <jkh@FreeBSD.org>2000-01-04 04:50:07 +0000
commit7ec94d00be14347c3957c59ad478314ccdb63448 (patch)
tree1720f72f3f2af480904d0b09dbaaf21ae70e6d8e
parentf47c71d76ed60c3944fd2bb9b0484b81daddfc5c (diff)
downloadFreeBSD-src-7ec94d00be14347c3957c59ad478314ccdb63448.zip
FreeBSD-src-7ec94d00be14347c3957c59ad478314ccdb63448.tar.gz
Add support for FTP installation via HTTP proxies.
Submitted by: Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de> PR: 11316
-rw-r--r--release/sysinstall/Makefile2
-rw-r--r--release/sysinstall/dispatch.c1
-rw-r--r--release/sysinstall/media.c43
-rw-r--r--release/sysinstall/menus.c2
-rw-r--r--release/sysinstall/sysinstall.h10
-rw-r--r--usr.sbin/sade/Makefile2
-rw-r--r--usr.sbin/sade/dispatch.c1
-rw-r--r--usr.sbin/sade/menus.c2
-rw-r--r--usr.sbin/sade/sade.h10
-rw-r--r--usr.sbin/sysinstall/Makefile2
-rw-r--r--usr.sbin/sysinstall/dispatch.c1
-rw-r--r--usr.sbin/sysinstall/media.c43
-rw-r--r--usr.sbin/sysinstall/menus.c2
-rw-r--r--usr.sbin/sysinstall/sysinstall.h10
14 files changed, 128 insertions, 3 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile
index 609ef7b..f6dc252 100644
--- a/release/sysinstall/Makefile
+++ b/release/sysinstall/Makefile
@@ -11,7 +11,7 @@ CLEANFILES+= keymap.tmp keymap.h pccard_conf.h
SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \
- ftp.c globals.c index.c install.c installUpgrade.c keymap.c \
+ ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \
msg.c network.c nfs.c options.c package.c pccard.c \
system.c tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \
diff --git a/release/sysinstall/dispatch.c b/release/sysinstall/dispatch.c
index 15c6c27..811bae5 100644
--- a/release/sysinstall/dispatch.c
+++ b/release/sysinstall/dispatch.c
@@ -99,6 +99,7 @@ static struct _word {
{ "mediaSetFTP", mediaSetFTP },
{ "mediaSetFTPActive", mediaSetFTPActive },
{ "mediaSetFTPPassive", mediaSetFTPPassive },
+ { "mediaSetHTTP", mediaSetHTTP },
{ "mediaSetUFS", mediaSetUFS },
{ "mediaSetNFS", mediaSetNFS },
{ "mediaSetFTPUserPass", mediaSetFTPUserPass },
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index 2ca3ea5..960e669 100644
--- a/release/sysinstall/media.c
+++ b/release/sysinstall/media.c
@@ -433,6 +433,49 @@ mediaSetFTPPassive(dialogMenuItem *self)
return mediaSetFTP(self);
}
+int mediaSetHTTP(dialogMenuItem *self)
+{
+ int result;
+ char *cp, *idx, hostname[MAXHOSTNAMELEN];
+ extern int HttpPort;
+ int what = DITEM_RESTORE;
+
+
+ result = mediaSetFTP(self);
+ if (DITEM_STATUS(result) != DITEM_SUCCESS)
+ return result;
+
+ variable_set2(VAR_HTTP_PATH, "", 0);
+ cp = variable_get_value(VAR_HTTP_PATH,
+ "Please enter the address of the HTTP proxy in this format:\n"
+ " hostname:port (the ':port' is optional, default is 3128)",0);
+ if (!cp)
+ return DITEM_FAILURE;
+ SAFE_STRCPY(hostname, cp);
+ if (!(idx = index(hostname, ':')))
+ HttpPort = 3128; /* try this as default */
+ else {
+ *(idx++) = '\0';
+ HttpPort = strtol(idx, 0, 0);
+ }
+
+ variable_set2(VAR_HTTP_HOST, hostname, 0);
+ variable_set2(VAR_HTTP_PORT, itoa(HttpPort), 0);
+ msgDebug("VAR_HTTP_HOST, _PORT: %s:%s",variable_get(VAR_HTTP_HOST),
+ variable_get(VAR_HTTP_PORT));
+
+ msgDebug("VAR_FTP_HOST, _PORT: %s:%s", variable_get(VAR_FTP_HOST),
+ variable_get(VAR_FTP_PORT));
+
+ /* mediaDevice has been set by mediaSetFTP(), overwrite partly: */
+ mediaDevice->type = DEVICE_TYPE_HTTP;
+ mediaDevice->init = mediaInitHTTP;
+ mediaDevice->get = mediaGetHTTP;
+ mediaDevice->shutdown = dummyShutdown;
+ return DITEM_SUCCESS | DITEM_LEAVE_MENU | what;
+}
+
+
int
mediaSetUFS(dialogMenuItem *self)
{
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index edc1413..0633145 100644
--- a/release/sysinstall/menus.c
+++ b/release/sysinstall/menus.c
@@ -290,6 +290,7 @@ 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 installation media.", NULL, mediaSetHTTP },
{ " 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" },
@@ -769,6 +770,7 @@ DMenu MenuMedia = {
{ { "1 CDROM", "Install from a FreeBSD CDROM", NULL, mediaSetCDROM },
{ "2 FTP", "Install from an FTP server", NULL, mediaSetFTPActive },
{ "3 FTP Passive", "Install from an FTP server through a firewall", NULL, mediaSetFTPPassive },
+ { "3b HTTP", "Install from an FTP server through a http proxy", NULL, mediaSetHTTP },
{ "4 DOS", "Install from a DOS partition", NULL, mediaSetDOS },
{ "5 NFS", "Install over NFS", NULL, mediaSetNFS },
{ "6 File System", "Install from an existing filesystem", NULL, mediaSetUFS },
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 13a65c6..2a4c618 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/sysinstall/sysinstall.h
@@ -110,6 +110,10 @@
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
#define VAR_FTP_HOST "ftpHost"
+#define VAR_HTTP_PATH "_httpPath"
+#define VAR_HTTP_PORT "httpPort"
+#define VAR_HTTP_HOST "httpHost"
+#define VAR_HTTP_FTP_MODE "httpFtpMode"
#define VAR_GATEWAY "defaultrouter"
#define VAR_GEOMETRY "geometry"
#define VAR_HOSTNAME "hostname"
@@ -235,6 +239,7 @@ typedef enum {
DEVICE_TYPE_UFS,
DEVICE_TYPE_NFS,
DEVICE_TYPE_ANY,
+ DEVICE_TYPE_HTTP,
} DeviceType;
/* CDROM mount codes */
@@ -530,6 +535,10 @@ extern Boolean mediaInitFTP(Device *dev);
extern FILE *mediaGetFTP(Device *dev, char *file, Boolean probe);
extern void mediaShutdownFTP(Device *dev);
+/* http.c */
+extern Boolean mediaInitHTTP(Device *dev);
+extern FILE *mediaGetHTTP(Device *dev, char *file, Boolean probe);
+
/* globals.c */
extern void globalsInit(void);
@@ -600,6 +609,7 @@ extern int mediaSetTape(dialogMenuItem *self);
extern int mediaSetFTP(dialogMenuItem *self);
extern int mediaSetFTPActive(dialogMenuItem *self);
extern int mediaSetFTPPassive(dialogMenuItem *self);
+extern int mediaSetHTTP(dialogMenuItem *self);
extern int mediaSetUFS(dialogMenuItem *self);
extern int mediaSetNFS(dialogMenuItem *self);
extern int mediaSetFTPUserPass(dialogMenuItem *self);
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 609ef7b..f6dc252 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -11,7 +11,7 @@ CLEANFILES+= keymap.tmp keymap.h pccard_conf.h
SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \
- ftp.c globals.c index.c install.c installUpgrade.c keymap.c \
+ ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \
msg.c network.c nfs.c options.c package.c pccard.c \
system.c tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \
diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c
index 15c6c27..811bae5 100644
--- a/usr.sbin/sade/dispatch.c
+++ b/usr.sbin/sade/dispatch.c
@@ -99,6 +99,7 @@ static struct _word {
{ "mediaSetFTP", mediaSetFTP },
{ "mediaSetFTPActive", mediaSetFTPActive },
{ "mediaSetFTPPassive", mediaSetFTPPassive },
+ { "mediaSetHTTP", mediaSetHTTP },
{ "mediaSetUFS", mediaSetUFS },
{ "mediaSetNFS", mediaSetNFS },
{ "mediaSetFTPUserPass", mediaSetFTPUserPass },
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index edc1413..0633145 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -290,6 +290,7 @@ 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 installation media.", NULL, mediaSetHTTP },
{ " 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" },
@@ -769,6 +770,7 @@ DMenu MenuMedia = {
{ { "1 CDROM", "Install from a FreeBSD CDROM", NULL, mediaSetCDROM },
{ "2 FTP", "Install from an FTP server", NULL, mediaSetFTPActive },
{ "3 FTP Passive", "Install from an FTP server through a firewall", NULL, mediaSetFTPPassive },
+ { "3b HTTP", "Install from an FTP server through a http proxy", NULL, mediaSetHTTP },
{ "4 DOS", "Install from a DOS partition", NULL, mediaSetDOS },
{ "5 NFS", "Install over NFS", NULL, mediaSetNFS },
{ "6 File System", "Install from an existing filesystem", NULL, mediaSetUFS },
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 13a65c6..2a4c618 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -110,6 +110,10 @@
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
#define VAR_FTP_HOST "ftpHost"
+#define VAR_HTTP_PATH "_httpPath"
+#define VAR_HTTP_PORT "httpPort"
+#define VAR_HTTP_HOST "httpHost"
+#define VAR_HTTP_FTP_MODE "httpFtpMode"
#define VAR_GATEWAY "defaultrouter"
#define VAR_GEOMETRY "geometry"
#define VAR_HOSTNAME "hostname"
@@ -235,6 +239,7 @@ typedef enum {
DEVICE_TYPE_UFS,
DEVICE_TYPE_NFS,
DEVICE_TYPE_ANY,
+ DEVICE_TYPE_HTTP,
} DeviceType;
/* CDROM mount codes */
@@ -530,6 +535,10 @@ extern Boolean mediaInitFTP(Device *dev);
extern FILE *mediaGetFTP(Device *dev, char *file, Boolean probe);
extern void mediaShutdownFTP(Device *dev);
+/* http.c */
+extern Boolean mediaInitHTTP(Device *dev);
+extern FILE *mediaGetHTTP(Device *dev, char *file, Boolean probe);
+
/* globals.c */
extern void globalsInit(void);
@@ -600,6 +609,7 @@ extern int mediaSetTape(dialogMenuItem *self);
extern int mediaSetFTP(dialogMenuItem *self);
extern int mediaSetFTPActive(dialogMenuItem *self);
extern int mediaSetFTPPassive(dialogMenuItem *self);
+extern int mediaSetHTTP(dialogMenuItem *self);
extern int mediaSetUFS(dialogMenuItem *self);
extern int mediaSetNFS(dialogMenuItem *self);
extern int mediaSetFTPUserPass(dialogMenuItem *self);
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index 609ef7b..f6dc252 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -11,7 +11,7 @@ CLEANFILES+= keymap.tmp keymap.h pccard_conf.h
SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \
- ftp.c globals.c index.c install.c installUpgrade.c keymap.c \
+ ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \
msg.c network.c nfs.c options.c package.c pccard.c \
system.c tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \
diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c
index 15c6c27..811bae5 100644
--- a/usr.sbin/sysinstall/dispatch.c
+++ b/usr.sbin/sysinstall/dispatch.c
@@ -99,6 +99,7 @@ static struct _word {
{ "mediaSetFTP", mediaSetFTP },
{ "mediaSetFTPActive", mediaSetFTPActive },
{ "mediaSetFTPPassive", mediaSetFTPPassive },
+ { "mediaSetHTTP", mediaSetHTTP },
{ "mediaSetUFS", mediaSetUFS },
{ "mediaSetNFS", mediaSetNFS },
{ "mediaSetFTPUserPass", mediaSetFTPUserPass },
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index 2ca3ea5..960e669 100644
--- a/usr.sbin/sysinstall/media.c
+++ b/usr.sbin/sysinstall/media.c
@@ -433,6 +433,49 @@ mediaSetFTPPassive(dialogMenuItem *self)
return mediaSetFTP(self);
}
+int mediaSetHTTP(dialogMenuItem *self)
+{
+ int result;
+ char *cp, *idx, hostname[MAXHOSTNAMELEN];
+ extern int HttpPort;
+ int what = DITEM_RESTORE;
+
+
+ result = mediaSetFTP(self);
+ if (DITEM_STATUS(result) != DITEM_SUCCESS)
+ return result;
+
+ variable_set2(VAR_HTTP_PATH, "", 0);
+ cp = variable_get_value(VAR_HTTP_PATH,
+ "Please enter the address of the HTTP proxy in this format:\n"
+ " hostname:port (the ':port' is optional, default is 3128)",0);
+ if (!cp)
+ return DITEM_FAILURE;
+ SAFE_STRCPY(hostname, cp);
+ if (!(idx = index(hostname, ':')))
+ HttpPort = 3128; /* try this as default */
+ else {
+ *(idx++) = '\0';
+ HttpPort = strtol(idx, 0, 0);
+ }
+
+ variable_set2(VAR_HTTP_HOST, hostname, 0);
+ variable_set2(VAR_HTTP_PORT, itoa(HttpPort), 0);
+ msgDebug("VAR_HTTP_HOST, _PORT: %s:%s",variable_get(VAR_HTTP_HOST),
+ variable_get(VAR_HTTP_PORT));
+
+ msgDebug("VAR_FTP_HOST, _PORT: %s:%s", variable_get(VAR_FTP_HOST),
+ variable_get(VAR_FTP_PORT));
+
+ /* mediaDevice has been set by mediaSetFTP(), overwrite partly: */
+ mediaDevice->type = DEVICE_TYPE_HTTP;
+ mediaDevice->init = mediaInitHTTP;
+ mediaDevice->get = mediaGetHTTP;
+ mediaDevice->shutdown = dummyShutdown;
+ return DITEM_SUCCESS | DITEM_LEAVE_MENU | what;
+}
+
+
int
mediaSetUFS(dialogMenuItem *self)
{
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index edc1413..0633145 100644
--- a/usr.sbin/sysinstall/menus.c
+++ b/usr.sbin/sysinstall/menus.c
@@ -290,6 +290,7 @@ 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 installation media.", NULL, mediaSetHTTP },
{ " 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" },
@@ -769,6 +770,7 @@ DMenu MenuMedia = {
{ { "1 CDROM", "Install from a FreeBSD CDROM", NULL, mediaSetCDROM },
{ "2 FTP", "Install from an FTP server", NULL, mediaSetFTPActive },
{ "3 FTP Passive", "Install from an FTP server through a firewall", NULL, mediaSetFTPPassive },
+ { "3b HTTP", "Install from an FTP server through a http proxy", NULL, mediaSetHTTP },
{ "4 DOS", "Install from a DOS partition", NULL, mediaSetDOS },
{ "5 NFS", "Install over NFS", NULL, mediaSetNFS },
{ "6 File System", "Install from an existing filesystem", NULL, mediaSetUFS },
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 13a65c6..2a4c618 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -110,6 +110,10 @@
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
#define VAR_FTP_HOST "ftpHost"
+#define VAR_HTTP_PATH "_httpPath"
+#define VAR_HTTP_PORT "httpPort"
+#define VAR_HTTP_HOST "httpHost"
+#define VAR_HTTP_FTP_MODE "httpFtpMode"
#define VAR_GATEWAY "defaultrouter"
#define VAR_GEOMETRY "geometry"
#define VAR_HOSTNAME "hostname"
@@ -235,6 +239,7 @@ typedef enum {
DEVICE_TYPE_UFS,
DEVICE_TYPE_NFS,
DEVICE_TYPE_ANY,
+ DEVICE_TYPE_HTTP,
} DeviceType;
/* CDROM mount codes */
@@ -530,6 +535,10 @@ extern Boolean mediaInitFTP(Device *dev);
extern FILE *mediaGetFTP(Device *dev, char *file, Boolean probe);
extern void mediaShutdownFTP(Device *dev);
+/* http.c */
+extern Boolean mediaInitHTTP(Device *dev);
+extern FILE *mediaGetHTTP(Device *dev, char *file, Boolean probe);
+
/* globals.c */
extern void globalsInit(void);
@@ -600,6 +609,7 @@ extern int mediaSetTape(dialogMenuItem *self);
extern int mediaSetFTP(dialogMenuItem *self);
extern int mediaSetFTPActive(dialogMenuItem *self);
extern int mediaSetFTPPassive(dialogMenuItem *self);
+extern int mediaSetHTTP(dialogMenuItem *self);
extern int mediaSetUFS(dialogMenuItem *self);
extern int mediaSetNFS(dialogMenuItem *self);
extern int mediaSetFTPUserPass(dialogMenuItem *self);
OpenPOWER on IntegriCloud