#! /bin/sh #---------------------------------------------------------------------- # /var/install/deinstall/apcupsd-cgi - deinstallation of UPS Monitor # # Creation: 2008-12-04 tom # Last Update: $Id$ # # Copyright (c) Thomas Dann, thomas.dann(at)gmx(dot)de # Copyright (c) 2019-@@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=apcupsd-cgi if [ "${1}" = "--update" ] then update=true 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 remove for update only # --------------------------------------------------------------------------- if ${update:-false} then exit 0 fi # --------------------------------------------------------------------------- # remove http aliase # --------------------------------------------------------------------------- . /etc/config.d/${package_name} vhost_alias_path='/etc/apache2/vhost' vhost_include_path='/etc/apache2/mods-include' inst_servername=${APCUPSD_CGI_HOST_NAME} inst_alias=${APCUPSD_CGI_HOST_ALIAS} rm -f ${vhost_alias_path}/host-${inst_servername}-${inst_alias} rm -f ${vhost_alias_path}/vhost-${inst_servername}-${inst_alias} rm -f ${vhost_include_path}/${package_name}-*.conf # write new apache config /var/install/config.d/apache2.sh >/dev/null rm -f /etc/apache2/mods-enabled/${package_name}.conf rm -f /etc/apache2/mods-enabled/virtualhost-${package_name}.conf rm -f /etc/apache2/mods-include/${package_name}-${inst_alias}.conf rm -f /etc/apache2/mods-include/${package_name}-${inst_alias}-*.conf rm -f /var/certs/ssl/certs/${package_name}.pem # reload apache2 configuration, if apache is running if /usr/sbin/service is-active apache2.service then /usr/sbin/service stop apache2.service sleep 3 /usr/sbin/service start apache2.service fi # --------------------------------------------------------------------------- # remove config file # --------------------------------------------------------------------------- configfiles="/etc/config.d/${package_name} /etc/backup.d/${package_name}.* /etc/backup.d/upsmonitor.* /etc/logrotate.d/${package_name} /var/install/menu/setup.services.apcupsd.${package_name}.logfileview.*" for cfile in ${configfiles} do rm -f ${cfile} done # remove folder rm -rf /srv/www/${package_name} exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------