summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakupdate_fstab
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-08-29 11:51:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-08-29 11:51:24 +0000
commit39608972cab56abcd03e7a1b45fe3aae05a4a6d9 (patch)
treec8c870773ad514b4523223a37a105fd8b902fe29 /perl-install/standalone/drakupdate_fstab
parent644301f079dd772dcd66873cef15510ffaeeda2b (diff)
downloaddrakx-backup-do-not-use-39608972cab56abcd03e7a1b45fe3aae05a4a6d9.tar
drakx-backup-do-not-use-39608972cab56abcd03e7a1b45fe3aae05a4a6d9.tar.gz
drakx-backup-do-not-use-39608972cab56abcd03e7a1b45fe3aae05a4a6d9.tar.bz2
drakx-backup-do-not-use-39608972cab56abcd03e7a1b45fe3aae05a4a6d9.tar.xz
drakx-backup-do-not-use-39608972cab56abcd03e7a1b45fe3aae05a4a6d9.zip
- add option --auto
- when --auto, ignore actions on partitions when the drive has extended partitions
Diffstat (limited to 'perl-install/standalone/drakupdate_fstab')
-rwxr-xr-xperl-install/standalone/drakupdate_fstab20
1 files changed, 19 insertions, 1 deletions
diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab
index e68d55b92..1ae5d7f42 100755
--- a/perl-install/standalone/drakupdate_fstab
+++ b/perl-install/standalone/drakupdate_fstab
@@ -29,14 +29,27 @@ use any;
use fs;
$::testing = $ARGV[0] eq '--test' && shift;
+$::auto = $ARGV[0] eq '--auto' && shift;
my ($raw_action, $device_name) = @ARGV;
my ($action) = $raw_action =~ /^--(add|del)/;
-@ARGV == 2 && $action or die "usage: drakupdate_fstab [--test] [--add | --del] <device>\n";
+@ARGV == 2 && $action or die "usage: drakupdate_fstab [--test] [--auto] [--add | --del] <device>\n";
main($action, $device_name);
+sub check_hard_drives {
+ my ($name) = @_;
+
+ #- do not do anything if there are many partitions
+ #- otherwise we may add main extended partitions
+ if ($name =~ s|/part\d+$||) {
+ ! grep { /part[5-9]/ } all($name);
+ } else {
+ 1;
+ }
+}
+
sub device_name_to_entry {
my ($name) = @_;
$name =~ s|/dev/||;
@@ -85,6 +98,11 @@ sub set_mount_point {
sub main {
my ($action, $device_name) = @_;
+
+ if ($::auto) {
+ check_hard_drives($device_name) or return;
+ }
+
my $part = device_name_to_entry($device_name);
my $fstab_file = '/etc/fstab';
if (!$part) {