#! /usr/bin/perl # $Id$ # # Yves Duret (yduret at mandrakesoft.com) # Christian Belisle (cbelisle at mandrakesoft.com) # # Copyright 2001 MandrakeSoft # # This software may be freely redistributed under the terms of the GNU # public license. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # ChangeLog # 01/11/27 - cbelisle@mandrakesoft.com # - Enhanced the windows partition search algorithm # - Put another message in the welcome screen (more professional) # - Enhance the data copying-moving function use lib q(/usr/lib/libDrakX); #use common qw(:common :file :functional :system); use interactive; use standalone; #use log; use my_gtk qw(:helpers :wrappers :ask); #use netconnect; use detect_devices; my $i = 0; my $found = 0; my @win = ""; my $version = 0.1; $::isInstall and die "Not supported during install.\n"; $::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/; local $_ = join '', @ARGV; /-h/ and die "usage: transfug [--version]\n"; /-version/ and die 'transfugdrake '.$version."\n"; $::isEmbedded or $::isWizard = 1; $::Wizard_pix_up = "wiz_drakgw.png"; $::Wizard_title = _("Transfugdrake"); $::direct = /-direct/; # Debug flag my $debug = 1; # Application initialization my $in = interactive::vnew(su); # Get folder listing in /mnt my @mnt_dir_folder = split("\n", `ls /mnt/`); # Look in the array if we have a windows partition my $folders_count = 1; while(@mnt_dir_folder[$folders_count] ne "") { if(@mnt_dir_folder[$folders_count] =~ /win/) { push(@win,"/mnt/".@mnt_dir_folder[$folders_count]); $found = 1; if($debug) { print "- Found windows partition at /mnt/@mnt_dir_folder[$folders_count]\n"; } } $folders_count++; } # If nothing is found, print an error and exit. if(!$found) { print "- No windows partitions\n"; $in->ask_warn(_("Can't find windows!"), _("Sorry, I can't find windows. Maybe it's not installed, or your windows partition is not mounted on Mandrake.")); quit_global($in); } #- ********************************** #- * 0th step: verify if we are already set up begin: $::Wizard_no_previous = 1; #- ********************************** #- * 1st step: Welcome message step_1: # TODO: Put a bigger message with some instructions and agreement if($debug) { print "- Printing welcome message and waiting for user response\n"; } $::direct or $in->ask_okcancel(_("Transfug"), _("Welcome to TransfugDrake! In this wizard, you will be able to transfer documents, email and address books from Microsoft Windows to Mandrake Linux."), 1) or quit_global($in, 0); #- ********************************** #- * 2nd step: win files step_2: # TODO Get windows listing in a listbox and home listing in another listbox (gftp like) # Automatic configuration if($debug) { print "- Beginning automatic configuration\n"; } $wait_configuring = $in->wait_message(_("Configuring..."), _("Finding all documents on your Windows partition. Can take several minutes.")); # Find documents. if($debug) { print "-- Finding .doc files\n"; } #$output = `find @win[0] -name *.doc`; $output = `find /home/cbelisle -name *.mp3`; undef $wait_configuring; if($debug) { print "- Ready to copy or link all the documents, waiting for user decision\n"; } $::direct or $in->ask_okcancel(_("Transfug"), _(" Do you want to copy all the c:\\My Documents to one of your user home ?"), 1) or goto step_3; if($debug) { print " - Linking $win/My Documents in $ENV{HOME}\n"; } # translators need to accord My Documents.. link(_("@win[0]/My Documents"), $ENV{HOME}); #- ******************************* #- * 3rd step: mail from windows step_3: $::direct or $in->ask_okcancel(_("Transfug"), _("We will bring back your Outlook Mailboxes to a standard unix mbox"), 1) or quit_global($in, 0); mkdir "$ENV{HOME}/Mail" unless (-e "$ENV{HOME}/Mail"); $oe5onwin98="$win/WINDOWS/Application Data/Identities/{424975E0-8577-11D4-A891-989048140B20}/Microsoft/Outlook Express"; if (-e $oe5onwin98) { print "OE5 on win98 detected\n"; opendir YREP, $oe5onwin98 or die "unable to open dir: $!"; @files = grep /.*dbx$/, readdir YREP; closedir YREP; foreach $i (@files) { `transfug_oe \"$oe5onwin98/$i\" \"$ENV{HOME}/Mail/$i\"`; } } else { while (1) { $a=ask_file_path(_("Select file"),"$win/Application Data/Identities") or goto step_4; `transfug_oe \"$a\" \"$ENV{HOME}/Mail/$i\"`; } } #- ******************************* #- * 4th step: address book from windows step_4: $::direct or $in->ask_okcancel(_("Transfug"), _("We will migrate your windows address book to mandrake"), 1) or quit_global($in, 0); #- ******************************* #- * 5th step: finish step_5: $::direct or $in->ask_okcancel(_("Transfugdrake"), _("The migration of all of your Windows data is finished."), 1) or quit_global($in, 0);