Codebase list grass / debian/6.3%7E20070922-1@603 grass.postrm
debian/6.3%7E20070922-1@603

Tree @debian/6.3%7E20070922-1@603 (Download .tar.gz)

grass.postrm @debian/6.3%7E20070922-1@603raw · history · blame

#!/bin/sh
# Make sure grass library dir is removed from ld.so.conf
# Lifted from xfree86 package's shell-lib.sh script

set -e

dir="/usr/lib/grass/lib"
ldsoconf="/etc/ld.so.conf"

if [ "$1" = "remove" ]; then
  # is the line present?
  if fgrep -qsx "$dir" "$ldsoconf"; then
    # rewrite the file (very carefully)
    set +e
    fgrep -svx "$dir" "$ldsoconf" > "$ldsoconf.dpkg-tmp"
    fgrep_status=$?
    set -e
    case $fgrep_status in
      0|1) ;; # we don't actually care if any lines matched or not
      *) die "error reading \"$ldsoconf\"; fgrep exited with status" \
        "$fgrep_status" ;;
    esac
    set +e
    cmp -s "$ldsoconf.dpkg-tmp" "$ldsoconf"
    cmp_status=$?
    set -e
    case $cmp_status in
      0) rm "$ldsoconf.dpkg-tmp" ;; # files are identical
      1) mv "$ldsoconf.dpkg-tmp" "$ldsoconf" ;; # files differ
      *) die "error comparing \"$ldsoconf.dpkg-tmp\" to \"$ldsoconf\"; cmp" \
        "exited with status $cmp_status" ;;
    esac
  fi
fi

if [ "$1" = "remove" ]; then
  ldconfig
fi

#DEBHELPER#

exit 0