#!/bin/sh
# Setup the revisions for the device's Identity class
DEVICE_MAJOR_REVISION=2
DEVICE_MINOR_REVISION=1
#
# ... More shell code / cmake calls etc.
#
# We need to patch the DEVICE_xxxOR_REVISION manually in src/ports/devicedata.h
# because we can't override the OpENer_VERSION_MAJOR and OpENer_VERSION_MINOR
# from the cmake command line with -DOpENer_VERSION_MAJOR:STRING="1" because
# cmake derives these versions from the project() directive and handles
# them as immutable!
echo "Patch the device's MAJOR and MINOR revision to deviate from the OpENer version!"
echo " DEVICE_MAJOR_REVISION=$DEVICE_MAJOR_REVISION"
echo " DEVICE_MINOR_REVISION=$DEVICE_MINOR_REVISION"
sed -e "s/OPENER_DEVICE_MAJOR_REVISION.*/OPENER_DEVICE_MAJOR_REVISION $DEVICE_MAJOR_REVISION/" \
-e "s/OPENER_DEVICE_MINOR_REVISION.*/OPENER_DEVICE_MINOR_REVISION $DEVICE_MINOR_REVISION/" \
src/ports/devicedata.h > src/ports/devicedata.out
if ! mv src/ports/devicedata.out src/ports/devicedata.h; then
echo "Problems moving config file. Abort"
exit 1
fi