Skip to content

Commit bb30fcf

Browse files
committed
handoff: Add printer setup
1 parent 5971138 commit bb30fcf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

script/handoff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ set -euo pipefail
44

55
. oks-lib.sh
66

7+
# NixOS generates `printers.conf` for us but we can't know the printers SN in
8+
# advance of the first ceremony where it's used. As a work-around we query cups
9+
# for the serial number for the attached printer and then swap it in
10+
# `printers.conf` with the place holder `SN_GOES_HERE`
11+
PRINTER_SN_REGEX='^direct[[:space:]]\+usb:\/\/Brother\/QL-600?serial=\(.*\)$'
12+
PRINTER_SN=$(lpinfo -v | sed -n "s/$PRINTER_SN_REGEX/\1/p")
13+
info "Label printer with SN: $PRINTER_SN found"
14+
15+
systemctl stop cups.service
16+
sed -i "s/SN_GOES_HERE/$PRINTER_SN/g" /etc/cups/printers.conf
17+
systemctl start cups.service
18+
info "Label printer with SN: $PRINTER_SN configured"
19+
720
# assume system has just booted & OS CD is still in the drive
821
wait_for_cd
922
hash-cd

0 commit comments

Comments
 (0)