nfs->iso scheme added
obsolete #define ripped out
This commit is contained in:
parent
f1ad494580
commit
74b6fa7a73
4
Makefile
4
Makefile
@ -105,8 +105,8 @@ endif
|
||||
|
||||
###############################################################################
|
||||
# stage1 itself
|
||||
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c automatic.c frontend-common.c
|
||||
MEDIASRC = cdrom.c disk.c lomount.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
|
||||
NETWORKSRC = network.c nfsmount.c dhcp.c url.c dns.c adsl.c
|
||||
ALLSRC = $(INITSRC) $(STAGE1SRC) $(MEDIASRC) $(NETWORKSRC)
|
||||
###############################################################################
|
||||
|
47
network.c
47
network.c
@ -38,6 +38,7 @@
|
||||
#include "probing.h"
|
||||
#include "log.h"
|
||||
#include "mount.h"
|
||||
#include "lomount.h"
|
||||
#include "automatic.h"
|
||||
#include "dhcp.h"
|
||||
#include "adsl.h"
|
||||
@ -634,13 +635,14 @@ enum return_type nfs_prepare(void)
|
||||
char * ramdisk_path;
|
||||
enum return_type results = intf_select_and_up();
|
||||
struct stat st;
|
||||
|
||||
int iso = 0;
|
||||
|
||||
if (results != RETURN_OK)
|
||||
return results;
|
||||
|
||||
do {
|
||||
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);
|
||||
if (results != RETURN_OK || streq(answers[0], "")) {
|
||||
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]);
|
||||
|
||||
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;
|
||||
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.");
|
||||
results = RETURN_BACK;
|
||||
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);
|
||||
if (access(ramdisk_path, R_OK)) {
|
||||
stg1_error_message("That NFS volume does not seem to contain the " DISTRIB_NAME " Distribution.");
|
||||
umount(IMAGE_LOCATION);
|
||||
if (iso) umount(IMAGE_LOCATION);
|
||||
results = RETURN_BACK;
|
||||
}
|
||||
} while (results == RETURN_BACK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user