post_install() {
    :
#!/bin/sh
# Let the signed-in person send receipts straight to USB receipt printers (no printer driver needed).
cat > /etc/udev/rules.d/60-vali-desktop.rules <<'EOF'
SUBSYSTEM=="usbmisc", KERNEL=="lp[0-9]*", MODE="0666"
EOF
udevadm control --reload-rules 2>/dev/null || true
udevadm trigger --subsystem-match=usbmisc 2>/dev/null || true
modprobe usblp 2>/dev/null || true

}
post_remove() {
    :
#!/bin/bash

# Delete the link to the binary
# update-alternatives --remove <name> <path>: 'path' must be the registered alternative binary,
# not the generic symlink — see https://man7.org/linux/man-pages/man1/update-alternatives.1.html
if type update-alternatives >/dev/null 2>&1; then
    update-alternatives --remove 'vali-desktop' '/opt/Vali/vali-desktop'
else
    rm -f '/usr/bin/vali-desktop'
fi

APPARMOR_PROFILE_DEST='/etc/apparmor.d/vali-desktop'

# Remove and unload apparmor profile.
if [ -f "$APPARMOR_PROFILE_DEST" ]; then
  # Unload the profile from the running kernel before deleting the file so the
  # policy is not left enforced until the next reboot.  Mirror the chroot guard
  # used in the after-install script — live AppArmor operations are not
  # meaningful inside a chroot.
  # https://wiki.debian.org/AppArmor/HowToUse
  if apparmor_status --enabled > /dev/null 2>&1; then
    if ! { [ -x '/usr/bin/ischroot' ] && /usr/bin/ischroot; } && hash apparmor_parser 2>/dev/null; then
      apparmor_parser --remove "$APPARMOR_PROFILE_DEST" || true
    fi
  fi
  rm -f "$APPARMOR_PROFILE_DEST"
fi
}
