-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·37 lines (28 loc) · 1.02 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# Requires sudo
# SPDX-License-Identifier: Unlicense
#
# Whenever the configuration file /etc/cups/cupsd.conf is changed,
# the CUPS server must be restarted, for which this command may be used:
# systemctl restart cups.service
#
# Remember to update the following information (variables).
# Name of the CUPS queue/class
printerQueue=HP_LaserJet_P1006
# User to append to lpadmin group in order to have admin rights on CUPS
user=pi
# Exit immediately if a command exits with a non-zero status
# set -o errexit
# Treat unset variables as errors when substituting
set -o nounset
### DEPENDENCIES
apt update
apt install -y libsystemd-dev cups libcups2-dev libxslt-dev hplip printer-driver-hpcups python3-pip python3-cups
pip3 install -r requirements.txt
### PRINTER SETUP
hp-setup --interactive --auto -x
### CUPS CONFIG
usermod -a -G lpadmin "$user"
lpadmin -p "$printerQueue" -o printer-error-policy=retry-current-job
cupsctl --remote-admin --remote-any --share-printers --user-cancel-any
systemctl restart cups.service