1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Add support for FTP installation via HTTP proxies.

Submitted by:	Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
PR:		11316
This commit is contained in:
Jordan K. Hubbard 2000-01-04 04:50:07 +00:00
parent b3ef0af491
commit 98bfd247d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55392
14 changed files with 128 additions and 3 deletions

View File

@ -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 \

View File

@ -99,6 +99,7 @@ static struct _word {
{ "mediaSetFTP", mediaSetFTP },
{ "mediaSetFTPActive", mediaSetFTPActive },
{ "mediaSetFTPPassive", mediaSetFTPPassive },
{ "mediaSetHTTP", mediaSetHTTP },
{ "mediaSetUFS", mediaSetUFS },
{ "mediaSetNFS", mediaSetNFS },
{ "mediaSetFTPUserPass", mediaSetFTPUserPass },

View File

@ -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)
{

View File

@ -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 },

View File

@ -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);

View File

@ -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 \

View File

@ -99,6 +99,7 @@ static struct _word {
{ "mediaSetFTP", mediaSetFTP },
{ "mediaSetFTPActive", mediaSetFTPActive },
{ "mediaSetFTPPassive", mediaSetFTPPassive },
{ "mediaSetHTTP", mediaSetHTTP },
{ "mediaSetUFS", mediaSetUFS },
{ "mediaSetNFS", mediaSetNFS },
{ "mediaSetFTPUserPass", mediaSetFTPUserPass },

View File

@ -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 },

View File

@ -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);

View File

@ -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 \

View File

@ -99,6 +99,7 @@ static struct _word {
{ "mediaSetFTP", mediaSetFTP },
{ "mediaSetFTPActive", mediaSetFTPActive },
{ "mediaSetFTPPassive", mediaSetFTPPassive },
{ "mediaSetHTTP", mediaSetHTTP },
{ "mediaSetUFS", mediaSetUFS },
{ "mediaSetNFS", mediaSetNFS },
{ "mediaSetFTPUserPass", mediaSetFTPUserPass },

View File

@ -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)
{

View File

@ -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 },

View File

@ -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);