File: preinst

package info (click to toggle)
auctex 9.9j-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,248 kB
  • ctags: 767
  • sloc: lisp: 11,580; makefile: 290; sh: 223
file content (100 lines) | stat: -rw-r--r-- 3,115 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
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
#!/bin/bash -e
#
# preinst configuration file for Debian auctex package.
# $Id: preinst,v 1.21 1998/08/27 16:23:37 salve Exp $
#
# Copyright  Davide G. M. Salvetti <salve@debian.org>, 1997, 1998.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to: The Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# On Debian GNU/Linux System you can find a copy of the GNU General Public
# License in /usr/doc/copyright/GPL.

set -o posix

function remove_handmade_auctex () {
	cat <<-EOF

		There is a locally installed version of AUC TeX in $1 which will conflict
		with this Debian package.

		Shall I:
		    1) rename its tex-site file(s) and go on installing;
		    2) stop installing this package.

	EOF
	unset answer || true
	while [ "$answer" != "1" -a "$answer" != "2" ]; do
	    read -e -p "Please answer (1/2, 1 recommended): " answer
	done
	if [ "$answer" = "2" ] ; then
	    exit 1
	fi
	mv -V t -bf $1/tex-site.el $1/tex-site.el.dpkg-old
	# Move the byte compiled version too if present.
	if [ -e $1/tex-site.elc ]; then
	    mv -V t -bf $1/tex-site.elc $1/tex-site.elc.dpkg-old
	fi
}

function move_old_conffile () {
	# Warn the user.
	cat <<-EOF

		There is a new method to start AUC TeX on a per user or per site basis: you
		should read /usr/doc/auctex/README.Debian.gz to learn about it.

		As a consequence of this new method, the old conffile /etc/elisp/tex-site.el
		is no more needed and will be moved to /etc/tex-site.el.old; you can safely
		remove it unless you made some change you wish to preserve.

	EOF
	mv -V t -bf /etc/elisp/tex-site.el /etc/tex-site.el.old
	# Move the byte compiled version too if present.
	if [ -e /etc/elisp/tex-site.elc ]; then
	    mv -V t -bf /etc/elisp/tex-site.elc /etc/tex-site.elc.old
	fi
	find /etc -name elisp -type d -empty | xargs --no-run-if-empty rmdir
	# This has to be removed.
	rm -f /etc/emacs/site-start.d/50tex-site.el
}

case "$1" in
    install|upgrade)
	# Remove hand-made auctex packages from /usr/local, if existant.
	if [ -f /usr/local/lib/xemacs/site-lisp/tex-site.el ]; then
	    remove_handmade_auctex /usr/local/lib/xemacs/site-lisp/
	fi
	if [ -f /usr/local/share/emacs/site-lisp/tex-site.el ]; then
	    remove_handmade_auctex /usr/local/share/emacs/site-lisp/
	fi
	# tex-site.el is no more a conffile.
	if [ -e /etc/elisp/tex-site.el ]; then
	    move_old_conffile
	fi
    ;;
    abort-upgrade)
	:
    ;;
    *)
	echo "${0##*/}: Called with unknown argument \`$1'." >&2
    ;;
esac

exit 0

### Local Variables:
### mode: shell-script
### End: