2020-06-28 10:39:09 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-07-05 19:39:55 -07:00
|
|
|
# file gen_signature.sh
|
|
|
|
|
2024-02-07 15:28:56 -08:00
|
|
|
SHORT_BOARD_NAME=${1:-$SHORT_BOARD_NAME}
|
2020-06-28 10:39:09 -07:00
|
|
|
|
2024-02-07 15:28:56 -08:00
|
|
|
cd $(dirname "$0")
|
2020-07-05 19:39:55 -07:00
|
|
|
|
2024-01-30 04:53:27 -08:00
|
|
|
SIGNATURE_FILE_NAME=tunerstudio/generated/signature_${SHORT_BOARD_NAME}.txt
|
|
|
|
echo "Generating signature for ${SHORT_BOARD_NAME}"
|
2020-06-28 10:39:09 -07:00
|
|
|
|
|
|
|
# generate a unique signature
|
2021-03-05 17:16:59 -08:00
|
|
|
date=`TZ=Europe/London date +"%Y.%m.%d"`
|
2024-02-07 15:28:56 -08:00
|
|
|
echo "! Generated by gen_signature.sh" > ${SIGNATURE_FILE_NAME}.temp
|
2020-06-28 10:39:09 -07:00
|
|
|
|
2024-02-07 15:28:56 -08:00
|
|
|
echo "! SIGNATURE_HASH is a built-in variable generated by config_definition-all.jar" >> ${SIGNATURE_FILE_NAME}.temp
|
2020-06-28 10:39:09 -07:00
|
|
|
|
2023-01-19 22:14:05 -08:00
|
|
|
# read the current git branch name
|
|
|
|
branchname=`git branch --show-current`
|
2023-12-01 19:19:46 -08:00
|
|
|
if [ "${branchname}" = "" ]; then
|
|
|
|
# custom board, empty value while executed within submodule
|
|
|
|
branchname="default"
|
2024-02-07 15:28:56 -08:00
|
|
|
echo "! Using default branch $branchname" >> ${SIGNATURE_FILE_NAME}.temp
|
2023-12-01 19:19:46 -08:00
|
|
|
else
|
2024-02-07 15:28:56 -08:00
|
|
|
echo "! Current branch is: $branchname" >> ${SIGNATURE_FILE_NAME}.temp
|
2023-12-01 19:19:46 -08:00
|
|
|
fi
|
2023-01-19 22:14:05 -08:00
|
|
|
|
2024-02-07 15:28:56 -08:00
|
|
|
echo "#define TS_SIGNATURE \"rusEFI $branchname.$date.${SHORT_BOARD_NAME}.@@SIGNATURE_HASH@@\"" >> ${SIGNATURE_FILE_NAME}.temp
|
|
|
|
cmp ${SIGNATURE_FILE_NAME}.temp ${SIGNATURE_FILE_NAME} || mv -f ${SIGNATURE_FILE_NAME}.temp ${SIGNATURE_FILE_NAME}
|
|
|
|
rm -f ${SIGNATURE_FILE_NAME}.temp
|
2020-07-02 09:33:31 -07:00
|
|
|
|
2020-06-28 10:39:09 -07:00
|
|
|
exit 0
|