diff options
Diffstat (limited to 'perl-install/standalone.pm')
| -rw-r--r-- | perl-install/standalone.pm | 78 |
1 files changed, 60 insertions, 18 deletions
diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index c9338d484..b138d62f7 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -1,10 +1,12 @@ -package standalone; # $Id$ +package standalone; # $Id: standalone.pm 262870 2009-10-27 10:53:55Z tv $ use c; use strict; -use common qw(N N_ if_); +use common qw(N N_ if_ backtrace); use Config; +BEGIN { unshift @::textdomains, 'libDrakX-standalone' } + #- for sanity (if a use standalone is made during install, MANY problems will happen) require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function if ($::isInstall) { @@ -15,8 +17,10 @@ $::isStandalone = 1; $ENV{SHARE_PATH} ||= "/usr/share"; -c::setlocale(); -c::bindtextdomain('libDrakX', "/usr/share/locale"); +eval { #- allow standalone.pm to be used in drakxtools-backend without perl-Locale-gettext + c::init_setlocale(); + Locale::gettext::bindtextdomain('libDrakX', "/usr/share/locale"); +}; $::license = N_("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +34,7 @@ GNU General Public License for more details. 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. "); my $progname = common::basename($0); @@ -49,17 +53,16 @@ Backup and Restore application --version : show version number. "), - 'drakboot' => N_("[--boot] [--splash] + 'drakboot' => N_("[--boot] OPTIONS: --boot - enable to configure boot loader - --splash - enable to configure boot theme default mode: offer to configure autologin feature"), 'drakbug' => N_("[OPTIONS] [PROGRAM_NAME] OPTIONS: --help - print this help message. - --report - program should be one of Mandriva Linux tools - --incident - program should be one of Mandriva Linux tools"), + --report - program should be one of %s tools + --incident - program should be one of %s tools"), 'drakconnect' => N_("[--add] --add - \"add a network interface\" wizard --del - \"delete a network interface\" wizard @@ -82,7 +85,7 @@ OPTIONS: 'draksec' => "[--debug] --debug: print debugging information", 'drakTermServ' => N_("[OPTIONS]... -Mandriva Linux Terminal Server Configurator +%s Terminal Server Configurator --enable : enable MTS --disable : disable MTS --start : start MTS @@ -104,9 +107,9 @@ Network & Internet connection and monitoring application --force : used with (dis)connect : force (dis)connection. --status : returns 1 if connected 0 otherwise, then exit. --quiet : do not be interactive. To be used with (dis)connect."), - 'printerdrake' => N_(" [--skiptest] [--cups] [--lprng] [--lpd] [--pdq]"), + 'printerdrake' => " [--skiptest] [--cups] [--lprng] [--lpd] [--pdq]", 'rpmdrake' => N_("[OPTION]... - --no-confirmation do not ask first confirmation question in Mandriva Update mode + --no-confirmation do not ask first confirmation question in %s Update mode --no-verify-rpm do not verify packages signatures --changelog-first display changelog before filelist in the description window --merge-all-rpmnew propose to merge all .rpmnew/.rpmsave files found"), @@ -116,7 +119,7 @@ Network & Internet connection and monitoring application XFdrake resolution"), ); -$usages{$_} = $usages{rpmdrake} foreach qw(rpmdrake-remove Mandriva Update); +$usages{$_} = $usages{rpmdrake} foreach qw(rpmdrake-remove MageiaUpdate); $usages{Xdrakres} = $usages{XFdrake}; @@ -131,13 +134,17 @@ sub __exit { } +sub real_version() { + return "VER"; # version automatically set from Makefile +} sub version() { - print 'Drakxtools version 10 -Copyright (C) 1999-2004 Mandriva by <install@mandriva.com> + print 'Drakxtools version ' . real_version() . ' +Copyright (C) 1999-2008 Mandriva by <install@mandriva.com> ', $::license, "\n"; } +if (!$::no_global_argv_parsing) { my ($i, @new_ARGV); foreach (@ARGV) { $i++; @@ -169,7 +176,7 @@ foreach (@ARGV) { } @ARGV = @new_ARGV; - +} ################################################################################ @@ -179,9 +186,44 @@ sub explanations { log::explanations("@_") } our @common_functs = qw(renamef linkf symlinkf output substInFile mkdir_p rm_rf cp_af touch setVarsInSh setExportedVarsInSh setExportedVarsInCsh update_gnomekderc); our @builtin_functs = qw(chmod chown __exit exit unlink link symlink rename system); -our @drakx_modules = qw(Xconfig::card Xconfig::default Xconfig::main Xconfig::monitor Xconfig::parse Xconfig::proprietary Xconfig::resolution_and_depth Xconfig::screen Xconfig::test Xconfig::various Xconfig::xfree any bootloader bootlook c class_discard commands crypto detect_devices devices diskdrake diskdrake::hd_gtk diskdrake::interactive diskdrake::removable diskdrake::removable_gtk diskdrake::smbnfs_gtk fs fsedit http keyboard lang log loopback lvm modules::parameters modules mouse my_gtk network network::adsl network::ethernet network::isdn_consts network::isdn network::modem network::netconnect network::network network::nfs network::smb network::tools partition_table partition_table_bsd partition_table::dos partition_table::empty partition_table::gpt partition_table::mac partition_table::raw partition_table::sun printer printerdrake proxy raid run_program scanner services steps swap timezone network::drakfirewall network::shorewall); +our @drakx_modules = qw(Xconfig::card Xconfig::default Xconfig::main Xconfig::monitor Xconfig::parse Xconfig::proprietary Xconfig::resolution_and_depth Xconfig::screen Xconfig::test Xconfig::various Xconfig::xfree any bootloader bootlook c commands crypto detect_devices devices diskdrake diskdrake::hd_gtk diskdrake::interactive diskdrake::removable diskdrake::removable_gtk diskdrake::smbnfs_gtk fs fsedit http keyboard lang log loopback lvm modules::parameters modules mouse my_gtk network network::adsl network::ethernet network::connection network::isdn_consts network::isdn network::modem network::netconnect network::network fs::remote::nfs fs::remote::smb network::tools partition_table partition_table_bsd partition_table::dos partition_table::empty partition_table::gpt partition_table::mac partition_table::raw partition_table::sun printer printerdrake proxy raid run_program scanner services steps swap timezone network::drakfirewall network::shorewall); + +sub bug_handler { + my ($error, $is_signal) = @_; + + # exceptions in eval are OK: + return if $error && $^S ne '0' && !$is_signal; + + # exceptions with "\n" are normal ways to quit: + if (!$is_signal && eval { $error eq MDK::Common::String::formatError($error) }) { + warn $error; + exit(255); + } -$SIG{SEGV} = sub { my $progname = $0; $progname =~ s|.*/||; exec("drakbug --incident $progname") }; + # we want the full backtrace: + if ($is_signal) { + my $ctrace = c::C_backtrace(); + $ctrace =~ s/0:.*(\d+:[^:]*Perl_sighandler)/\1/sig if $ctrace =~ /0:.*(\d+:[^:]*Perl_sighandler)/sig; + $error .= "\nGlibc's trace:\n$ctrace\n"; + } + $error .= "Perl's trace:\n" . common::backtrace() if $error; + + my $progname = $0; + + # do not loop if drakbug crashes and do not complain about wizcancel: + if ($progname =~ /drakbug/ || $error =~ /wizcancel/ || !-x '/usr/bin/drakbug') { + warn $error; + exit(1); + } + $progname =~ s|.*/||; + exec('drakbug', if_($error, '--error', $error), '--incident', $progname); + c::_exit(1); +} + +if (!$ENV{DISABLE_DRAKBUG}) { + $SIG{SEGV} = sub { bug_handler(@_, 1) }; + $SIG{__DIE__} = \&bug_handler; +} sub import() { ($standalone_name = $0) =~ s|.*/||; |
