summaryrefslogtreecommitdiffstats
path: root/perl-install
ModeNameSize
-rw-r--r--.cvsignore54logstatsplain
-rw-r--r--.perl_checker152logstatsplain
-rw-r--r--ChangeLog1747912logstatsplain
-rw-r--r--Makefile10082logstatsplain
-rw-r--r--Makefile.config1582logstatsplain
-rw-r--r--Makefile.drakxtools2460logstatsplain
d---------Newt304logstatsplain
d---------Xconfig565logstatsplain
-rw-r--r--any.pm43061logstatsplain
-rw-r--r--apps.net_monitor73logstatsplain
-rw-r--r--bootloader.pm40640logstatsplain
-rw-r--r--c.pm352logstatsplain
d---------c431logstatsplain
-rw-r--r--class_discard.pm189logstatsplain
-rwxr-xr-xcommands394logstatsplain
-rw-r--r--commands.pm14709logstatsplain
-rw-r--r--common.pm7277logstatsplain
-rw-r--r--crypto.pm5524logstatsplain
-rw-r--r--detect_devices.pm24488logstatsplain
-rw-r--r--devices.pm6962logstatsplain
d---------diskdrake278logstatsplain
-rw-r--r--drakxtools.spec101142logstatsplain
-rw-r--r--fs.pm28831logstatsplain
-rw-r--r--fsedit.pm25784logstatsplain
-rw-r--r--ftp.pm2204logstatsplain
-rwxr-xr-xg_auto_install1978logstatsplain
-rw-r--r--handle_configs.pm4192logstatsplain
d---------harddrake177logstatsplain
-rw-r--r--help.pm46246logstatsplain
-rw-r--r--http.pm978logstatsplain
-rwxr-xr-xinstall21206logstatsplain
-rw-r--r--install2.pm25588logstatsplain
-rw-r--r--install_any.pm42662logstatsplain
-rw-r--r--install_gtk.pm11005logstatsplain
-rw-r--r--install_interactive.pm11222logstatsplain
-rw-r--r--install_messages.pm6750logstatsplain
-rw-r--r--install_steps.pm37429logstatsplain
-rw-r--r--install_steps_auto_install.pm3285logstatsplain
-rw-r--r--install_steps_gtk.pm26404logstatsplain
-rw-r--r--install_steps_interactive.pm47645logstatsplain
-rw-r--r--install_steps_newt.pm1309logstatsplain
-rw-r--r--install_steps_stdio.pm667logstatsplain
-rw-r--r--interactive.pm17487logstatsplain
d---------interactive140logstatsplain
-rw-r--r--keyboard.pm22964logstatsplain
-rw-r--r--lang.pm52324logstatsplain
-rw-r--r--list.sparc2771logstatsplain
-rwxr-xr-xlive_install1347logstatsplain
-rwxr-xr-xlive_install22503logstatsplain
-rw-r--r--log.pm1366logstatsplain
-rw-r--r--loopback.pm3426logstatsplain
-rw-r--r--lvm.pm3855logstatsplain
-rw-r--r--modules.pm12044logstatsplain
d---------modules83logstatsplain
-rw-r--r--mouse.pm19288logstatsplain
-rw-r--r--network.pm51logstatsplain
d---------network490logstatsplain
-rw-r--r--pam.net_monitor225logstatsplain
-rw-r--r--partition_table.pm29393logstatsplain
d---------partition_table277logstatsplain
d---------patch460logstatsplain
-rwxr-xr-xperl2etags154logstatsplain
d---------pixmaps2290logstatsplain
-rw-r--r--pkgs.pm41006logstatsplain
d---------printer405logstatsplain
-rw-r--r--raid.pm4545logstatsplain
d---------resize_fat531logstatsplain
-rw-r--r--run_program.pm3375logstatsplain
d---------sbus_probing35logstatsplain
-rwxr-xr-xscanner.pm13759logstatsplain
d---------security179logstatsplain
-rw-r--r--services.pm16910logstatsplain
d---------share1710logstatsplain
-rw-r--r--standalone.pm13571logstatsplain
d---------standalone1645logstatsplain
-rw-r--r--steps.pm2356logstatsplain
-rw-r--r--swap.pm668logstatsplain
-rw-r--r--timezone.pm7909logstatsplain
-rw-r--r--ugtk2.pm52057logstatsplain
d---------unused288logstatsplain
-rwxr-xr-xverify_c303logstatsplain
">#- not selected means no need for worying about. my $max = 32; #- always refuse after $max tries. if ($::o->{method} eq "cdrom") { cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1; return unless $cdrom; ejectCdrom($cdrom); while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) { $current_medium = $asked_medium; eval { fs::mount($cdrom, "/tmp/image", "iso9660", 'readonly') }; my $getFile = getFile($file); $getFile && @advertising_images and copy_advertising($::o); $getFile and return $getFile; $current_medium = 'unknown'; #- don't know what CD is inserted now. ejectCdrom($cdrom); --$max; } } else { while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) { $current_medium = $asked_medium; my $getFile = getFile($file); $getFile and return $getFile; $current_medium = 'unknown'; #- don't know what CD image has been copied. --$max; } } #- keep in mind the asked medium has been refused on this way. #- this means it is no more selected. $::o->{packages}{mediums}{$asked_medium}{selected} = undef; #- on cancel, we can expect the current medium to be undefined too, #- this enable remounting if selecting a package back. $current_medium = 'unknown'; return; } sub getFile { my ($f, $method) = @_; log::l("getFile $f:$method"); my $rel = relGetFile($f); do { if ($method =~ /crypto/i) { require crypto; crypto::getFile($f); } elsif ($::o->{method} eq "ftp") { require ftp; ftp::getFile($rel); } elsif ($::o->{method} eq "http") { require http; http::getFile($rel); } else { #- try to open the file, but examine if it is present in the repository, this allow #- handling changing a media when some of the file on the first CD has been copied #- to other to avoid media change... my $f2 = "$postinstall_rpms/$f"; $f2 = "/tmp/image/$rel" unless $postinstall_rpms && -e $f2; open GETFILE, $f2 and *GETFILE; } } || errorOpeningFile($f); } sub getAndSaveFile { my ($file, $local) = @_ == 1 ? ("Mandrake/mdkinst$_[0]", $_[0]) : @_; local *F; open F, ">$local" or return; local $/ = \ (16 * 1024); my $f = ref($file) ? $file : getFile($file) or return; local $_; while (<$f>) { syswrite F, $_ } 1; } #-###################################################################################### #- Post installation RPMS from cdrom only, functions #-###################################################################################### sub setup_postinstall_rpms($$) { my ($prefix, $packages) = @_; $postinstall_rpms and return; $postinstall_rpms = "$prefix/usr/postinstall-rpm"; require pkgs; require commands; log::l("postinstall rpms directory set to $postinstall_rpms"); clean_postinstall_rpms(); #- make sure in case of previous upgrade problem. commands::mkdir_('-p', $postinstall_rpms); #- compute closure of unselected package that may be copied, #- don't complain if package does not exists as it may happen #- for the various architecture taken into account (X servers). my %toCopy; foreach (@needToCopy) { my $pkg = pkgs::packageByName($packages, $_); pkgs::selectPackage($packages, $pkg, 0, \%toCopy) if $pkg; } @toCopy{@needToCopyIfRequiresSatisfied} = (); my @toCopy = map { pkgs::packageByName($packages, $_) } keys %toCopy; #- extract headers of package, this is necessary for getting #- the complete filename of each package. #- copy the package files in the postinstall RPMS directory. #- last arg is default medium '' known as the CD#1. pkgs::extractHeaders($prefix, \@toCopy, $packages->{mediums}{1}); commands::cp((map { "/tmp/image/" . relGetFile(pkgs::packageFile($_)) } @toCopy), $postinstall_rpms); } sub clean_postinstall_rpms() { require commands; $postinstall_rpms and -d $postinstall_rpms and commands::rm('-rf', $postinstall_rpms); } #-###################################################################################### #- Specific Hardware to take into account and associated rpms to install #-###################################################################################### sub allowNVIDIA_rpms { my ($packages) = @_; require pkgs; if (pkgs::packageByName($packages, "NVIDIA_GLX")) { #- at this point, we can allow using NVIDIA 3D acceleration packages. my @rpms; foreach (qw(kernel kernel-smp kernel-entreprise kernel22 kernel22-smp kernel22-secure)) { my $p = pkgs::packageByName($packages, $_); pkgs::packageSelectedOrInstalled($p) or next; my $name = "NVIDIA_kernel-" . pkgs::packageVersion($p) . "-" . pkgs::packageRelease($p) . (/(-.*)/ && $1); pkgs::packageByName($packages, $name) or return; push @rpms, $name; } @rpms > 0 or return; return [ @rpms, "NVIDIA_GLX" ]; } } #-###################################################################################### #- Functions #-###################################################################################### sub kernelVersion { my ($o) = @_; require pkgs; my $p = pkgs::packageByName($o->{packages}, "kernel"); $p ||= pkgs::packageByName($o->{packages}, "kernel22"); $p or die "I couldn't find the kernel package!"; pkgs::packageVersion($p) . "-" . pkgs::packageRelease($p); } sub getNextStep { my ($s) = $::o->{steps}{first}; $s = $::o->{steps}{$s}{next} while $::o->{steps}{$s}{done} || !$::o->{steps}{$s}{reachable}; $s; } sub spawnShell { return if $::o->{localInstall} || $::testing; -x "/bin/sh" or die "cannot open shell - /bin/sh doesn't exist"; fork and return; $ENV{DISPLAY} ||= ":0"; #- why not :pp local *F; sysopen F, "/dev/tty2", 2 or die "cannot open /dev/tty2 -- no shell will be provided"; open STDIN, "<&F" or die ''; open STDOUT, ">&F" or die ''; open STDERR, ">&F" or die ''; close F; print any::drakx_version(), "\n"; c::setsid(); ioctl(STDIN, c::TIOCSCTTY(), 0) or warn "could not set new controlling tty: $!"; my $busybox = "/usr/bin/busybox"; exec {-e $busybox ? $busybox : "/bin/sh"} "/bin/sh" or log::l("exec of /bin/sh failed: $!"); } sub fsck_option { my ($o) = @_; my $y = $o->{security} < 3 && !$::expert && "-y "; substInFile { s/^(\s*fsckoptions="?)(-y )?/$1$y/ } "$o->{prefix}/etc/rc.d/rc.sysinit"; #- " help po, DONT REMOVE } sub getAvailableSpace { my ($o) = @_; #- make sure of this place to be available for installation, this could help a lot. #- currently doing a very small install use 36Mb of postinstall-rpm, but installing #- these packages may eat up to 90Mb (of course not all the server may be installed!). #- 65mb may be a good choice to avoid almost all problem of insuficient space left... my $minAvailableSize = 65 * sqr(1024); my $n = !$::testing && getAvailableSpace_mounted($o->{prefix}) || getAvailableSpace_raw($o->{fstab}) * 512 / 1.07; $n - max(0.1 * $n, $minAvailableSize); } sub getAvailableSpace_mounted { my ($prefix) = @_; my $dir = -d "$prefix/usr" ? "$prefix/usr" : "$prefix"; my (undef, $free) = MDK::Common::System::df($dir) or return; log::l("getAvailableSpace_mounted $free KB"); $free * 1024 || 1; } sub getAvailableSpace_raw { my ($fstab) = @_; do { $_->{mntpoint} eq '/usr' and return $_->{size} } foreach @$fstab; do { $_->{mntpoint} eq '/' and return $_->{size} } foreach @$fstab; if ($::testing) { my $nb = 450; log::l("taking ${nb}MB for testing"); return $nb << 11; } die "missing root partition"; } sub preConfigureTimezone { my ($o) = @_; require timezone; #- can't be done in install cuz' timeconfig %post creates funny things add2hash($o->{timezone}, { timezone::read($o->{prefix}) }) if $o->{isUpgrade}; $o->{timezone}{timezone} ||= timezone::bestTimezone(lang::lang2text($o->{lang})); my $utc = $::expert && !grep { isFat($_) || isNT($_) } @{$o->{fstab}}; my $ntp = timezone::ntp_server($o->{prefix}); add2hash_($o->{timezone}, { UTC => $utc, ntp => $ntp }); } sub setPackages { my ($o) = @_; require pkgs; if (!$o->{packages} || is_empty_hash_ref($o->{packages}{names})) { $o->{packages} = pkgs::psUsingHdlists($o->{prefix}, $o->{method}); push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs"; push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock}; push @{$o->{default_packages}}, "kernel-enterprise" if (availableRamMB() > 800) && (arch() !~ /ia64/); push @{$o->{default_packages}}, "kernel22" if c::kernel_version() =~ /^\Q2.2/; push @{$o->{default_packages}}, "kernel22-secure" if $o->{security} > 3; push @{$o->{default_packages}}, "kernel-smp" if detect_devices::hasSMP(); push @{$o->{default_packages}}, "kernel-pcmcia-cs" if $o->{pcmcia}; push @{$o->{default_packages}}, "raidtools" if $o->{raid} && !is_empty_array_ref($o->{raid}{raid}); push @{$o->{default_packages}}, "lvm" if -e '/etc/lvmtab'; push @{$o->{default_packages}}, "usbd" if modules::get_alias("usb-interface"); push @{$o->{default_packages}}, "reiserfsprogs" if grep { isThisFs("reiserfs", $_) } @{$o->{fstab}}; push @{$o->{default_packages}}, "xfsprogs" if grep { isThisFs("xfs", $_) } @{$o->{fstab}}; push @{$o->{default_packages}}, "jfsprogs" if grep { isThisFs("jfs", $_) } @{$o->{fstab}}; push @{$o->{default_packages}}, "alsa", "alsa-utils" if modules::get_alias("sound-slot-0") =~ /^snd-card-/; push @{$o->{default_packages}}, "imwheel" if $o->{mouse}{nbuttons} > 3; pkgs::getDeps($o->{prefix}, $o->{packages}); pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, 'basesystem') || die("missing basesystem package"), 1); #- must be done after selecting base packages (to save memory) pkgs::getProvides($o->{packages}); #- must be done after getProvides pkgs::read_rpmsrate($o->{packages}, getFile("Mandrake/base/rpmsrate")); ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers($o->{meta_class}); if ($::auto_install && !$o->{compssUsersChoice}) { $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}{flags}} } @{$o->{compssUsersSorted}}; } if (!$::auto_install && !$o->{isUpgrade}) { #- by default, choose: $o->{compssUsersChoice}{$_} = 1 foreach 'GNOME', 'KDE', 'CONFIG';