#!/bin/sh # ---------------------------------------------------------------------------- # /var/install/deinstall/apache2_webalizer - deinstall script # # Creation : 2009-05-24 jv # Last update: $Id$ # # Copyright (c) 2009 the eisfair team, # # 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. # ---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib # Set package name packageName=apache2_webalizer # Set filelist filelist=/etc/filelist.d/apache2_webalizer-files.txt # Check if this is an update if [ "${1}" == "update" ] then mecho -info "Updating package 'apache2_webalizer' (removing previous version)" update=true # ---------------------------------------------------------------------- # Add everything to this list what should _not_ be removed during an # update. This can be folders too, but let the bash expand their content # using an '*' like 'foo/bar/*'. The entries listet here must be given # on the file list of the package. All other stuff must be remove by hand # using an additional line like 'rm /foo/bar/foobar.txt'. filesToLeave="etc/config.d/apache2_webalizer etc/backup.d/apache2_webalizer* etc/filelist.d/apache2_webalizer-files.txt var/install/deinstall/apache2_webalizer" else mecho -info "Removing package 'apache2_webalizer'" update=false filesToLeave='' fi # ---------------------------------------------------------------------------- # Remove symlinks # ---------------------------------------------------------------------------- rm -f /usr/bin/webazolver # ---------------------------------------------------------------------------- # Remove package content except some special files if it's an update # instead of a deinstallation # ---------------------------------------------------------------------------- while read id perm user group package file do # ------------------------------------------------ # Remove file only if it is not on the ignore list removeCurrentFile=true for currentFileToLeave in "${filesToLeave}" do if [ "${currentFileToLeave}" == "${file}" ] then removeCurrentFile=false break fi done if ${removeCurrentFile} then case ${id} in b|u) if [ "${file}" != "tmp/install.sh" -a "${file}" != "tmp/preinstall.sh" ] then rm -f /${file} fi ;; f) # Remove directories rmdir --ignore-fail-on-non-empty /${file} ;; esac fi done < ${filelist} # ---------------------------------------------------------------------------- # Check files and default config must be removed separately because they # are not on the file list if the package is used as it was created by # create-package-new.sh, they are created dynamically during installation. # ---------------------------------------------------------------------------- rm -f /etc/check.d/apache2_webalizer* rm -f /etc/default.d/apache2_webalizer* # ---------------------------------------------------------------------------- # Stop remove for update only # ---------------------------------------------------------------------------- if [ "$update" == true ] then exit 0 fi # ---------------------------------------------------------------------------- # Remove cron jobs # ---------------------------------------------------------------------------- if [ "$EISFAIR_SYSTEM" = "eisfair-2" ] then rm -f /etc/cron/root/webalizer /var/install/bin/update-cron else rm -f /var/cron/etc/root/webalizer /var/install/config.d/cron >/dev/null 2>&1 fi # ---------------------------------------------------------------------------- # Remove config file # ---------------------------------------------------------------------------- rm -f /etc/config.d/apache2_webalizer rm -f /etc/backup.d/apache2_webalizer* rm -f /etc/filelist.d/apache2_webalizer-files.txt # ---------------------------------------------------------------------------- # Remove deinstall script # ---------------------------------------------------------------------------- rm -f /var/install/deinstall/apache2_webalizer # ---------------------------------------------------------------------------- exit 0