#! /bin/bash # ---------------------------------------------------------------------------- # /var/install/deinstall/wibukey - deinstall script # # Creation : 2010-07-17 Marcel Weiler # Last update: $Id$ # # Copyright (c) 2010 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=wibukey # Set filelist filelist=/etc/filelist.d/wibukey-files.txt # Check if this is an update if [ "${1}" == "update" ] then mecho -info "Updating package 'wibukey' (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/wibukey etc/backup.d/wibukey* etc/filelist.d/wibukey-files.txt var/install/deinstall/wibukey var/install/menu/setup.services.wibukey*" else mecho -info "Removing package 'wibukey'" update=false filesToLeave='' fi # ---------------------------------------------------------------------------- # 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/wibukey* rm -f /etc/default.d/wibukey* # ---------------------------------------------------------------------------- # Stop remove for update only # ---------------------------------------------------------------------------- if ${update} then exit 0 fi # ---------------------------------------------------------------------------- # Remove package from menu system / remove all menu and config files # ---------------------------------------------------------------------------- /var/install/bin/del-menu setup.services.menu setup.services.wibukey.menu # ---------------------------------------------------------------------------- # Remove config file # ---------------------------------------------------------------------------- rm -f /etc/config.d/wibukey rm -f /etc/backup.d/wibukey* rm -f /etc/filelist.d/wibukey-files.txt # ---------------------------------------------------------------------------- # Remove deinstall script # ---------------------------------------------------------------------------- rm -f /var/install/deinstall/wibukey # ---------------------------------------------------------------------------- exit 0