blob: 59d36e90fc658e14c4b402c3c50a4b6c6533b475 (
plain)
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
|
#!/bin/sh
# See deb-preinst(5).
set -e
: "${DPKG_ADMINDIR:=/var/lib/dpkg}"
# Rename state directories to match renamed method names.
rename_method_state_dir() {
methodoldname="$1"
methodoldopt="$2"
methodnewname="$3"
methodnewopt="$4"
methodsdir="$DPKG_ADMINDIR/methods"
if [ -d "$methodsdir/$methodoldname" ]; then
if [ -e "$methodsdir/$methodnewname" ]; then
rm -rf "$methodsdir/$methodoldname"
else
if [ -e "$methodsdir/$methodoldname/shvar.$methodoldopt" ]; then
cp -a "$methodsdir/$methodoldname/shvar.$methodoldopt" \
"$methodsdir/$methodoldname/shvar.$methodnewopt"
fi
mv "$methodsdir/$methodoldname" "$methodsdir/$methodnewname"
rm -f "$methodsdir/$methodnewname/shvar.$methodoldopt"
fi
# Update the currently selected method and option if needed.
sed -i -e "s/^$methodoldname $methodoldopt/$methodnewname $methodnewopt/" \
"$DPKG_ADMINDIR/cmethopt"
fi
}
case "$1" in
install|upgrade)
if [ -n "$2" ]; then
rename_method_state_dir disk mounted file file
rename_method_state_dir multicd multi_cd media media
fi
;;
abort-upgrade)
;;
*)
echo "$0 called with unknown argument '$1'" 1>&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|