Files
deploy_home/ansible/roles/labelprint/files/trim-ppd-media.awk
T
Bastian de BylandClaude Opus 5 6cd4d56de1 feat(labelprint): 4x6 label print proxy on a Raspberry Pi
A Pi 3B+ (stickah.local) shares a Phomemo PM246 to the LAN as a plain CUPS
queue, so any machine can print 4x6 labels -- fulfillr-site's shipping labels
in particular -- without installing the vendor driver, which is x86-64 only.
The role builds the TSPL CUPS driver from source instead.

It is Debian, not Fedora, so it lives in its own inventory and playbook
(make deploy-labelprint / check-labelprint) and the home.debyl.io roles can
never run against it. make bootfs renders its cloud-init first-boot files onto
a freshly imaged SD card from the same templates the role uses. The Wi-Fi
credentials for the home and rescue networks are in the vault.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 23:14:45 -04:00

26 lines
1.1 KiB
Awk

# Cuts every media size except one out of a CUPS PPD.
#
# macOS and Windows add this printer driverless: they never see this PPD, they
# see the IPP media-supported list cupsd derives from it. Trimming here is
# therefore the only way to make 4x6 the single choice a client can offer --
# there is no lpadmin option that restricts the media list.
#
# Regenerated from the driver's own PPD on every deploy, so a driver version
# bump carries its new PPD through this filter rather than being pinned to a
# fork.
#
# awk -v keep=w288h432 -f trim-ppd-media.awk tspl-label.ppd
#
# The four families below are keyed by the PPD page-size keyword in field 2,
# which reads as "w288h432/4 x 6 in:" -- hence the split on "/".
/^\*(PageSize|PageRegion|ImageableArea|PaperDimension) / {
split($2, f, "/")
if (f[1] != keep) next
}
# Custom sizes would put "Manage Custom Sizes" back in the client's paper menu
# and let a job arrive at any dimension, which is the thing being prevented.
/^\*(CustomPageSize|ParamCustomPageSize|MaxMediaWidth|MaxMediaHeight)/ { next }
{ print }