#!/bin/bash set -e # $HeadURL$ $LastChangedRevision$ TRIES=2 INTERVAL=15 case "$1" in upgrade|remove) for ((I=0; I<$TRIES; I++)); do ((I==0)) || { echo "prerm/$1: udi appears to be running; waiting $((INTERVAL*(TRIES-I)))s more before giving up ..." >&2 sleep 15 } lockfile-create -p -r 0 -l -q /tmp/udi.lock && exit 0 done exit 1 ;; deconfigure) : ;; failed-upgrade) # failed-upgrade called after the old verion of the package's prerm failed (as a sort # of "maybe the new one will work" approach). Since that only fails when udi is locking # out an upgrade, we want to abort in this situation. Which means that also the # new version of the prerm script should fail. See https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html # specifically section 6.6, for more details. exit 1 ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0