aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/deb/meshbay-cli/DEBIAN/prerm
blob: 96e593098f51ececc63e9dc63cb24978443711b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
set -e

# The client's files live in meshbay-common's venv, whose own cleanup runs only
# after this package is gone: the bytecode compiled next to them is removed
# here, or dpkg cannot remove the directories it sits in.
case "$1" in
    remove|upgrade|deconfigure)
        site=$(echo /opt/meshbay-common/venv/lib/python3.*/site-packages)
        while IFS= read -r entry; do
            [ -n "$entry" ] && [ -d "$site/$entry" ] || continue
            find "$site/$entry" -depth -type d -name __pycache__ \
                -exec rm -rf {} + 2>/dev/null || true
        done < /opt/meshbay-cli/site-packages.list
        ;;
esac

#DEBHELPER#