diff options
Diffstat (limited to 'live/draklive-install')
-rw-r--r-- | live/draklive-install/Makefile | 21 | ||||
-rwxr-xr-x | live/draklive-install/draklive-install | 418 | ||||
-rw-r--r-- | live/draklive-install/draklive-install.desktop | 7 | ||||
-rw-r--r-- | live/draklive-install/draklive-install.spec | 69 | ||||
-rw-r--r-- | live/draklive-install/install_interactive.pm | 299 | ||||
-rw-r--r-- | live/draklive-install/theme/IC-installone-128.png | bin | 0 -> 8949 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IC-installone-16.png | bin | 0 -> 857 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IC-installone-24.png | bin | 0 -> 1424 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IC-installone-32.png | bin | 0 -> 1863 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IC-installone-48.png | bin | 0 -> 3019 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IC-installone-64.png | bin | 0 -> 4305 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IM-INSTALLCDONE.png | bin | 0 -> 68499 bytes | |||
-rw-r--r-- | live/draklive-install/theme/IM-INSTALLCDONE2.png | bin | 0 -> 55654 bytes |
13 files changed, 814 insertions, 0 deletions
diff --git a/live/draklive-install/Makefile b/live/draklive-install/Makefile new file mode 100644 index 000000000..6d5025822 --- /dev/null +++ b/live/draklive-install/Makefile @@ -0,0 +1,21 @@ +NAME = draklive-install +VERSION := $(shell rpm -q --qf '%{VERSION}\n' --specfile $(NAME).spec | head -1) +RELEASE := $(shell rpm -q --qf '%{RELEASE}\n' --specfile $(NAME).spec | head -1) + +rpm: dis + rpm -tb ../$(NAME)-$(VERSION).tar.bz2 + +check: + perl -cw $(NAME) + +clean: + find -name '*~' -exec rm {} \; + +dis ../$(NAME)-$(VERSION).tar.bz2: clean check + rm -rf $(NAME)-$(VERSION) ../$(NAME)-$(VERSION).tar* + mkdir -p $(NAME)-$(VERSION) + find . -not -name "$(NAME)-$(VERSION)"|cpio -pd $(NAME)-$(VERSION)/ + find $(NAME)-$(VERSION) -type d -name CVS -o -name .cvsignore -o -name unused |xargs rm -rf + tar cf ../$(NAME)-$(VERSION).tar $(NAME)-$(VERSION) + bzip2 -9f ../$(NAME)-$(VERSION).tar + rm -rf $(NAME)-$(VERSION) diff --git a/live/draklive-install/draklive-install b/live/draklive-install/draklive-install new file mode 100755 index 000000000..bb4880850 --- /dev/null +++ b/live/draklive-install/draklive-install @@ -0,0 +1,418 @@ +#!/usr/bin/perl + +use lib qw(/usr/lib/libDrakX); +use standalone; +use interactive; +#- err, yes, we're loaded, aren't we? (actually not used by this wizard in install_interactive) +BEGIN { undef @INC{'install_any.pm', 'install_steps.pm'} }; +use install_interactive; +use fs::type; +use common; + +{ + use interactive; + package interactive; + *ask_mntpoint_s = \&main::ask_mntpoint_s_interactive; +} + +{ + use diskdrake::interactive; + package diskdrake::interactive; + my $old = \&hd_possible_actions; + undef *hd_possible_actions; + *hd_possible_actions = sub { + #- for the partition wizard to show the auto-allocate option + local $::isInstall = 1; + &$old; + }; + undef *Done; + #- skip the fstab/reboot checks + *Done = \&diskdrake_interactive_Done; +} + +sub umount_all { + my ($in) = @_; + #- make sure nothing is mounted in the new root + foreach (sort { $b cmp $a } grep { /^$in->{prefix}/ } map { (split)[1] } cat_('/proc/mounts')) { + system('umount', $_); + } + #- make sure selected devices aren't mounted, and swap isn't used + foreach (grep { isSwap($_) } @{$in->{fstab}}) { + eval { fs::mount::swapoff($_->{device}) }; + } + foreach (map { $_->{mntpoint} && !isSwap($_) ? "/dev/$_->{device}" : () } @{$in->{fstab}}) { + system('umount', $_); + } +} + +my $in = 'interactive'->vnew('su'); +$in->{prefix} = $::prefix = '/mnt/install'; + +$in->{all_hds} = fsedit::get_hds(); + +umount_all($in); + +$::isWizard = 1; +$::Wizard_no_previous = 1; +$::Wizard_pix_up = "MandrivaOne-install-icon"; +my $live_install_img = "MandrivaOne-install"; +my $title = N("Mandriva Live"); +{ + my $w = ugtk2->new($title); + ugtk2::gtkadd($w->{window}, + #ugtk2::gtkcreate_img($live_install_img), + ugtk2::gtknew('Label', height => 5), + N("This wizard will help you to install the live distribution."), + ugtk2::create_okcancel($w)); + $w->{ok}->grab_focus; + $w->main; +} + +install_interactive::partitionWizard($in); +mkdir_p($::prefix) or die "unable to create $::prefix"; + +doPartitionDisksAfter($in); +choosePartitionsToFormat_interactive($in, $in->{fstab}); + +umount_all($in); +formatMountPartitions($in); + +#- copy to disk +my $_w = do { + local $::isInstall = 1; # quick hack to embed the wait message + $in->wait_message('', N("Computing total size")); +}; +my $total = first(split(/\s+/, `du -sbx / 2>/dev/null`)); + +#- fork interactive::wait_message_with_progress_bar to allow embedding and images +my $progress_displayed; +my $progress = Gtk2::ProgressBar->new; +$progress->hide; +$progress->signal_connect(expose_event => sub { $progress_displayed = 1; 0 }); +undef $_w; +$_w = do { + local $::isInstall = 1; # quick hack to embed the wait message + my $w = $in->wait_messageW('', [ ugtk2::gtkcreate_img($live_install_img), N("Copying in progress"), if_($progress, $progress) ]); + before_leaving { $in->wait_message_endW($w) }; +}; #- should be my ($w, $update_progress) = $in->wait_message_with_progress_bar() + +open(my $OUTPUT, '-|', 'tar c ' . + join(' ', map { ('--exclude', $_) } '/mnt', '/live', '/proc', '/dev', '/sys') + . ' / | tar xvv -C ' . $in->{prefix}); +{ + local $_; + my $current = my $previous = 0; + while (<$OUTPUT>) { + (undef, undef, my $size) = split; + $current += $size; + if ($current <= $total && $current/$total > $previous/$total + 0.001) { + $progress->set_fraction($current / $total); + $progress->show; + $progress_displayed = 0; + mygtk2::flush() while !$progress_displayed; #- these 4 lines should $update_progress->('', $current, $total) + $previous = $current; + } + } +} +undef $_w; + +#- FIXME: maybe factorize with draklive, using draklive --clean-chroot ? +#- remove unwanted files and packages +unlink(map { $in->{prefix} . $_} '/.autofsck', + '/home/guest/Desktop/draklive-copy-wizard.desktop', + '/home/guest/Desktop/draklive-install.desktop'); +system('chroot', $in->{prefix}, 'rpm', '-e', 'draklive-install'); +#- enable drakx-finish-install +output($in->{prefix} . '/etc/sysconfig/finish-install', qq( +FINISH_INSTALL=yes +LICENSE=no +LANGUAGE=no +KEYBOARD=no +NETWORK=yes +AUTHENTICATION=yes +USERS=yes +USER_RENAME_FROM=guest +)); +#- unselect guest user in kdm +my $kdm_cfg = '/etc/kde/kdm/kdmrc'; +update_gnomekderc($in->{prefix} . $kdm_cfg, + 'X-:0-Greeter' => (PreselectUser => 'None', DefaultUser => '')) if -f $kdm_cfg; + +#- create required directories and devices +mkdir_p($in->{prefix} . $_) foreach qw(/dev /etc /proc /sys); +run_program::run('makedev', $in->{prefix} . '/dev'); +#- write fstab +fs::write_fstab($in->{all_hds}, $in->{prefix}); + + +#- setup bootloader +#- TODO: factorize with drakboot +use bootloader; +my $bootloader = {}; +my $cmdline = cat_('/proc/cmdline'); +bootloader::suggest($bootloader, $in->{all_hds}, + vga_fb => first($cmdline =~ /\bvga=(\S+)/), #- don't use $1 here, otherwise perl will hit you because of the other "=~" below + quiet => $cmdline =~ /\bsplash=silent\b/, + ); +lilo_choice(); + +#- cleanly umount here, it will avoid fs journals to be corrupted after a hackish reboot +umount_all($in); + +$::Wizard_finished = 1; +$in->ask_okcancel(N("Congratulations"), N("Please halt your computer, remove your live system, and restart your computer.")); + +$in->exit(0); + + +### +### duplicate code +### + +#- install_steps::doPartitionDisksAfter +sub doPartitionDisksAfter { + my ($o) = @_; + my $hds = $o->{all_hds}{hds}; + partition_table::write($_) foreach @$hds; + if (grep { $_->{rebootNeeded} } @$hds) { + #- install_steps_interactive::rebootNeeded + $o->ask_warn('', N("You need to reboot for the partition table modifications to take place")); + $o->exit(0); + } + fs::set_removable_mntpoints($o->{all_hds}); + fs::mount_options::set_all_default($o->{all_hds}, %$o, lang::fs_options($o->{locale})); + $o->{fstab} = [ fs::get::fstab($o->{all_hds}) ]; +} + +#- install_steps::choosePartitionsToFormat +sub choosePartitionsToFormat($$) { + my ($_o, $fstab) = @_; + + return if $::local_install; + + foreach (@$fstab) { + $_->{mntpoint} = "swap" if isSwap($_); + $_->{mntpoint} or next; + + add2hash_($_, { toFormat => $_->{notFormatted} }) if $_->{fs_type}; #- eg: do not set toFormat for isRawRAID (0xfd) + $_->{toFormatUnsure} ||= member($_->{mntpoint}, '/', '/usr'); + + if (!$_->{toFormat}) { + my $fs_type = fs::type::fs_type_from_magic($_); + if (!$fs_type || $fs_type ne $_->{fs_type}) { + log::l("setting toFormatUnsure for $_->{device} because <$_->{fs_type}> ne <$fs +_type>"); + $_->{toFormatUnsure} = 1; + } + } + } +} + +#- install_steps_interactive::choosePartitionsToFormat +sub choosePartitionsToFormat_interactive { + my ($o, $fstab) = @_; + + choosePartitionsToFormat($o, $fstab); + + my @l = grep { !$_->{isMounted} && $_->{mntpoint} && + (!isSwap($_) || $::expert) && + (!isFat_or_NTFS($_) || $_->{notFormatted} || $::expert) && + (!isOtherAvailableFS($_) || $::expert || $_->{toFormat}); + } @$fstab; + $_->{toFormat} = 1 foreach grep { isSwap($_) && !$::expert } @$fstab; + + return if @l == 0 || !$::expert && every { $_->{toFormat} } @l; + + #- keep it temporary until the guy has accepted + $_->{toFormatTmp} = $_->{toFormat} || $_->{toFormatUnsure} foreach @l; + + $o->ask_from_( + { messages => N("Choose the partitions you want to format"), + interactive_help_id => 'formatPartitions', + advanced_messages => N("Check bad blocks?"), + }, + [ map { + my $e = $_; + ({ + text => partition_table::description($e), type => 'bool', + val => \$e->{toFormatTmp} + }, if_(!isLoopback($_) && !member($_->{fs_type}, 'reiserfs', 'xfs', 'jfs'), { + text => partition_table::description($e), type => 'bool', advanced => 1, + disabled => sub { !$e->{toFormatTmp} }, + val => \$e->{toFormatCheck} + })) } @l ] + ) or die 'already displayed'; + #- ok now we can really set toFormat + foreach (@l) { + $_->{toFormat} = delete $_->{toFormatTmp}; + set_isFormatted($_, 0); + } +} + +#- install_steps_interactive::formatMountPartitions +#- FIXME(?): drop $_fstab +sub formatMountPartitions { + my ($o, $_fstab) = @_; + my ($w, $wait_message) = $o->wait_message_with_progress_bar; + catch_cdie { + fs::format::formatMount_all($o->{all_hds}, $o->{fstab}, $wait_message); + } sub { + $@ =~ /fsck failed on (\S+)/ or return; + $o->ask_yesorno('', N("Failed to check filesystem %s. Do you want to repair the errors? + (beware, you can lose data)", $1), 1); + }; + undef $w; #- help perl (otherwise wait_message stays forever in newt) + die N("Not enough swap space to fulfill installation, please add some") if availableMemory( +) < 40 * 1024; +} + +#- install_any::guess_mount_point +sub guess_mount_point { + my ($part, $prefix, $user) = @_; + + my %l = ( + '/' => 'etc/fstab', + '/boot' => 'vmlinuz', + '/tmp' => '.X11-unix', + '/usr' => 'X11R6', + '/var' => 'catman', + ); + + require any; + my $handle = any::inspect($part, $prefix) or return; + my $d = $handle->{dir}; + my $mnt = find { -e "$d/$l{$_}" } keys %l; + $mnt ||= (stat("$d/.bashrc"))[4] ? '/root' : '/home/user' . ++$$user if -e "$d/.bashrc"; + $mnt ||= (any { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bashrc" } glob_($d)) ? '/home' : ' +'; + ($mnt, $handle); +} + +#- install_any::suggest_mount_points +sub suggest_mount_points { + my ($fstab, $prefix, $uniq) = @_; + + my $user; + foreach my $part (grep { isTrueFS($_) } @$fstab) { + $part->{mntpoint} && !$part->{unsafeMntpoint} and next; #- if already found via an fstab + + my ($mnt, $handle) = guess_mount_point($part, $prefix, \$user) or next; + + next if $uniq && fs::get::mntpoint2part($mnt, $fstab); + $part->{mntpoint} = $mnt; delete $part->{unsafeMntpoint}; + + #- try to find other mount points via fstab + fs::merge_info_from_fstab($fstab, $handle->{dir}, $uniq, 'loose') if $mnt eq '/'; + } + $_->{mntpoint} and log::l("suggest_mount_points: $_->{device} -> $_->{mntpoint}") foreach @$fstab; +} + +#- install_steps_interactive::ask_mntpoint_s +sub ask_mntpoint_s_interactive { #- }{} + my ($o, $fstab) = @_; + + my @fstab = grep { isTrueFS($_) } @$fstab; + @fstab = grep { isSwap($_) } @$fstab if @fstab == 0; + @fstab = @$fstab if @fstab == 0; + die N("No partition available") if @fstab == 0; + + { + my $_w = $o->wait_message('', N("Scanning partitions to find mount points")); + suggest_mount_points($fstab, $o->{prefix}, 'uniq'); + log::l("default mntpoint $_->{mntpoint} $_->{device}") foreach @fstab; + } + if (@fstab == 1) { + $fstab[0]{mntpoint} = '/'; + } else { + $o->ask_from_({ messages => N("Choose the mount points"), + title => N("Partitioning"), + icon => 'banner-part', + interactive_help_id => 'ask_mntpoint_s', + callbacks => { + complete => sub { + require diskdrake::interactive; + eval { 1, find_index { + !diskdrake::interactive::check_mntpoint($o, $_->{mntpoint}, $_, $o->{all_hds}); + } @fstab }; + }, + }, + }, + [ map { + { + label => partition_table::description($_), + val => \$_->{mntpoint}, + not_edit => 0, + list => [ '', fsedit::suggestions_mntpoint(fs::get::empty_all_hds()) ], + }; + } @fstab ]) or return; + } + ask_mntpoint_s($o, $fstab); +} + +#- install_steps::ask_mntpoint_s +sub ask_mntpoint_s {#-}}} + my ($_o, $fstab) = @_; + + #- TODO: set the mntpoints + + my %m; foreach (@$fstab) { + my $m = $_->{mntpoint}; + + $m && $m =~ m!^/! or next; #- there may be a lot of swaps or "none" + + $m{$m} and die N("Duplicate mount point %s", $m); + $m{$m} = 1; + + #- in case the type does not correspond, force it to ext3 + fs::type::set_fs_type($_, 'ext3') if !isTrueFS($_) && !isOtherAvailableFS($_); + } + 1; +} + +#- adapted from drakboot +sub lilo_choice() { + do { + my $before = fs::fstab_to_string($in->{all_hds}); + any::setupBootloader($in, $bootloader, $in->{all_hds}, $in->{fstab}, $ENV{SECURE_LEVEL}) or $in->exit; + fs::write_fstab($all_hds); + } while !any::installBootloader($in, $bootloader, $all_hds); +} + +#- from disdrake::interactive +{ + package diskdrake::interactive; + sub diskdrake_interactive_Done { + my ($in, $all_hds) = @_; + eval { raid::verify($all_hds->{raids}) }; + if (my $err = $@) { + $::expert or die; + $in->ask_okcancel('', [ formatError($err), N("Continue anyway?") ]) or return; + } + foreach (@{$all_hds->{hds}}) { + if (!write_partitions($in, $_, 'skip_check_rebootNeeded')) { + return if !$::isStandalone; + $in->ask_yesorno(N("Quit without saving"), N("Quit without writing the partition table?"), 1) or return; + } + } + #- skip that fstab/reboot steps + if (!$::isInstall && 0) { + my $new = fs::fstab_to_string($all_hds); + if ($new ne $all_hds->{current_fstab} && $in->ask_yesorno('', N("Do you want to save /etc/fstab modifications"), 1)) { + $all_hds->{current_fstab} = $new; + fs::write_fstab($all_hds); + } + update_bootloader_for_renumbered_partitions($in, $all_hds); + + if (any { $_->{rebootNeeded} } @{$all_hds->{hds}}) { + $in->ask_warn('', N("You need to reboot for the partition table modifications to take place")); + tell_wm_and_reboot(); + } + } + if (my $part = find { $_->{mntpoint} && !maybeFormatted($_) } fs::get::fstab($all_hds)) { + $in->ask_okcancel('', N("You should format partition %s. +Otherwise no entry for mount point %s will be written in fstab. +Quit anyway?", $part->{device}, $part->{mntpoint})) or return if $::isStandalone&& 0; #- no, please + } + 1; + } +} diff --git a/live/draklive-install/draklive-install.desktop b/live/draklive-install/draklive-install.desktop new file mode 100644 index 000000000..be1c497ac --- /dev/null +++ b/live/draklive-install/draklive-install.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Encoding=UTF-8 +Exec=/usr/sbin/live-install +Icon=MandrivaOne-install-icon +Terminal=false +Type=Application +Name=Install from live system diff --git a/live/draklive-install/draklive-install.spec b/live/draklive-install/draklive-install.spec new file mode 100644 index 000000000..b658fd2a9 --- /dev/null +++ b/live/draklive-install/draklive-install.spec @@ -0,0 +1,69 @@ +%define name draklive-install +%define version 0.1 +%define release %mkrel 1 +%define iconname MandrivaOne-install-icon.png +%define imgname MandrivaOne-install.png + +Summary: Live installer +Name: %{name} +Version: %{version} +Release: %{release} +Source0: %{name}-%{version}.tar.bz2 +License: GPL +Group: System/Configuration/Other +Url: http://qa.mandriva.com/twiki/bin/view/Main/DrakLive +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch + +%description +This tool allows to install Mandriva from a running live system. + +%prep +%setup -q + +%install +rm -rf $RPM_BUILD_ROOT + +for d in %_datadir/nautilus/default-desktop %_datadir/apps/kdesktop/DesktopLinks; do + install -D -m 0644 %name.desktop %buildroot/$d/%name.desktop +done +install -D -m 0755 %name %buildroot/%_datadir/%name/%name +install -m 0644 install_interactive.pm %buildroot/%_datadir/%name + +install -d -m 0755 %buildroot/%_sbindir +cat > %buildroot/%_sbindir/%name <<EOF +#!/bin/sh +cd %_datadir/%name +./%name +EOF +chmod 0755 %buildroot/%_sbindir/%name + +mkdir -p %buildroot{%_miconsdir,%_iconsdir,%_liconsdir,%_menudir,%_datadir/libDrakX/pixmaps/} +install theme/IC-installone-48.png %buildroot%_liconsdir/%iconname +install theme/IC-installone-32.png %buildroot%_iconsdir/%iconname +install theme/IC-installone-32.png %buildroot%_miconsdir/%iconname +install theme/IM-INSTALLCDONE2.png %buildroot%_datadir/libDrakX/pixmaps/%imgname + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%update_menus + +%postun +%clean_menus + +%files +%defattr(-,root,root) +%_sbindir/%name +%_datadir/%name +%_datadir/apps/kdesktop/DesktopLinks/*.desktop +%_datadir/nautilus/default-desktop/*.desktop +%_iconsdir/%iconname +%_liconsdir/%iconname +%_miconsdir/%iconname +%_datadir/libDrakX/pixmaps/%imgname + +%changelog +* Fri Dec 16 2005 Olivier Blin <oblin@mandriva.com> 0.1-1mdk +- initial release diff --git a/live/draklive-install/install_interactive.pm b/live/draklive-install/install_interactive.pm new file mode 100644 index 000000000..738739a55 --- /dev/null +++ b/live/draklive-install/install_interactive.pm @@ -0,0 +1,299 @@ +package install_interactive; # $Id$ + +use diagnostics; +use strict; + +use common; +use partition_table; +use partition_table::raw; +use fs::type; +use detect_devices; +use install_steps; +use install_any; +use devices; +use fsedit; +use log; + + +sub tellAboutProprietaryModules { + my ($o) = @_; + my @l = detect_devices::probe_name('Bad') or return; + $o->ask_warn('', formatAlaTeX( +N("Some hardware on your computer needs ``proprietary'' drivers to work. +You can find some information about them at: %s", join(", ", @l)))); +} + +#- unit of $mb is mega bytes, min and max are in sectors, this +#- function is used to convert back to sectors count the size of +#- a partition ($mb) given from the interface (on Resize or Create). +#- modified to take into account a true bounding with min and max. +sub from_Mb { + my ($mb, $min, $max) = @_; + $mb <= $min >> 11 and return $min; + $mb >= $max >> 11 and return $max; + $mb * 2048; +} + +sub partition_with_diskdrake { + my ($o, $all_hds, $nowizard) = @_; + my $ok; + + do { + $ok = 1; + my $do_force_reload = sub { + $o->{all_hds} = fs::get::empty_all_hds(); + install_any::getHds($o, $o); + $all_hds = $o->{all_hds}; + $o->{all_hds}; + }; + require diskdrake::interactive; + { + local $::expert = $::expert; + diskdrake::interactive::main($o, $all_hds, $nowizard, $do_force_reload, $o->interactive_help_sub_display_id('partition_with_diskdrake')); + } + if (delete $o->{wizard}) { + partitionWizard($o, 'nodiskdrake') or redo; + return 1; + } + my @fstab = fs::get::fstab($all_hds); + + unless (fs::get::root_(\@fstab)) { + $ok = 0; + $o->ask_okcancel('', N("You must have a root partition. +For this, create a partition (or click on an existing one). +Then choose action ``Mount point'' and set it to `/'"), 1) or return; + } + if (!any { isSwap($_) } @fstab) { + $ok &&= $o->ask_okcancel('', N("You do not have a swap partition.\n\nContinue anyway?")); + } + if (arch() =~ /ia64/ && !fs::get::has_mntpoint("/boot/efi", $all_hds)) { + $o->ask_warn('', N("You must have a FAT partition mounted in /boot/efi")); + $ok = ''; + } + } until $ok; + 1; +} + +sub partitionWizardSolutions { + my ($o, $all_hds) = @_; + my $hds = $all_hds->{hds}; + my $fstab = [ fs::get::fstab($all_hds) ]; + my @wizlog; + my (%solutions); + + my $min_linux = 400 << 11; + my $max_linux = 2000 << 11; + my $min_swap = 50 << 11; + my $max_swap = 300 << 11; + my $min_freewin = 100 << 11; + + # each solution is a [ score, text, function ], where the function retunrs true if succeeded + + my @hds_rw = grep { !$_->{readonly} } @$hds; + my @hds_can_add = grep { $_->can_raw_add } @hds_rw; + if (fs::get::hds_free_space(@hds_can_add) > $min_linux) { + $solutions{free_space} = [ 20, N("Use free space"), sub { fsedit::auto_allocate($all_hds, $o->{partitions}); 1 } ]; + } else { + push @wizlog, N("Not enough free space to allocate new partitions") . ": " . + (@hds_can_add ? + fs::get::hds_free_space(@hds_can_add) . " < $min_linux" : + "no harddrive on which partitions can be added"); + } + + if (my @truefs = grep { isTrueLocalFS($_) } @$fstab) { + #- value twice the ext2 partitions + $solutions{existing_part} = [ 6 + @truefs + @$fstab, N("Use existing partitions"), sub { $o->ask_mntpoint_s($fstab) } ]; + } else { + push @wizlog, N("There is no existing partition to use"); + } + + my @fats = grep { $_->{fs_type} eq 'vfat' } @$fstab; + fs::df($_) foreach @fats; + if (my @ok_forloopback = sort { $b->{free} <=> $a->{free} } grep { $_->{free} > $min_linux + $min_swap + $min_freewin } @fats) { + $solutions{loopback} = + [ -10 - @fats, N("Use the Windows partition for loopback"), + sub { + my ($s_root, $s_swap); + my $part = $o->ask_from_listf('', N("Which partition do you want to use for Linux4Win?"), \&partition_table::description, \@ok_forloopback) or return; + $max_swap = $min_swap + 1 if $part->{free} - $max_swap < $min_linux; + $o->ask_from('', N("Choose the sizes"), [ + { label => N("Root partition size in MB: "), val => \$s_root, min => $min_linux >> 11, max => min($part->{free} - $max_swap, $max_linux) >> 11, type => 'range' }, + { label => N("Swap partition size in MB: "), val => \$s_swap, min => $min_swap >> 11, max => $max_swap >> 11, type => 'range' }, + ]) or return; + push @{$part->{loopback}}, + { fs_type => 'ext3', loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => $s_root << 11, loopback_device => $part, notFormatted => 1 }, + { fs_type => 'swap', loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => $s_swap << 11, loopback_device => $part, notFormatted => 1 }; + fsedit::recompute_loopbacks($all_hds); + 1; + } ]; + } else { + push @wizlog, N("There is no FAT partition to use as loopback (or not enough space left)") . + (@fats ? "\nFAT partitions:" . join('', map { "\n $_->{device} $_->{free} (" . ($min_linux + $min_swap + $min_freewin) . ")" } @fats) : ''); + } + + + if (my @ok_for_resize_fat = grep { isFat_or_NTFS($_) && !fs::get::part2hd($_, $all_hds)->{readonly} } @$fstab) { + $solutions{resize_fat} = + [ 6 - @ok_for_resize_fat, N("Use the free space on the Windows partition"), + sub { + my $part = $o->ask_from_listf_raw({ messages => N("Which partition do you want to resize?"), + interactive_help_id => 'resizeFATChoose', + }, \&partition_table::description, \@ok_for_resize_fat) or return; + my $hd = fs::get::part2hd($part, $all_hds); + my $resize_fat = eval { + my $pkg = $part->{fs_type} eq 'vfat' ? do { + require resize_fat::main; + 'resize_fat::main'; + } : do { + require diskdrake::resize_ntfs; + 'diskdrake::resize_ntfs'; + }; + $pkg->new($part->{device}, devices::make($part->{device})); + }; + $@ and die N("The FAT resizer is unable to handle your partition, +the following error occurred: %s", formatError($@)); + my $min_win = do { + my $_w = $o->wait_message(N("Resizing"), N("Computing the size of the Windows partition")); + $resize_fat->min_size; + }; + #- make sure that even after normalizing the size to cylinder boundaries, the minimun will be saved, + #- this save at least a cylinder (less than 8Mb). + $min_win += partition_table::raw::cylinder_size($hd); + + $part->{size} > $min_linux + $min_swap + $min_freewin + $min_win or die N("Your Windows partition is too fragmented. Please reboot your computer under Windows, run the ``defrag'' utility, then restart the Mandriva Linux installation."); + $o->ask_okcancel('', formatAlaTeX( + #-PO: keep the double empty lines between sections, this is formatted a la LaTeX + N("WARNING! + +DrakX will now resize your Windows partition. Be careful: this +operation is dangerous. If you have not already done so, you +first need to exit the installation, run \"chkdsk c:\" from a +Command Prompt under Windows (beware, running graphical program +\"scandisk\" is not enough, be sure to use \"chkdsk\" in a +Command Prompt!), optionally run defrag, then restart the +installation. You should also backup your data. +When sure, press Ok."))) or return; + + my $mb_size = $part->{size} >> 11; + $o->ask_from('', N("Which size do you want to keep for Windows on"), [ + { label => N("partition %s", partition_table::description($part)), val => \$mb_size, min => $min_win >> 11, max => ($part->{size} - $min_linux - $min_swap) >> 11, type => 'range' }, + ]) or return; + + my $oldsize = $part->{size}; + $part->{size} = from_Mb($mb_size, $min_win, $part->{size}); + + $hd->adjustEnd($part); + + eval { + my $_w = $o->wait_message(N("Resizing"), N("Resizing Windows partition")); + $resize_fat->resize($part->{size}); + }; + if (my $err = $@) { + $part->{size} = $oldsize; + die N("FAT resizing failed: %s", formatError($err)); + } + + $o->ask_warn('', N("To ensure data integrity after resizing the partition(s), +filesystem checks will be run on your next boot into Windows(TM)")) if $part->{fs_type} ne 'vfat'; + + set_isFormatted($part, 1); + partition_table::will_tell_kernel($hd, resize => $part); #- down-sizing, write_partitions is not needed + partition_table::adjust_local_extended($hd, $part); + partition_table::adjust_main_extended($hd); + + fsedit::auto_allocate($all_hds, $o->{partitions}); + 1; + } ]; + } else { + push @wizlog, N("There is no FAT partition to resize (or not enough space left)"); + } + + if (@$fstab && @hds_rw) { + $solutions{wipe_drive} = + [ 10, fsedit::is_one_big_fat_or_NT($hds) ? N("Remove Windows(TM)") : N("Erase and use entire disk"), + sub { + my $hd = $o->ask_from_listf_raw({ messages => N("You have more than one hard drive, which one do you install linux on?"), + interactive_help_id => 'takeOverHdChoose', + }, + \&partition_table::description, \@hds_rw) or return; + $o->ask_okcancel_({ messages => N("ALL existing partitions and their data will be lost on drive %s", partition_table::description($hd)), + interactive_help_id => 'takeOverHdConfirm' }) or return; + partition_table::raw::zero_MBR($hd); + fsedit::auto_allocate($all_hds, $o->{partitions}); + 1; + } ]; + } + + if (@hds_rw) { + $solutions{diskdrake} = [ 0, N("Custom disk partitioning"), sub { partition_with_diskdrake($o, $all_hds, 'nowizard') } ]; + } + + $solutions{fdisk} = + [ -10, N("Use fdisk"), sub { + $o->enter_console; + foreach (@$hds) { + print "\n" x 10, N("You can now partition %s. +When you are done, do not forget to save using `w'", partition_table::description($_)); + print "\n\n"; + my $pid = 0; + if (arch() =~ /ppc/) { + $pid = fork() or exec "pdisk", devices::make($_->{device}); + } else { + $pid = fork() or exec "fdisk", devices::make($_->{device}); + } + waitpid($pid, 0); + } + $o->leave_console; + 0; + } ] if $o->{partitioning}{fdisk}; + + log::l("partitioning wizard log:\n", (map { ">>wizlog>>$_\n" } @wizlog)); + %solutions; +} + +sub partitionWizard { + my ($o, $b_nodiskdrake) = @_; + + my %solutions = partitionWizardSolutions($o, $o->{all_hds}); + + delete $solutions{diskdrake} if $b_nodiskdrake; + + my @solutions = sort { $b->[0] <=> $a->[0] } values %solutions; + + my $level = $::expert ? -9999 : 0; + my @sol = grep { $_->[0] >= $level } @solutions; + + log::l('' . "solutions found: " . join('', map { $_->[1] } @sol) . + " (all solutions found: " . join('', map { $_->[1] } @solutions) . ")"); + + @solutions = @sol if @sol > 1; + log::l("solutions: ", int @solutions); + @solutions or $o->ask_warn('', N("I can not find any room for installing")), die 'already displayed'; + + log::l('HERE: ', join(',', map { $_->[1] } @solutions)); + my $sol; + $o->ask_from_({ messages => N("The DrakX Partitioning wizard found the following solutions:"), + interactive_help_id => 'doPartitionDisks', + }, + [ { val => \$sol, list => \@solutions, format => sub { $_[0][1] }, type => 'list' } ]); + log::l("partitionWizard calling solution $sol->[1]"); + my $ok = eval { $sol->[2]->() }; + $@ and $o->ask_warn('', N("Partitioning failed: %s", formatError($@))); + $ok or goto &partitionWizard; + 1; +} + +sub upNetwork { + my ($o, $b_pppAvoided) = @_; + my $_w = $o->wait_message('', N("Bringing up the network")); + install_steps::upNetwork($o, $b_pppAvoided); +} +sub downNetwork { + my ($o, $b_pppOnly) = @_; + my $_w = $o->wait_message('', N("Bringing down the network")); + install_steps::downNetwork($o, $b_pppOnly); +} + + + +1; diff --git a/live/draklive-install/theme/IC-installone-128.png b/live/draklive-install/theme/IC-installone-128.png Binary files differnew file mode 100644 index 000000000..10ff11fc7 --- /dev/null +++ b/live/draklive-install/theme/IC-installone-128.png diff --git a/live/draklive-install/theme/IC-installone-16.png b/live/draklive-install/theme/IC-installone-16.png Binary files differnew file mode 100644 index 000000000..f96fc005d --- /dev/null +++ b/live/draklive-install/theme/IC-installone-16.png diff --git a/live/draklive-install/theme/IC-installone-24.png b/live/draklive-install/theme/IC-installone-24.png Binary files differnew file mode 100644 index 000000000..a25723fc1 --- /dev/null +++ b/live/draklive-install/theme/IC-installone-24.png diff --git a/live/draklive-install/theme/IC-installone-32.png b/live/draklive-install/theme/IC-installone-32.png Binary files differnew file mode 100644 index 000000000..764431a90 --- /dev/null +++ b/live/draklive-install/theme/IC-installone-32.png diff --git a/live/draklive-install/theme/IC-installone-48.png b/live/draklive-install/theme/IC-installone-48.png Binary files differnew file mode 100644 index 000000000..a56e58b91 --- /dev/null +++ b/live/draklive-install/theme/IC-installone-48.png diff --git a/live/draklive-install/theme/IC-installone-64.png b/live/draklive-install/theme/IC-installone-64.png Binary files differnew file mode 100644 index 000000000..0a578631f --- /dev/null +++ b/live/draklive-install/theme/IC-installone-64.png diff --git a/live/draklive-install/theme/IM-INSTALLCDONE.png b/live/draklive-install/theme/IM-INSTALLCDONE.png Binary files differnew file mode 100644 index 000000000..b97d90213 --- /dev/null +++ b/live/draklive-install/theme/IM-INSTALLCDONE.png diff --git a/live/draklive-install/theme/IM-INSTALLCDONE2.png b/live/draklive-install/theme/IM-INSTALLCDONE2.png Binary files differnew file mode 100644 index 000000000..d6313f079 --- /dev/null +++ b/live/draklive-install/theme/IM-INSTALLCDONE2.png |