#!/bin/sh
# prerm script for weewx debian package
# Copyright 2013 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

case "$1" in
remove|upgrade)
        # stop the weewx daemon
        invoke-rc.d weewx stop

        # remove any bytecompiled code
        find /usr/share/weewx -name '*.pyc' -delete
	      find /usr/share/weewx -name __pycache__ -delete
        ;;
esac

exit 0
