summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Makefile1
-rw-r--r--perl-install/commands.pm19
-rw-r--r--perl-install/fs.pm116
-rw-r--r--perl-install/share/list.xml1
4 files changed, 62 insertions, 75 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile
index 50944f882..d60e6068a 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -99,6 +99,7 @@ mo_files : $(MOFILES)
get_needed_files: $(DIRS) mo_files
REP4PMS=$(REP4PMS) ../tools/install-xml-file-list share/list.xml $(DEST)
+ $(SUDO) chmod u-s -R $(DEST)
mv -f $(DEST)/usr/{lib,X11R6/lib}/*.so* $(DEST)/lib
../tools/simplify-drakx-modules $(DEST)/usr/*/*/*/utf8_heavy.pl
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index 43dcbeca6..14c4786f3 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -61,25 +61,6 @@ sub tr_ {
eval "(tr/$set1/$set2/$s$d$c, print) while <>";
}
-sub mount {
- @_ or return cat("/proc/mounts");
- my ($t, $r) = getopts(\@_, qw(tr));
- my $fs = $t && shift;
-
- @_ == 2 or die "usage: mount [-r] [-t <fs>] <device> <dir>\n",
- " (use -r for readonly)\n",
- " (if /dev/ is left off the device name, a temporary node will be created)\n";
-
- my ($dev, $where) = @_;
- $fs ||= $dev =~ /:/ ? "nfs" :
- $dev =~ /fd/ ? "vfat" : "ext2";
-
- require fs;
- require modules;
- modules::load_dependencies("/modules/modules.dep");
- fs::mount($dev, $where, $fs, $r);
-}
-
sub umount {
@_ == 1 or die "umount expects a single argument\n";
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 1d16a3e9c..16c1f9277 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -477,69 +477,73 @@ sub mount {
my ($dev, $where, $fs, $b_rdonly, $o_options, $o_wait_message) = @_;
log::l("mounting $dev on $where as type $fs, options $o_options");
- -d $where or mkdir_p($where);
+ mkdir_p($where);
$fs or log::l("not mounting $dev partition"), return;
- my @fs_modules = qw(ext3 hfs jfs ntfs romfs reiserfs ufs xfs vfat);
+ {
+ my @fs_modules = qw(ext3 hfs jfs ntfs romfs reiserfs ufs xfs vfat);
+ my @types = (qw(ext2 proc sysfs usbfs usbdevfs iso9660 devfs devpts), @fs_modules);
- if (member($fs, 'smb', 'smbfs', 'nfs', 'davfs') && $::isStandalone || $::move) {
- $o_wait_message->(N("Mounting partition %s", $dev)) if $o_wait_message;
- system('mount', '-t', $fs, $dev, $where, if_($o_options, '-o', $o_options)) == 0 or die N("mounting partition %s in directory %s failed", $dev, $where);
- } else {
- my @types = ('ext2', 'proc', 'sysfs', 'usbfs', 'usbdevfs', 'iso9660', 'devfs', 'devpts', @fs_modules);
-
- member($fs, @types) or log::l("skipping mounting $dev partition ($fs)"), return;
-
- $where =~ s|/$||;
-
- my $flag = c::MS_MGC_VAL();
- $flag |= c::MS_RDONLY() if $b_rdonly;
- my $mount_opt = "";
-
- if ($fs eq 'vfat') {
- $mount_opt = 'check=relaxed';
- } elsif ($fs eq 'reiserfs') {
- #- could be better if we knew if there is a /boot or not
- #- without knowing it, / is forced to be mounted with notail
- # if $where =~ m|/(boot)?$|;
- $mount_opt = 'notail'; #- notail in any case
- } elsif ($fs eq 'jfs' && !$b_rdonly) {
- $o_wait_message->(N("Checking %s", $dev)) if $o_wait_message;
- #- needed if the system is dirty otherwise mounting read-write simply fails
- run_program::raw({ timeout => 60 * 60 }, "fsck.jfs", $dev) or do {
- my $err = $?;
- die "fsck.jfs failed" if $err & 0xfc00;
- };
- } elsif ($fs eq 'ext2' && !$b_rdonly) {
- $o_wait_message->(N("Checking %s", $dev)) if $o_wait_message;
- foreach ('-a', '-y') {
- run_program::raw({ timeout => 60 * 60 }, "fsck.ext2", $_, $dev);
- my $err = $?;
- if ($err & 0x0100) {
- log::l("fsck corrected partition $dev");
- }
- if ($err & 0xfeff) {
- my $txt = sprintf("fsck failed on %s with exit code %d or signal %d", $dev, $err >> 8, $err & 255);
- $_ eq '-y' ? die($txt) : cdie($txt);
- } else {
- last;
- }
- }
+ push @types, 'smb', 'smbfs', 'nfs', 'davfs' if !$::isInstall;
+
+ if (!member($fs, @types) && !$::move) {
+ log::l("skipping mounting $dev partition ($fs)");
+ return;
}
- if (member($fs, @fs_modules)) {
- eval { modules::load($fs) };
- } elsif ($fs eq 'iso9660') {
- eval { modules::load('isofs') };
+ if ($::isInstall) {
+ if (member($fs, @fs_modules)) {
+ eval { modules::load($fs) };
+ } elsif ($fs eq 'iso9660') {
+ eval { modules::load('isofs') };
+ }
}
- log::l("calling mount($dev, $where, $fs, $flag, $mount_opt)");
- $o_wait_message->(N("Mounting partition %s", $dev)) if $o_wait_message;
- syscall_('mount', $dev, $where, $fs, $flag, $mount_opt) or die N("mounting partition %s in directory %s failed", $dev, $where) . " ($!)";
-
- eval { #- fail silently, /etc may be read-only
- append_to_file("/etc/mtab", "$dev $where $fs defaults 0 0\n");
- };
}
+
+ $where =~ s|/$||;
+
+ my @mount_opt = split(',', $o_options || '');
+
+ if ($fs eq 'vfat') {
+ @mount_opt = 'check=relaxed';
+ } elsif ($fs eq 'jfs' && !$b_rdonly) {
+ fsck_jfs($dev, $o_wait_message);
+ } elsif ($fs eq 'ext2' && !$b_rdonly) {
+ fsck_ext2($dev, $o_wait_message);
+ }
+
+ push @mount_opt, 'ro' if $b_rdonly;
+
+ log::l("calling mount -t $fs $dev $where @mount_opt");
+ $o_wait_message->(N("Mounting partition %s", $dev)) if $o_wait_message;
+ run_program::run('mount', '-t', $fs, $dev, $where, if_(@mount_opt, '-o', join(',', @mount_opt))) or die N("mounting partition %s in directory %s failed", $dev, $where);
+}
+
+sub fsck_ext2 {
+ my ($dev, $o_wait_message) = @_;
+ $o_wait_message->(N("Checking %s", $dev)) if $o_wait_message;
+ foreach ('-a', '-y') {
+ run_program::raw({ timeout => 60 * 60 }, "fsck.ext2", $_, $dev);
+ my $err = $?;
+ if ($err & 0x0100) {
+ log::l("fsck corrected partition $dev");
+ }
+ if ($err & 0xfeff) {
+ my $txt = sprintf("fsck failed on %s with exit code %d or signal %d", $dev, $err >> 8, $err & 255);
+ $_ eq '-y' ? die($txt) : cdie($txt);
+ } else {
+ last;
+ }
+ }
+}
+sub fsck_jfs {
+ my ($dev, $o_wait_message) = @_;
+ $o_wait_message->(N("Checking %s", $dev)) if $o_wait_message;
+ #- needed if the system is dirty otherwise mounting read-write simply fails
+ run_program::raw({ timeout => 60 * 60 }, "fsck.jfs", $dev) or do {
+ my $err = $?;
+ die "fsck.jfs failed" if $err & 0xfc00;
+ };
}
#- takes the mount point to umount (can also be the device)
diff --git a/perl-install/share/list.xml b/perl-install/share/list.xml
index fb4300739..594a8b5e5 100644
--- a/perl-install/share/list.xml
+++ b/perl-install/share/list.xml
@@ -13,6 +13,7 @@
insmod-25 modinfo-25 rmmod-25
losetup
lvm2 mdadm
+ mount
badblocks
mkswap