| Server IP : 85.112.90.236 / Your IP : 192.168.1.26 Web Server : Apache System : Linux 85-112-90-236.cprapid.com 6.12.0-211.7.3.el10_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 12:46:58 EDT 2026 x86_64 User : ftechme ( 1002) PHP Version : 8.2.32 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/usr/sbin/ |
Upload File : |
#!/usr/bin/perl
# -*- perl -*-
# This is foomatic-cleanupdrivers. It removes all driver XML files
# which have an empty command line. So one can avoid that "unusable"
# printer/driver combos are shown in frontends. This program also runs
# when Foomatic is not installed.
use Foomatic::Defaults;
if ($#ARGV > -1) {
$libdir = $ARGV[0];
} elsif ($ENV{FOOMATICDB}) {
$libdir = $ENV{FOOMATICDB};
} elsif (!$libdir) {
$libdir = "/usr/share/foomatic";
}
# Read out the program name with which we were called, but discard the path
$0 =~ m!/([^/]+)\s*$!;
$progname = $1;
# Read the directory with the driver's XML entries
opendir DRIVERDIR, "$libdir/db/source/driver" ||
die "Cannot open driver XML directory!\n";
my $driver;
while ($driver = readdir(DRIVERDIR)) {
open DRIVERENTRY, "< $libdir/db/source/driver/$driver" || die " Database entry for the driver $driver cannot be read!\n";
my @driverentryfield = <DRIVERENTRY>;
close DRIVERENTRY;
my $driverentry = join ('', @driverentryfield);
next unless $driverentry;
if (($driverentry =~ m!<prototype>\s*</prototype>!sg) ||
($driverentry =~ m!<prototype\s*/\s*>!sg) ||
($driverentry !~ m!<prototype[>/\s]!sg)) {
unlink("$libdir/db/source/driver/$driver") ||
die "Cannot delete $driver!\n";
print "$driver has an empty command line, deleted!\n";
}
}
closedir DRIVERDIR;