From 61e87a9fb56f97ae843557511ba3609f9849cc2e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 18 Jul 1999 19:16:10 +0000 Subject: *** empty log message *** --- perl-install/Makefile | 30 ++++++---- perl-install/common.pm | 18 +++++- perl-install/fs.pm | 12 ++-- perl-install/fsedit.pm | 2 +- perl-install/install2 | 9 +++ perl-install/install2.pm | 123 ++++++++++++++++++++--------------------- perl-install/keyboard.pm | 78 ++++++++++++++------------ perl-install/share/po/Makefile | 21 +++++++ 8 files changed, 174 insertions(+), 119 deletions(-) create mode 100755 perl-install/install2 create mode 100644 perl-install/share/po/Makefile (limited to 'perl-install') diff --git a/perl-install/Makefile b/perl-install/Makefile index 3773961d1..ccd410301 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -1,20 +1,21 @@ SO_FILES = c/blib/arch/auto/c/c.so -PMS = *.pm c/*.pm resize_fat/*.pm commands diskdrake +PMS = *.pm c/*.pm resize_fat/*.pm commands install2 diskdrake DEST = /tmp/t/Mandrake/instimage DESTREP4PMS = $(DEST)/usr/bin/perl-install PERL = perl -LOCALFILES = $(PERL) mouseconfig fr.map -EXCLUDE = $(LOCALFILES) boot-hd.img +LOCALFILES = $(PERL) mouseconfig +EXCLUDE = $(LOCALFILES) boot-hd.img keymaps xmodmaps -.PHONY: all tags install clean verify_c +.PHONY: all po tags install clean verify_c -all: $(SO_FILES) install1_hd +all: $(SO_FILES) po install1_hd tags: etags -o - $(PMS) | perl2etags > TAGS clean: test ! -e c/Makefile || $(MAKE) -C c clean + $(MAKE) -C po clean rm -f c/c.xs install1_hd find . -name "*~" -o -name "TAGS" -o -name "*.old" | xargs rm -f @@ -25,7 +26,7 @@ tar-diskdrake: clean cd .. ; rm -rf diskdrake ; cp -af perl-install diskdrake l=`perl2fcalls -uses -excludec diskdrake | sort | uniq | sed -e 's/::/\//' -e 's/^/diskdrake\//' -e 's/$$/.pm/'` ; \ - cd .. ; tar cfz diskdrake.tgz --exclude CVS diskdrake/c diskdrake/diskdrake* $$l + cd .. ; tar cfz diskdrake.tgz --exclude CVS $(patsubst %,diskdrake/%,c po diskdrake*) $$l c/c.xs: c/c.xs.pm rm -f $@ @@ -39,8 +40,11 @@ $(SO_FILES): c/c.xs install1_hd: install1_hd.c $(CC) -static -Wall -o $@ $< +po: + $(MAKE) -C po + test_pms: verify_c - perl2fcalls -excludec install2.pm + perl2fcalls -excludec install2 (for i in $(PMS); do perl -cw -I. -Ic -Ic/blib/arch $$i || exit 1 ; done) verify_c: @@ -57,16 +61,16 @@ install_pms: $(SO_FILES) done cp diskdrake.rc $(DESTREP4PMS) - ln -sf perl-install/install2.pm $(DEST)/usr/bin/install2 - ln -sf perl-install/commands $(DEST)/usr/bin/commands - chmod a+x $(DESTREP4PMS)/install2.pm + ln -sf perl-install/install2 $(DEST)/usr/bin + ln -sf perl-install/commands $(DEST)/usr/bin + chmod a+x $(DESTREP4PMS)/install2 chmod a+x $(DESTREP4PMS)/commands cp -af */blib/arch/auto $(DESTREP4PMS) find $(DESTREP4PMS) -name "*.so" | xargs strip get_needed_files: $(SO_FILES) -# export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2.pm < /dev/null +# export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2 < /dev/null cp -f list /tmp/list for i in c/blib/arch/auto/c/c.so $(LOCALFILES) `cat /tmp/list` ; do \ ldd $$i 2>/dev/null | sed -e 's/.*=> //' -e 's/ .*//' | uniq | sort >> /tmp/list; \ @@ -76,6 +80,7 @@ get_needed_files: $(SO_FILES) install -d $(DEST)/bin install -d $(DEST)/usr/bin install -d $(DEST)/usr/lib + install -d $(DEST)/usr/share install -s $(LOCALFILES) $(DEST)/usr/bin for i in `cat /tmp/list`; do \ @@ -101,6 +106,9 @@ get_needed_files: $(SO_FILES) install -d $(DEST)/usr/X11R6/lib/X11/fonts/ cp -a /usr/X11R6/lib/X11/fonts/misc $(DEST)/usr/X11R6/lib/X11/fonts/ + cp -a xmodmaps $(DEST)/usr/share + cp -a keymaps $(DEST)/usr/share + echo -e "#!/usr/bin/perl\n\nsymlink '/tmp/rhimage/usr/lib/perl5', '/usr/lib/perl5';\nexec '/usr/bin/sh'" > $(DEST)/usr/bin/runinstall2 chmod a+x $(DEST)/usr/bin/runinstall2 diff --git a/perl-install/common.pm b/perl-install/common.pm index e03c03114..1d7b8730f 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int @ISA = qw(Exporter); %EXPORT_TAGS = ( - common => [ qw(min max bool member divide is_empty_array_ref round_up round_down first top) ], + common => [ qw(_ __ min max bool member divide is_empty_array_ref round_up round_down first top translate) ], file => [ qw(dirname basename all glob_ cat_ chop_ mode) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_) ], constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ], @@ -20,6 +20,8 @@ $SECTORSIZE = 512; 1; +sub _ { my $s = shift; sprintf translate($s), @_ } +sub __ { $_[0] } sub min { my $min = shift; grep { $_ < $min and $min = $_; } @_; $min } sub max { my $max = shift; grep { $_ > $max and $max = $_; } @_; $max } sub first { $_[0] } @@ -29,7 +31,7 @@ sub dirname { @_ == 1 or die "usage: dirname \n"; local $_ = shift; s|[^/] sub basename { @_ == 1 or die "usage: basename \n"; local $_ = shift; s|/*\s*$||; s|.*/||; $_ } sub bool { $_[0] ? 1 : 0 } sub strcpy { substr($_[0], $_[2] || 0, length $_[1]) = $_[1] } -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = ; @l } +sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = ; wantarray ? @l : join '', @l } sub chop_ { map { my $l = $_; chomp $l; $l } @_ } sub divide { my $d = int $_[0] / $_[1]; wantarray ? ($d, $_[0] % $_[1]) : $d } sub round_up { my ($i, $r) = @_; $i += $r - ($i + $r - 1) % $r - 1; } @@ -37,7 +39,7 @@ sub round_down { my ($i, $r) = @_; $i -= $i % $r; } sub is_empty_array_ref { my $a = shift; !defined $a || @$a == 0 } sub sync { syscall_('sync') } -sub gettimeofday { my $t = pack "LL"; syscall_('gettimeofday', $t, 0) or die "gettimeofday: $!\n"; unpack("LL", $t) } +sub gettimeofday { my $t = pack "LL"; syscall_('gettimeofday', $t, 0) or die "gettimeofday failed: $!\n"; unpack("LL", $t) } sub remove_spaces { local $_ = shift; s/^ +//; s/ +$//; $_ } sub mode { my @l = stat $_[0] or die "unable to get mode of file $_[0]: $!\n"; $l[2] } @@ -78,3 +80,13 @@ sub crypt_ { sub makedev { ($_[0] << 8) | $_[1] } sub unmakedev { $_[0] >> 8, $_[0] & 0xff } + +sub translate { + my ($s) = @_; + unless (defined %po::I18N::I18N) { + if (my ($lang) = ($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG}) =~ /(..)/) { + eval { require "po/$lang.pm" }; $@ and warn "no translation in $lang available\n"; + } + } + $po::I18N::I18N{$s} || $s; +} diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 18f6db4cb..024ceb5e6 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -65,13 +65,13 @@ sub format_ext2($;$) { $dev =~ m,(rd|ida)/, and push @options, qw(-b 4096 -R stride=16); # For RAID only. $bad_blocks and push @options, "-c"; - run_program::run("mke2fs", devices::make($dev), @options) or die "ext2 formatting of $dev failed"; + run_program::run("mke2fs", devices::make($dev), @options) or die _("%s formatting of %s failed", "ext2", $dev); } sub format_dos($;$@) { my ($dev, $bad_blocks, @options) = @_; - run_program::run("mkdosfs", devices::make($dev), @options, $bad_blocks ? "-c" : ()) or die "dos formatting of $dev failed"; + run_program::run("mkdosfs", devices::make($dev), @options, $bad_blocks ? "-c" : ()) or die _("%s formatting of %s failed", "dos", $dev); } sub format_part($;$) { @@ -90,7 +90,7 @@ sub format_part($;$) { } elsif (isSwap($part)) { swap::make($part->{device}, $bad_blocks); } else { - die "don't know how to format $_->{device} in type " . type2name($_->{type}); + die _("don't know how to format %s in type %s", $_->{device}, type2name($_->{type})); } $part->{isFormatted} = 1; } @@ -103,7 +103,7 @@ sub mount($$$;$) { if ($fs eq 'nfs') { log::l("calling nfs::mount($dev, $where)"); - nfs::mount($dev, $where) or die "nfs mount failed"; + nfs::mount($dev, $where) or die _("nfs mount failed"); } elsif ($fs eq 'smb') { die "no smb yet..."; } else { @@ -114,7 +114,7 @@ sub mount($$$;$) { my $mount_opt = $fs eq 'vfat' ? "check=relaxed" : ""; log::l("calling mount($dev, $where, $fs, $flag, $mount_opt)"); - syscall_('mount', $dev, $where, $fs, $flag, $mount_opt) or die "mount failed: $!"; + syscall_('mount', $dev, $where, $fs, $flag, $mount_opt) or die _("mount failed: ") . "$!"; } local *F; open F, ">>/etc/mtab" or return; # fail silently, must be read-only /etc @@ -124,7 +124,7 @@ sub mount($$$;$) { # takes the mount point to umount (can also be the device) sub umount($) { my ($mntpoint) = @_; - syscall_('umount', $mntpoint) or die "error unmounting $mntpoint: $!";; + syscall_('umount', $mntpoint) or die _("error unmounting %s: %s", $mntpoint, "$!"); my @mtab = cat_('/etc/mtab'); # don't care about error, if we can't read, we won't manage to write... (and mess mtab) local *F; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 8687d694c..aaef30baf 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -33,7 +33,7 @@ sub hds($$) { foreach (@$drives) { my $file = devices::make($_->{device}); - my $hd = partition_table_raw::get_geometry($file) or die "An error occurred while getting the geometry of block device $file: $!"; + my $hd = partition_table_raw::get_geometry($file) or die _("An error occurred while getting the geometry of block device %s: %s", $file, "$!"); $hd->{file} = $file; $hd->{prefix} = $hd->{device} = $_->{device}; # for RAID arrays of format c0d0p1 diff --git a/perl-install/install2 b/perl-install/install2 new file mode 100755 index 000000000..c8ae2ce9b --- /dev/null +++ b/perl-install/install2 @@ -0,0 +1,9 @@ +#!/usr/bin/perl + +use diagnostics; +use strict; + +use lib qw(. c c/blib/arch); +use install2; + +install2::main(@ARGV); diff --git a/perl-install/install2.pm b/perl-install/install2.pm index ff8c55994..9b7a42865 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -1,10 +1,9 @@ -#!/usr/bin/perl +package install2; use diagnostics; use strict; use vars qw($testing $INSTALL_VERSION $o); -use lib qw(/usr/bin/perl-install . c c/blib/arch); use common qw(:common :file :system); use install_any qw(:all); use log; @@ -18,47 +17,48 @@ use partition_table qw(:types); use detect_devices; use pkgs; use smp; +use lang; -$testing = 1;#$ENV{PERL_INSTALL_TEST}; +$::testing = 1;#$ENV{PERL_INSTALL_TEST}; $INSTALL_VERSION = 0; my @installStepsFields = qw(text help skipOnCancel skipOnLocal prev next); my @installSteps = ( - selectLanguage => [ "Choose your language", "aide", 0, 0 ], - selectPath => [ "Choose install or upgrade", "aide", 0, 0 ], - selectInstallClass => [ "Select installation class", "aide", 0, 0 ], - setupSCSI => [ "Setup SCSI", "aide", 0, 1 ], - partitionDisks => [ "Setup filesystems", "aide", 0, 1 ], - formatPartitions => [ "Format partitions", "aide", 0, 1 ], - findInstallFiles => [ "Find installation files", "aide", 1, 0 ], - choosePackages => [ "Choose packages to install", "aide", 0, 0 ], - doInstallStep => [ "Install system", "aide", 0, 0 ], -# configureMouse => [ "Configure mouse", "aide", 0, 0 ], - finishNetworking => [ "Configure networking", "aide", 0, 0 ], -# configureTimezone => [ "Configure timezone", "aide", 0, 0 ], -# configureServices => [ "Configure services", "aide", 0, 0 ], -# configurePrinter => [ "Configure printer", "aide", 0, 0 ], - setRootPassword => [ "Set root password", "aide", 0, 0 ], - addUser => [ "Add a user", "aide", 0, 0 ], - createBootdisk => [ "Create bootdisk", "aide", 0, 1 ], - setupBootloader => [ "Install bootloader", "aide", 0, 1 ], -# configureX => [ "Configure X", "aide", 0, 0 ], - exitInstall => [ "Exit install", "aide", 0, 0, undef, 'done' ], + selectLanguage => [ "Choose your language", "help", 0, 0 ], + selectPath => [ __("Choose install or upgrade"), __("help"), 0, 0 ], + selectInstallClass => [ __("Select installation class"), __("help"), 0, 0 ], + setupSCSI => [ __("Setup SCSI"), __("help"), 0, 1 ], + partitionDisks => [ __("Setup filesystems"), __("help"), 0, 1 ], + formatPartitions => [ __("Format partitions"), __("help"), 0, 1 ], + findInstallFiles => [ __("Find installation files"), __("help"), 1, 0 ], + choosePackages => [ __("Choose packages to install"), __("help"), 0, 0 ], + doInstallStep => [ __("Install system"), __("help"), 0, 0 ], +# configureMouse => [ __("Configure mouse"), __("help"), 0, 0 ], + finishNetworking => [ __("Configure networking"), __("help"), 0, 0 ], +# configureTimezone => [ __("Configure timezone"), __("help"), 0, 0 ], +# configureServices => [ __("Configure services"), __("help"), 0, 0 ], +# configurePrinter => [ __("Configure printer"), __("help"), 0, 0 ], + setRootPassword => [ __("Set root password"), __("help"), 0, 0 ], + addUser => [ __("Add a user"), __("help"), 0, 0 ], + createBootdisk => [ __("Create bootdisk"), __("help"), 0, 1 ], + setupBootloader => [ __("Install bootloader"), __("help"), 0, 1 ], +# configureX => [ __("Configure X"), __("help"), 0, 0 ], + exitInstall => [ __("Exit install"), __("help"), 0, 0, undef, 'done' ], ); # this table is translated at run time my @upgradeSteps = ( - selectLanguage => [ "Choose your language", "aide", 0, 0 ], - selectPath => [ "Choose install or upgrade", "aide", 0, 0 ], - selectInstallClass => [ "Select installation class", "aide", 0, 0 ], - setupSCSI => [ "Setup SCSI", "aide", 0, 0 ], - upgrFindInstall => [ "Find current installation", "aide", 0, 0 ], - findInstallFiles => [ "Find installation files", "aide", 1, 0 ], - upgrChoosePackages => [ "Choose packages to upgrade", "aide", 0, 0 ], - doInstallStep => [ "Upgrade system", "aide", 0, 0 ], - createBootdisk => [ "Create bootdisk", "aide", 0, 0 , 'none' ], - setupBootloader => [ "Install bootloader", "aide", 0, 0 ], - exitInstall => [ "Exit install", "aide", 0, 0 , undef, 'done' ], + selectLanguage => [ "Choose your language", "help", 0, 0 ], + selectPath => [ __("Choose install or upgrade"), __("help"), 0, 0 ], + selectInstallClass => [ __("Select installation class"), __("help"), 0, 0 ], + setupSCSI => [ __("Setup SCSI"), __("help"), 0, 0 ], + upgrFindInstall => [ __("Find current installation"), __("help"), 0, 0 ], + findInstallFiles => [ __("Find installation files"), __("help"), 1, 0 ], + upgrChoosePackages => [ __("Choose packages to upgrade"), __("help"), 0, 0 ], + doInstallStep => [ __("Upgrade system"), __("help"), 0, 0 ], + createBootdisk => [ __("Create bootdisk"), __("help"), 0, 0 , 'none' ], + setupBootloader => [ __("Install bootloader"), __("help"), 0, 0 ], + exitInstall => [ __("Exit install"), __("help"), 0, 0 , undef, 'done' ], ); my (%installSteps, %upgradeSteps, @orderedInstallSteps, @orderedUpgradeSteps); for (my $i = 0; $i < @installSteps; $i += 2) { @@ -100,11 +100,11 @@ my $default = { mkbootdisk => 0, base => [ qw(basesystem mkbootdisk linuxconf anacron linux_logo rhs-hwdiag utempter ldconfig chkconfig ntsysv mktemp setup setuptool filesystem MAKEDEV SysVinit ash at authconfig bash bdflush binutils console-tools cpio crontabs dev diffutils e2fsprogs ed eject etcskel file fileutils findutils getty_ps gpm grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup mailcap mailx man mkinitrd mingetty modutils mount mouseconfig net-tools passwd kernel-pcmcia-cs procmail procps psmisc pump mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time timeconfig tmpwatch util-linux vim-minimal vixie-cron which) ], comps => [ - [ 1, 'X Window System' => qw(XFree86 XFree86-xfs XFree86-75dpi-fonts) ], - [ 1, 'KDE' => qw(kdeadmin kdebase kthememgr kdegames kjumpingcube kdegraphics kdelibs kdemultimedia kdenetwork kdesupport kdeutils kBeroFTPD kdesu kdetoys kpilot kcmlaptop kdpms kpppload kmpg) ], - [ 0, 'Console Multimedia' => qw(aumix audiofile esound sndconfig awesfx rhsound cdp mpg123 svgalib playmidi sox mikmod) ], - [ 0, 'CD-R burning and utilities' => qw(mkisofs cdrecord cdrecord-cdda2wav cdparanoia xcdroast) ], - [ 0, 'Games' => qw(xbill xboard xboing xfishtank xgammon xjewel xpat2 xpilot xpuzzles xtrojka xkobo freeciv) ], + [ 1, __('X Window System') => qw(XFree86 XFree86-xfs XFree86-75dpi-fonts) ], + [ 1, __('KDE') => qw(kdeadmin kdebase kthememgr kdegames kjumpingcube kdegraphics kdelibs kdemultimedia kdenetwork kdesupport kdeutils kBeroFTPD kdesu kdetoys kpilot kcmlaptop kdpms kpppload kmpg) ], + [ 0, __('Console Multimedia') => qw(aumix audiofile esound sndconfig awesfx rhsound cdp mpg123 svgalib playmidi sox mikmod) ], + [ 0, __('CD-R burning and utilities') => qw(mkisofs cdrecord cdrecord-cdda2wav cdparanoia xcdroast) ], + [ 0, __('Games') => qw(xbill xboard xboing xfishtank xgammon xjewel xpat2 xpilot xpuzzles xtrojka xkobo freeciv) ], ], packages => [ qw() ], partitionning => { clearall => 0, eraseBadPartitions => 1, autoformat => 1 }, @@ -116,11 +116,13 @@ my $default = { ], shells => [ map { "/bin/$_" } qw(bash tcsh zsh ash) ], }; -$o = { default => $default, steps => \%installSteps, orderedSteps => \@orderedInstallSteps }; +$o = $::o = { default => $default, steps => \%installSteps, orderedSteps => \@orderedInstallSteps }; sub selectLanguage { $o->{lang} = $o->chooseLanguage; + lang::set($o->{lang}); + keyboard::setup(); } sub selectPath { @@ -156,12 +158,12 @@ sub setupSCSI { sub partitionDisks { $o->{drives} = [ detect_devices::hds() ]; $o->{hds} = fsedit::hds($o->{drives}, $o->{default}->{partitionning}); - @{$o->{hds}} > 0 or die "An error has occurred - no valid devices were found on which to create new filesystems. Please check your hardware for the cause of this problem"; + @{$o->{hds}} > 0 or die _"An error has occurred - no valid devices were found on which to create new filesystems. Please check your hardware for the cause of this problem"; unless ($o->{isUpgrade}) { $o->doPartitionDisks($o->{hds}); - unless ($testing) { + unless ($::testing) { # Write partitions to disk my $need_reboot = 0; foreach (@{$o->{hds}}) { @@ -175,14 +177,14 @@ sub partitionDisks { $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}) ]; my $root_fs; map { $_->{mntpoint} eq '/' and $root_fs = $_ } @{$o->{fstab}}; - $root_fs or die "partitionning failed: no root filesystem"; + $root_fs or die _"partitionning failed: no root filesystem"; } sub formatPartitions { $o->choosePartitionsToFormat($o->{fstab}); - $testing and return; + $::testing and return; foreach (@{$o->{fstab}}) { fs::format_part($_) if $_->{toFormat}; @@ -191,6 +193,10 @@ sub formatPartitions { } sub findInstallFiles { + log::l("reading /usr/lib/rpm/rpmrc"); + c::rpmReadConfigFiles() or die "can't read rpm config files"; + log::l("\tdone"); + $o->{packages} = pkgs::psFromHeaderListFile(install_any::imageGetFile("hdlist")); } @@ -217,7 +223,7 @@ sub setRootPassword { $o->setRootPassword } sub addUser { $o->addUser } sub createBootdisk { - $testing and return; + $::testing and return; $o->{isUpgrade} or fs::write($o->{prefix}, $o->{fstab}); modules::write_conf("$o->{prefix}/etc/conf.modules", 'append'); $o->createBootdisk; @@ -232,7 +238,7 @@ sub configureX { $o->setupXfree; } sub exitInstall { $o->warn( -"Congratulations, installation is complete. +_"Congratulations, installation is complete. Remove the boot media and press return to reboot. For information on fixes which are available for this release of Linux Mandrake, consult the Errata available from http://www.linux-mandrake.com/. @@ -245,13 +251,15 @@ sub main { # if this fails, it's okay -- it might help with free space though unlink "/sbin/install"; - symlink '/tmp/rhimage/usr/X11R6', '/usr/X11R6'; print STDERR "in second stage install\n"; - log::openLog(($testing || $o->{localInstall}) && 'debug.log'); + log::openLog(($::testing || $o->{localInstall}) && 'debug.log'); log::l("second stage install running (version $INSTALL_VERSION)"); log::ld("extra log messages are enabled"); + $o->{prefix} = $::testing ? "/tmp/test-perl-install" : "/mnt"; + mkdir $o->{prefix}, 0755; + # make sure we don't pick up any gunk from the outside world $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin"; $ENV{LD_LIBRARY_PATH} = ""; @@ -259,9 +267,6 @@ sub main { spawnSync(); eval { spawnShell() }; - $o->{prefix} = $testing ? "/tmp/test-perl-install" : "/mnt"; - mkdir $o->{prefix}, 0755; - $o = install_steps_graphical->new($o); $o->{netc} = net::readNetConfig("/tmp"); @@ -270,30 +275,22 @@ sub main { $o->{intf} = net::readNetInterfaceConfig($file); } - log::l("reading /usr/lib/rpm/rpmrc"); - c::rpmReadConfigFiles() or die "can't read rpm config files"; - log::l("\tdone"); - modules::load_deps("/modules/modules.dep"); modules::read_conf("/tmp/conf.modules"); - $o->{keyboard} = eval { keyboard::read("/tmp/keyboard") } || $default->{keyboard}; - for (my $step = $o->{steps}->{first}; $step ne 'done'; $step = getNextStep($step)) { $o->enteringStep($step); - &{$main::{$step}}() and $o->{steps}->{$step}->{completed} = 1; + &{$install2::{$step}}() and $o->{steps}->{$step}->{completed} = 1; $o->leavingStep($step); } killCardServices(); log::l("installation complete, leaving"); - unless $testing; + unless $::testing; } sub killCardServices { - my $pid = cat_("/tmp/cardmgr.pid"); - $pid and kill(15, chop_($pid)); # send SIGTERM + my $pid = chop_(cat_("/tmp/cardmgr.pid")); + $pid and kill(15, $pid); # send SIGTERM } - -main(@ARGV); diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index bece2df93..2d147328c 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -7,12 +7,14 @@ use vars qw($KMAP_MAGIC %defaultKeyboards %loadKeymap); use common qw(:system :file); use run_program; use log; +use c; $KMAP_MAGIC = 0x8B39C07F; %defaultKeyboards = ( "de" => "de-latin1", + "fr" => "fr-latin1", "fi" => "fi-latin1", "se" => "se-latin1", "no" => "no-latin1", @@ -24,12 +26,12 @@ $KMAP_MAGIC = 0x8B39C07F; sub load($) { - my ($keymap_raw) = @_; + my ($keymap) = @_; - my ($magic, @keymaps) = unpack "i i" . c::MAX_NR_KEYMAPS() . "a*", $keymap_raw; - $keymap_raw = pop @keymaps; + my ($magic, @keymaps) = unpack "I i" . c::MAX_NR_KEYMAPS() . "a*", $keymap; + $keymap = pop @keymaps; - $magic != $KMAP_MAGIC and die "failed to read kmap magic: $!"; + $magic != $KMAP_MAGIC and die "failed to read kmap magic"; local *F; sysopen F, "/dev/console", 2 or die "failed to open /dev/console: $!"; @@ -38,53 +40,59 @@ sub load($) { foreach (0 .. c::MAX_NR_KEYMAPS() - 1) { $keymaps[$_] or next; - my @keymap = unpack "s" . c::NR_KEYS() . "a*", $keymap_raw; - $keymap_raw = pop @keymap; + my @keymap = unpack "s" . c::NR_KEYS() . "a*", $keymap; + $keymap = pop @keymap; - my $key = 0; + my $key = -1; foreach my $value (@keymap) { - c::KTYP($value) != c::KT_SPEC() or next; - ioctl(F, c::KDSKBENT(), pack("CCS", $_, $key++, $value)) or die "keymap ioctl failed: $!"; $key++; + c::KTYP($value) != c::KT_SPEC() or next; + ioctl(F, c::KDSKBENT(), pack("CCS", $_, $key, $value)) or die "keymap ioctl failed ($_ $key $value): $!"; } $count++; } log::l("loaded $count keymap tables"); } -sub setup($) { +sub setup(;$) { my ($defkbd) = @_; my $t; $defkbd ||= $defaultKeyboards{$ENV{LANG}} || "us"; - local *F; - open F, "/etc/keymaps" or die "cannot open /etc/keymaps: $!"; - - my $format = "i2"; - read F, $t, psizeof($format) or die "failed to read keymaps header: $!"; - my ($magic, $numEntries) = unpack $format, $t; - - log::l("%d keymaps are available", $numEntries); - - my @infoTable; - my $format2 = "i Z40"; - foreach (1..$numEntries) { - read F, $t, psizeof($format2) or die "failed to read keymap information: $!"; - push @infoTable, [ unpack $format2, $t ]; + my $file = "/usr/share/keymaps/$defkbd.kmap"; + if (-e $file) { + log::l("loading keymap $defkbd"); + load(cat_($file)); } - foreach (@infoTable) { - read F, $t, $_->[0] or die "error reading keymap data: $!"; - - if ($defkbd eq $_->[1]) { - log::l("using keymap $_->[1]"); - load($t); - &write("/tmp", $_->[1]); - return; - } - } - die "keyboard $defkbd not found in /etc/keymaps"; +# local *F; +# open F, "/usr/etc/keymaps" or die "cannot open /usr/etc/keymaps: $!"; +# +# my $format = "i2"; +# read F, $t, psizeof($format) or die "failed to read keymaps header: $!"; +# my ($magic, $numEntries) = unpack $format, $t; +# +# log::l("%d keymaps are available", $numEntries); +# +# my @infoTable; +# my $format2 = "i Z40"; +# foreach (1..$numEntries) { +# read F, $t, psizeof($format2) or die "failed to read keymap information: $!"; +# push @infoTable, [ unpack $format2, $t ]; +# } +# +# foreach (@infoTable) { +# read F, $t, $_->[0] or die "error reading keymap data: $!"; +# +# if ($defkbd eq $_->[1]) { +# log::l("using keymap $_->[1]"); +# load($t); +# &write("/tmp", $_->[1]); +# return; +# } +# } +# die "keyboard $defkbd not found in /usr/etc/keymaps"; } sub write($$) { diff --git a/perl-install/share/po/Makefile b/perl-install/share/po/Makefile new file mode 100644 index 000000000..6743ddaf9 --- /dev/null +++ b/perl-install/share/po/Makefile @@ -0,0 +1,21 @@ +PMSFILES = $(shell find .. -name "*.pm") +POFILES = $(wildcard *.po) +FROMPOFILES = $(POFILES:%.po=%.pm) + +all: $(FROMPOFILES) + +clean: + rm -f $(FROMPOFILES) + +$(FROMPOFILES): %.pm: %.po + ./po2perl < $< > $@ + +%.po: $(PMSFILES) + touch $@ + for i in $(PMSFILES); do \ + sed -e 's/#\(.*\)/\/*\1*\//' -e 's/$$/\\n\\/' < $$i > $${i}c; \ + xgettext -j -F -Lc -n --omit-header --keyword=_ --keyword=__ -o $@ $${i}c; \ + rm $${i}c; \ + done + +FORCE: \ No newline at end of file -- cgit v1.2.1