forked from msproul/AlpacaPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_everything.sh
executable file
·471 lines (404 loc) · 11.1 KB
/
install_everything.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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
#!/bin/bash
###############################################################################
# script to check and install everything for alpaca on linux or raspberry pi
### Nov 16, 2019 <MLS> Started on install script
### Jan 25, 2021 <MLS> Updated ZWO files
### Mar 21, 2022 <MLS> Added !/bin/bash to start of script
### Oct 1, 2022 <MLS> Added libcfitsio-dev in install script
###############################################################################
clear
echo "Getting ready to update (sudo apt-get update)"
echo "Press return to continue, ^C to abort"
read INPUT_VARIABLE
sudo apt-get update
echo "****************************************************************************"
echo "Getting ready to install libusb-1.0-0-dev"
sudo apt-get install libusb-1.0-0-dev
echo "****************************************************************************"
echo "Getting ready to install libudev-dev"
sudo apt-get install libudev-dev
echo "****************************************************************************"
echo "Getting ready to install libopencv-dev"
sudo apt-get install libopencv-dev
echo "****************************************************************************"
echo "Getting ready to install libi2c-dev"
sudo apt-get install libi2c-dev
echo "****************************************************************************"
echo "Getting ready to install libcfitsio-dev"
sudo apt-get install libcfitsio-dev
#ASI_TAR_FILE="ASI_linux_mac_SDK_V1.14.0425.tar.bz2"
#ASI_TAR_FILE="ASI_linux_mac_SDK_V1.14.1108.tar.bz2"
#ASI_TAR_FILE="ASI_linux_mac_SDK_V1.14.1119.tar.bz2"
#ASI_TAR_FILE="ASI_linux_mac_SDK_V1.14.1227.tar.bz2"
ASI_TAR_FILE="ASI_linux_mac_SDK_V1.16.3.tar.bz2"
#EFW_TAR_FILE="EFW_linux_mac_SDK_V0.3.1205.tar"
#EFW_TAR_FILE="EFW_linux_mac_SDK_V0.4.1022.tar.bz2"
#EFW_TAR_FILE="EFW_linux_mac_SDK_V1.5.0615.tar.bz2"
EFW_TAR_FILE="EFW_linux_mac_SDK_V1.5.0615.tar.bz2"
EFW_LIB_DIR="EFW_linux_mac_SDK"
ATIK_RULES_FILE="99-atik.rules"
TOUP_ZIP_FILE="toupcamsdk.zip"
ATIK_ZIP_FILE="AtikCamerasSDK-129.zip"
CFITS_TAR="cfitsio_latest.tar.gz"
COPY="cp -p -v"
DEV_DIR="dev-mark"
##################################################################
checkfiles()
{
echo "*******************************************************"
echo "Checking to make sure all files are present"
if [ -f $ASI_TAR_FILE ]
then
echo "ASI Library file present and accounted for"
else
echo "Can't find $ASI_TAR_FILE"
# exit
fi
if [ -f $EFW_TAR_FILE ]
then
echo "EFW Library file present and accounted for"
else
echo "Can't find $EFW_TAR_FILE"
# exit
fi
if [ -f $CFITSIO_FILE ]
then
echo "cfitios file present and accounted for"
else
echo "Can't find $CFITSIO_FILE"
# exit
fi
if [ -f $ATIK_LIB_FILE ]
then
echo "ATIK file present and accounted for"
else
echo "Can't find $ATIK_LIB_FILE"
# exit
fi
if [ -f $ATIK_RULES_FILE ]
then
echo "ATIK rules file present and accounted for"
else
echo "Can't find $ATIK_RULES_FILE"
# exit
fi
if [ -f $TOUP_ZIP_FILE ]
then
echo "Toupcam file present and accounted for"
else
echo "Can't find $TOUP_ZIP_FILE"
# exit
fi
echo "------------------------------------------------------------------"
}
###############################################################################
setupDirectories()
{
# echo "*******************************************************"
# echo "Setting up directories"
# echo -n "Hit return to continue"
# read WAITINPUT
# cd
# cd
# mkdir -p $DEV_DIR
# mkdir -p $DEV_DIR/alpaca
# mkdir -p $DEV_DIR/alpaca/src
# mkdir -p $DEV_DIR/alpaca/src_discovery
# mkdir -p $DEV_DIR/alpaca/Objectfiles
# mkdir -p $DEV_DIR/cfitsio
# mkdir -p $DEV_DIR/MLS_Library
echo "------------------------------------------------------------------"
}
###############################################################################
setupCfitsio()
{
echo "*******************************************************"
echo "Checking to see if cfitsio is installed"
echo -n "Hit return to continue"
# read WAITINPUT
if [ -d $DEV_DIR/cfitsio/cfitsio-3.47 ]
then
echo "cfitsio already installed"
else
cd
echo "looking for setup/$CFITS_TAR"
if [ -f setup/$CFITS_TAR ]
then
mkdir -p $DEV_DIR/cfitsio/
$COPY setup/$CFITS_TAR $DEV_DIR/cfitsio/
pwd
cd $DEV_DIR/cfitsio/
pwd
if [ -d cfitsio-3.47 ]
then
echo "cfitsio already untared, leaving it alone"
else
# it should be here
if [ -f $CFITS_TAR ]
then
echo "cfitsio tar file found, untaring....."
tar -xvf $CFITS_TAR
else
echo "For some unknown reason, the tar file is missing."
fi
fi
else
echo "did not find $CFITS_TAR"
fi
# if [ -d cfitsio-3.47 ]
# then
# if [ -d $DEV_DIR/cfitsio ]
# then
# echo "$DEV_DIR/cfitsio exists"
# else
# mkdir $DEV_DIR/cfitsio
# fi
# $COPY cfitsio-3.47 $DEV_DIR/cfitsio/
# fi
#
# if [ -d $DEV_DIR/cfitsio ]
# then
# echo "cfitsio appears to be installed"
# else
# echo "Run the separate cfitsio installer"
# fi
fi
echo "------------------------------------------------------------------"
}
###############################################################################
setupOPENCV()
{
echo "*******************************************************"
echo "Checking to see if openCV is installed"
echo -n "Hit return to continue"
# read WAITINPUT
cd
#check to see if opencv is installed
if [ -d /usr/include/opencv ]
then
echo "OpenCV appears to be installed"
else
echo "CANT FIND OpenCV"
echo "Installing opencv"
sudo apt-get -y install libopencv-dev
fi
echo "------------------------------------------------------------------"
}
###############################################################################
setupASI()
{
echo "*******************************************************"
echo "Setting up ASI library"
echo -n "Hit return to continue"
# read WAITINPUT
cd
# install the stuff for alpaca
if [ -d $DEV_DIR/alpaca/ASI_lib/lib ]
then
echo "ASI_lib appears to be installed"
else
echo "Installing ASI library"
echo -n "Hit return to continue"
# read WAITINPUT
if [ -f setup/$ASI_TAR_FILE ]
then
echo "ASI Tar file already downloaded"
else
echo "Downloading ASI_linux_mac_SDK_V1 SDK"
echo -n "Hit return to continue"
read WAITINPUT
# wget https://astronomy-imaging-camera.com/software/$ASI_TAR_FILE
fi
if [ -f setup/$ASI_TAR_FILE ]
then
mkdir -p $DEV_DIR/
mkdir -p $DEV_DIR/alpaca
mkdir -p $DEV_DIR/alpaca/ASI_lib
$COPY setup/$ASI_TAR_FILE $DEV_DIR/alpaca/ASI_lib/
cd
cd $DEV_DIR/alpaca/ASI_lib
tar xvf $ASI_TAR_FILE
else
echo "Download failed"
fi
fi
cd
echo "------------------------------------------------------------------"
}
#############################################################
setupEFW()
{
echo "*******************************************************"
echo "Checking ZWO filter wheel support"
echo -n "Hit return to continue"
read WAITINPUT
cd
if [ -d $DEV_DIR/alpaca/EFW_linux_mac_SDK ]
then
echo "EFW_linux_mac_SDK is installed"
else
if [ -f setup/$EFW_TAR_FILE ]
then
echo "$EFW_TAR_FILE is already downloaded"
else
echo "Downloading EFW_linux_mac_SDK"
# wget https://astronomy-imaging-camera.com/software/$EFW_TAR_FILE
fi
if [ -f setup/$EFW_TAR_FILE ]
then
mkdir -p $DEV_DIR
mkdir -p $DEV_DIR/alpaca
if [ -d $DEV_DIR/alpaca/$EFW_LIB_DIR ]
then
echo "$EFW_LIB_DIR exists"
else
echo "Creating EFW directory"
mkdir -p $DEV_DIR/alpaca/$EFW_LIB_DIR
$COPY setup/$EFW_TAR_FILE $DEV_DIR/alpaca/$EFW_LIB_DIR
cd
cd $DEV_DIR/alpaca/$EFW_LIB_DIR
pwd
echo "untaring EFW_linux_mac_SDK_V0"
tar xvf $EFW_TAR_FILE
# if [ -f EFW_linux_mac_SDK.tar.bz2 ]
# then
# bunzip2 EFW_linux_mac_SDK.tar.bz2
# if [ -f EFW_linux_mac_SDK.tar ]
# then
# mkdir EFW_linux_mac_SDK
# $COPY EFW_linux_mac_SDK.tar EFW_linux_mac_SDK/
# cdsetupASI EFW_linux_mac_SDK
# tar xvf EFW_linux_mac_SDK.tar
# cd ..
# $COPY EFW_linux_mac_SDK alpaca/
# fi
# fi
fi
else
echo "Failed to download EFW_linux_mac_SDK_V0"
fi
fi
echo "------------------------------------------------------------------"
}
###############################################################################
setupATIK()
{
echo "*******************************************************"
echo "Setting up ATIK libraries"
echo -n "Hit return to continue"
read WAITINPUT
cd
if [ -d $DEV_DIR/alpaca/AtikCamerasSDK ]
then
echo "AtikCamerasSDK lib appears to be installed"
else
if [ -f setup/$ATIK_ZIP_FILE ]
then
echo "Copying $ATIK_ZIP_FILE to $DEV_DIR"
$COPY setup/$ATIK_ZIP_FILE $DEV_DIR/alpaca
cd $DEV_DIR/alpaca
if [ -f $ATIK_ZIP_FILE ]
then
echo "Unzip $ATIK_ZIP_FILE"
unzip $ATIK_ZIP_FILE
if [ -d AtikCamerasSDK ]
then
echo "Unzip success"
if [ -d AtikCamerasSDK/AtikCamerasSDK ]
then
cd AtikCamerasSDK/AtikCamerasSDK
mv -v * ../
rm -v .DS_Store
cd ..
rm -v .DS_Store
rmdir -v AtikCamerasSDK
# $COPY AtikCamerasSDK/AtikCamerasSDK alpaca
fi
else
echo "Failed to unzip"
fi
fi
else
echo "$ATIK_ZIP_FILE not found"
fi
fi
echo "------------------------------------------------------------------"
}
#############################################################
setupTOUP()
{
echo "*******************************************************"
echo "Checking Toupcam support"
echo -n "Hit return to continue"
read WAITINPUT
cd
if [ -d $DEV_DIR/toupcamsdk/linux ]
then
echo "toupcamsdk lib appears to be installed"
else
if [ -f setup/$TOUP_ZIP_FILE ]
then
mkdir -p $DEV_DIR/alpaca/toupcamsdk
echo "Copying $TOUP_ZIP_FILE to $DEV_DIR/alpaca/toupcamsdk"
$COPY setup/$TOUP_ZIP_FILE $DEV_DIR/alpaca/toupcamsdk/
cd $DEV_DIR/alpaca/toupcamsdk
if [ -f $TOUP_ZIP_FILE ]
then
echo "Unzip $TOUP_ZIP_FILE"
unzip $TOUP_ZIP_FILE
cd ..
if [ -d toupcamsdk ]
then
echo "Unzip success"
else
echo "Failed to unzip"
fi
else
echo "For some unknown reason, $TOUP_ZIP_FILE is missing."
fi
else
echo "$TOUP_ZIP_FILE not found"
fi
fi
echo "------------------------------------------------------------------"
}
##################################################################
setupJPEGlib()
{
echo "*******************************************************"
echo "Getting ready to install libjpeg-dev"
sudo apt-get install libjpeg-dev
}
###############################################################################
setupLibUSB()
{
echo "*******************************************************"
echo "checking libusb "
echo -n "Hit return to continue"
read WAITINPUT
if [ -f /usr/include/libusb-1.0/libusb.h ]
then
echo "libusb appears to be installed"
else
echo "installing libusb "
sudo apt-get -y install libusb-1.0-0-dev
fi
echo "------------------------------------------------------------------"
}
###############################################################################
./install_rules.sh
checkfiles
setupDirectories
setupOPENCV
setupCfitsio
setupASI
setupEFW
setupATIK
setupLibUSB
setupTOUP
checkfiles
sudo apt-get -y install libudev-dev
# sudo apt-get -y install libi2c-dev
#
# example: gpio readall
# sudo apt-get install wiringpi