#! /bin/sh set -e stop_gpm () { # Try several methods of stopping the daemon. # The init.d script had problems in earlier revisions. invoke-rc.d gpm stop || systemctl stop gpm || gpm -k || # Try stopping gpm via the executable and via the PID file. # The PID filename changed between 1.14 and 1.16, so we try both. start-stop-daemon --stop --quiet --exec /usr/sbin/gpm || start-stop-daemon --stop --quiet --pidfile /var/run/gpmpid || start-stop-daemon --stop --quiet --pidfile /var/run/gpm.pid || # If all of the above fails, assume gpm was already stopped. true } if [ "$1" != "upgrade" ]; then # Note, we do /NOT/ stop gpm on upgrade, as it may be repeating to X.. # However we do want to stop it if the upgrade fails. stop_gpm fi