-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
66 lines (47 loc) · 1.49 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
#!/bin/bash
# Install script for prussd daemon service
# To be run on the BeagleBone, from the cloned PRUSS-Bindings
# git repository
DIR=$(cd `dirname $BASH_SOURCE[0]` && pwd -P)
pru_examples() {
#paths needed to compile PRU firmware examples
if [ ! -d /usr/share/ti/cgt-pru/bin ] ;
then
ln -s /usr/bin/ /usr/share/ti/cgt-pru/bin
fi
export PRU_CGT=/usr/share/ti/cgt-pru
#run compilation scripts
bash "${DIR}/examples/run.sh" blinky
bash "${DIR}/examples/run.sh" rpmsg_echo
bash "${DIR}/examples/run.sh" pru_pin_state_reader
bash "${DIR}/examples/run.sh" pru1_to_pru0_to_arm
bash "${DIR}/examples/run.sh" multi_threaded
}
systemd_service() {
#copy the systemd unit configuration file
cp -v "${DIR}/prussd/prussd.service" "/lib/systemd/system/prussd.service"
#copy the config file
cp -v "${DIR}/prussd/prussd.conf" "/etc/default/prussd.conf"
#edit the unit file to replace DIR by the actual path
sed -i -e "s:DIR:${DIR}:" "/lib/systemd/system/prussd.service"
#edit the config file to include paths to firmware_examples
sed -i -e "s:DIR:${DIR}:" "/etc/default/prussd.conf"
#mark the daemon script as executable
chmod a+x "${DIR}/prussd/prussd.py"
#enable the service
systemctl enable prussd.service
#reload the systemctl daemons
systemctl daemon-reload
#start the prussd daemon
systemctl start prussd.service
}
if [ $# -eq 0 ]; then
pru_examples
systemd_service
fi
if [ "$1" == "--examples" ] ; then
pru_examples
fi
if [ "$1" == "--service" ] ; then
systemd_service
fi