From a9e3d6a8465c3cd53eed82431b2467a169bf7adf Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 31 Jul 2007 15:23:26 +0000 Subject: lookup windows disk --- transfugdrake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'transfugdrake') diff --git a/transfugdrake b/transfugdrake index 7163e92..4812c2a 100755 --- a/transfugdrake +++ b/transfugdrake @@ -9,6 +9,7 @@ use interactive; use common; my %distrib = distrib(); +my $win_disk = get_windows_disk(); my @linux_users = list_users(); my @windows_users = list_windows_users(); my %windows_bookmarks = list_windows_bookmarks(); @@ -28,6 +29,7 @@ my $wiz = wizards->new({ welcome => { name => N("This wizard will help you to import Windows documents and settings in your %s distribution.", $distrib{system}) . "\n" . N("It allows two differents migration methods: you can either import all documents and settings by copying them, or share them between operating systems."), post => sub { + $win_disk or return 'no_win'; $linux_user = @linux_users == 1 && $linux_users[0]; $windows_user = @windows_users == 1 && $windows_users[0]; !$linux_user || !$windows_user ? 'users' : 'files'; @@ -126,11 +128,26 @@ my $wiz = wizards->new({ name => N("Congratulations, your migration is now completed!"), end => 1, }, + no_win => { + name => N("No Windows installation has been detected."), + end => 1, + }, }, }); $wiz->process($in); +sub get_windows_disk { + require fs; + require fs::type; + + my $fstab = [ fs::read_fstab($::prefix, '/etc/fstab', '') ]; + fs::merge_info_from_mtab($fstab); + + my @win_devices = grep { fs::type::isFat_or_NTFS($_) && fs::type::isMounted($_) } @$fstab; + find { -e "$_/WINDOWS/system32/config/software" } map { $_->{mntpoint} } @win_devices; +} + sub list_windows_users { my ($win_prefix) = @_; qw(john alice); -- cgit v1.2.1