Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
unix
FI printers over Samba on Linux
Commits
ae104d18
Commit
ae104d18
authored
Feb 10, 2021
by
Martin Klimes (k11m1)
Browse files
Add cron.pl for updating ppd
parent
b18b1b4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
cron.pl
0 → 100755
View file @
ae104d18
#!/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
View file @
ae104d18
...
...
@@ -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 #
...
...
@@ -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
)
=
@_
;
...
...
@@ -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
;
...
...
@@ -294,7 +318,11 @@ if ($model eq "TA5007ci") {
for
my
$filter
(
@
{(
$models
->
{
$model
}
//
{})
->
{
filters
}
//
[]
})
{
copy_filter
(
$filter
);
}
install_printer
"
$printer_name
";
say
"
[INFO] Installation is completed.
";
if
(
$only_update
)
{
update_ppd
("
$printer_name
");
say
"
[INFO] Update is completed.
";
}
else
{
install_printer
("
$printer_name
");
say
"
[INFO] Installation is completed.
";
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment