1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package transfugdrake;
use strict;
use warnings;
use common;
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;
# FIXME: we should WINNT, ... (see drakfont):
find { -e "$_/WINDOWS/system32/config/software" } map { $_->{mntpoint} } @win_devices;
}
sub list_windows_users {
my ($win_prefix) = @_;
my @users = chomp_(split(/,\s*/, run_program::get_stdout("ma-search-users", "windowsxp", $win_prefix)));
my ($standard, $admin) = partition { $_ ne "Administrator" } @users;
sort(@$standard), @$admin;
}
sub list_windows_items {
my ($win_prefix, $win_user) = @_;
chomp_(split(/,\s*/, run_program::get_stdout("ma-search-items",
"--ostype=windowsxp",
"--path=$win_prefix",
"--user=$win_user")));
}
sub import_target {
my ($win_prefix, $win_user, $linux_user, $target) = @_;
my $lc_target = lc($target);
$lc_target =~ s/\s//g;
run_program::raw({ timeout => "never" },
"ma-import",
"--ostype=windowsxp",
"--fromuser=$win_user",
"--frompath=$win_prefix",
"--touser=$linux_user",
"--topath=/",
"--target=$lc_target");
}
1;
|