-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·223 lines (184 loc) · 5.31 KB
/
install.sh
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
# __author__ = "Kurt Pagani <[email protected]>"
# __svn_id__ = "$Id: setup 2 2015-10-20 02:42:11Z pagani $"
#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#
# iSPAD Installation
# ==================
# 1. Check FriCAS installation
# 2. Find AxiomSYS
# 3. Check SBCL installation
# 3.1 SBCL_HOME
# 3.2 SBCL Executable
# 3.3 SBCL/QuickLisp dependencies
# 4. Checking Jupyter installation
# 5. Creating iSPAD core from AxiomSYS
# 6. Generate and install kernel spec
# 7. Install iSPAD binary
#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
# Install iSPAD to ...
# Thanks to Ralf Hemmecke ... usage: install.sh --prefix
prefix=$HOME/.local
while [ "$*" != "" ] ; do
case $1 in
--prefix)
if [ "$2" = "" ] ; then
echo "--prefix has no directory value." ; fi
shift
prefix="$1"
;;
esac
shift
done
install_dir="$prefix/bin"
# Messages
fricas_in_path="FriCAS in path ... ok."
fricas_not_in_path="[1] FriCAS not found ... exit."
axiomsys_found="AxiomSYS found ... ok."
axiomsys_not_found="[2] AxiomSYS not found ... exit."
sbcl_home_defined="SBCL_HOME set ... ok."
sbcl_home_not_def="[3] SBCL_HOME not set. exit."
sbcl_exe_found="SBCL executable ... ok."
sbcl_exe_not_found="[4] SBCL executable not found ... exit."
ql_dep_ok="SBCL/QuickLisp ......... ok."
ql_dep_failed="[5] SBCL/QuickLisp failed ... exit."
ispad_core_ok="iSPAD core built ... ok."
ispad_core_failed="[6] Building iSPAD core failed ... exit."
jupyter_ok="Jupyter command ... ok."
jupyter_not_found="[7] Jupyter command not found ... exit."
kernel_spec_ok="Kernel spec installed ... ok."
kernel_spec_failed="[8] Installation of kernel spec failed ... exit."
install_ispad_ok="Executable iSPAD installed ... ok."
install_ispad_failed="[9] Installation of iSPAD failed ... exit."
id_created="Installation directory created ... ok."
# Banner
echo =================================================
echo Installation of iSPAD - Jupyter kernel for FriCAS
echo =================================================
# Check if FriCAS in path
echo ------------------
echo FriCAS installed ?
echo ------------------
if fricas -nogo; then
echo $fricas_in_path ;
else
echo $fricas_not_in_path ;
exit 1 ;
fi
# Find AxiomSYS
echo ---------------
echo AxiomSYS path ?
echo ---------------
export AXSYS="?"
if fricas -nogo > axsys ; then
export AXSYS=$(awk '/-ws/ {print $(NF)}' axsys);
rm axsys ;
fi
if [ ! -f "$AXSYS" ] ; then
echo $axiomsys_not_found ;
exit 1 ;
else
echo $axiomsys_found ;
echo $AXSYS ;
export AXIOM=$(dirname $(dirname $AXSYS)) ;
fi
# Check SBCL installation
echo ----------------
echo SBCL installed ?
echo ----------------
if [ -d "$SBCL_HOME" ] ; then
echo $sbcl_home_defined ;
echo $SBCL_HOME ;
else
echo $sbcl_home_not_def ;
exit 1 ;
fi
echo -----------------
echo SBCL executable ?
echo -----------------
if !(sbcl --version) ; then
echo $sbcl_exe_not_found ;
exit 1 ;
else
echo $sbcl_exe_found ;
fi
# QuickLisp
echo -------------------------------------------
echo SBCL/QuickLisp dependencies ... pre-loading
echo -------------------------------------------
if sbcl --non-interactive --load "lisp/quick.lisp" ; then
echo $ql_dep_ok ;
else
echo $ql_dep_failed ;
exit 1 ;
fi
# Checking Jupyter
echo ---------------------------------
echo Checking Jupyter installation ...
echo ---------------------------------
if !(jupyter --version) ; then
echo $jupyter_not_found ;
exit 1
else
jupyter --paths ;
echo $jupyter_ok ;
fi
# Creating the iSPAD image
echo -------------------------------------
echo Creating iSPAD core from AxiomSYS ...
echo -------------------------------------
if [ -f $AXSYS ] ; then
echo ")lisp (load \"lisp/sbcl.lisp\")" > acmd
sbcl --core $AXSYS < acmd;
rm acmd;
fi
if [ -x "iSPAD" ] ; then
echo $ispad_core_ok ;
else
echo $ispad_core_failed ;
exit 1 ;
fi
# Install kernel spec
echo ----------------------------------------
echo Install Jupyer Kernel Spec : kernel.json
echo ----------------------------------------
if [ ! -d "./ifricas" ]; then
mkdir ./ifricas ;
fi
kspec=./ifricas/kernel.json
echo '{"argv": ['"\"$install_dir/iSPAD\""',"{connection_file}"],' > $kspec
echo '"codemirror_mode": "shell",' >> $kspec
echo '"display_name": "FriCAS",' >> $kspec
echo '"language": "spad"}' >> $kspec
echo kernel.json written to $kspec
if jupyter kernelspec install --user ./ifricas ; then
jupyter kernelspec list ;
echo $kernel_spec_ok ;
else
echo $kernel_spec_failed ;
exit 1 ;
fi
# Install iSPAD binary
echo -----------------------
echo Installing iSPAD binary
echo -----------------------
if [ ! -d "$install_dir" ]; then
mkdir $install_dir ;
echo $id_created ;
fi
if cp -v ./iSPAD $install_dir ; then
echo $install_ispad_ok ;
else
echo $install_ispad_failed ;
exit 1
fi
# Congratulations
echo ------------------------------------
echo "*** iSPAD successfully installed ***"
echo ------------------------------------
echo To use the kernel do as follows:
echo " $ jupyter notebook"
echo " goto: http://localhost:8888"
echo " choose: New -> FriCAS"
echo ====================================