summaryrefslogtreecommitdiffstats
path: root/perl-install/install_interactive.pm
blob: 4f1ce506454a2b5043c30f07bc077d1799a674bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
-rw-r--r--perl-install/any.pm2
-rw-r--r--perl-install/detect_devices.pm4
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_gtk.pm6
-rw-r--r--perl-install/my_gtk.pm2
-rw-r--r--perl-install/network/isdn.pm2
-rw-r--r--perl-install/network/modem.pm4
-rw-r--r--perl-install/network/network.pm2
-rw-r--r--perl-install/network/tools.pm2
-rw-r--r--perl-install/printer.pm62
10 files changed, 45 insertions, 45 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index e0dfb62d1..5500f9766 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -887,7 +887,7 @@ sub set_login_serial_console {
my ($prefix, $port, $speed) = @_;
my $line = "s$port:12345:respawn:/sbin/getty ttyS$port DT$speed ansi\n";
- substInFile { s/^s$port:.*//; $_ = "$line" if eof } "$prefix/etc/inittab";
+ substInFile { s/^s$port:.*//; $_ = $line if eof } "$prefix/etc/inittab";
}
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 3da219e8b..ff689800c 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -515,10 +515,10 @@ sub whatUsbport() {
my @res;
foreach $i (0..15) {
my $port = "/dev/usb/lp$i";
- my $realport = devices::make("$port");
+ my $realport = devices::make($port);
next if (!$realport);
next if (! -r $realport);
- open PORT, "$realport" or do next;
+ open PORT, $realport or do next;
my $idstr = "";
# Calculation of IOCTL function 0x84005001 (to get device ID
# string):
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 14565b100..8159ffe19 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -267,7 +267,7 @@ sub getAvailableSpace {
sub getAvailableSpace_mounted {
my ($prefix) = @_;
- my $dir = -d "$prefix/usr" ? "$prefix/usr" : "$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;
@@ -936,7 +936,7 @@ sub guess_mount_point {
my $d = $handle->{dir};
my ($mnt) = grep { -e "$d/$l{$_}" } keys %l;
$mnt ||= (stat("$d/.bashrc"))[4] ? '/root' : '/home/user' . ++$$user if -e "$d/.bashrc";
- $mnt ||= (grep { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bashrc" } glob_("$d")) ? '/home' : '';
+ $mnt ||= (grep { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bashrc" } glob_($d)) ? '/home' : '';
($mnt, $handle);
}
diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm
index 712fbbcda..3ffb7991e 100644
--- a/perl-install/install_gtk.pm
+++ b/perl-install/install_gtk.pm
@@ -224,7 +224,7 @@ if (arch() =~ /^ia64/) {
require Xconfig::card;
my ($card) = Xconfig::card::probe();
Xconfig::card::add_to_card__using_Cards($card, $card->{type}) if $card && $card->{type};
- output($file, <<END);
+ output($file, sprintf(<<'END', $mouse_type, $card->{driver}));
Section "Files"
FontPath "/usr/X11R6/lib/X11/fonts:unscaled"
@@ -241,7 +241,7 @@ EndSection
Section "InputDevice"
Identifier "Mouse"
Driver "mouse"
- Option "Protocol" "$mouse_type"
+ Option "Protocol" "%s"
Option "Device" "/dev/mouse"
EndSection
@@ -253,7 +253,7 @@ EndSection
Section "Device"
Identifier "device"
- Driver "$card->{driver}"
+ Driver "%s"
EndSection
Section "Screen"
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index 04aabea56..a7d67f993 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -501,7 +501,7 @@ sub get_text_coord {
$width = 0;
$idx++;
}
- $lines[$idx] = $flag ? "$_" : $lines[$idx] . $wrap_char . "$_";
+ $lines[$idx] = $flag ? $_ : $lines[$idx] . $wrap_char . $_;
$width += $l;
$flag = 0;
$l <= $max_width2 or $max_width2 = $l;
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index f9c8bd409..4bdc83990 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -59,7 +59,7 @@ We recommand the light configuration.
my $p = pkgs::packageByName($in->{packages}, $rmpackage);
$p && $p->flag_selected and pkgs::unselectPackage($in->{packages}, $p);
}
- run_program::rooted($prefix, "rpm", "-e", "$rmpackage");
+ run_program::rooted($prefix, "rpm", "-e", $rmpackage);
$in->do_pkgs->install($instpackage, if_($isdn->{speed} =~ /128/, 'ibod'), 'isdn4k-utils');
my $light = $e =~ /light/ ? 1 : 0;
isdn_write_config_backend($isdn, $light, $netc);
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
index 046ebbf8d..c90725081 100644
--- a/perl-install/network/modem.pm
+++ b/perl-install/network/modem.pm
@@ -70,13 +70,13 @@ sub modem_detect_backend {
$mouse ||={};
$mouse->{device} ||= readlink "/dev/mouse";
my $serdev = arch() =~ /ppc/ ? "macserial" : "serial";
- eval { modules::load("$serdev") };
+ eval { modules::load($serdev) };
detect_devices::probeSerialDevices();
foreach ('modem', map { "ttyS$_" } (0..7)) {
next if $mouse->{device} =~ /$_/;
next unless -e "/dev/$_";
- detect_devices::hasModem("/dev/$_") and $modem->{device} = "$_", last;
+ detect_devices::hasModem("/dev/$_") and $modem->{device} = $_, last;
}
#- add an alias for macserial on PPC
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 9ae4e3f24..880b23aa6 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -153,7 +153,7 @@ sub add2hosts {
open F, ">$file" or die "cannot write $file: $!";
while (my ($ip, $v) = each %l) {
$ip or next;
- print F "$ip";
+ print F $ip;
if ($v =~ /^\s/) {
print F $v;
} else {
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index c2a1b28cd..f43406c80 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -22,7 +22,7 @@ sub write_cnx_script {
'#!/bin/bash
' . if_(!$netc->{at_boot}, 'if [ "x$1" == "x--boot_time" ]; then exit; fi
') . $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{$_});
- chmod 0755, "$prefix" . $_;
+ chmod 0755, "$prefix$_";
}
}
}
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 0d24d0eb8..ce3d02d5e 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -190,7 +190,7 @@ sub stop_service ($) {
sub service_starts_on_boot ($) {
my ($service) = @_;
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"/bin/sh -c \"export LC_ALL=C; /sbin/chkconfig --list $service 2>&1\" |" ||
return 0;
while (my $line = <F>) {
@@ -274,7 +274,7 @@ sub assure_device_is_available_for_cups {
# CUPS knows the device.
my ($device) = @_;
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"/bin/sh -c \"export LC_ALL=C; /usr/sbin/lpinfo -v\" |" ||
die "Could not run \"lpinfo\"!";
while (my $line = <F>) {
@@ -291,7 +291,7 @@ sub assure_device_is_available_for_cups {
sub network_running {
# If the network is not running return 0, otherwise 1.
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"/bin/sh -c \"export LC_ALL=C; /sbin/ifconfig\" |" ||
die "Could not run \"ifconfig\"!";
while (my $line = <F>) {
@@ -374,7 +374,7 @@ sub set_alternative {
local *F;
# Read the list of executables for the given command to find the number
# of the desired executable
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"/bin/sh -c \"export LC_ALL=C; /bin/echo | update-alternatives --config $command \" |" ||
die "Could not run \"update-alternatives\"!";
my $choice = 0;
@@ -390,7 +390,7 @@ sub set_alternative {
close F;
# If the executable was found, assign the command to it
if ($choice > 0) {
- system(($::testing ? "$prefix" : "chroot $prefix/ ") .
+ system(($::testing ? $prefix : "chroot $prefix/ ") .
"/bin/sh -c \"/bin/echo $choice | update-alternatives --config $command > /dev/null 2>&1\"");
}
return 1;
@@ -449,7 +449,7 @@ sub read_configured_queues($) {
for $spooler (qw(cups pdq lprng lpd)) {
#- poll queue info
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"foomatic-configure -P -q -s $spooler |" ||
die "Could not run foomatic-configure";
eval (join('',(<F>)));
@@ -463,7 +463,7 @@ sub read_configured_queues($) {
} else {
#- Poll the queues of the current default spooler
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"foomatic-configure -P -q -s $printer->{SPOOLER} |" ||
die "Could not run foomatic-configure";
eval (join('',(<F>)));
@@ -595,7 +595,7 @@ sub read_printer_db(;$) {
# Generate the Foomatic printer/driver overview, read it from the
# appropriate file when it is already generated
if (!(-f $dbpath)) {
- open DBPATH, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open DBPATH, ($::testing ? $prefix : "chroot $prefix/ ") .
"foomatic-configure -O -q |" ||
die "Could not run foomatic-configure";
} else {
@@ -724,7 +724,7 @@ sub read_foomatic_options ($) {
# Generate the option data for the chosen printer/driver combo
my $COMBODATA;
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"foomatic-configure -P -q -p $printer->{currentqueue}{printer}" .
" -d $printer->{currentqueue}{driver}" .
($printer->{OLD_QUEUE} ?
@@ -746,10 +746,10 @@ sub read_cups_options ($) {
# reuse the dialog
local *F;
if ($queue_or_file =~ /.ppd.gz$/) { # compressed PPD file
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"gunzip -cd $queue_or_file | lphelp - |" || return 0;
} else { # PPD file not compressed or queue
- open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
"lphelp $queue_or_file |" || return 0;
}
my $i;
@@ -831,7 +831,7 @@ sub read_cups_printer_list {
# This function reads in a list of all printers which the local CUPS
# daemon currently knows, including remote ones.
local *F;
- open F, ($::testing ? "$prefix" : "chroot $prefix/ 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 Mandrakelinux 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 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;