File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,24 @@ set -eou pipefail
44
55. oks-lib.sh
66
7+ command_on_path lpinfo
8+ command_on_path systemctl
9+ command_on_path sed
10+ command_on_path oks
11+
12+ # NixOS generates `printers.conf` for us but we can't know the printers SN in
13+ # advance of the first ceremony where it's used. As a work-around we query cups
14+ # for the serial number for the attached printer and then swap it in
15+ # `printers.conf` with the place holder `SN_GOES_HERE`
16+ PRINTER_SN_REGEX=' ^direct[[:space:]]\+usb:\/\/Brother\/QL-600?serial=\(.*\)$'
17+ PRINTER_SN=$( lpinfo -v | sed -n " s/$PRINTER_SN_REGEX /\1/p" )
18+ info " Label printer with SN: $PRINTER_SN found"
19+
20+ systemctl stop cups.service
21+ sed -i " s/SN_GOES_HERE/$PRINTER_SN /g" /etc/cups/printers.conf
22+ systemctl start cups.service
23+ info " Label printer with SN: $PRINTER_SN configured"
24+
725while read -rsp " Enter password: " OKS_PASSWORD; do
826 export OKS_PASSWORD
927
You can’t perform that action at this time.
0 commit comments