From 98849cc4d519b8ddf44afda9e5eed89c440ed942 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 24 Jun 2004 01:51:52 +0000 Subject: Some standalone tools don't compile when run from console --- perl-install/standalone/drakTermServ | 11 ++++++++++- perl-install/standalone/drakbug | 11 ++++++++++- perl-install/standalone/drakclock | 11 ++++++++++- perl-install/standalone/drakfloppy | 11 ++++++++++- perl-install/standalone/drakfont | 11 ++++++++++- perl-install/standalone/drakperm | 11 ++++++++++- perl-install/standalone/draksec | 11 ++++++++++- perl-install/standalone/draksplash | 11 ++++++++++- perl-install/standalone/drakups | 11 ++++++++++- perl-install/standalone/harddrake2 | 11 ++++++++++- perl-install/standalone/logdrake | 11 ++++++++++- perl-install/standalone/net_monitor | 11 ++++++++++- perl-install/standalone/printerdrake | 11 ++++++++++- 13 files changed, 130 insertions(+), 13 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ index 8dd512658..52d87fa29 100755 --- a/perl-install/standalone/drakTermServ +++ b/perl-install/standalone/drakTermServ @@ -22,7 +22,16 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla use strict; use interactive; -use ugtk2 qw(:helpers :wrappers :create); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:helpers :wrappers :create)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use common; use run_program; use MDK::Common::File qw(:all); diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index 7cce5ec9e..a0ac09265 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -23,7 +23,16 @@ use lib qw(/usr/lib/libDrakX); use standalone; use common; -use ugtk2 qw(:all); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:all)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use Config; my $bugzilla_url = "http://drakbug.mandrakesoft.com"; diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock index a1dd5b5f5..2012cf6ad 100755 --- a/perl-install/standalone/drakclock +++ b/perl-install/standalone/drakclock @@ -6,7 +6,16 @@ use POSIX; use common; # i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) BEGIN { unshift @::textdomains, 'drakconf' } -use ugtk2 qw(:all); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:all)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use interactive; use standalone; use timezone; diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy index d58305f61..830340da4 100755 --- a/perl-install/standalone/drakfloppy +++ b/perl-install/standalone/drakfloppy @@ -29,7 +29,16 @@ use lib qw(/usr/lib/libDrakX); use standalone; #- warning, standalone must be loaded very first, for 'explanations' use common; -use ugtk2 qw(:create :dialogs :helpers :wrappers); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:create :dialogs :helpers :wrappers)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use detect_devices; require_root_capability(); diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index 3b232919b..a35378eef 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -86,7 +86,16 @@ use lib qw(/usr/lib/libDrakX); use standalone; #- warning, standalone must be loaded very first, for 'explanations' -use ugtk2 qw(:create :dialogs :helpers :wrappers); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:create :dialogs :helpers :wrappers)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use common; require_root_capability(); diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm index 234228edb..7b7e56cc2 100755 --- a/perl-install/standalone/drakperm +++ b/perl-install/standalone/drakperm @@ -6,7 +6,16 @@ use lib qw(/usr/lib/libDrakX); use standalone; use common; -use ugtk2 qw(:helpers :wrappers :create); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:helpers :wrappers :create)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} require_root_capability(); local $_ = join '', @ARGV; diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index 04e9dd0b4..9e8e3129a 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -24,7 +24,16 @@ use lib qw(/usr/lib/libDrakX); use common; use standalone; use vars qw($MODE %options); -use ugtk2 qw(:helpers :wrappers :ask :create); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:helpers :wrappers :ask :create)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use run_program; use security::level; use security::msec; diff --git a/perl-install/standalone/draksplash b/perl-install/standalone/draksplash index 527631bd6..8dc252b5f 100755 --- a/perl-install/standalone/draksplash +++ b/perl-install/standalone/draksplash @@ -4,7 +4,16 @@ use strict; use lib qw(/usr/lib/libDrakX); use standalone; use common; -use ugtk2 qw(:helpers :wrappers :create); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:helpers :wrappers :create)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use interactive; #- convenience variables for true and false diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups index 9f55af292..7bfb70642 100755 --- a/perl-install/standalone/drakups +++ b/perl-install/standalone/drakups @@ -6,7 +6,16 @@ use standalone; use common; use mouse; use detect_devices; -use ugtk2 qw(:create :dialogs :helpers :wrappers); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:create :dialogs :helpers :wrappers)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use interactive; use Libconf qw(:functions); use Libconf::Glueconf::NUT::Ups_conf; diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index d6822b1cd..74e98b563 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -6,7 +6,16 @@ use lib qw(/usr/lib/libDrakX); use standalone; use common; -use ugtk2 qw(:create :helpers :wrappers); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:create :helpers :wrappers)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use interactive; use harddrake::data; #- needs to stay after use-ugtk2 as long as this module defines globals containing some N() use POSIX qw(:sys_wait_h); diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index 1610dcaf5..541d97a58 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -26,7 +26,16 @@ use lib qw(/usr/lib/libDrakX); use standalone; #- warning, standalone must be loaded very first, for 'explanations' use common; use interactive; -use ugtk2 qw(:create :dialogs :wrappers :helpers); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:create :dialogs :helpers :wrappers)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use vars qw(*F); my $in = 'interactive'->vnew('su'); diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor index 3863e0197..9fdd05c91 100755 --- a/perl-install/standalone/net_monitor +++ b/perl-install/standalone/net_monitor @@ -27,7 +27,16 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla use c; use interactive; -use ugtk2 qw(:helpers :wrappers :create); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:create :helpers :wrappers)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use common; use network::netconnect; use network::tools; diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake index 00ebf6288..889696b09 100755 --- a/perl-install/standalone/printerdrake +++ b/perl-install/standalone/printerdrake @@ -26,7 +26,16 @@ use standalone; use common; use any; -use ugtk2 qw(:all); +BEGIN { + eval { + require ugtk2; + ugtk2->import(qw(:all)); + }; + if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END + } +} use interactive; use POSIX qw(mktime ceil); use printer::printerdrake; -- cgit v1.2.1