Dpkg::OpenPGP::Backend::GnuPG: Fallback to use «gpg dearmor» if present
[dpkg.git] / debian / dselect.prerm
blob0a49491ec82e4fd65c57c162caf0cd79bf472006
1 #!/bin/sh
2 # See deb-prerm(5).
4 set -e
6 : "${DPKG_ADMINDIR:=/var/lib/dpkg}"
8 # Rename state directories to match renamed method names.
9 rename_method_state_dir() {
10 methodoldname="$1"
11 methodoldopt="$2"
12 methodnewname="$3"
13 methodnewopt="$4"
14 methodsdir="$DPKG_ADMINDIR/methods"
16 if [ -d "$methodsdir/$methodoldname" ]; then
17 if [ -e "$methodsdir/$methodnewname" ]; then
18 rm -rf "$methodsdir/$methodoldname"
19 else
20 if [ -e "$methodsdir/$methodoldname/shvar.$methodoldopt" ]; then
21 cp -a "$methodsdir/$methodoldname/shvar.$methodoldopt" \
22 "$methodsdir/$methodoldname/shvar.$methodnewopt"
24 mv "$methodsdir/$methodoldname" "$methodsdir/$methodnewname"
25 rm -f "$methodsdir/$methodnewname/shvar.$methodoldopt"
27 # Update the currently selected method and option if needed.
28 sed -i -e "s/^$methodoldname $methodoldopt/$methodnewname $methodnewopt/" \
29 "$DPKG_ADMINDIR/cmethopt"
33 case "$1" in
34 upgrade)
35 if dpkg --compare-versions "$2" lt 1.21.3; then
36 # Downgrade
37 rename_method_state_dir file file disk mounted
38 rename_method_state_dir media media multicd multi_cd
41 deconfigure|remove|failed-upgrade)
44 echo "$0 called with unknown argument '$1'" 1>&2
45 exit 1
47 esac
49 #DEBHELPER#
51 exit 0