File: common-lisp-controller.postinst

package info (click to toggle)
common-lisp-controller 7.10
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 320 kB
  • sloc: sh: 332; lisp: 191; makefile: 43
file content (107 lines) | stat: -rw-r--r-- 3,453 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
# postinst script for common-lisp-controller
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.


. /usr/share/debconf/confmodule 

case "$1" in
    configure)
	db_get common-lisp-controller/long-site-name
	long=$(printf "%s" "$RET" | sed -e 's/[\"]/\\&/g')
	db_get common-lisp-controller/short-site-name
	short=$(printf "%s" "$RET" | sed -e 's/[\"]/\\&/g')
	umask 0022
	cat > /var/lib/common-lisp-controller/lisp-config.lisp <<EOF
(in-package :common-lisp-user)
;;; Please don't change this file. Automaticly generated by common-lisp-controller package.
;;; Run dpkg-reconfigure common-lisp-controller as root to change the settings

#+(or cmu scl)
(setf system:*short-site-name* "${short}" 
      system:*long-site-name* "${long}")
#+sbcl
(setf sb-sys:*short-site-name* "${short}" 
      sb-sys:*long-site-name* "${long}")
EOF
        # in any case we rebuild with defsystem loaded...
	for compiler in /usr/lib/common-lisp/bin/*.sh ; do
	    if [ -f "$compiler" -a -r "$compiler" ] ; then
		i=${compiler##*/}
		i=${i%.sh}
		if [ -x "$compiler" ] ; then
		    echo Reinstalling for $i
		    echo Recompiling Common Lisp Controller for $i
		    bash "$compiler" install-clc || true
		    echo
		    echo Done rebuilding
		fi 
	    fi
	done 

#  From Aaron M. Ucko:
	cronjob=/etc/cron.daily/common-lisp-controller
	if test -f $cronjob \
	   &&  dpkg --compare-versions "$2" lt 4.3; then
	    case `md5sum $cronjob | awk '{print $1}'` in
	        719552df1d7fc0b895288f21e89ca1c4|\
		acc0a4ae42a332a14cd40354fa2f46b2|\
		36ebc5c2aec0c78e286895521336fec1|\
		073df8f27df19c7b66252048c8c329d7|\
		fdb29432288c44d315b51ff750e747a7|\
	        c44b060d069846025ca171f0f6c59d24)
	            echo "Cleaning obsolete cron job $cronjob"
	            echo "(apparently not modified)."
	            rm -f $cronjob
	            ;;
	        *)
	            echo "Obsolete cron job $cronjob appears to have been modified;"
	            echo "it is your responsibility to remove it yourself unless you"
	            echo "still need it for some reason."
	            ;;
	    esac
	fi

	# just check if the user already exists:
	getent passwd cl-builder > /dev/null || \
	    adduser --system --home /usr/share/common-lisp/ --shell /bin/false --no-create-home \
                --disabled-password --disabled-login --group cl-builder
	;;
    
    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0