aboutsummaryrefslogtreecommitdiffstats
path: root/transfugdrake.pm
diff options
context:
space:
mode:
authorChristian Belisle <cbelisle@mandriva.com>2002-01-13 23:52:32 +0000
committerChristian Belisle <cbelisle@mandriva.com>2002-01-13 23:52:32 +0000
commit6905d5f38ca29d035aea1507de15f214e891f183 (patch)
treec6e58435fb37e290af7f5559d59fdc5aa3a39ca8 /transfugdrake.pm
parentdcd7553eb10ac930d3b6e8974c7c6adbe94b12be (diff)
downloadtransfugdrake-6905d5f38ca29d035aea1507de15f214e891f183.tar
transfugdrake-6905d5f38ca29d035aea1507de15f214e891f183.tar.gz
transfugdrake-6905d5f38ca29d035aea1507de15f214e891f183.tar.bz2
transfugdrake-6905d5f38ca29d035aea1507de15f214e891f183.tar.xz
transfugdrake-6905d5f38ca29d035aea1507de15f214e891f183.zip
Add mount_partition(), now able to mount partitions correctly
Diffstat (limited to 'transfugdrake.pm')
-rw-r--r--transfugdrake.pm49
1 files changed, 42 insertions, 7 deletions
diff --git a/transfugdrake.pm b/transfugdrake.pm
index 1027186..2c0428f 100644
--- a/transfugdrake.pm
+++ b/transfugdrake.pm
@@ -72,6 +72,10 @@ sub get_windows_partition {
my (undef, undef, @parts) = cat_('/proc/partitions');
my @fat_parts;
my $i = 0;
+ my $devname = "";
+ my @ls_array;
+ my @tmp_array;
+ my $fstype;
P: foreach (@parts) {
my (undef, undef, $blocks, $dev) = split or next;
@@ -84,8 +88,9 @@ sub get_windows_partition {
my $type = typeFromMagic("/dev/$dev");
if($type2name{$type} =~ /NTFS/ || $type2name{$type} =~ /FAT32/ || $type2name{$type} =~ /FAT/) {
- printf "$dev: type <0x%0x> (%s)\n", $type, $type2name{$type};
- $fat_parts[$i] = "$dev ($type2name{$type})";
+ $devname = `cd /dev/; ls -l | grep '$dev' ; cd -`;
+ @ls_array = split(' ', $devname);
+ $fat_parts[$i] = "/dev/$ls_array[8] ($type2name{$type})";
$i++;
}
}
@@ -95,9 +100,31 @@ sub get_windows_partition {
[ @fat_parts ],
$fat_parts[0])
or quit_global($in, 0);
- if($fat_parts[1] eq "") { $in->ask_warn(_("Your Windows Partition"), _("$fat_parts[0] is your Windows partition")); }
-
- return $win_part;
+ if($fat_parts[1] eq "") { $in->ask_warn(_("Your Windows Partition"), _("$fat_parts[0] is found as your Windows partition")); }
+
+ if($win_part =~ /NTFS/) { $fstype = "ntfs"; }
+ elsif($win_part =~ /FAT32/) {$fstype = "msdos"; }
+ elsif($win_part =~ /FAT/) {$fstype = "msdos"; }
+
+ @tmp_array = split(' ', $win_part);
+ $win_part = $tmp_array[0];
+ return ($win_part, $fstype);
+}
+
+sub mount_partition {
+ my $fstype = $_[0];
+ my $win_partition = $_[1];
+ my $mountpoint = "/mnt/windows";
+
+ if(-e $mountpoint) {
+ $mountpoint .= '2';
+ }
+ mkdir($mountpoint);
+
+ print "mount -t $fstype $win_partition $mountpoint\n";
+ if(`mount -t $fstype $win_partition $mountpoint`) { print "Error\n:"; }
+
+ return $mountpoint;
}
sub get_windows_version {
@@ -108,10 +135,18 @@ sub get_windows_config {
my %config;
my $in = $_[0];
- $config->{'partitions'} = get_windows_partition($in);
- print $config->{'partitions'} . '\n';
+ # Get the windows partition
+ ($config->{partition}, $config->{fstype}) = get_windows_partition($in);
+
+ # Mount it
+ $config->{mountpoint} = mount_partition($config->{fstype}, $config->{partition});
+
+ # Find where the documents are
+ # If possible, get some registry config
+ return %config;
}
sub get_linux_config {
}
+
1;