Loading cron.pl 0 → 100755 +26 −0 Original line number Diff line number Diff line #!/usr/bin/perl -w my $message = "Already up to date."; my $output = `git pull --ff-only`; if ($output eq "Already up to date.\n") { print "Nothing to do"; exit; } print $output; my @files = glob( '/etc/cups/ppd/*.ppd' ); my @new_files = (); for my $item (@files) { print "current $item\n"; $item =~ s/\/etc\/cups\/ppd\///; $item =~ s/\.fi\.muni\.ppd//; } for my $printer (@files) { system("./install.pl --update $printer") } install.pl +38 −10 Original line number Diff line number Diff line Loading @@ -8,6 +8,21 @@ use Cwd qw(cwd); use File::Path; use File::Copy; use File::Basename; use Getopt::Long qw(:config bundling); #my $opt = { #}; #-------------------------------------------------------------------- # Option processing #-------------------------------------------------------------------- my $only_update = ''; my $only_usage = ''; GetOptions( 'update' => \$only_update, 'help|h|?' => \$only_usage ) or die; ######## # DATA # Loading Loading @@ -162,6 +177,18 @@ sub install_printer { return; } sub update_ppd { my ($printer_name) = @_; my $command = qq(lpadmin \\ -p "${printer_name}.fi.muni" \\ -P "ppds/${printer_name}.ppd" ); system($command); return; } sub copy_filter { my ($path) = @_; Loading Loading @@ -258,12 +285,9 @@ sub pre_TA5007ci { # START OF THE SCRIPT # ####################### if (@ARGV == 0 || $ARGV[0] eq "-h" || $ARGV[0] eq "--help") { usage; } if (@ARGV != 1) { usage; # Show help if ($only_usage || @ARGV != 1) { usage(); } my ($printer_name) = @ARGV; Loading Loading @@ -294,7 +318,11 @@ if ($model eq "TA5007ci") { for my $filter (@{($models->{$model} // {})->{filters} // []}) { copy_filter($filter); } install_printer "$printer_name"; if ($only_update) { update_ppd("$printer_name"); say "[INFO] Update is completed."; } else { install_printer("$printer_name"); say "[INFO] Installation is completed."; } Loading
cron.pl 0 → 100755 +26 −0 Original line number Diff line number Diff line #!/usr/bin/perl -w my $message = "Already up to date."; my $output = `git pull --ff-only`; if ($output eq "Already up to date.\n") { print "Nothing to do"; exit; } print $output; my @files = glob( '/etc/cups/ppd/*.ppd' ); my @new_files = (); for my $item (@files) { print "current $item\n"; $item =~ s/\/etc\/cups\/ppd\///; $item =~ s/\.fi\.muni\.ppd//; } for my $printer (@files) { system("./install.pl --update $printer") }
install.pl +38 −10 Original line number Diff line number Diff line Loading @@ -8,6 +8,21 @@ use Cwd qw(cwd); use File::Path; use File::Copy; use File::Basename; use Getopt::Long qw(:config bundling); #my $opt = { #}; #-------------------------------------------------------------------- # Option processing #-------------------------------------------------------------------- my $only_update = ''; my $only_usage = ''; GetOptions( 'update' => \$only_update, 'help|h|?' => \$only_usage ) or die; ######## # DATA # Loading Loading @@ -162,6 +177,18 @@ sub install_printer { return; } sub update_ppd { my ($printer_name) = @_; my $command = qq(lpadmin \\ -p "${printer_name}.fi.muni" \\ -P "ppds/${printer_name}.ppd" ); system($command); return; } sub copy_filter { my ($path) = @_; Loading Loading @@ -258,12 +285,9 @@ sub pre_TA5007ci { # START OF THE SCRIPT # ####################### if (@ARGV == 0 || $ARGV[0] eq "-h" || $ARGV[0] eq "--help") { usage; } if (@ARGV != 1) { usage; # Show help if ($only_usage || @ARGV != 1) { usage(); } my ($printer_name) = @ARGV; Loading Loading @@ -294,7 +318,11 @@ if ($model eq "TA5007ci") { for my $filter (@{($models->{$model} // {})->{filters} // []}) { copy_filter($filter); } install_printer "$printer_name"; if ($only_update) { update_ppd("$printer_name"); say "[INFO] Update is completed."; } else { install_printer("$printer_name"); say "[INFO] Installation is completed."; }