Commit db4ec02e authored by Martin Klimes (k11m1)'s avatar Martin Klimes (k11m1)
Browse files

better ppd filtering + fix whitespaces

parent 2b2b4b48
......@@ -22,13 +22,13 @@ copy("/opt/fi-printers/cron.pl", "/etc/cron.weekly/fi_printers_cron");
my @files = glob( '/etc/cups/ppd/*fi.muni.ppd' );
for my $item (@files) {
print "current $item\n";
$item =~ s/\/etc\/cups\/ppd\///;
$item =~ s/\.fi\.muni\.ppd//;
print "current $item\n";
$item =~ s/\/etc\/cups\/ppd\///;
$item =~ s/\.fi\.muni\.ppd//;
}
for my $printer (@files) {
system("/opt/fi-printers/install.pl --update $printer");
system("/opt/fi-printers/install.pl --update $printer");
}
......@@ -11,7 +11,6 @@ use File::Basename;
use Getopt::Long qw(:config bundling);
use FindBin '$RealBin';
#--------------------------------------------------------------------
# DATA
#--------------------------------------------------------------------
......@@ -185,15 +184,15 @@ sub install_printer {
}
sub update_ppd {
my ($printer_name) = @_;
my ($printer_name) = @_;
my $command = qq(lpadmin \\
-p "${printer_name}.fi.muni" \\
-P "ppds/${printer_name}.ppd" );
my $command = qq(lpadmin \\
-p "${printer_name}.fi.muni" \\
-P "ppds/${printer_name}.ppd" );
system($command);
system($command);
return;
return;
}
sub copy_filter {
......@@ -346,12 +345,12 @@ for my $filter (@{($models->{$model} // {})->{filters} // []}) {
copy_filter($filter);
}
if ($options->{update}) {
update_ppd("$printer_name");
say "[INFO] Update of $printer_name is completed.";
update_ppd("$printer_name");
say "[INFO] Update of $printer_name is completed.";
}
else {
install_printer("$printer_name");
say "[INFO] Installation of $printer_name is completed.";
install_printer("$printer_name");
say "[INFO] Installation of $printer_name is completed.";
check_cron();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment