# Same intent as the .deb postinst (assets/deb-scripts/postinst): pick up the
# Knokke udev rule without a reboot so the scanner is usable straight after
# install. Beyond the deb version: create the plugdev group first (the
# sysusers.d hook only runs after install scripts, and udev drops the whole
# GROUP assignment while it doesn't resolve), and replay 'add' — not the
# default 'change' — scoped to the scanner's vendor IDs, since MODE/GROUP and
# the uaccess ACL are applied on add for an already-plugged device.
post_install() {
  systemd-sysusers korova.conf 2>/dev/null || true
  udevadm control --reload-rules 2>/dev/null || true
  udevadm trigger --subsystem-match=usb --attr-match=idVendor=34b4 --action=add 2>/dev/null || true
  udevadm trigger --subsystem-match=usb --attr-match=idVendor=04b4 --action=add 2>/dev/null || true
}

post_upgrade() {
  post_install
}
