aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/deb/meshbay-common
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/deb/meshbay-common')
-rwxr-xr-xpackaging/deb/meshbay-common/DEBIAN/preinst14
-rwxr-xr-xpackaging/deb/meshbay-common/DEBIAN/prerm13
2 files changed, 27 insertions, 0 deletions
diff --git a/packaging/deb/meshbay-common/DEBIAN/preinst b/packaging/deb/meshbay-common/DEBIAN/preinst
new file mode 100755
index 0000000..16af2f8
--- /dev/null
+++ b/packaging/deb/meshbay-common/DEBIAN/preinst
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+
+# The postinst compiles bytecode next to every module, into __pycache__
+# directories the package does not own. Left in place, they keep dpkg from
+# removing a directory the new version no longer ships, and it warns.
+case "$1" in
+ upgrade)
+ find /opt/meshbay-common/venv -depth -type d -name __pycache__ \
+ -exec rm -rf {} + 2>/dev/null || true
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/packaging/deb/meshbay-common/DEBIAN/prerm b/packaging/deb/meshbay-common/DEBIAN/prerm
new file mode 100755
index 0000000..e7b665b
--- /dev/null
+++ b/packaging/deb/meshbay-common/DEBIAN/prerm
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+
+# Bytecode the postinst compiled is not the package's: removed here, so that
+# dpkg can remove the directories it was written into.
+case "$1" in
+ remove|upgrade|deconfigure)
+ find /opt/meshbay-common/venv -depth -type d -name __pycache__ \
+ -exec rm -rf {} + 2>/dev/null || true
+ ;;
+esac
+
+#DEBHELPER#