Files
weewx/pkg/debian/prerm
2023-12-14 07:53:12 -05:00

39 lines
946 B
Bash
Executable File

#!/bin/sh
# prerm script for weewx debian package
# Copyright 2013-2023 Matthew Wall
#
# ways this script might be invoked:
#
# prerm remove
# old-prerm upgrade new-version
# conflictor's-prerm remove in-favor package new-version
# deconfigured's-prerm deconfigure in-favour package-being-installed version
# [removing conflicting-package version]
# new-prerm failed-upgrade old-version
# abort if any command returns error
set -e
pid1=none
if [ -d /run/systemd/system ]; then
pid1=systemd
fi
case "$1" in
remove|upgrade)
# stop the weewx daemon and remove the startup configuration
if [ "$pid1" = "systemd" ]; then
systemctl stop weewx
systemctl disable weewx
fi
# remove any bytecompiled code
find /usr/share/weewx -name '*.pyc' -delete
find /usr/share/weewx -name __pycache__ -delete
find /etc/weewx/bin -name '*.pyc' -delete
find /etc/weewx/bin -name __pycache__ -delete
;;
esac
exit 0