This file is indexed.

postrm is in module-init-tools 3.16-1ubuntu2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/sh -e
# This script can be called in the following ways:
#
# After the package was removed:
#	<postrm> remove
#
# After the package was purged:
#	<postrm> purge
#
# After the package was upgraded:
#	<old-postrm> upgrade <new-version>
# if that fails:
#	<new-postrm> failed-upgrade <old-version>
#
#
# After all of the packages files have been replaced:
#	<postrm> disappear <overwriting-package> <version>
#
#
# If preinst fails during install:
#	<new-postrm> abort-install
#
# If preinst fails during upgrade of removed package:
#	<new-postrm> abort-install <old-version>
#
# If preinst fails during upgrade:
#	<new-postrm> abort-upgrade <old-version>


# Undo removal of a no-longer used conffile
undo_rm_conffile()
{
    CONFFILE="$1"

    if [ ! -e "$CONFFILE" ]; then
	if [ -e "$CONFFILE".dpkg-bak ]; then
	    echo "Restoring modified conffile $CONFFILE"
	    mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
	elif [ -e "$CONFFILE".dpkg-obsolete ]; then
	    mv -f "$CONFFILE".dpkg-obsolete "$CONFFILE"
	fi
    fi
}

# Finish removal of a no-longer used conffile
finish_rm_conffile()
{
    CONFFILE="$1"

    if [ -e "$CONFFILE".dpkg-bak ]; then
	rm -f "$CONFFILE".dpkg-bak
    fi
}

# Undo move of a conffile
undo_mv_conffile()
{
    CONFFILE="$1"

    if [ ! -e "$CONFFILE" ]; then
	if [ -e "$CONFFILE".dpkg-bak ]; then
	    mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
	elif [ -e "$CONFFILE".dpkg-moving ]; then
	    mv -f "$CONFFILE".dpkg-moving "$CONFFILE"
	fi
    fi
}

# Finish move of a conffile
finish_mv_conffile()
{
    CONFFILE="$1"

    if [ -e "$CONFFILE".dpkg-bak ]; then
	rm -f "$CONFFILE".dpkg-bak
    fi
}


# Finish migrating config to 3.7-style
finish_migrate_config_37()
{
    finish_rm_conffile /etc/modprobe.d/aliases
    finish_rm_conffile /etc/modprobe.d/isapnp
    finish_rm_conffile /etc/modprobe.d/options

    finish_rm_conffile /etc/modprobe.d/arch/alpha
    finish_rm_conffile /etc/modprobe.d/arch/i386
    finish_rm_conffile /etc/modprobe.d/arch/ia64
    finish_rm_conffile /etc/modprobe.d/arch/m68k.amiga
    finish_rm_conffile /etc/modprobe.d/arch/m68k.atari
    finish_rm_conffile /etc/modprobe.d/arch/m68k.generic
    finish_rm_conffile /etc/modprobe.d/arch/mips
    finish_rm_conffile /etc/modprobe.d/arch/parisc
    finish_rm_conffile /etc/modprobe.d/arch/powerpc.apus
    finish_rm_conffile /etc/modprobe.d/arch/powerpc.generic
    finish_rm_conffile /etc/modprobe.d/arch/powerpc.pmac
    finish_rm_conffile /etc/modprobe.d/arch/s390
    finish_rm_conffile /etc/modprobe.d/arch/sparc
    finish_rm_conffile /etc/modprobe.d/arch/x86_64

    finish_rm_conffile /etc/modprobe.d/blacklist-amd76-edac
    finish_mv_conffile /etc/modprobe.d/blacklist \
		       /etc/modprobe.d/blacklist.conf
    finish_mv_conffile /etc/modprobe.d/blacklist-firewire \
		       /etc/modprobe.d/blacklist-firewire.conf
    finish_mv_conffile /etc/modprobe.d/blacklist-framebuffer \
		       /etc/modprobe.d/blacklist-framebuffer.conf
    finish_mv_conffile /etc/modprobe.d/blacklist-watchdog \
		       /etc/modprobe.d/blacklist-watchdog.conf
    finish_mv_conffile /etc/modprobe.d/intel-5300-iwlagn-disable11n \
		       /etc/modprobe.d/intel-5300-iwlagn-disable11n.conf
}

# Undo migrating config to 3.7-style
undo_migrate_config_37()
{
    undo_rm_conffile /etc/modprobe.d/aliases
    undo_rm_conffile /etc/modprobe.d/isapnp
    undo_rm_conffile /etc/modprobe.d/options

    undo_rm_conffile /etc/modprobe.d/arch/alpha
    undo_rm_conffile /etc/modprobe.d/arch/i386
    undo_rm_conffile /etc/modprobe.d/arch/ia64
    undo_rm_conffile /etc/modprobe.d/arch/m68k.amiga
    undo_rm_conffile /etc/modprobe.d/arch/m68k.atari
    undo_rm_conffile /etc/modprobe.d/arch/m68k.generic
    undo_rm_conffile /etc/modprobe.d/arch/mips
    undo_rm_conffile /etc/modprobe.d/arch/parisc
    undo_rm_conffile /etc/modprobe.d/arch/powerpc.apus
    undo_rm_conffile /etc/modprobe.d/arch/powerpc.generic
    undo_rm_conffile /etc/modprobe.d/arch/powerpc.pmac
    undo_rm_conffile /etc/modprobe.d/arch/s390
    undo_rm_conffile /etc/modprobe.d/arch/sparc
    undo_rm_conffile /etc/modprobe.d/arch/x86_64

    undo_rm_conffile /etc/modprobe.d/blacklist-amd76-edac
    undo_mv_conffile /etc/modprobe.d/blacklist \
		     /etc/modprobe.d/blacklist.conf
    undo_mv_conffile /etc/modprobe.d/blacklist-firewire \
		     /etc/modprobe.d/blacklist-firewire.conf
    undo_mv_conffile /etc/modprobe.d/blacklist-framebuffer \
		     /etc/modprobe.d/blacklist-framebuffer.conf
    undo_mv_conffile /etc/modprobe.d/blacklist-watchdog \
		     /etc/modprobe.d/blacklist-watchdog.conf
}



# Remove configuration
purge_files()
{
    if [ -f /etc/modules ]; then
	rm -f /etc/modules
    fi
}


case "$1" in
    remove)
	;;

    purge)
	finish_migrate_config_37
	purge_files
	;;

    upgrade|failed-upgrade|disappear)
	;;

    abort-install|abort-upgrade)
	# Abort upgrade from intrepid
	if dpkg --compare-versions "$2" lt "3.7~pre7-1"; then
	    undo_migrate_config_37
	fi
	;;

    *)
	echo "$0 called with unknown argument \`$1'" 1>&2
	exit 1
	;;
esac

# iwlwifi split into 2 drivers as of 2.6.38; iwl3945 and iwlagn
dpkg-maintscript-helper rm_conffile /etc/modprobe.d/intel-5300-iwlagn-disable11n.conf 3.12-1ubuntu4 -- "$@"


exit 0