diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-01-28 15:39:51 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-01-28 15:39:51 +0000 |
commit | 0f1a363af19d12e8bc38ec02f5a99ecbae1eadc1 (patch) | |
tree | 8ca816bf1fff041b773ac512d3a1e3604e75743e /perl-install/common.pm | |
parent | 09676045bd344ea218b7e2abeec8d2f0b5334d76 (diff) | |
download | drakx-0f1a363af19d12e8bc38ec02f5a99ecbae1eadc1.tar drakx-0f1a363af19d12e8bc38ec02f5a99ecbae1eadc1.tar.gz drakx-0f1a363af19d12e8bc38ec02f5a99ecbae1eadc1.tar.bz2 drakx-0f1a363af19d12e8bc38ec02f5a99ecbae1eadc1.tar.xz drakx-0f1a363af19d12e8bc38ec02f5a99ecbae1eadc1.zip |
cleaning the utf8 support stuff:
- consolidate check_for_xserver() to check for x11 access
- introduce prepare_gtk2() to do what gtk+2 needs, so that
tools that're not part of drakxtools (aka: rpmdrake, mcc, ...) can just do :
unshift @::textdomains, 'drakconf'; prepare_gtk2();
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r-- | perl-install/common.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index 8fa267d46..a3deaac16 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -9,7 +9,7 @@ use vars qw(@ISA @EXPORT $SECTORSIZE); @ISA = qw(Exporter); # no need to export ``_'' -@EXPORT = qw($SECTORSIZE N N_ translate untranslate formatXiB removeXiBSuffix formatTime setVirtual makedev unmakedev salt set_permissions files_exist set_alternative mandrake_release require_root_capability); +@EXPORT = qw($SECTORSIZE N N_ translate untranslate formatXiB removeXiBSuffix formatTime setVirtual makedev unmakedev salt set_permissions files_exist set_alternative mandrake_release require_root_capability check_for_xserver); # perl_checker: RE-EXPORT-ALL push @EXPORT, @MDK::Common::EXPORT; @@ -245,7 +245,7 @@ sub mandrake_release { sub require_root_capability { return unless $>; # we're already root - if ($ENV{DISPLAY} && system('/usr/X11R6/bin/xtest') == 0) { + if (check_for_xserver()) { if (fuzzy_pidofs(qr/\bkwin\b/) > 0) { exec("kdesu", "-c", "$0 @ARGV") or die N("kdesu missing"); } @@ -256,4 +256,12 @@ sub require_root_capability { die "you must be root to run this program" if $>; } +sub check_for_xserver { + if (!defined $::xtest) { + $::xtest = $ENV{DISPLAY} && (system('/usr/X11R6/bin/xtest') == 0); + } + return $::xtest; +} + + 1; |