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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
#! /bin/sh
# preinst script for #PACKAGE#
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
#
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
createOriginalFile() {
cat > $1 << "EOF"
;; -*-emacs-lisp-*-
;;
;; Emacs startup file for the Debian GNU/Linux riece package
;;
;; Originally contributed by Nils Naumann <naumann@unileoben.ac.at>
;; Modified by Dirk Eddelbuettel <edd@debian.org>
;; Adapted for dh-make by Jim Van Zandt <jrv@vanzandt.mv.com>
;; The riece package follows the Debian/GNU Linux 'emacsen' policy and
;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
;; xemacs19, emacs20, xemacs20...). The compiled code is then
;; installed in a subdirectory of the respective site-lisp directory.
;; We have to add this to the load-path:
(if (not (file-exists-p "/usr/share/emacs/site-lisp/riece"))
(message "Package riece removed but not purged. Skipping setup.")
(debian-pkg-add-load-path-item
(concat "/usr/share/" (symbol-name flavor) "/site-lisp/riece"))
(autoload 'riece "riece" nil t)
;; Don't touch manually the following line which is modified by debconf.
;; If you want to customize add-ons, use `dpkg-reconfigure'.
(setq riece-addons '())
(when (and (memq 'riece-history riece-addons)
(memq 'riece-guess riece-addons))
(setq riece-guess-channel-try-functions
'(riece-guess-channel-from-history)))
)
EOF
}
createStartupFile() {
cat > $1 << "EOF"
;; -*-emacs-lisp-*-
;;
;; Emacs startup file for the Debian riece package
;;
;; Originally contributed by Nils Naumann <naumann@unileoben.ac.at>
;; Modified by Dirk Eddelbuettel <edd@debian.org>
;; Adapted for dh-make by Jim Van Zandt <jrv@vanzandt.mv.com>
;; The riece package follows the Debian/GNU Linux 'emacsen' policy and
;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
;; xemacs19, emacs20, xemacs20...). The compiled code is then
;; installed in a subdirectory of the respective site-lisp directory.
;; We have to add this to the load-path:
(if (not (file-exists-p "/usr/share/emacs/site-lisp/riece"))
(message "Package riece removed but not purged. Skipping setup.")
(debian-pkg-add-load-path-item
(concat "/usr/share/" (symbol-name debian-emacs-flavor)
"/site-lisp/riece"))
(autoload 'riece "riece" nil t)
(setq riece-data-directory "/usr/share/emacs/site-lisp/riece"))
EOF
}
case "$1" in
install|upgrade)
if [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
# Remove garbage.
rm -rf /var/cache/riece
rm -rf /usr/share/emacs-snapshot/site-lisp/riece-ndcc
# for useless dpkg conffiles
STARTUPFILE=/etc/emacs/site-start.d/50riece.el
ORIGINALFILE=/tmp/emacsen-startup.1.0.8-2
if [ -f "$STARTUPFILE" ]; then
if grep "Don't touch manually" "$STARTUPFILE" > /dev/null 2>&1; then
createOriginalFile "$ORIGINALFILE"
sed "s/(setq riece-addons '(.*))/(setq riece-addons '())/" \
"$STARTUPFILE" > "$STARTUPFILE".tmp
if diff -q "$STARTUPFILE".tmp "$ORIGINALFILE" > /dev/null 2>&1; then
# installed file and original are identical
rm "$STARTUPFILE"
createStartupFile "$STARTUPFILE"
fi
rm -f "$STARTUPFILE".tmp
rm -f "$ORIGINALFILE"
fi
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|