summaryrefslogtreecommitdiff
path: root/emacsen-common/remove
blob: 8abaf36fc1186972a60e50320cb510219d4b0eee (plain)
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
#!/bin/sh
# /usr/lib/emacsen-common/packages/remove/foo
set -e

PACKAGE=$DPKG_MAINTSCRIPT_PACKAGE
VERSION=$(dpkg-query -Wf '${Version}' $PACKAGE)
UPSTREAM_VERSION=${VERSION%-*}
ELPA_PACKAGE=${PACKAGE#elpa-}-${UPSTREAM_VERSION}

FLAVOR=$1
elc_dir=/usr/share/${FLAVOR}/site-lisp/elpa/${ELPA_PACKAGE}

FLAVOR=$1
case $FLAVOR in
    emacs)
        exit 0
        ;;
    emacs23)
        echo remove/${ELPA_PACKAGE}: Skipping obsolete emacs ${FLAVOUR}
        exit 0
        ;;
    xemacs*)
           echo remove/${ELPA_PACKAGE}: Skipping unsupported emacs ${FLAVOUR}
        ;;
    *)
        echo remove/${ELPA_PACKAGE}: Handling removal of emacsen flavor ${FLAVOR}
esac

echo emacsen-common: purging byte-compiled files for ${FLAVOR}
rm -f ${elc_dir}/*.elc
rm -f ${elc_dir}/*.el
rm -f ${elc_dir}/Install.log*
if test -e "${elc_dir}"
then
  rmdir --ignore-fail-on-non-empty "${elc_dir}"
fi

exit 0;