File: acl.sh.template

package info (click to toggle)
acl-installer 6.2.32
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 176 kB
  • ctags: 99
  • sloc: sh: 1,017; lisp: 183; makefile: 117
file content (131 lines) | stat: -rwxr-xr-x 3,687 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
# This is part of the acl-installer program: 
#    http://kevin.rosenberg.net/acl-installer
#
# Copyright (c) 2002-2004 Kevin M. Rosenberg
# Copyright (c) 2000-2002 Peter Van Endye
#
# acl-installer is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 2) as
# published by the Free Software Foundation.
#
# acl-installer 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 a copy of the GNU General Public License on your
# Debian system in the file /usr/share/common-licenses/GPL-2

 
if [ ! -f /usr/share/common-lisp/source/common-lisp-controller/common-lisp-controller.lisp ] ; then
  echo "*** Can't find common-lisp-controller.lisp ***" >&2
  echo "Please report this as a bug" &>2
  exit 1
fi

acl_dir=%dir%
lisp_builder=%builder%
lisp_target=%target%
clc_lib_dir=/var/cache/common-lisp-controller/*/$lisp_target

builder=$acl_dir/$lisp_builder
old_dxl=$acl_dir/$lisp_target.dxl
new_dxl=$acl_dir/${lisp_target}-new.dxl
orig_dxl=$acl_dir/${lisp_target}orig.dxl

if [ -z "$acl_dir" -o -z "$lisp_builder" -o -z "$lisp_target" ]; then
  echo "Error: variables not set correctly in $0" >&2
  exit 1;
fi

lisp_error ()
{
    echo "Error running $builder" >&2
    exit 1
}

dxl_error ()
{
    echo "Error moving new lisp image $new_dxl" >&2
    exit 1
}


case $1 in
    rebuild)
	echo $0 Rebuilding packages...
	shift
	while [ -x $acl_dir/$lisp_builder -a ! -z "$1" ] ; do
	    echo ...rebuilding $1
	    /usr/bin/$lisp_target -q -batch -L $acl_dir/siteinit.cl -e "
(let ((*compile-print* nil)
      (*compile-progress* nil)
      (*compile-verbose*  nil)
      (*require-verbose* nil)
      (*load-verbose* nil))
   (handler-case
      (progn
         (load \"$acl_dir/siteinit.cl\")
         (asdf:operate 'asdf:compile-op (quote $1))
         (excl:exit 0)
       )
    (error (e)
      (ignore-errors (format t \"~&Build error: ~A~%\" e))
      (finish-output)
      (excl:exit 1))))" -kill || lisp_error
	    shift
	done 
	;;
    remove)
	echo $0 Removing packages...
	shift
	while [ ! -z "$1" ] ; do
	    echo ...removing package $1
	    rm -rf "${clc_lib_dir}/$1"
	    shift
	done
	rmdir $clc_lib_dir 2> /dev/null 
	;;
    install-clc)
	echo Installing clc...
	if [ -x $acl_dir/$lisp_builder ]; then
	    $builder -q -batch -I $old_dxl \
		-L $acl_dir/siteinit.cl -e "
(handler-case
  (progn 
    (when (find-package :clc) ; have to remove 
      (delete-package :clc))  ; for acl workaround
    (load \"$acl_dir/siteinit.cl\")
    (load \"$acl_dir/install-clc-${lisp_target}.cl\") 
    (dumplisp :name \"${new_dxl}\")
    (excl:exit 0))
  (error (e)
    (ignore-errors (format t \"~&install-clc error: ~A~%\" e))
    (finish-output)
    (excl:exit 1)))" -kill > /dev/null  || lisp_error
  	    mv $new_dxl $old_dxl || dxl_error
	fi
	;;
    remove-clc)
	if [ -f $orig_dxl ]; then
	    cp $orig_dxl $old_dxl
	    # Skip calling dl-and-install-patches for speed's sake
	    # So, after remove-clc, the original distributed
	    # image will be active without any of the downloaded patches.
	    # It will be up to the user to manual build images with patches
	    # if they want to run without install-clc
	    # ${acl_dir}/dl-and-install-patches.sh remove-clc
	else
	    echo "Warning: Can't find original image file $orig_dxl. Aborting." >& 2
	fi
	;;
    *)
	echo "$0: Unknown command $1" >&2
	echo "Known commands are:" >&2 
	echo "install-clc, remove-clc, rebuild, and remove" >&2
	exit 1
	;;
esac

exit 0