summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-08-22 12:43:27 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-08-22 12:43:27 +0000
commit16f86947bf85478e045613a9118d5bacfb9e7917 (patch)
tree257e55c20ae011ad3d7518e7b45034e15939fa96 /mdk-stage1
parent787759c0a3106ecf52b017861067ac6a669902f3 (diff)
downloaddrakx-backup-do-not-use-16f86947bf85478e045613a9118d5bacfb9e7917.tar
drakx-backup-do-not-use-16f86947bf85478e045613a9118d5bacfb9e7917.tar.gz
drakx-backup-do-not-use-16f86947bf85478e045613a9118d5bacfb9e7917.tar.bz2
drakx-backup-do-not-use-16f86947bf85478e045613a9118d5bacfb9e7917.tar.xz
drakx-backup-do-not-use-16f86947bf85478e045613a9118d5bacfb9e7917.zip
mount all but ramdisk Read Only
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/cdrom.c2
-rw-r--r--mdk-stage1/disk.c6
-rw-r--r--mdk-stage1/lomount.c2
-rw-r--r--mdk-stage1/modules.c2
-rw-r--r--mdk-stage1/mount.c20
-rw-r--r--mdk-stage1/mount.h2
-rw-r--r--mdk-stage1/network.c2
-rw-r--r--mdk-stage1/stage1.c2
-rw-r--r--mdk-stage1/tools.c2
9 files changed, 15 insertions, 25 deletions
diff --git a/mdk-stage1/cdrom.c b/mdk-stage1/cdrom.c
index d99877b7f..c3ff2e802 100644
--- a/mdk-stage1/cdrom.c
+++ b/mdk-stage1/cdrom.c
@@ -41,7 +41,7 @@ static int mount_that_cd_device(char * dev_name)
strcpy(device_fullname, "/dev/");
strcat(device_fullname, dev_name);
- return my_mount(device_fullname, IMAGE_LOCATION, "iso9660");
+ return my_mount(device_fullname, IMAGE_LOCATION, "iso9660", 0);
}
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index 9b47ce466..ec9e1a97f 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -106,9 +106,9 @@ static enum return_type try_with_device(char *dev_name)
strcpy(device_fullname, "/dev/");
strcat(device_fullname, choice);
- if (my_mount(device_fullname, disk_own_mount, "ext2") == -1 &&
- my_mount(device_fullname, disk_own_mount, "vfat") == -1 &&
- my_mount(device_fullname, disk_own_mount, "reiserfs") == -1) {
+ if (my_mount(device_fullname, disk_own_mount, "ext2", 0) == -1 &&
+ my_mount(device_fullname, disk_own_mount, "vfat", 0) == -1 &&
+ my_mount(device_fullname, disk_own_mount, "reiserfs", 0) == -1) {
stg1_error_message("I can't find a valid filesystem (tried: ext2, vfat, reiserfs).");
return try_with_device(dev_name);
}
diff --git a/mdk-stage1/lomount.c b/mdk-stage1/lomount.c
index 7d34948b0..991a862c7 100644
--- a/mdk-stage1/lomount.c
+++ b/mdk-stage1/lomount.c
@@ -146,7 +146,7 @@ lomount(char *loopfile, char *where)
return 1;
}
- if (my_mount(loopdev, where, "iso9660")) {
+ if (my_mount(loopdev, where, "iso9660", 0)) {
del_loop();
return 1;
}
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 8d2825993..dac13ff7c 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -390,7 +390,7 @@ void update_modules(void)
my_insmod("floppy", ANY_DRIVER_TYPE, NULL);
- if (my_mount("/dev/fd0", floppy_mount_location, "ext2") == -1) {
+ if (my_mount("/dev/fd0", floppy_mount_location, "ext2", 0) == -1) {
enum return_type results = ask_yes_no("I can't find a Linux ext2 floppy in first floppy drive.\n"
"Retry?");
if (results == RETURN_OK)
diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c
index 171bf30b5..9098456b6 100644
--- a/mdk-stage1/mount.c
+++ b/mdk-stage1/mount.c
@@ -99,9 +99,9 @@ static int ensure_dev_exists(char *dev)
/* mounts, creating the device if needed+possible */
-int my_mount(char *dev, char *location, char *fs)
+int my_mount(char *dev, char *location, char *fs, int force_rw)
{
- unsigned long flags;
+ unsigned long flags = MS_MGC_VAL | (force_rw ? 0 : MS_RDONLY);
char * opts = NULL;
struct stat buf;
int rc;
@@ -135,33 +135,24 @@ int my_mount(char *dev, char *location, char *fs)
}
}
- flags = MS_MGC_VAL;
-
#ifndef DISABLE_MEDIAS
if (!strcmp(fs, "vfat")) {
my_insmod("vfat", ANY_DRIVER_TYPE, NULL);
opts = "check=relaxed";
}
- if (!strcmp(fs, "reiserfs")) {
+ if (!strcmp(fs, "reiserfs"))
my_insmod("reiserfs", ANY_DRIVER_TYPE, NULL);
- }
- if (!strcmp(fs, "iso9660")) {
+ if (!strcmp(fs, "iso9660"))
my_insmod("isofs", ANY_DRIVER_TYPE, NULL);
- flags |= MS_RDONLY;
- }
#endif
#ifndef DISABLE_NETWORK
if (!strcmp(fs, "nfs")) {
- int flags = 0;
-
+ int flags = MS_RDONLY;
my_insmod("nfs", ANY_DRIVER_TYPE, NULL);
- flags |= MS_RDONLY;
-
log_message("preparing nfsmount for %s", dev);
-
rc = nfsmount_prepare(dev, &flags, &opts);
if (rc != 0)
return rc;
@@ -169,7 +160,6 @@ int my_mount(char *dev, char *location, char *fs)
#endif
rc = mount(dev, location, fs, flags, opts);
-
if (rc != 0) {
log_perror("mount failed");
rmdir(location);
diff --git a/mdk-stage1/mount.h b/mdk-stage1/mount.h
index b679e5c30..992796bde 100644
--- a/mdk-stage1/mount.h
+++ b/mdk-stage1/mount.h
@@ -26,6 +26,6 @@
#include "nfsmount.h"
#endif
-int my_mount(char *dev, char *location, char *fs);
+int my_mount(char *dev, char *location, char *fs, int force_rw);
#endif
diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c
index 6cf24f626..6eb28e5e5 100644
--- a/mdk-stage1/network.c
+++ b/mdk-stage1/network.c
@@ -648,7 +648,7 @@ enum return_type nfs_prepare(void)
strcat(nfsmount_location, ":");
strcat(nfsmount_location, answers[1]);
- if (my_mount(nfsmount_location, IMAGE_LOCATION, "nfs") == -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;
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index df297ead8..b8c6914ce 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -226,7 +226,7 @@ static void expert_third_party_modules(void)
my_insmod("floppy", ANY_DRIVER_TYPE, NULL);
- if (my_mount("/dev/fd0", floppy_mount_location, "ext2") == -1) {
+ if (my_mount("/dev/fd0", floppy_mount_location, "ext2", 0) == -1) {
stg1_error_message("I can't find a Linux ext2 floppy in first floppy drive.");
return expert_third_party_modules();
}
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index bd99f6cf3..ad136b4d4 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -295,7 +295,7 @@ enum return_type load_ramdisk_fd(int ramdisk_fd, int size)
BZ2_bzclose(st2); /* opened by gzdopen, but also closes the associated fd */
close(ram_fd);
- if (my_mount(ramdisk, STAGE2_LOCATION, "ext2"))
+ if (my_mount(ramdisk, STAGE2_LOCATION, "ext2", 1))
return RETURN_ERROR;
set_param(MODE_RAMDISK);