#!/bin/sh #---------------------------------------------------------------------------- # /var/install/deinstall/geoipupdate-legacy - deinstall script # # Creation : 2020-11-03 holbru # Last update: $Id$ # # Copyright (c) 2020-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # set package name package_name=geoipupdate-legacy # check for update is given if [ "${1}" = "--update" ] then update=true fi # --------------------------------------------------------------------------- # stop deamon # --------------------------------------------------------------------------- if ! /usr/sbin/service is-enabled geoip-legacy-updater.timer then quiet='--quiet' fi /usr/sbin/service ${quiet} stop geoip-legacy-updater.timer /usr/sbin/service disable geoip-legacy-updater.timer # --------------------------------------------------------------------------- # remove cron file # --------------------------------------------------------------------------- if [ -f /var/cron/etc/root/${package_name} ] then rm -f /var/cron/etc/root/${package_name} /var/install/config.d/cron --quiet fi # --------------------------------------------------------------------------- # remove config and check file # --------------------------------------------------------------------------- rm -f /etc/default.d/${package_name} rm -f /etc/check.d/${package_name} rm -f /etc/check.d/${package_name}.* # --------------------------------------------------------------------------- # stop for update only # --------------------------------------------------------------------------- if ${update:-false} then exit 0 fi # --------------------------------------------------------------------------- # remove config file # --------------------------------------------------------------------------- timer_dir='/etc/systemd/system/geoip-legacy-updater.timer.d' timer_conf='75-update-time.conf' configfiles="/etc/config.d/${package_name} /etc/backup.d/${package_name}.* ${timer_dir}/${timer_conf}" for cfile in ${configfiles} do rm -f ${cfile} done # --------------------------------------------------------------------------- # clean up runtime created files # --------------------------------------------------------------------------- rm -f /var/lib/GeoIP/GeoIP.dat rm -f /var/lib/GeoIP/GeoIPASNum.dat rm -f /var/lib/GeoIP/GeoIPASNumv6.dat rm -f /var/lib/GeoIP/GeoIPCity.dat rm -f /var/lib/GeoIP/GeoIPCityv6.dat rm -f /var/lib/GeoIP/GeoIPv6.dat rm -f /var/lib/GeoIP/GeoLite2-ASN-CSV.zip rm -f /var/lib/GeoIP/GeoLite2-City-CSV.zip rm -f /var/lib/GeoIP/GeoLite2-Country-CSV.zip rmdir --ignore-fail-on-non-emtpy /var/lib/GeoIP 2>/dev/null rmdir --ignore-fail-on-non-empty ${timer_dir} 2>/dev/null /usr/bin/systemctl clean --what=state geoip-legacy-updater.timer exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------