summaryrefslogtreecommitdiffstats
path: root/debian/dselect.preinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:58:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:58:51 +0000
commite52abbeea0a0fd87f2df577263fdfcb89da6c1b0 (patch)
tree27a6f3ded04c521f55558166ee9322076339ca2b /debian/dselect.preinst
parentAdding upstream version 1.21.22. (diff)
downloaddpkg-e52abbeea0a0fd87f2df577263fdfcb89da6c1b0.tar.xz
dpkg-e52abbeea0a0fd87f2df577263fdfcb89da6c1b0.zip
Adding debian version 1.21.22.debian/1.21.22debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/dselect.preinst')
-rw-r--r--debian/dselect.preinst50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/dselect.preinst b/debian/dselect.preinst
new file mode 100644
index 0000000..59d36e9
--- /dev/null
+++ b/debian/dselect.preinst
@@ -0,0 +1,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