83 lines
2.1 KiB
Markdown
83 lines
2.1 KiB
Markdown
# totoro
|
|
|
|
A simple web interface to line printer daemon (lpd) printing
|
|
on OpenBSD.
|
|
|
|
May work on other unixes, or may not.
|
|
|
|
## Installation
|
|
|
|
These installation instructions assume OpenBSD.
|
|
|
|
Copy the perl script to the cgi-bin directory:
|
|
|
|
doas cp print.pl /var/www/cgi-bin/
|
|
|
|
### Perl
|
|
|
|
Install perl packages:
|
|
|
|
doas pkg_add p5-Any-URI-Escape p5-YAML p5-Clone
|
|
|
|
As of this writing, `Net::Printer` and `URI::Query` are not in openbsd
|
|
packages, so we'll install them locally. You may want to check if this has
|
|
changed.
|
|
|
|
To install them locally, first install `local::lib`:
|
|
|
|
doas pkg_add p5-local-lib
|
|
|
|
Then tell perl to install modules to `/var/www/perl5`:
|
|
|
|
PATH="/var/www/perl5/bin${PATH:+:${PATH}}"; export PATH;
|
|
PERL5LIB="/var/www/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
|
|
PERL_LOCAL_LIB_ROOT="/var/www/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
|
|
PERL_MB_OPT="--install_base \"/var/www/perl5\""; export PERL_MB_OPT;
|
|
PERL_MM_OPT="INSTALL_BASE=/var/www/perl5"; export PERL_MM_OPT;
|
|
|
|
Then install dependencies:
|
|
|
|
perl -MCPAN -e "use local::lib '/var/www/perl5'; install Net::Printer;"
|
|
perl -MCPAN -e "use local::lib '/var/www/perl5'; install URI::Query;"
|
|
|
|
### Daemons
|
|
|
|
Set up httpd and slowcgi:
|
|
|
|
NOTE: these instructions set up httpd and slowcgi without chroot.
|
|
Probably it can be made to work in a chroot.
|
|
|
|
Add to `/etc/httpd.conf`:
|
|
|
|
chroot "/"
|
|
logdir "/var/www/logs"
|
|
|
|
server "totoro" {
|
|
listen on * port 80
|
|
root "/var/www/htdocs"
|
|
|
|
# cgi
|
|
location "/" {
|
|
fastcgi socket "/var/www/run/slowcgi.sock"
|
|
root "/var/www/cgi-bin/print.pl"
|
|
}
|
|
location "/" {
|
|
root "/var/www/print.pl"
|
|
fastcgi socket "/var/www/run/slowcgi.sock"
|
|
}
|
|
}
|
|
|
|
Set daemon flags and start:
|
|
|
|
$ doas rcctl set slowcgi flags "-p /"
|
|
$ doas rcctl enable httpd slowcgi
|
|
$ doas rcctl start httpd slowcgi
|
|
|
|
If your printer is not already set up yet, read up on lpd(8) and printcap(5).
|
|
|
|
## Usage
|
|
|
|
Place any jobs files into `/var/www/jobs`.
|
|
|
|
Visit the web interface in a web browser.
|