#!/bin/bash

MUSA_FILE=.devzone/build/musa.ini
TMP_MUSA=tmp_musa.ini
[ ! -e $MUSA_FILE ] && echo "Musa config $MUSA_FILE does not exist!" && exit 1

VERSION=`./findversion.sh | cut -f7`
REPO_NAME=`cat Makefile.config | grep 'REPO_NAME' | head -n1 | sed "s/REPO_NAME *?= *//g"`
echo "Version is '$VERSION' for project '$REPO_NAME'. Using $MUSA_FILE"
cat $MUSA_FILE | sed "s/\$VERSION/$VERSION/g" | sed "s/\$REPO_NAME/$REPO_NAME/g" > $TMP_MUSA
musa -c $TMP_MUSA -u openttdcoop docs/readme.txt docs/changelog.txt pota-ghat.grf
rm $TMP_MUSA