diff options
Diffstat (limited to 'old')
-rw-r--r-- | old/spec | 118 | ||||
-rwxr-xr-x | old/transfugdrake | 336 | ||||
-rw-r--r-- | old/transfugdrake.pm | 164 |
3 files changed, 618 insertions, 0 deletions
diff --git a/old/spec b/old/spec new file mode 100644 index 0000000..22bd6c2 --- /dev/null +++ b/old/spec @@ -0,0 +1,118 @@ +* Bookmark + http://gnobog.sourceforge.net + +* General Info + - http://www.emailman.com/conversion + +* Outlook Express -> mbox + - http://www.gpl.no/liboe + pros: 4.x 5.0 + liboe is a C library that reads Outlook Express 4 and 5.x mailboxes and + returns a standard Unix mailbox to a function specified as a parameter + to the converter. oe2mbx is a C program using liboe to convert Outlook + Express messages to the Unix mailbox format + + - http://www.arrakis.es/~fperezma/OtlkToNs/OtlkToNs.htm + pros: 4.x + cons: no 5.0 support + This software is suited for anyone who wants to move his e-mail files + from OutLook Express (mbx format) to Communicator v4.61 + It can't process files from OutLook Express 5 because this release stores + e-mail data in files with a format (dbx) that OtlkToNs can't read. + It is still in Alpha stage and it may not work well with some *.mbx files. + Also, the format specifications for the *.mbx files used in this program have + been recopiled from the Internet and may not be complete. + OutLook Express uses some index files (idx) in order to speed up access to + e-mail data. These are not used by this program because e-mail bodies keep + stored into *.mbx files. + + - kmailcvt + pro: 4.x 5.0 really well done and programming + cons: C++, depends on qt and kdenetwork + + - MS Outlook to Unix Mailbox Conversion mini HOWTO + http://www.ibiblio.org/pub/Linux/docs/HOWTO/mini/other-formats/html_single/Outlook-to-Unix-Mailbox.html + use windows and an IMAP server + + - http://www.wirejunkie.com/freestuff/devout/ + pros: 2000 !!!!!!!!! + it's a VBA utility that will export Outlook 2000 mail to Evolution mbox format. It now does Base64 and + Quoted Printable encoding (courtesy of a DLL), and thus handles attachments + and HTML messages. + + - http://mbx2mbox.sourceforge.net/ + cons: no update since 1997 + +------------------------------------------------------------------- +07/11/01 - Christian Belisle + +Goal of the project: Migrate mail, data and useful informations from +Windows to Mandrake Linux + +Features: +- Mail & account migration from Netscape, Outlook Express, Outlook +and Eudora. +- Data migration from folders specified by the user. +- Migration will be in a format that all the programs can read. Need to +be determined. + +How it will work: +- The first step will be in the Mandrake First Time Wizard. The program +will detect Netscape, OE and Eudora accounts and will ask to the user if +he want to transfer his account(s) in Linux. And if so, in which +program. After, the user will have to choose if he wants to transfer his +emails or not. And finally, he will have to tell if he wants to transfer +his data, and from where. +- After, configuration will be available thru the control panel to let the +user choose if he wants to synchronize, what to migrate, etc. +- The two parts will be depending on a library with all the necessary +functions to allow migration. Only the ergonomics features will be +developped in the applications. +- If the user choose so, a boot-only program can be installed to +synchronize Windows and Linux each time he boots (will mainly be +symbolic links to the files in the windows partition). + +Priorities: +- Research for information about Netscape, OE and Eudora formats +(mailbox and accounts) +- Build the mail part of the library + - OE migration (high priority) + - Netscape migration (middle priority) + - Eudora migration (low priority) + - Build the data part of the library + - Build the standalone interface first to crashtest the library + - Build an embedded interface to put it in Mandrake First Time + - Build the synchronizer + + Timeframe: + - Research: 1 week + - Mail Part of the Library: 5 weeks + - OE migration: 2 weeks + - Netscape migration: 2 weeks + - Eudora migration: 1 week + - Data Part of the Library: 2 weeks + - Standalone interface: 3 weeks + - Embedded interface: 2 weeks + - Synchronizer: 2 weeks + +Risk Evaluation: +- The first risk will be found in the eudora part of the library. That's +why I put only 1 week. If it's not working, it's not enough popular to +give more time. +- For OE and Netscape, there should be any stuff on the internet to +build something, so no risk here. +- For the data migration part, there's no risk either... we just have to +think about a good way to manage the files (copying or linking in the +windows partition) and once done, the development will be easy. +- In the standalone interface, there will be risks that the library is +not working correctly. That's why I put 3 weeks for the standalone and 2 +weeks for the embedded. +- The synchronizer will be like the embedded part... meaning no major +risks. + +Technologies used: +- Library: Perl +- Standalone interface: gtk (perl-GTK) +- Mandrake First Time: using the same language than the program itself. +- Synchronizer: perl (to ease the development, we don't need big speed +here) diff --git a/old/transfugdrake b/old/transfugdrake new file mode 100755 index 0000000..8e51a22 --- /dev/null +++ b/old/transfugdrake @@ -0,0 +1,336 @@ +#! /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. +# +use lib q(/usr/lib/libDrakX); + +## Includes +use common; +use interactive; +use standalone; +use fsedit qw(:read_partitions); +use detect_devices; +use transfugdrake; + +# TODO TODO TODO +# Add a variable and a detection for Windows version + +## Variables +my $version = 0.3; # Version number +my $debug = 1; # Debug flag +my $windowsxp = 0; # Flag to know if we have win xp +my $laststep = ""; + +# Array used to locate the documents. +my @documents_folders = +('My Documents', # 95,98 - English + 'Documents and Settings'); # XP - French & English + +# Ignored users in the document folder (XP) +my @ignored_document_folders = +('LocalService', + 'NetworkService', + 'Owner', + '.', + '..'); + +# Address book location +my $address_book_location = "Application Data/Microsoft/Address Book"; + +# If it's started during install, die. +$::isInstall and die "Not supported during install.\n"; + +$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/; + +# Application initialization +my $in = interactive::vnew(su); + +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 = N("Transfugdrake"); +$::direct = /-direct/; + +#- ********************************** +#- * 0th step: verify if we are already set up +begin: + +$::Wizard_no_previous = 1; + +#- ********************************** +#- * 0th step: Welcome page +step_0: +if($debug) { print "- Starting Transfugdrake\n"; } + +#my %linux_config = transfugdrake::get_linux_config(); + +$::direct or $in->ask_okcancel(N("Transfugdrake"), +N("Welcome to Transfugdrake! I will help you to ease the step windows-linux +by migrating your documents, mails and address books"), 1) or quit_global($in, 0); + +#- ********************************** +#- * 1st step: Windows configuration +step_1: +if($debug) { print "- Getting Windows Configuration\n"; } +my ($win_partition, $win_fstype, $win_mountpoint) = transfugdrake::get_windows_config($in); +$laststep = "step_1"; + +#- ********************************** +#- * 2nd step: Windows User Chooser +step_2: +my $notvalid = 0; +my $addbook = ""; +my $addbook_folder_win95 = "$windows_config->{mountpoint}/WINDOWS/Application Data/Microsoft/Address Book"; + +if($debug) { print "- Windows User Chooser page\n"; } + +if($debug) { print "-- Looking where is the document folder $win_mountpoint\n"; } +my $document_location = get_documents_folder(@documents_folders, $win_mountpoint); + +if($document_location eq "") { + $in->ask_warn(N("Can't find documents folder!"), + N("Can't find the folder where the documents are located. Exiting...")); + quit_global($in, 0); +} + +if($debug) { print "-- Looking which Windows version we have\n"; } + +# Initialize the users array +@users = (); + +if($document_location eq $win_mountpoint.'/'.$documents_folders[0]) { + # For 95-98, go see in the address books folder to get the users + if($debug) { print "--- Windows 95/98 found\n"; } + opendir YREP, $addbook_folder_win95 or die "unable to open dir: $!\n"; + my @addbook_files = grep /.*dbx$/, readdir YREP; + closedir YREP; + foreach my $addbook (@addbook_files) { + $addbook =~ s/.wab//g; + foreach my $tmp_ignored (@users) { + if($addbook eq $tmp_ignored) { $notvalid = 1; } + } + if($notvalid != 1) { push(@users, $addbook); } + $notvalid = 0; + } +} +elsif($document_location eq $win_mountpoint.'/'.$documents_folders[1]) { + # For XP, go see in the documents folder to get the directory listing + if($debug) { print "--- Windows XP found\n"; } + $in->ask_warn(N("No mail migration available"), + N("Warning: Windows XP detected. No mail migration available yet for your Windows version.")); + $windowsxp = 1; + opendir YREP, $document_location or die "unable to opendir: $!\n"; + my @tmp_user_array = readdir YREP; + closedir YREP; + foreach my $tmp_user (@tmp_user_array) { + foreach my $tmp_ignored (@ignored_document_folders) { + if ($tmp_user eq $tmp_ignored) { $notvalid = 1; } + } + if($notvalid != 1) { push(@users, $tmp_user); } + $notvalid = 0; + } +} + +if($users[0] eq "") { + $in->ask_warn(N("No user found!"), + N("Can't find any user on your Windows partition. Will copy all documents from Windows")); +} +else { + $::Wizard_no_previous = 0; + my $chosen_user = $in->ask_from_list(N("Transfugdrake"), + N("You have the following users in Windows. Which one do you want to use for migration?"), + [ @users ], $users[0]) or goto step_0; +} + +$laststep = "step_2"; + +#- ********************************** +#- * 3rd step: Task Chooser +step_3: +my @tasks = ('Copy files and folders from your Windows partition'); + +if($debug) { print "- Task Chooser\n"; } + +$document_location .= '/'.$chosen_user; +#if(-f $win_mountpoint."/WINDOWS".$address_book_location.$chosen_user.".wab" || +# -f $document_location.'/'.$address_book_location.'/'.$chosen_user.".wab") { + # push(@tasks, "Migrate address book from Windows (not implemented yet)"); + #} + +# This is the Windows XP mailbox checkup. Will be active as soon as transfug_oe support OE 6. +#if(-d $document_location."/Local Settings/Application Data/Identities") { + # opendir YREP, $document_location."/Local Settings/Application Data/Identities" or die "unable to opendir: $!\n"; + # my @identity = readdir YREP; + # closedir YREP; + # if(-f $document_location."/Local Settings/Application Data/Identities/".$identity[2]."/Microsoft/Outlook Express/Inbox.dbx") { + # push(@tasks, "Migrate your mail messages from Windows (Outlook Express 4 & 5 ONLY)"); + # } + #} +if(-d $win_mountpoint."/WINDOWS/Application Data/Identities") { + opendir YREP, $win_mountpoint."/WINDOWS/Application Data/Identities" or die "unable to opendir: $!\n"; + my @identity = readdir YREP; + closedir YREP; + if(-f $win_mountpoint."/WINDOWS/Application Data/Identities/".$identity[2]."/Microsoft/Outlook Express/Inbox.dbx") { + push(@tasks, "Migrate your mail messages from Windows (Outlook Express 4.5 & 5 ONLY)"); + } +} + +my $chosen_task = $in->ask_from_list(N("Transfugdrake"), +N("Welcome to TransfugDrake! You are now able to ease\n the step Windows-Linux with many migrations. Please choose what you\n want to do:"), [ @tasks ], $tasks[0]) or quit_global($in, 0); + +if($chosen_task eq "Copy files and folders from your Windows partition") { goto step_4; } +#if($chosen_task eq "Migrate address book from Windows (not implemented yet)") { goto step_7; } +if($chosen_task eq "Migrate your mail messages from Windows (Outlook Express 4.5 & 5 ONLY)") { goto step_6; } +$laststep = "step_3"; + +#- ********************************** +#- * 4th step: Copy Windows Files +step_4: +if($debug) { print "- Ready to copy all the documents, waiting for user response\n"; } + +copy_documents($document_location, $ENV{HOME}); +$laststep = "step_4"; + +#- ****************************** +#- * 5th step: redo if needed +step_5: + +if($in->ask_yesorno(N("Transfugdrake"), +N("Do you want to copy other files from another folder?"), 1)) { + goto step_2; +} +$laststep = "step_5"; + +#- ******************************* +#- * 4th step: mail from windows +step_6: + +if ($windowsxp) { goto step_8; } +$::direct or $in->ask_okcancel(N("Transfug"), +N("We will bring back your Outlook Mailboxes to a standard unix mbox\n +NB: This feature works only with Outlook Express 4.5 and 5"), 1) or goto step_7; + +mkdir "$ENV{HOME}/Mail" unless (-e "$ENV{HOME}/Mail"); + +$oe5onwin98="$win/WINDOWS/Application Data/Identities"; +opendir YREP, $oe5onwin98; +my @tmp_identitity = readdir YREP; +closedir YREP; +$oe5onwin98 .= '/'.$tmp_identity[2]."/Microsoft/Outlook Express"; + +if (-e $oe5onwin98) { + print "OE 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\"`; + } +} +$laststep = "step_6"; + +#- ******************************* +#- * 6th step: address book from windows +# In XP, address book is located in /Document and Settings/user/Appli Data/Microsoft/Address Book/ +#step_7: + +#$::direct or $in->ask_okcancel(N("Transfugdrake"), +#N("Here will come the address book migration page."), 1) or quit_global($in, 0); + +#- ******************************* +#- * 8th step: finish +step_8: +$::Wizard_no_previous = 0; +$::direct or $in->ask_okcancel(N("Transfugdrake"), +N("The migration of all of your Windows data is finished."), 1) or goto $laststep; + +#- ******************************* +#- FUNCTIONS +#- ******************************* +sub detect_partition { + # Return array + my @win; + + # TODO TODO TODO TODO TODO TODO TODO TODO + # - Print partition type beside the partition + # - Mount the partition the user want. + # - Detect partition as user, and ask root passwd only when needed + + # 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 "") { + 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(N("Can't find windows!"), + N("Sorry, I can't find windows. Maybe it's not installed, or your windows partition is not mounted on Mandrake.")); + quit_global($in); + } + else { + return @win; + } +} + +sub get_documents_folder { + my @doc_folders = @_; + my $mountpoint = ""; + + # Last entry in @doc_folders is moved to $mountpoint. + $mountpoint = pop(@doc_folders); + $mountpoint .= '/'; + + # Make a whole checkup to see where My Documents is located. + foreach my $test_doc (@doc_folders) { + if(-d $mountpoint.$test_doc) { + if(debug) { print "-- $mountpoint$test_doc found\n"; } + if($test_doc eq $doc_folders[2]) { $xp = 1; } + return $mountpoint.$test_doc; + } + } +} + +sub copy_documents { + my $source = $_[0]; + my $dest = $_[1]; + + mkdir("$dest/win_backup"); + $dest .= "/win_backup"; + + $::Wizard_no_previous = 1; + if(!($in->ask_yesorno(N("Transfugdrake"), + N("Do you want to copy all the content of\n \"$source\" to\n \"$dest\"?"), 1))) { + goto step_5; + } + $wait_configuring = $in->wait_message(N("Copying files..."), + N("Copying all files from $source to $dest. This may take several minutes.")); + + $source =~ s/\ /\\ /g; + system("cp -R $source $dest"); + undef $wait_configuring; +} + +1; diff --git a/old/transfugdrake.pm b/old/transfugdrake.pm new file mode 100644 index 0000000..b14ec36 --- /dev/null +++ b/old/transfugdrake.pm @@ -0,0 +1,164 @@ +package transfugdrake; + +use common; + +# From pixel and gc +sub arch() { + my $t = `uname -m`; + chomp $t; + $t; +} + +# From pixel and gc +sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } + +# From pixel and gc +sub typeFromMagic { + my $f = shift; + my $tmp; + my @partitions_signatures = ( + # [ 0x8e, 0, "HM\1\0" ], + # [ 0x83, 0x438, "\x53\xEF" ], + #[ 0x183, 0x10034, "ReIsErFs" ], + #[ 0x183, 0x10034, "ReIsEr2Fs" ], + #[ 0x283, 0, 'XFSB', 0x200, 'XAGF', 0x400, 'XAGI' ], + #[ 0x383, 0x8000, 'JFS1' ], + #[ 0x82, 4086, "SWAP-SPACE" ], + #[ 0x82, 4086, "SWAPSPACE2" ], + [ 0x7, 0x1FE, "\x55\xAA", 0x3, "NTFS" ], + [ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ], + arch() !~ /^sparc/ ? ( [ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ],) : (), + ); + + local *F; + sysopen F, $f, 0 or return; + + M: foreach (@partitions_signatures) { + my ($name, @l) = @$_; + + while (@l) { + my ($offset, $signature) = splice(@l, 0, 2); + sysseek(F, $offset, 0) or next M; + sysread(F, $tmp, length $signature); + if($tmp ne $signature) { next M; } + } + return $name; + } + return -1; +} + +sub get_windows_partition { + my $in = $_[0]; + + my %type2name = ( + 0x1 => 'DOS 12-bit FAT', + 0x4 => 'DOS 16-bit FAT (up to 32M)', + 0x5 => 'DOS 3.3+ Extended Partition', + 0x6 => 'DOS FAT16', + 0x7 => 'NTFS (or HPFS)', + 0xb => 'Win98 FAT32', + 0xc => 'Win98 FAT32, LBA-mapped', + 0xe => 'Win95: DOS 16-bit FAT, LBA-mapped', + 0xf => 'Win95: Extended partition, LBA-mapped', + 0x82 => 'Linux Swap', + 0x83 => 'Ext2', + 0x183 => 'ReiserFS', + 0x283 => 'XFS', + 0x383 => 'JFS', + 0x85 => 'Linux extended partition', + 0x87 => 'NTFS volume set', + 0x8e => 'Linux LVM', + -1 => 'unknown' + ); + + 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; + + my %skip_conditions = ( + "Skipping <$dev> because too little blocks ($blocks)" => ($blocks <= 1), + "Skipping <$dev> because doesn't end with a number (e.g. seems to not be a partition)" => ($dev !~ /\d$/), + ); + $skip_conditions{$_} and ($verbose and print(STDERR $_, "\n")), next P foreach keys %skip_conditions; + my $type = typeFromMagic("/dev/$dev"); + + if($type2name{$type} =~ /NTFS/ || $type2name{$type} =~ /FAT32/ || $type2name{$type} =~ /FAT/) { + $devname = `cd /dev/; ls -l | grep '$dev' ; cd -`; + @ls_array = split(' ', $devname); + $fat_parts[$i] = "/dev/$ls_array[8] ($type2name{$type})"; + $i++; + } + } + + if($fat_parts[0] eq "") { $in->ask_warn(N("No Windows Partition"), N("No Windows Partition found")); quit_global($in, 0); } + $::Wizard_no_previous = 1; + my $win_part = $in->ask_from_list_(N("Select your windows partition"), + N("Please specify your windows partition from the following list"), + [ @fat_parts ], + $fat_parts[0]) + or quit_global($in, 0); + if($fat_parts[1] eq "") { $in->ask_warn(N("Your Windows Partition"), N("$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/transfug"; + my @mounts; + my $mounted = 0; + my @tmp; + + (@mounts) = cat_('/proc/mounts'); + + foreach (@mounts) { + @tmp = split(' ', $_); + if($tmp[0] eq $win_partition) { + $mounted = 1; + $mountpoint = $tmp[1]; + } + } + + if(!$mounted) { + 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_config { + my %config; + my $in = $_[0]; + + # 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->{partition}, $config->{fstype}, $config->{mountpoint}); +} + +sub get_linux_config { +} + +1; |