-
Notifications
You must be signed in to change notification settings - Fork 0
/
substitute-placeholders.sh
executable file
·23 lines (19 loc) · 957 Bytes
/
substitute-placeholders.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Get version from the repository
# Note that the --match argument is a glob pattern and not regex
# As such, it will also match stuff like "v1.1asd.0". Let's just
# assume that nobody would make a tag like that.
GIT_DESCRIPTION=$(git describe --tags --dirty --always \
--match v[0-9]*.[0-9]*.[0-9]*)
# Strip leading 'v' from GIT_DESCRIPTION
VERSION=${GIT_DESCRIPTION#?}
# Only touch files if the checksum is different. This way, we avoid
# unnecessary rebuilds when make is called.
# INPUT: sw-description.in
# OUTPUT: sw-description
sed "s/{VERSION}/$VERSION/g; s/{TARGET}/$TARGET/g" sw-description.in > /tmp/sbtos-set-version-output
rsync -c /tmp/sbtos-set-version-output sw-description
# INPUT: os-release.in
# OUTPUT: $OSRELEASE
OSRELEASE=sbt-open-source/board/common/rootfs_overlay/etc/os-release
sed "s/{VERSION}/$VERSION/g; s/{TARGET}/$TARGET/g" os-release.in > /tmp/sbtos-set-version-output
rsync -c /tmp/sbtos-set-version-output $OSRELEASE