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
f15e7db0
Commit
f15e7db0
authored
Jan 19, 2021
by
Martin Klimes (k11m1)
Browse files
cleanup
parent
4d5dde87
Changes
1
Hide whitespace changes
Inline
Side-by-side
install.pl
View file @
f15e7db0
...
...
@@ -4,7 +4,6 @@ use 5.24.0;
use
strict
;
use
warnings
;
use
Carp
qw/croak/
;
use
Data::
Dumper
qw(Dumper)
;
use
Cwd
qw(cwd)
;
use
File::
Path
;
use
File::
Copy
;
...
...
@@ -23,7 +22,7 @@ my $printers = {
'
location
'
=>
'
Building A, 3th floor kitchen
',
},
'
lj5c
'
=>
{
'
model
'
=>
'
hplj
-
600
',
'
model
'
=>
'
hplj600
',
'
location
'
=>
'
Building C, 5th floor, next to copy
',
},
'
copy5b
'
=>
{
...
...
@@ -31,15 +30,15 @@ my $printers = {
'
location
'
=>
'
Building B, 5th floor
',
},
'
lj4c
'
=>
{
'
model
'
=>
'
hplj
-
600
',
'
model
'
=>
'
hplj600
',
'
location
'
=>
'
Building C, 4th floor, next to copy
',
},
'
lj4p
'
=>
{
'
model
'
=>
'
hplj
-
p4015x
',
'
model
'
=>
'
hpljp4015x
',
'
location
'
=>
'
Building B, 4th floor, next to copy
',
},
'
lj4a
'
=>
{
'
model
'
=>
'
hplj
-
600
',
'
model
'
=>
'
hplj600
',
'
location
'
=>
'
Building A, 4th floor kitchen
',
},
'
copy4a
'
=>
{
...
...
@@ -51,11 +50,11 @@ my $printers = {
'
location
'
=>
'
Building A, 2nd floor kitchen
',
},
'
lj3a
'
=>
{
'
model
'
=>
'
hplj
-
600
',
'
model
'
=>
'
hplj600
',
'
location
'
=>
'
Building A, 3th floor kitchen
',
},
'
lj2a
'
=>
{
'
model
'
=>
'
hplj
-
600
',
'
model
'
=>
'
hplj600
',
'
location
'
=>
'
Building A, 2nd floor kitchen
',
},
'
copy5c
'
=>
{
...
...
@@ -63,11 +62,11 @@ my $printers = {
'
location
'
=>
'
Building C, 5th floor
',
},
'
lj3b
'
=>
{
'
model
'
=>
'
hplj
-
p4515x
',
'
model
'
=>
'
hpljp4515x
',
'
location
'
=>
'
Building B, 3th floor, kitchen
',
},
'
lj-a302
'
=>
{
'
model
'
=>
'
hplj
-
600
',
'
model
'
=>
'
hplj600
',
'
location
'
=>
'
Building A, 3th floor A302 LaSArIS
',
},
'
copy4c
'
=>
{
...
...
@@ -75,21 +74,21 @@ my $printers = {
'
location
'
=>
'
Building C, 4th floor
',
},
'
lj2b
'
=>
{
'
model
'
=>
'
hplj
-
p3015
',
'
model
'
=>
'
hpljp3015
',
'
location
'
=>
'
Building B, 2nd floor, kitchen
',
}
};
my
$models
=
{
'
TA5007ci
'
=>
{
'
filters
'
=>
[
'
kyofilter_pre_E
',
'
kyofilter_E
'
],
'
filters
'
=>
[
'
kyofilter_pre_E
',
'
kyofilter_E
'
,
],
},
'
TA4505ci
'
=>
{
'
filters
'
=>
['
kyofilter_B
'
],
'
options
'
=>
[
'
Option19=One
',
'
Option21=True
',
'
Option17=DF730
'
],
'
filters
'
=>
[
'
kyofilter_B
',
],
'
options
'
=>
[
'
Option19=One
',
'
Option21=True
',
'
Option17=DF730
'
,
],
},
'
hplj
-
600
'
=>
{
'
options
'
=>
['
HPOption_Duplexer=True
'],
'
hplj600
'
=>
{
'
options
'
=>
[
'
HPOption_Duplexer=True
'
,
],
}
};
...
...
@@ -112,9 +111,9 @@ sub prompt_password {
print
"
[PROMPT] Enter password:
";
system
("
stty -echo
");
chomp
(
my
$password1
=
<
STDIN
>
);
system
(
'
stty echo
'
);
system
(
"
stty echo
"
);
print
"
\n
[PROMPT] Repeat password:
";
system
(
'
stty -echo
'
);
system
(
"
stty -echo
"
);
chomp
(
my
$password2
=
<
STDIN
>
);
system
("
stty echo
");
print
"
\n
";
...
...
@@ -160,7 +159,7 @@ sub install_printer {
}
sub
copy_filter
{
(
my
$filter
)
=
@_
;
my
(
$filter
)
=
@_
;
my
$destination
=
"
/usr/lib/cups/filter/
";
...
...
@@ -173,7 +172,7 @@ sub copy_filter {
or
die
"
[ERROR] Failed to copy
$filter
: $!
\n
";
say
"
[OK] Copied
$filter
.
";
chmod
(
0755
,
$destination
.
$filter
)
;
chmod
0755
,
$destination
.
$filter
;
return
;
}
...
...
@@ -190,8 +189,8 @@ sub print_printers() {
}
sub
usage
()
{
say
"
Script for installing
FI
printers on
l
inux.
";
say
"
Requires local CUPS server running and S
AMBA
client installed.
";
say
"
Script for installing
fi
printers on
L
inux
via Samba print server
.
";
say
"
Requires local CUPS server running and S
amba
client installed.
";
say
"
usage: $0 <printer-name>
";
say
"
Must be run as root.
";
say
"
Triumph-Adler 50007ci needs Python 2.7 as a dependency
";
...
...
@@ -223,7 +222,7 @@ sub check_python {
}
sub
python_package
{
(
my
$package_name
,
my
$python
)
=
@_
;
my
(
$package_name
,
$python
)
=
@_
;
say
"
[INFO] Installing
$package_name
...
";
my
$status
=
chdir
"
$package_name
";
...
...
@@ -263,14 +262,14 @@ if ( @ARGV != 1 ) {
my
(
$printer_name
)
=
@ARGV
;
# Check for smbclient
my
$output
=
`
which smbclient
>/dev/null 2
>/dev/null
`;
my
$output
=
`
which smbclient
&
>/dev/null
`;
if
(
$?
!=
0
)
{
die
"
[ERROR] Samba client seems not to be installed. (smbclinet)
";
}
if
(
not
(
exists
(
$printers
->
{
$printer_name
}
)
)
)
{
say
"
[ERROR] Printer
$printer_name
is not supported.
";
print_printers
()
;
print_printers
;
exit
1
;
}
...
...
@@ -282,14 +281,13 @@ say "[INFO] Selected model is $model";
#TA5007ci requires python2 reportlab and PyPDF2
if
(
$model
eq
"
TA5007ci
"
)
{
pre_TA5007ci
()
;
pre_TA5007ci
;
}
for
my
$filter
(
@
{
(
$models
->
{
$model
}
//
{}
)
->
{
filters
}
//
[]
}
)
{
copy_filter
(
$filter
);
copy_filter
$filter
;
}
install_printer
(
"
$printer_name
"
)
;
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