summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/printerdrake
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/printerdrake')
-rwxr-xr-xperl-install/standalone/printerdrake25
1 files changed, 16 insertions, 9 deletions
diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake
index 3ccd01311..cee224da9 100755
--- a/perl-install/standalone/printerdrake
+++ b/perl-install/standalone/printerdrake
@@ -21,22 +21,29 @@
use lib qw(/usr/lib/libDrakX);
use interactive;
+use printer;
use printerdrake;
+use c;
local $_ = join '', @ARGV;
/-h/ and die "usage: printerdrake [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n";
-$::beginner = /--beginner/;
-$::expert = /--expert/;
-$::auto = /--auto/;
-$::noauto = /--noauto/;
-$::skiptest = /--skiptest/;
-$::testing = /--testing/;
+$::beginner = /-beginner/;
+$::expert = /-expert/;
+$::auto = /-auto/;
+$::noauto = /-noauto/;
+$::skiptest = /-skiptest/;
+$::testing = /-testing/;
$::isStandalone = 1;
-my $in = vnew interactive;
+my $printer; eval { $printer = printer::getinfo('') };
+/-lpr/ and $printer->{mode} = 'lpr';
+/-cups/ and $printer->{mode} = 'CUPS';
+$printer->{mode} ||= 'CUPS'; #- assume this default if nothing found.
-printerdrake::main('', printerdrake::getinfo(''), $in, sub { `urpmi --auto $_[0]` });
+my $in = vnew interactive('su');
-exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK
+printerdrake::main($printer, $in, sub { $in->suspend; system("urpmi --auto --best-output " . join(' ', @_)); $in->resume; });
+
+$in->exit(0);