From f37b03503507f3b0c57247c61d2c4c803be09c66 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 2 Sep 2019 12:06:46 -0300 Subject: initial attempt at moving maint scripts into helper package This commit is a bit bug, but at least it is atomic. --- helper/remove | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 helper/remove (limited to 'helper/remove') diff --git a/helper/remove b/helper/remove new file mode 100644 index 0000000..9a980e9 --- /dev/null +++ b/helper/remove @@ -0,0 +1,47 @@ +#!/bin/sh +#!/bin/sh +# invoke as /usr/lib/dh-elpa/helper/remove flavor elpa_package elpa_version + +set -e + +# safe values for important variables + +unset HOME +PATH=/usr/sbin:/usr/bin:/sbin:/bin + +# grab parameters + +FLAVOR=$1 +ELPA_PACKAGE=$2 +ELPA_VERSION=$3 + +ELPA_DIR=${ELPA_PACKAGE}-${ELPA_VERSION} + +elpa_root="/usr/share/${FLAVOR}/site-lisp/elpa" +elc_dir="${elpa_root}/${ELPA_DIR}" + +FLAVOR=$1 +case $FLAVOR in + emacs2[01234]*) + echo remove/${ELPA_DIR}: Skipping obsolete emacs ${FLAVOR} + exit 0 + ;; + xemacs*) + echo remove/${ELPA_DIR}: Skipping unsupported emacs ${FLAVOR} + exit 0 + ;; + *) + echo remove/${ELPA_DIR}: Handling removal of emacsen flavor ${FLAVOR} +esac + +echo dh-elpa: purging flavor specific files for ${FLAVOR} +rm -f ${elc_dir}/*.elc +[ -d ${elc_dir} ] && find ${elc_dir} -type l -delete +rm -f ${elc_dir}/Install.log* +if test -e "${elc_dir}" +then + rmdir --ignore-fail-on-non-empty "${elc_dir}" + rmdir --ignore-fail-on-non-empty "${elpa_root}" +fi + +exit 0; -- cgit v1.2.3