File: remove.in

package info (click to toggle)
mailcrypt 3.5.8-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 928 kB
  • ctags: 422
  • sloc: lisp: 4,439; python: 437; makefile: 208; sh: 170
file content (68 lines) | stat: -rw-r--r-- 2,009 bytes parent folder | download
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
#include "variables"
#!/bin/bash -e
#
# elisp remove file for Debian <:=$PACKAGE:> package.
# $Id: remove.in,v 1.9 2002/09/01 15:08:41 salve Exp $
#
<:=@COPYRIGHT:>//

set -o posix; shopt -s nullglob

FLAVOR=$1

### 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 and 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 or system.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

case "$FLAVOR" in
    (emacs)
	:
    ;;
    (emacs20|emacs21|mule2)
	echo -n "remove/<:=$PACKAGE:>: Removing for $FLAVOR... "
	rm -f <:=if($_=$lisp)=~s|emacs|\$FLAVOR|:>/{*.elc,<:=$ELCLOG:>.gz}
	test -d <:=if($_=$lisp)=~s|emacs|\$FLAVOR|:> && \
	    rmdir --ignore-fail-on-non-empty \
	    <:=if($_=$lisp)=~s|emacs|\$FLAVOR|:>
	echo "done."
    ;;
    (*)
	echo "remove/<:=$PACKAGE:>: Ignoring emacsen flavor $FLAVOR."
    ;;
esac

exit 0
<:
# local Variables:
# mode: shell-script
# end:
:>//