-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_hw
More file actions
executable file
·49 lines (43 loc) · 987 Bytes
/
update_hw
File metadata and controls
executable file
·49 lines (43 loc) · 987 Bytes
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
#!/bin/bash
# update the DART design in the board
# usage: update_hw <user> <ip> <path>
usage(){
echo "usage #1: run \`update_hw <user> <ip> <path>\`"
echo "usage #2: set the environment variables FRED_USER, FRED_IP, FRED_PATH. Then run \`update_hw\`"
exit 1
}
if [[ -z "${FRED_USER}" ]]; then
SCP_USERNAME=$1
else
SCP_USERNAME="${FRED_USER}"
fi
if [[ -z "${FRED_IP}" ]]; then
SCP_IP=$2
else
SCP_IP="${FRED_IP}"
fi
if [[ -z "${FRED_PATH}" ]]; then
SCP_PATH=$3
else
SCP_PATH="${FRED_PATH}"
fi
scp ${SCP_USERNAME}\@${SCP_IP}:${SCP_PATH}/fred.tar.gz /tmp
RESULT=$?
if [ $RESULT -gt 0 ]; then
echo "ERROR running scp"
usage
fi
# if this no errors during the download, then clean up the dir and extract the design
mkdir -p /opt/fredsys/
cd /opt/fredsys/
rm -rf /opt/fredsys/*
mv /tmp/fred.tar.gz .
tar xzf fred.tar.gz .
RESULT=$?
if [ $RESULT -gt 0 ]; then
echo "ERROR running tar"
usage
fi
echo "DART hw design was updated in /opt/fredsys/!"
cd -
exit 0