From 79c2889d61649d36c7b3688dfa55c0ce1616fa12 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Sat, 15 Sep 2001 15:06:10 +0000 Subject: Command line commands as "lpr", "lpq", ... are mapped to the correct spooler now. --- perl-install/printer.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'perl-install/printer.pm') diff --git a/perl-install/printer.pm b/perl-install/printer.pm index bd10417b1..454909cda 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -196,6 +196,33 @@ sub files_exist { return 1; } +sub set_alternative { + my ($command, $executable) = @_; + local *F; + # Read the list of executables for the given command to find the number + # of the desired executable + open F, ($::testing ? "$prefix" : "chroot $prefix/ ") . + "/bin/sh -c \"export LC_ALL=C; /bin/echo | update-alternatives --config $command \" |" || + die "Could not run \"update-alternatives\"!"; + my $choice = 0; + while () { + chomp; + if ($_ =~ m/^[\* ][\+ ]\s*([0-9]+)\s+(\S+)\s*$/) { # list entry? + if ($2 eq $executable) { + $choice = $1; + last; + } + } + } + close F; + # If the executable was found, assign the command to it + if ($choice > 0) { + system(($::testing ? "$prefix" : "chroot $prefix/ ") . + "/bin/sh -c \"/bin/echo $choice | update-alternatives --config $command > /dev/null 2>&1\""); + } + return 1; +} + sub copy_printer_params($$) { my ($from, $to) = @_; map { $to->{$_} = $from->{$_} } grep { $_ ne 'configured' } keys %$from; -- cgit v1.2.1