forked from msproul/AlpacaPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_libraries.sh
executable file
·351 lines (312 loc) · 8.35 KB
/
install_libraries.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
###############################################################################
# Driver library installation for AlpacaPi
###############################################################################
### Mar 18, 2021 <MLS> Adding full support for QHY installation
###############################################################################
function CheckFile
{
MYPATH=$1
FILENAME=$2
ERRSTRING=$3
#echo $1
#echo $2
#echo $3
FULLPATH="$MYPATH/$FILENAME"
#echo $FULLPATH
if [ -d $FULLPATH ]
then
STATUS="Present"
ERRSTRING=""
else
if [ -f $FULLPATH ]
then
STATUS="Present"
ERRSTRING=""
else
STATUS="Missing"
let MISSING_COUNT=$MISSING_COUNT+1
fi
fi
# echo -e "\t$FILENAME\t\t$STATUS"
printf "\t%-24s\t%s\t%s\r\n" $FILENAME $STATUS "$ERRSTRING"
}
###########################################################
function Checksystem
{
MISSING_COUNT=0
clear
echo "**********************************************"
echo "* AlpacaPi library installation *"
echo "* *"
echo "* It is OK to run this script multiple times *"
echo "* *"
echo "* Not all of these libraries are required *"
echo "* For example, if you don't use QHY cameras *"
echo "* then the QHY library is not needed *"
echo "**********************************************"
echo
CheckFile "./" "ASI_lib"
CheckFile "./" "AtikCamerasSDK" "Not required"
CheckFile "./" "EFW_linux_mac_SDK" "Not required"
CheckFile "./" "FLIR-SDK" "Not required"
CheckFile "./" "QHY" "Not required"
CheckFile "./" "toupcamsdk" "Not required"
echo "*********************************************"
}
###########################################################
#Determine platform
ISX64=true
ISARM32=false
ISARM64=false
###########################################################
function DeterminePlatform()
{
uname -a | grep aarch64
ARMCNT=`uname -a | grep aarch64 | wc -l`
echo $ARMCNT
if [ $ARMCNT -ge 1 ]
then
echo "Running on aarch64"
ISARM64=true
ISX64=false
else
ISARM64=false
fi
uname -a | grep armv7l
ARMCNT=`uname -a | grep armv7l | wc -l`
echo $ARMCNT
if [ $ARMCNT -ge 1 ]
then
echo "Running on armv7l"
ISARM32=true
ISX64=false
else
ISARM32=false
fi
echo "Running on intel x64 : $ISX64"
echo "Running on Arm 32 bit: $ISARM32"
echo "Running on Arm 64 bit: $ISARM64"
}
###########################################################
function InstallFlir()
{
echo "***************************************************************"
FLIR_SDK_DIR="FLIR-SDK"
if [ -d $FLIR_SDK_DIR ]
then
echo "FLIR SDK present, checking for installation"
if [ -f "$FLIR_SDK_DIR/install_spinnaker_mls.sh" ]
then
echo -n "Would you like to install FLIR support [y/n]?"
read YESNO
if [ $YESNO == "y" ]
then
cd $FLIR_SDK_DIR
echo "Running FLIR install script"
./install_spinnaker_mls.sh
cd ..
fi
else
echo "FLIR install script not found"
fi
fi
}
###########################################################
function InstallToupTec()
{
echo "***************************************************************"
if [ -d "toupcamsdk" ]
then
echo "Touptech SDK library found"
echo -n "Would you like to install ToupTec support [y/n]?"
read YESNO
if [ $YESNO == "y" ]
then
# this is for Raspberry Pi
sudo cp -v toupcamsdk/linux/armhf/libtoupcam.so $LIB_DIR/
fi
else
echo "Cant find touptech SDK"
fi
}
###############################################################################
function InstallATIK()
{
echo "***************************************************************"
ATIK_SDK_DIR="AtikCamerasSDK"
if [ -d $ATIK_SDK_DIR ]
then
echo "AtikCamerasSDK SDK folder found"
echo -n "Would you like to install AtikCamerasSDK support [y/n]?"
read YESNO
if [ $YESNO == "y" ]
then
if $ISX64
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_DIR/lib/linux
elif $ISARM64
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_DIR/lib/ARM
elif $ISARM32
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_DIR/lib/ARM
else
echo "Platform unkonwn"
exit
fi
echo "Platform is '$ATIK_SDK_LIB_DIR'"
if $ISX64
then
echo "Running on X64 platform"
if [ -d $ATIK_SDK_LIB_DIR/x64 ]
then
echo "Using lib/x64"
ATIK_SDK_LIB_DIR=$ATIK_SDK_LIB_DIR/x64
elif [ -d $ATIK_SDK_LIB_DIR/64 ]
then
echo "Using lib/64"
ATIK_SDK_LIB_DIR=$ATIK_SDK_LIB_DIR/64
fi
elif $ISARM64
then
echo "Running on ARM64 platform"
if [ -d $ATIK_SDK_LIB_DIR/64 ]
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_LIB_DIR/64
elif [ -d $ATIK_SDK_LIB_DIR/x64 ]
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_LIB_DIR/x64
fi
elif $ISARM32
then
echo "Running on ARM32 platform"
echo $ATIK_SDK_LIB_DIR
if [ -d $ATIK_SDK_LIB_DIR/32 ]
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_LIB_DIR/32
elif [ -d $ATIK_SDK_LIB_DIR/x86 ]
then
ATIK_SDK_LIB_DIR=$ATIK_SDK_LIB_DIR/x86
fi
else
exit
fi
echo "Platform is '$ATIK_SDK_LIB_DIR'"
# this is for Raspberry Pi
# sudo cp -v ~/dev-mark/alpaca/AtikCamerasSDK/lib/ARM/pi/pi3/x86/NoFlyCapture/libatikcameras.so $LIB_DIR/
sudo cp -v $ATIK_SDK_LIB_DIR/NoFlyCapture/libatikcameras.so $LIB_DIR/
else
echo "Cant find AtikCamerasSDK SDK: $ATIK_SDK_DIR"
fi
fi
}
###############################################################################
# Latest versions as of Mar 18, 2021
# https://www.qhyccd.com/file/repository/publish/SDK/210201/sdk_linux64_21.02.01.tgz
# https://www.qhyccd.com/file/repository/publish/SDK/210201/sdk_Arm64_21.02.01.tgz
# https://www.qhyccd.com/file/repository/publish/SDK/210201/sdk_arm32_21.02.01.tgz
###############################################################################
function GetQHY()
{
echo "***************************************************************"
if [ -d $QHY_SDK_DIR ]
then
echo "QHY directory already exists: $QHY_SDK_DIR"
else
echo -n "Would you like to download QHY support [y/n]?"
read YESNO
if [ $YESNO == "y" ]
then
echo "Downloading QHY libraries"
mkdir -p $QHY_SDK_DIR
if [ -d $QHY_SDK_DIR ]
then
if $ISX64
then
echo "Running on X64 platform"
# QHY_TAR_FILE="sdk_linux64_21.02.01.tgz"
QHY_SUBDIR="200626"
QHY_TAR_FILE="sdk_linux64_20.06.26.tgz"
# https://www.qhyccd.com/file/repository/publish/SDK/200626/sdk_linux64_20.06.26.tgz
elif $ISARM64
then
echo "Running on ARM64 platform"
# QHY_TAR_FILE="sdk_Arm64_21.02.01.tgz"
QHY_SUBDIR="200626"
QHY_TAR_FILE="sdk_Arm64_20.06.26.tgz"
# https://www.qhyccd.com/file/repository/publish/SDK/200626/sdk_Arm64_20.06.26.tgz
elif $ISARM32
then
echo "Running on ARM32 platform"
# QHY_TAR_FILE="sdk_arm32_21.02.01.tgz"
QHY_SUBDIR="200626"
QHY_TAR_FILE="sdk_arm32_20.06.26.tgz"
# https://www.qhyccd.com/file/repository/publish/SDK/200626/sdk_arm32_20.06.26.tgz
else
exit
fi
cd $QHY_SDK_DIR
pwd
# wget "https://www.qhyccd.com/file/repository/publish/SDK/210201/$QHY_TAR_FILE"
wget "https://www.qhyccd.com/file/repository/publish/SDK/$QHY_SUBDIR/$QHY_TAR_FILE"
ls -l
if [ -f $QHY_TAR_FILE ]
then
tar -xvf $QHY_TAR_FILE
mv -v sdk*/* .
else
echo "QHY Tar file $QHY_TAR_FILE, not found"
fi
cd ..
pwd
else
echo "Failed to create QHY directory"
fi
fi
fi
}
###############################################################################
function InstallQHY()
{
QHY_TAR_FILE="RPI34_qhyccd_V20200219_0.tgz"
echo "***************************************************************"
echo "$QHY_TAR_FILE"
if [ -d $QHY_SDK_DIR ]
then
echo "QHY SDK folder found: $QHY_SDK_DIR"
echo -n "Would you like to install QHY support [y/n]?"
read YESNO
if [ $YESNO == "y" ]
then
if [ -d $QHY_SDK_DIR/include ]
then
echo "It looks like the library is already installed"
else
echo "Installing QHY libraries"
cd $QHY_SDK_DIR
chmod 755 install.sh
chmod 755 uninstall.sh
sudo ./install.sh
# sudo cp -a -v lib/udev/rules.d/* /lib/udev/rules.d
# sudo cp -a -v etc/udev/rules.d/* /etc/udev/rules.d
# sudo cp -a -v usr/local/lib/* /usr/local/lib
mkdir -p include
cp -a -v usr/local/include/* include/
sudo ldconfig
cd ..
fi
fi
fi
}
clear
echo "***************************************************************"
LIB_DIR="/usr/lib"
Checksystem
DeterminePlatform
echo "Installing libraries into $LIB_DIR"
InstallATIK
InstallToupTec
InstallFlir
QHY_SDK_DIR="QHY"
GetQHY
InstallQHY