mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
Fix a variety of problems with my timeout handling, make it more
configurable (you can now set the timeout interval), fix a crash-bug when no network device was attached.
This commit is contained in:
parent
7adaef9c39
commit
a0e47058d0
16 changed files with 111 additions and 52 deletions
|
|
@ -345,6 +345,10 @@ static void
|
|||
media_timeout(int sig)
|
||||
{
|
||||
AlarmWentOff = TRUE;
|
||||
if (sig != SIGINT)
|
||||
msgDebug("A media timeout occurred.\n");
|
||||
else
|
||||
msgDebug("User generated interrupt.\n");
|
||||
}
|
||||
|
||||
static Boolean
|
||||
|
|
@ -409,7 +413,7 @@ distExtract(char *parent, Distribution *me)
|
|||
new.sa_mask = 0;
|
||||
sigaction(SIGINT, &new, &old);
|
||||
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
status = attr_parse(dist_attr, fp);
|
||||
alarm_clear();
|
||||
sigaction(SIGINT, &old, NULL); /* Restore signal handler */
|
||||
|
|
@ -494,7 +498,7 @@ distExtract(char *parent, Distribution *me)
|
|||
while (1) {
|
||||
int seconds;
|
||||
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
n = fread(buf, 1, BUFSIZ, fp);
|
||||
alarm_clear();
|
||||
if (n <= 0 || AlarmWentOff) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ mediaInitFTP(Device *dev)
|
|||
}
|
||||
|
||||
/* If we can't initialize the network, bag it! */
|
||||
if (!netdev->init(netdev))
|
||||
if (netdev && !netdev->init(netdev))
|
||||
return FALSE;
|
||||
|
||||
try:
|
||||
|
|
@ -75,7 +75,8 @@ try:
|
|||
if (!cp) {
|
||||
if (DITEM_STATUS(mediaSetFTP(NULL)) == DITEM_FAILURE || (cp = variable_get(VAR_FTP_PATH)) == NULL) {
|
||||
msgConfirm("Unable to get proper FTP path. FTP media not initialized.");
|
||||
netdev->shutdown(netdev);
|
||||
if (netdev)
|
||||
netdev->shutdown(netdev);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +85,8 @@ try:
|
|||
dir = variable_get(VAR_FTP_DIR);
|
||||
if (!hostname || !dir) {
|
||||
msgConfirm("Missing FTP host or directory specification. FTP media not initialized,");
|
||||
netdev->shutdown(netdev);
|
||||
if (netdev)
|
||||
netdev->shutdown(netdev);
|
||||
return FALSE;
|
||||
}
|
||||
user = variable_get(VAR_FTP_USER);
|
||||
|
|
@ -147,7 +149,8 @@ punt:
|
|||
fclose(OpenConn);
|
||||
OpenConn = NULL;
|
||||
}
|
||||
netdev->shutdown(netdev);
|
||||
if (netdev)
|
||||
netdev->shutdown(netdev);
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -223,6 +226,6 @@ mediaShutdownFTP(Device *dev)
|
|||
fclose(OpenConn);
|
||||
OpenConn = NULL;
|
||||
}
|
||||
/* netdev->shutdown(netdev); */
|
||||
/* if (netdev) netdev->shutdown(netdev); */
|
||||
ftpInitted = FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1004,6 +1004,7 @@ installVarDefaults(dialogMenuItem *self)
|
|||
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
|
||||
variable_set2(VAR_FTP_STATE, "passive");
|
||||
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
|
||||
variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT));
|
||||
if (getpid() != 1)
|
||||
variable_set2(SYSTEM_STATE, "update");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -298,9 +298,8 @@ mediaSetFTP(dialogMenuItem *self)
|
|||
SAFE_STRCPY(ftpDevice.name, cp);
|
||||
|
||||
dialog_clear_norefresh();
|
||||
if (RunningAsInit &&
|
||||
(network_init || msgYesNo("You've already done the network configuration once,\n"
|
||||
"would you like to skip over it now?") != 0)) {
|
||||
if (RunningAsInit && (network_init || msgYesNo("You've already done the network configuration once,\n"
|
||||
"would you like to skip over it now?") != 0)) {
|
||||
if (mediaDevice)
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
if (!tcpDeviceSelect()) {
|
||||
|
|
@ -348,7 +347,7 @@ mediaSetFTP(dialogMenuItem *self)
|
|||
ftpDevice.init = mediaInitFTP;
|
||||
ftpDevice.get = mediaGetFTP;
|
||||
ftpDevice.shutdown = mediaShutdownFTP;
|
||||
ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */
|
||||
ftpDevice.private = RunningAsInit ? mediaDevice : NULL; /* Set to network device by tcpDeviceSelect() */
|
||||
mediaDevice = &ftpDevice;
|
||||
return DITEM_SUCCESS | DITEM_LEAVE_MENU | what;
|
||||
}
|
||||
|
|
@ -392,6 +391,7 @@ int
|
|||
mediaSetNFS(dialogMenuItem *self)
|
||||
{
|
||||
static Device nfsDevice;
|
||||
static int network_init = 1;
|
||||
char *cp, *idx;
|
||||
|
||||
dialog_clear_norefresh();
|
||||
|
|
@ -406,16 +406,19 @@ mediaSetNFS(dialogMenuItem *self)
|
|||
return DITEM_FAILURE;
|
||||
}
|
||||
SAFE_STRCPY(nfsDevice.name, cp);
|
||||
/* str == NULL means we were just called to change NFS paths, not network interfaces */
|
||||
if (!tcpDeviceSelect())
|
||||
return DITEM_FAILURE;
|
||||
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
|
||||
if (isDebug())
|
||||
msgDebug("mediaSetNFS: Net device init failed\n");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
*idx = '\0';
|
||||
if (variable_get(VAR_NAMESERVER)) {
|
||||
if (RunningAsInit && (network_init || msgYesNo("You've already done the network configuration once,\n"
|
||||
"would you like to skip over it now?") != 0)) {
|
||||
if (!tcpDeviceSelect())
|
||||
return DITEM_FAILURE;
|
||||
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
|
||||
if (isDebug())
|
||||
msgDebug("mediaSetNFS: Net device init failed\n");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
}
|
||||
network_init = 0;
|
||||
if (!RunningAsInit || variable_get(VAR_NAMESERVER)) {
|
||||
if ((gethostbyname(cp) == NULL) && (inet_addr(cp) == INADDR_NONE)) {
|
||||
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
|
||||
"name server, gateway and network interface are correctly configured?", cp);
|
||||
|
|
@ -423,14 +426,13 @@ mediaSetNFS(dialogMenuItem *self)
|
|||
}
|
||||
else
|
||||
msgNotify("Found DNS entry for %s successfully..", cp);
|
||||
|
||||
}
|
||||
variable_set2(VAR_NFS_HOST, cp);
|
||||
nfsDevice.type = DEVICE_TYPE_NFS;
|
||||
nfsDevice.init = mediaInitNFS;
|
||||
nfsDevice.get = mediaGetNFS;
|
||||
nfsDevice.shutdown = mediaShutdownNFS;
|
||||
nfsDevice.private = mediaDevice;
|
||||
nfsDevice.private = RunningAsInit ? mediaDevice : NULL;
|
||||
mediaDevice = &nfsDevice;
|
||||
return DITEM_LEAVE_MENU;
|
||||
}
|
||||
|
|
@ -522,6 +524,19 @@ media_timeout(int sig)
|
|||
AlarmWentOff = TRUE;
|
||||
}
|
||||
|
||||
/* Return the timeout interval */
|
||||
int
|
||||
mediaTimeout(void)
|
||||
{
|
||||
char *cp;
|
||||
int t;
|
||||
|
||||
cp = getenv(VAR_MEDIA_TIMEOUT);
|
||||
if (!cp || !(t = atoi(cp)))
|
||||
t = MEDIA_TIMEOUT;
|
||||
return t;
|
||||
}
|
||||
|
||||
Boolean
|
||||
mediaExtractDist(char *dir, char *dist, FILE *fp)
|
||||
{
|
||||
|
|
@ -595,7 +610,7 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
|||
new.sa_mask = 0;
|
||||
sigaction(SIGINT, &new, &old);
|
||||
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) {
|
||||
alarm_clear();
|
||||
if (AlarmWentOff) {
|
||||
|
|
@ -619,7 +634,7 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
|||
msgInfo("%10d bytes read from %s dist @ %.1f KB/sec.",
|
||||
total, dist, (total / seconds) / 1024.0);
|
||||
}
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
}
|
||||
alarm_clear();
|
||||
sigaction(SIGINT, &old, NULL); /* restore sigint */
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ mediaInitNFS(Device *dev)
|
|||
if (NFSMounted)
|
||||
return TRUE;
|
||||
|
||||
if (!netDevice->init(netDevice))
|
||||
if (netDevice && !netDevice->init(netDevice))
|
||||
return FALSE;
|
||||
|
||||
if (Mkdir("/dist"))
|
||||
|
|
@ -101,7 +101,7 @@ mediaShutdownNFS(Device *dev)
|
|||
if (unmount("/dist", MNT_FORCE) != 0)
|
||||
msgConfirm("Could not unmount the NFS partition: %s", strerror(errno));
|
||||
msgDebug("Unmount of NFS partition successful\n");
|
||||
/* netdev->shutdown(netdev); */
|
||||
/* if (netdev) netdev->shutdown(netdev); */
|
||||
NFSMounted = FALSE;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ mediaCheck(Option opt)
|
|||
#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:"
|
||||
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
|
||||
#define INSTROOT_PROMPT "Please specify a root directory if installing somewhere other than /"
|
||||
#define TIMEOUT_PROMPT "Please specify the number of seconds to wait for slow media:"
|
||||
|
||||
static Option Options[] = {
|
||||
{ "NFS Secure", "NFS server talks only on a secure port",
|
||||
|
|
@ -128,6 +129,8 @@ static Option Options[] = {
|
|||
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
|
||||
{ "Media Type", "The current installation media type.",
|
||||
OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck },
|
||||
{ "Media Timeout", "Timeout value in seconds for slow media.",
|
||||
OPT_IS_VAR, TIMEOUT_PROMPT, VAR_MEDIA_TIMEOUT, varCheck },
|
||||
{ "Package Temp", "The directory where package temporary files should go",
|
||||
OPT_IS_VAR, PKG_PROMPT, VAR_PKG_TMPDIR, varCheck },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
#define VAR_LABEL "label"
|
||||
#define VAR_LABEL_COUNT "labelCount"
|
||||
#define VAR_MEDIA_TYPE "mediaType"
|
||||
#define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT"
|
||||
#define VAR_NAMESERVER "nameserver"
|
||||
#define VAR_NETMASK "netmask"
|
||||
#define VAR_NFS_PATH "nfs"
|
||||
|
|
@ -548,6 +549,7 @@ extern u_char default_scrnmap[];
|
|||
|
||||
/* media.c */
|
||||
extern char *cpioVerbosity(void);
|
||||
extern int mediaTimeout(void);
|
||||
extern int mediaSetCDROM(dialogMenuItem *self);
|
||||
extern int mediaSetFloppy(dialogMenuItem *self);
|
||||
extern int mediaSetDOS(dialogMenuItem *self);
|
||||
|
|
|
|||
|
|
@ -1004,6 +1004,7 @@ installVarDefaults(dialogMenuItem *self)
|
|||
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
|
||||
variable_set2(VAR_FTP_STATE, "passive");
|
||||
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
|
||||
variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT));
|
||||
if (getpid() != 1)
|
||||
variable_set2(SYSTEM_STATE, "update");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
#define VAR_LABEL "label"
|
||||
#define VAR_LABEL_COUNT "labelCount"
|
||||
#define VAR_MEDIA_TYPE "mediaType"
|
||||
#define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT"
|
||||
#define VAR_NAMESERVER "nameserver"
|
||||
#define VAR_NETMASK "netmask"
|
||||
#define VAR_NFS_PATH "nfs"
|
||||
|
|
@ -548,6 +549,7 @@ extern u_char default_scrnmap[];
|
|||
|
||||
/* media.c */
|
||||
extern char *cpioVerbosity(void);
|
||||
extern int mediaTimeout(void);
|
||||
extern int mediaSetCDROM(dialogMenuItem *self);
|
||||
extern int mediaSetFloppy(dialogMenuItem *self);
|
||||
extern int mediaSetDOS(dialogMenuItem *self);
|
||||
|
|
|
|||
|
|
@ -345,6 +345,10 @@ static void
|
|||
media_timeout(int sig)
|
||||
{
|
||||
AlarmWentOff = TRUE;
|
||||
if (sig != SIGINT)
|
||||
msgDebug("A media timeout occurred.\n");
|
||||
else
|
||||
msgDebug("User generated interrupt.\n");
|
||||
}
|
||||
|
||||
static Boolean
|
||||
|
|
@ -409,7 +413,7 @@ distExtract(char *parent, Distribution *me)
|
|||
new.sa_mask = 0;
|
||||
sigaction(SIGINT, &new, &old);
|
||||
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
status = attr_parse(dist_attr, fp);
|
||||
alarm_clear();
|
||||
sigaction(SIGINT, &old, NULL); /* Restore signal handler */
|
||||
|
|
@ -494,7 +498,7 @@ distExtract(char *parent, Distribution *me)
|
|||
while (1) {
|
||||
int seconds;
|
||||
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
n = fread(buf, 1, BUFSIZ, fp);
|
||||
alarm_clear();
|
||||
if (n <= 0 || AlarmWentOff) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ mediaInitFTP(Device *dev)
|
|||
}
|
||||
|
||||
/* If we can't initialize the network, bag it! */
|
||||
if (!netdev->init(netdev))
|
||||
if (netdev && !netdev->init(netdev))
|
||||
return FALSE;
|
||||
|
||||
try:
|
||||
|
|
@ -75,7 +75,8 @@ try:
|
|||
if (!cp) {
|
||||
if (DITEM_STATUS(mediaSetFTP(NULL)) == DITEM_FAILURE || (cp = variable_get(VAR_FTP_PATH)) == NULL) {
|
||||
msgConfirm("Unable to get proper FTP path. FTP media not initialized.");
|
||||
netdev->shutdown(netdev);
|
||||
if (netdev)
|
||||
netdev->shutdown(netdev);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +85,8 @@ try:
|
|||
dir = variable_get(VAR_FTP_DIR);
|
||||
if (!hostname || !dir) {
|
||||
msgConfirm("Missing FTP host or directory specification. FTP media not initialized,");
|
||||
netdev->shutdown(netdev);
|
||||
if (netdev)
|
||||
netdev->shutdown(netdev);
|
||||
return FALSE;
|
||||
}
|
||||
user = variable_get(VAR_FTP_USER);
|
||||
|
|
@ -147,7 +149,8 @@ punt:
|
|||
fclose(OpenConn);
|
||||
OpenConn = NULL;
|
||||
}
|
||||
netdev->shutdown(netdev);
|
||||
if (netdev)
|
||||
netdev->shutdown(netdev);
|
||||
variable_unset(VAR_FTP_PATH);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -223,6 +226,6 @@ mediaShutdownFTP(Device *dev)
|
|||
fclose(OpenConn);
|
||||
OpenConn = NULL;
|
||||
}
|
||||
/* netdev->shutdown(netdev); */
|
||||
/* if (netdev) netdev->shutdown(netdev); */
|
||||
ftpInitted = FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1004,6 +1004,7 @@ installVarDefaults(dialogMenuItem *self)
|
|||
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
|
||||
variable_set2(VAR_FTP_STATE, "passive");
|
||||
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
|
||||
variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT));
|
||||
if (getpid() != 1)
|
||||
variable_set2(SYSTEM_STATE, "update");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -298,9 +298,8 @@ mediaSetFTP(dialogMenuItem *self)
|
|||
SAFE_STRCPY(ftpDevice.name, cp);
|
||||
|
||||
dialog_clear_norefresh();
|
||||
if (RunningAsInit &&
|
||||
(network_init || msgYesNo("You've already done the network configuration once,\n"
|
||||
"would you like to skip over it now?") != 0)) {
|
||||
if (RunningAsInit && (network_init || msgYesNo("You've already done the network configuration once,\n"
|
||||
"would you like to skip over it now?") != 0)) {
|
||||
if (mediaDevice)
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
if (!tcpDeviceSelect()) {
|
||||
|
|
@ -348,7 +347,7 @@ mediaSetFTP(dialogMenuItem *self)
|
|||
ftpDevice.init = mediaInitFTP;
|
||||
ftpDevice.get = mediaGetFTP;
|
||||
ftpDevice.shutdown = mediaShutdownFTP;
|
||||
ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */
|
||||
ftpDevice.private = RunningAsInit ? mediaDevice : NULL; /* Set to network device by tcpDeviceSelect() */
|
||||
mediaDevice = &ftpDevice;
|
||||
return DITEM_SUCCESS | DITEM_LEAVE_MENU | what;
|
||||
}
|
||||
|
|
@ -392,6 +391,7 @@ int
|
|||
mediaSetNFS(dialogMenuItem *self)
|
||||
{
|
||||
static Device nfsDevice;
|
||||
static int network_init = 1;
|
||||
char *cp, *idx;
|
||||
|
||||
dialog_clear_norefresh();
|
||||
|
|
@ -406,16 +406,19 @@ mediaSetNFS(dialogMenuItem *self)
|
|||
return DITEM_FAILURE;
|
||||
}
|
||||
SAFE_STRCPY(nfsDevice.name, cp);
|
||||
/* str == NULL means we were just called to change NFS paths, not network interfaces */
|
||||
if (!tcpDeviceSelect())
|
||||
return DITEM_FAILURE;
|
||||
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
|
||||
if (isDebug())
|
||||
msgDebug("mediaSetNFS: Net device init failed\n");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
*idx = '\0';
|
||||
if (variable_get(VAR_NAMESERVER)) {
|
||||
if (RunningAsInit && (network_init || msgYesNo("You've already done the network configuration once,\n"
|
||||
"would you like to skip over it now?") != 0)) {
|
||||
if (!tcpDeviceSelect())
|
||||
return DITEM_FAILURE;
|
||||
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
|
||||
if (isDebug())
|
||||
msgDebug("mediaSetNFS: Net device init failed\n");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
}
|
||||
network_init = 0;
|
||||
if (!RunningAsInit || variable_get(VAR_NAMESERVER)) {
|
||||
if ((gethostbyname(cp) == NULL) && (inet_addr(cp) == INADDR_NONE)) {
|
||||
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
|
||||
"name server, gateway and network interface are correctly configured?", cp);
|
||||
|
|
@ -423,14 +426,13 @@ mediaSetNFS(dialogMenuItem *self)
|
|||
}
|
||||
else
|
||||
msgNotify("Found DNS entry for %s successfully..", cp);
|
||||
|
||||
}
|
||||
variable_set2(VAR_NFS_HOST, cp);
|
||||
nfsDevice.type = DEVICE_TYPE_NFS;
|
||||
nfsDevice.init = mediaInitNFS;
|
||||
nfsDevice.get = mediaGetNFS;
|
||||
nfsDevice.shutdown = mediaShutdownNFS;
|
||||
nfsDevice.private = mediaDevice;
|
||||
nfsDevice.private = RunningAsInit ? mediaDevice : NULL;
|
||||
mediaDevice = &nfsDevice;
|
||||
return DITEM_LEAVE_MENU;
|
||||
}
|
||||
|
|
@ -522,6 +524,19 @@ media_timeout(int sig)
|
|||
AlarmWentOff = TRUE;
|
||||
}
|
||||
|
||||
/* Return the timeout interval */
|
||||
int
|
||||
mediaTimeout(void)
|
||||
{
|
||||
char *cp;
|
||||
int t;
|
||||
|
||||
cp = getenv(VAR_MEDIA_TIMEOUT);
|
||||
if (!cp || !(t = atoi(cp)))
|
||||
t = MEDIA_TIMEOUT;
|
||||
return t;
|
||||
}
|
||||
|
||||
Boolean
|
||||
mediaExtractDist(char *dir, char *dist, FILE *fp)
|
||||
{
|
||||
|
|
@ -595,7 +610,7 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
|||
new.sa_mask = 0;
|
||||
sigaction(SIGINT, &new, &old);
|
||||
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) {
|
||||
alarm_clear();
|
||||
if (AlarmWentOff) {
|
||||
|
|
@ -619,7 +634,7 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
|
|||
msgInfo("%10d bytes read from %s dist @ %.1f KB/sec.",
|
||||
total, dist, (total / seconds) / 1024.0);
|
||||
}
|
||||
alarm_set(MEDIA_TIMEOUT, media_timeout);
|
||||
alarm_set(mediaTimeout(), media_timeout);
|
||||
}
|
||||
alarm_clear();
|
||||
sigaction(SIGINT, &old, NULL); /* restore sigint */
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ mediaInitNFS(Device *dev)
|
|||
if (NFSMounted)
|
||||
return TRUE;
|
||||
|
||||
if (!netDevice->init(netDevice))
|
||||
if (netDevice && !netDevice->init(netDevice))
|
||||
return FALSE;
|
||||
|
||||
if (Mkdir("/dist"))
|
||||
|
|
@ -101,7 +101,7 @@ mediaShutdownNFS(Device *dev)
|
|||
if (unmount("/dist", MNT_FORCE) != 0)
|
||||
msgConfirm("Could not unmount the NFS partition: %s", strerror(errno));
|
||||
msgDebug("Unmount of NFS partition successful\n");
|
||||
/* netdev->shutdown(netdev); */
|
||||
/* if (netdev) netdev->shutdown(netdev); */
|
||||
NFSMounted = FALSE;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ mediaCheck(Option opt)
|
|||
#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:"
|
||||
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
|
||||
#define INSTROOT_PROMPT "Please specify a root directory if installing somewhere other than /"
|
||||
#define TIMEOUT_PROMPT "Please specify the number of seconds to wait for slow media:"
|
||||
|
||||
static Option Options[] = {
|
||||
{ "NFS Secure", "NFS server talks only on a secure port",
|
||||
|
|
@ -128,6 +129,8 @@ static Option Options[] = {
|
|||
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
|
||||
{ "Media Type", "The current installation media type.",
|
||||
OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck },
|
||||
{ "Media Timeout", "Timeout value in seconds for slow media.",
|
||||
OPT_IS_VAR, TIMEOUT_PROMPT, VAR_MEDIA_TIMEOUT, varCheck },
|
||||
{ "Package Temp", "The directory where package temporary files should go",
|
||||
OPT_IS_VAR, PKG_PROMPT, VAR_PKG_TMPDIR, varCheck },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
#define VAR_LABEL "label"
|
||||
#define VAR_LABEL_COUNT "labelCount"
|
||||
#define VAR_MEDIA_TYPE "mediaType"
|
||||
#define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT"
|
||||
#define VAR_NAMESERVER "nameserver"
|
||||
#define VAR_NETMASK "netmask"
|
||||
#define VAR_NFS_PATH "nfs"
|
||||
|
|
@ -548,6 +549,7 @@ extern u_char default_scrnmap[];
|
|||
|
||||
/* media.c */
|
||||
extern char *cpioVerbosity(void);
|
||||
extern int mediaTimeout(void);
|
||||
extern int mediaSetCDROM(dialogMenuItem *self);
|
||||
extern int mediaSetFloppy(dialogMenuItem *self);
|
||||
extern int mediaSetDOS(dialogMenuItem *self);
|
||||
|
|
|
|||
Loading…
Reference in a new issue