diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2001-09-15 15:06:10 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2001-09-15 15:06:10 +0000 |
commit | 79c2889d61649d36c7b3688dfa55c0ce1616fa12 (patch) | |
tree | 9771d49ba2c9a6dda8cae15c55620dae5fa6d375 /perl-install/printer.pm | |
parent | cf6f3a5084b9c5150228dc7560ed5e99d228d3e8 (diff) | |
download | drakx-backup-do-not-use-79c2889d61649d36c7b3688dfa55c0ce1616fa12.tar drakx-backup-do-not-use-79c2889d61649d36c7b3688dfa55c0ce1616fa12.tar.gz drakx-backup-do-not-use-79c2889d61649d36c7b3688dfa55c0ce1616fa12.tar.bz2 drakx-backup-do-not-use-79c2889d61649d36c7b3688dfa55c0ce1616fa12.tar.xz drakx-backup-do-not-use-79c2889d61649d36c7b3688dfa55c0ce1616fa12.zip |
Command line commands as "lpr", "lpq", ... are mapped to the correct spooler now.
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r-- | perl-install/printer.pm | 27 |
1 files changed, 27 insertions, 0 deletions
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 (<F>) { + 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; |