summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-11-12 16:46:50 +0000
committerOlivier Blin <oblin@mandriva.com>2008-11-12 16:46:50 +0000
commit7fb7c02945c7fd30c00f0716c4203ca5fbff33bd (patch)
treedc65225b18692343fab06e9a267b6379b1fd2845 /bin
parente9809605625b03337290066bddc5c12c96b20129 (diff)
downloaddrak3d-7fb7c02945c7fd30c00f0716c4203ca5fbff33bd.tar
drak3d-7fb7c02945c7fd30c00f0716c4203ca5fbff33bd.tar.gz
drak3d-7fb7c02945c7fd30c00f0716c4203ca5fbff33bd.tar.bz2
drak3d-7fb7c02945c7fd30c00f0716c4203ca5fbff33bd.tar.xz
drak3d-7fb7c02945c7fd30c00f0716c4203ca5fbff33bd.zip
do not die in automatic mode if there is no control terminal
Diffstat (limited to 'bin')
-rwxr-xr-xbin/drak3d16
1 files changed, 11 insertions, 5 deletions
diff --git a/bin/drak3d b/bin/drak3d
index ec10a6e..1cb2f07 100755
--- a/bin/drak3d
+++ b/bin/drak3d
@@ -27,12 +27,18 @@ BEGIN { unshift @::textdomains, 'drak3d' }
use standalone;
use common;
use interactive;
+use do_pkgs;
use Xconfig::glx;
use any;
use Getopt::Long;
-my $in = interactive->vnew('su');
-my $glx = Xconfig::glx::detect_may_install($in) or $in->exit;
+my $in = eval { interactive->vnew('su') };
+$in || $::auto or die $@;
+my $do_pkgs = $in ? $in->do_pkgs : do_pkgs_standalone->new;
+
+sub exit_program { $in ? $in->exit(@_) : exit(@_) }
+
+my $glx = Xconfig::glx::detect_may_install($do_pkgs) or exit_program();
my $running_wm = any::running_window_manager();
GetOptions(
@@ -149,9 +155,9 @@ if ($::auto) {
} else {
$res = Xconfig::glx::choose_interactive($in, $glx);
}
-if ($res && Xconfig::glx::install($in, $glx)) {
+if ($res && Xconfig::glx::install($do_pkgs, $glx)) {
Xconfig::glx::write($glx);
- any::ask_for_X_restart($in);
+ any::ask_for_X_restart($in) if $in;
}
-$in->exit;
+exit_program();