From e9cedd36d5fb1138cbeb57c6071d2188de3a2417 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 3 Oct 2007 14:42:24 +0000 Subject: handle WINNT and lowercase system folder (#34377) --- transfugdrake.pm | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'transfugdrake.pm') diff --git a/transfugdrake.pm b/transfugdrake.pm index da1355e..927df51 100755 --- a/transfugdrake.pm +++ b/transfugdrake.pm @@ -4,6 +4,26 @@ use strict; use warnings; use common; +sub get_insensitive_path { + my ($prefix, $path) = @_; + my $full_path = $prefix; + my @path_l = split("/", $path); + foreach my $i (@path_l) { + my $e = find { member($_, lc($i), uc($i)) } all($full_path) + or return; + $full_path .= "/" . $e; + } + return $full_path; +} + +sub get_windows_system_path { + my ($prefix, $suffix) = @_; + foreach my $system (qw(WINDOWS WINNT)) { + my $p = get_insensitive_path($prefix, join("/", $system, $suffix)); + return $p if $p; + } +} + sub get_windows_disk() { require fs; require fs::type; @@ -12,8 +32,9 @@ sub get_windows_disk() { 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; + find { + get_windows_system_path($_, "system32/config/software"); + } map { $_->{mntpoint} } @win_devices; } sub list_windows_users { -- cgit v1.2.1