1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include "variables"
#! /bin/bash -e
#
# <% elisp %> Emacs remove script for <:=${PACKAGE}:>
#
<:=@COPYRIGHT:>//
set -o posix; shopt -s nullglob
### Historic cleanup code
<:
# Version 3.5.4-5, 3.5.5-1, 3.5.5-2, 3.5.5-3, 3.5.5-4, and 3.5.5-5 of
# mailcrypt had a typo bug and failed to remove $ELCLOG.gz.
# The affected time window is from 1999-10-12 to 1999-12-12, when the
# emacs19 Debian version was 19.34-21 while the emacs20 ones were
# 20.3-11--20.4-3.
# However, other emacsen may have been used as well, so our strategy is
# to remove $ELCLOG.gz and its parents, if empty, from every no more
# installed emacsen directory.
# Of course package, files, and directories names are hardcoded here, as
# this is code that deals with old cruft, and should not change in the
# future with "variables".
:>//
clean_old_cruft () {
rm -f /usr/share/emacs/${1}/site-lisp/mailcrypt/CompilationLog.gz
test -d /usr/share/emacs/${1}/site-lisp/mailcrypt/ \
&& rmdir --ignore-fail-on-non-empty --parents \
/usr/share/emacs/${1}/site-lisp/mailcrypt/
}
<:
# Note that /usr/share/emacs/site-lisp/mailcrypt is _not_ enclosed in
# the following pattern, neither it should be. Also note that the
# nullglob shell option should be enabled!
:>//
for i in /usr/share/emacs/*/site-lisp/mailcrypt/; do
i=${i#/usr/share/emacs/}
i=${i%/site-lisp/mailcrypt/}
test -e /usr/bin/emacs-${i} || clean_old_cruft ${i}
done
FLAVOR=${1}
undo_install () {
echo >&2 -n "remove/<:=${PACKAGE}:>: Removing for ${FLAVOR}... "
rm -f <:=if($_="${sstartd}/${EPRIORITY}${PACKAGE}.el")
=~s|emacs|\${FLAVOR}|:>
rm -f <:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:>/<:=${ELCLOG}:>{,.gz}
rm -f <:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:>/*.elc
test -d <:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:> && \
rmdir --ignore-fail-on-non-empty \
<:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:>
echo >&2 "done."
return 0
}
case "${FLAVOR}" in
emacs) :;;
emacs2[123]|emacs-snapshot) undo_install;;
*) echo >&2 "remove/<:=${PACKAGE}:>:" \
"Ignoring emacsen flavor: \"${FLAVOR}\"."
esac
exit 0
<:
# arch-tag: 02840558-59db-42e5-bc45-fe3cce8d379e
#
# local variables:
# mode: shell-script
# coding: utf-8
# ispell-local-dictionary: "american"
# ispell-check-comments: exclusive
# end:
#
# LocalWords: mailcrypt ELCLOG gz emacs emacsen nullglob
:>//
|