-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreset.sh
executable file
·27 lines (25 loc) · 1.05 KB
/
reset.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
#!/bin/bash
CURPWD=`pwd`
PROJNAME=${PWD##*/}
OCFBASEPATH=`jq --raw-output '.ocf_base_path' ${CURPWD}/${PROJNAME}-config.json`
# TODO Go through DeviceBuilder for each of the implementations and platforms (just doing the first array element for this example)
OCFSUBPATH=`jq --raw-output '.implementation_paths[0]' ${CURPWD}/${PROJNAME}-config.json`
OCFPATH="${OCFBASEPATH}${OCFSUBPATH}"
PLATFORM=`jq --raw-output '.platforms[0]' ${CURPWD}/${PROJNAME}-config.json`
if [ "$PLATFORM" == "esp32" ]; then
MY_COMMAND="cd ${OCFPATH}/iotivity-lite/port/${PLATFORM}/"
eval ${MY_COMMAND}
MY_COMMAND="idf.py erase_flash"
eval ${MY_COMMAND}
cd $CURPWD
elif [ "$PLATFORM" == "arduino" ]; then
echo "Arduino reset"
elif [ "$OCFSUBPATH" == "/iot" ]; then
rm -f ./bin/server_security.dat
MY_COMMAND="cp ${OCFPATH}/iotivity/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat ./bin/server_security.dat"
eval ${MY_COMMAND}
elif [ "$OCFSUBPATH" == "/iot-lite" ]; then
rm -rf ./bin/device_builder_server_creds
else
echo "No OCFSUBPATH: $OCFSUBPATH"
fi