summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/diskdrake
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/diskdrake')
-rwxr-xr-xperl-install/standalone/diskdrake55
1 files changed, 35 insertions, 20 deletions
diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake
index 8f42d9664..7e5645509 100755
--- a/perl-install/standalone/diskdrake
+++ b/perl-install/standalone/diskdrake
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# DiskDrake
-# Copyright (C) 1999 MandrakeSoft (pixel@mandrakesoft.com)
+# Copyright (C) 1999-2008 Mandriva (pixel)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,6 @@ use lib qw(/usr/lib/libDrakX);
use standalone; #- warning, standalone must be loaded very first, for 'explanations'
use common;
-use diskdrake::interactive;
use interactive;
use detect_devices;
use fsedit;
@@ -35,6 +34,7 @@ use fs;
use log;
use c;
+$ugtk3::wm_icon = "/usr/share/mcc/themes/default/diskdrake_hd.png";
my %options;
my @l = @ARGV;
@@ -46,10 +46,8 @@ while (my $e = shift @l) {
$options{$option} = '';
}
}
-$::expert = defined(delete $options{expert});
-$::testing = defined(delete $options{testing});
-my @types = qw(hd nfs smb dav removable fileshare);
+my @types = qw(hd nfs smb dav removable fileshare list-hd change-geometry);
my ($type, $para) = ('hd', '');
foreach (@types) {
if (exists $options{$_}) {
@@ -58,7 +56,7 @@ foreach (@types) {
last;
}
}
-%options and die "usage: diskdrake [--expert] [--testing] [--{" . join(",", @types) . "}]\n";
+keys %options and die "usage: diskdrake [--expert] [--testing] [--{" . join(",", @types) . "}]\n";
if ($>) {
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
@@ -68,35 +66,52 @@ if ($>) {
my $in = 'interactive'->vnew('su');
if ($type eq 'fileshare') {
- any::fileshare_config($in);
+ require any;
+ any::fileshare_config($in, '');
$in->exit(0);
}
my $all_hds = fsedit::get_hds({}, $in);
-$SIG{__DIE__} = sub { my $m = chomp_($_[0]); log::l("ERROR: $m") };
-
fs::get_raw_hds('', $all_hds);
-fs::merge_info_from_fstab([ fsedit::get_really_all_fstab($all_hds) ]);
-fs::merge_info_from_mtab([ fsedit::get_really_all_fstab($all_hds) ]);
-
-$all_hds->{current_fstab} = fs::fstab_to_string($all_hds);
-
-if ($type eq 'hd') {
- diskdrake::interactive::main($in, $all_hds);
+fs::get_info_from_fstab($all_hds);
+fs::merge_info_from_mtab([ fs::get::really_all_fstab($all_hds) ]);
+
+$all_hds->{current_fstab} = fs::fstab_to_string($all_hds, '');
+
+if ($type eq 'list-hd') {
+ print partition_table::description($_), "\n" foreach fs::get::fstab($all_hds);
+} elsif ($type eq 'change-geometry') {
+ my ($device, undef, $heads, $sectors) = $para =~ /(.+)=(\d+,)?(\d+),(\d+)$/ or die "usage: diskdrake --change-geometry=<device>=[<cylinders>,]<heads>,<sectors>\n";
+ my $hd = fs::get::device2part($device, $all_hds->{hds});
+ put_in_hash($hd->{geom}, { heads => $heads, sectors => $sectors });
+ $hd->{isDirty} = 1;
+ partition_table::write($hd);
+} elsif ($type eq 'hd') {
+ require diskdrake::interactive;
+ diskdrake::interactive::main($in, $all_hds, '');
} elsif ($type eq 'removable') {
require diskdrake::removable;
- $para =~ s|^/dev/||;
my ($raw_hd) = $para ?
- first(grep { $para eq $_->{device} } @{$all_hds->{raw_hds}}) || die "unknown removable $para\n" :
+ fs::get::device2part($para, $all_hds->{raw_hds}) || die "unknown removable $para\n" :
$in->ask_from_listf('', '', \&diskdrake::interactive::format_raw_hd_info, $all_hds->{raw_hds}) or $in->exit(0);
+
+ if (!$raw_hd->{mntpoint}) {
+ my $mntpoint = detect_devices::suggest_mount_point($raw_hd);
+ $raw_hd->{mntpoint} ||= find { !fs::get::has_mntpoint($_, $all_hds) } map { "/media/$mntpoint$_" } '', 2 .. 10;
+ $raw_hd->{is_removable} = 1; #- force removable flag
+
+ require security::level;
+ require lang;
+ fs::mount_options::set_default($raw_hd,
+ security => security::level::get(),
+ lang::fs_options(lang::read()));
+ }
diskdrake::removable::main($in, $all_hds, $raw_hd);
} elsif ($type eq 'dav') {
- ($::isEmbedded, my $isEmbedded) = (0, $::isEmbedded);
require diskdrake::dav;
diskdrake::dav::main($in, $all_hds);
- $::isEmbedded = $isEmbedded;
} else {
$in->ask_warn('', "Sorry only a gtk frontend is available") if !$in->isa('interactive::gtk');
require diskdrake::smbnfs_gtk;