2
# prerm script for iscsitarget
4
# see: dh_installdeb(1)
8
# summary of how this script can be called:
10
# * <old-prerm> `upgrade' <new-version>
11
# * <new-prerm> `failed-upgrade' <old-version>
12
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
13
# * <deconfigured's-prerm> `deconfigure' `in-favour'
14
# <package-being-installed> <version> `removing'
15
# <conflicting-package> <version>
16
# for details, see http://www.debian.org/doc/debian-policy/ or
17
# the debian-policy package
21
remove|upgrade|deconfigure)
24
# The iscsitarget init script matching this md5sum will exit non-zero
25
# if the iscsi_trgt module cannot be unloaded, even if the daemon is killed.
27
# Compounding the issue is the fact that the iscsi_trgt module provided by
28
# the Ubuntu kernel (circa Intrepid) does not unload properly (LP: #278625).
30
# Newer iscsitarget init scripts should handle this more gracefully.
32
# This maintainer-script code is intended to stop the iscsi target, and
33
# ignore the module unloading error, and thus allow the upgrade to proceed.
34
if md5sum /etc/init.d/iscsitarget 2>/dev/null | grep -qs "^f0f3eed8e9f7daddb7dcb31004633a16"; then
35
# The old package's init script will succeed in stopping the daemon,
36
# but fail in unloading the module. Restart the daemon here
37
/etc/init.d/iscsitarget start || true
38
# Now try to stop it, capturing the output
40
OUT=`/etc/init.d/iscsitarget stop 2>&1` || RC=$?
41
# If the exit code is non-zero, and the error reported is the known
42
# module issue, exit 0
43
if [ "$RC" != "0" ]; then
44
if echo "$OUT" | grep -qs "Module iscsi_trgt is in use"; then
45
echo "WARNING: Ignoring the fact that module iscsi_trgt is in use"
53
echo "prerm called with unknown argument \`$1'" >&2
59
# dh_installdeb will replace this with shell code automatically
60
# generated by other debhelper scripts.