Improved script on macosx system
This commit is contained in:
+11
-2
@@ -13,9 +13,18 @@ if [ $# -ne 2 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
SED=sed
|
||||
MASTER=$1
|
||||
DEVICES=$2
|
||||
|
||||
if [[ $OSTYPE == "darwin"* ]]; then
|
||||
if ! command -v gsed > /dev/null 2>&1; then
|
||||
echo "You need gnu-sed on darwin system (available with homebrew)"
|
||||
exit 1
|
||||
fi
|
||||
SED=gsed
|
||||
fi
|
||||
|
||||
if [ ! -e $MASTER ]; then
|
||||
echo "The master file $MASTER doesn't exists"
|
||||
exit 1;
|
||||
@@ -31,8 +40,8 @@ for DEVICE in $(cat $DEVICES); do
|
||||
deviceeui=$(echo $DEVICE | cut -d : -f 2)
|
||||
appeui=$(echo $DEVICE | cut -d : -f 3)
|
||||
appkey=$(echo $DEVICE | cut -d : -f 4)
|
||||
echo $name
|
||||
hexdump -ve '1/1 "%.2X"' $MASTERFILE | sed "s/$DEVICEEUI/$deviceeui/; s/$APPEUI/$appeui/; s/$APPKEY/$appkey/" | xxd -r -p > waveofhoney-${name}.bin
|
||||
echo "Generating device $name ($deviceeui)"
|
||||
hexdump -ve '1/1 "%.2X"' $MASTER | $SED "s/${DEVICEEUI}/${deviceeui}/; s/${APPEUI}/${appeui}/; s/${APPKEY}/${appkey}/" | xxd -r -p - ${deviceeui}.bin
|
||||
done
|
||||
|
||||
exit;
|
||||
Reference in New Issue
Block a user