nfs->iso scheme added

obsolete #define ripped out
This commit is contained in:
Sergey Bolshakov 2005-02-04 20:28:52 +00:00
parent f1ad494580
commit 74b6fa7a73
3 changed files with 44 additions and 9 deletions

View File

@ -105,8 +105,8 @@ endif
############################################################################### ###############################################################################
# stage1 itself # stage1 itself
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c automatic.c frontend-common.c STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c lomount.c automatic.c frontend-common.c
MEDIASRC = cdrom.c disk.c lomount.c MEDIASRC = cdrom.c disk.c
NETWORKSRC = network.c nfsmount.c dhcp.c url.c dns.c adsl.c NETWORKSRC = network.c nfsmount.c dhcp.c url.c dns.c adsl.c
ALLSRC = $(INITSRC) $(STAGE1SRC) $(MEDIASRC) $(NETWORKSRC) ALLSRC = $(INITSRC) $(STAGE1SRC) $(MEDIASRC) $(NETWORKSRC)
############################################################################### ###############################################################################

View File

@ -38,6 +38,7 @@
#include "probing.h" #include "probing.h"
#include "log.h" #include "log.h"
#include "mount.h" #include "mount.h"
#include "lomount.h"
#include "automatic.h" #include "automatic.h"
#include "dhcp.h" #include "dhcp.h"
#include "adsl.h" #include "adsl.h"
@ -634,13 +635,14 @@ enum return_type nfs_prepare(void)
char * ramdisk_path; char * ramdisk_path;
enum return_type results = intf_select_and_up(); enum return_type results = intf_select_and_up();
struct stat st; struct stat st;
int iso = 0;
if (results != RETURN_OK) if (results != RETURN_OK)
return results; return results;
do { do {
results = ask_from_entries_auto("Please enter the name or IP address of your NFS server, " results = ask_from_entries_auto("Please enter the name or IP address of your NFS server, "
"and the directory containing the " DISTRIB_NAME " Distribution.", "and the directory (or ISO image file) containing the " DISTRIB_NAME " Distribution.",
questions, &answers, 40, questions_auto, NULL); questions, &answers, 40, questions_auto, NULL);
if (results != RETURN_OK || streq(answers[0], "")) { if (results != RETURN_OK || streq(answers[0], "")) {
unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */ unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
@ -653,15 +655,50 @@ enum return_type nfs_prepare(void)
strcat(nfsmount_location, answers[1]); strcat(nfsmount_location, answers[1]);
if (my_mount(nfsmount_location, IMAGE_LOCATION, "nfs", 0) == -1) { if (my_mount(nfsmount_location, IMAGE_LOCATION, "nfs", 0) == -1) {
char location_full[500];
char *s;
/* iso pathname ? */
s = strrchr(nfsmount_location, '/');
if (s == NULL || s == nfsmount_location) {
stg1_error_message("I can't mount the directory from the NFS server."); stg1_error_message("I can't mount the directory from the NFS server.");
results = RETURN_BACK; results = RETURN_BACK;
continue; continue;
} }
*s++ = 0;
log_message("assuming ISO image, NFS path:%s", nfsmount_location);
if (my_mount(nfsmount_location, IMAGE_LOCATION, "nfs", 0) == -1) {
stg1_error_message("I can't mount the directory from the NFS server.");
results = RETURN_BACK;
continue;
}
strcpy(location_full, IMAGE_LOCATION);
strcat(location_full, "/");
strcat(location_full, s);
log_message("assuming ISO image, path:%s", location_full);
if (!stat(location_full, &st) && !S_ISREG(st.st_mode)) {
stg1_error_message("Not a ISO image: %s", location_full);
umount(IMAGE_LOCATION);
results = RETURN_BACK;
continue;
}
if (lomount(location_full, IMAGE_LOCATION)) {
stg1_error_message("Could not mount file %s as an ISO image of the " DISTRIB_NAME " Distribution.", location_full);
umount(IMAGE_LOCATION);
results = RETURN_BACK;
continue;
}
iso = 1;
}
ramdisk_path = get_ramdisk_path(NULL); ramdisk_path = get_ramdisk_path(NULL);
if (access(ramdisk_path, R_OK)) { if (access(ramdisk_path, R_OK)) {
stg1_error_message("That NFS volume does not seem to contain the " DISTRIB_NAME " Distribution."); stg1_error_message("That NFS volume does not seem to contain the " DISTRIB_NAME " Distribution.");
umount(IMAGE_LOCATION); umount(IMAGE_LOCATION);
if (iso) umount(IMAGE_LOCATION);
results = RETURN_BACK; results = RETURN_BACK;
} }
} while (results == RETURN_BACK); } while (results == RETURN_BACK);

View File

@ -193,11 +193,9 @@ static void pci_probe(enum driver_type type)
break; break;
#endif #endif
#ifndef DISABLE_NETWORK #ifndef DISABLE_NETWORK
#ifndef DISABLE_PCINET
case NETWORK_DEVICES: case NETWORK_DEVICES:
that_class = PCI_CLASS_NETWORK_ETHERNET << 8; that_class = PCI_CLASS_NETWORK_ETHERNET << 8;
break; break;
#endif
#endif #endif
case USB_CONTROLLERS: case USB_CONTROLLERS:
that_class = PCI_CLASS_SERIAL_USB << 8; that_class = PCI_CLASS_SERIAL_USB << 8;