forked from Ideetron/Larank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·50 lines (41 loc) · 1.36 KB
/
install
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
#!/bin/bash
# start me like: install lorank8v1 1.0.1
# from the directory you cloned the repro Lorank in.
# Control of urs leds
function led_on { pushd /sys/class/leds/beaglebone\:green\:usr$1; echo none > trigger; echo 1 > brightness; popd; }
function led_off { pushd /sys/class/leds/beaglebone\:green\:usr$1; echo none > trigger; echo 0 > brightness; popd; }
function led_flash { pushd /sys/class/leds/beaglebone\:green\:usr$1; echo timer > trigger; echo 50 > delay_on; echo 100 > delay_off; popd; }
function led_blank { led_off 0; led_off 1; led_off 2; led_off 3; }
function led_error { led_flash 0; led_flash 1; led_flash 2; led_flash 3; }
HWTARGET=$1
SWVERSION=$2
# report progress
led_blank
led_flash 0
sleep 1
# Check if we start at the correct location
if [ -d Larank ]
then
mv Larank Lorank
fi
mkdir -p $HWTARGET
# Set the Lorank installation software to the correct release.
pushd Lorank
if [[ $SWVERSION != "" ]]; then git checkout -q Lorank_v$SWVERSION; fi
popd
# Start the platform dependent installation for this release.
if [[ $HWTARGET != "" ]] && [ -e ./Lorank/$HWTARGET/install ]
then
./Lorank/$HWTARGET/install $SWVERSION
else
echo "Target does not exist, nothing to install."
led_error
exit 1
fi
# We are done, check if we must report an error, if not terminate.
if [ $? -ne 0 ];
then
led_error
else
systemctl --no-block poweroff
fi