#!/bin/sh # ---------------------------------------------------------------------------- # /var/install/deinstall/lzma - deinstall script # # Creation : 2009-07-09 starwarsfan # 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=lzma # Set filelist filelist=/etc/filelist.d/lzma-files.txt # Check if this is an update if [ "${1}" == "update" ] then mecho -info "Updating package 'lzma' (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="var/install/deinstall/lzma" else mecho -info "Removing package 'lzma'" 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} >/dev/null 2>&1 ;; esac fi done < ${filelist} # ---------------------------------------------------------------------------- # Remove symlinks etc. # ---------------------------------------------------------------------------- rm -f /usr/bin/lzcat rm -f /usr/bin/lzcmp rm -f /usr/bin/lzegrep rm -f /usr/bin/lzfgrep rm -f /usr/bin/lzless rm -f /usr/bin/unlzma # ---------------------------------------------------------------------------- # Stop remove for update only # ---------------------------------------------------------------------------- if [ "$update" == true ] then exit 0 fi # ---------------------------------------------------------------------------- # Remove file list # ---------------------------------------------------------------------------- rm -f /etc/filelist.d/lzma-files.txt # ---------------------------------------------------------------------------- # Remove deinstall script # ---------------------------------------------------------------------------- rm -f /var/install/deinstall/lzma # ---------------------------------------------------------------------------- exit 0