#!/bin/sh # arpwatch.postinst: v11 2004/09/15 KELEMEN Peter set -e AWUSER="arpwatch" AWGROUP="arpwatch" AWHOME="/var/lib/${AWUSER}" AWGECOS="ARP Watcher" update_ethercodes () { # create or update the database file ethercodes.db; check existence of # the script so it can be disabled using dpkg-divert if [ -x /var/lib/ieee-data/update.d/arpwatch ] ; then /var/lib/ieee-data/update.d/arpwatch \ /var/lib/ieee-data/ oui.txt fi } case "$1" in configure) # Take care of group. if AWGROUP_ENTRY=`getent group "${AWGROUP}"`; then # group exists : else # group does not exist yet addgroup --quiet --system "${AWGROUP}" fi # Take care of user. if AWUSER_ENTRY=`getent passwd "${AWUSER}"`; then # user exists adduser --quiet "${AWUSER}" "${AWGROUP}" else # user does not exist yet adduser --quiet --system \ --ingroup "${AWGROUP}" \ --gecos "${AWGECOS}" \ --home "${AWHOME}" \ --no-create-home \ --shell /bin/sh \ --disabled-login \ --disabled-password \ "${AWUSER}" fi # Set up home directory with correct permissions. mkdir -p "${AWHOME}" chown "${AWUSER}:${AWGROUP}" "${AWHOME}" chmod 0750 "${AWHOME}" update_ethercodes ;; triggered) update_ethercodes ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_installinit/13.20 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/arpwatch" ]; then update-rc.d arpwatch defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native arpwatch $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.20 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'arpwatch.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'arpwatch.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'arpwatch.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'arpwatch.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.20 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'arpwatch.service' >/dev/null || true fi fi # End automatically added section exit 0 # End of file.