aboutsummaryrefslogtreecommitdiffstats
path: root/git-version.sh
diff options
context:
space:
mode:
authorPierre Labastie <pierre.labastie@neuf.fr>2021-09-01 11:08:49 +0200
committerPierre Labastie <pierre.labastie@neuf.fr>2021-09-22 23:11:52 +0200
commit4467b18d3f43db4116864efa4171062c5d000602 (patch)
treeb3144ab869ad504716196aa5444956b9bc71e3c3 /git-version.sh
parent2f142598a98ee76266c9e0c4e3fecd58b2cbb4f6 (diff)
Add a conditional entity for sysv/systemd
This removes the need for versiond, and other xxxd entities. Those entities will be removed in the next commits.
Diffstat (limited to 'git-version.sh')
-rwxr-xr-xgit-version.sh30
1 files changed, 26 insertions, 4 deletions
diff --git a/git-version.sh b/git-version.sh
index ff0eb6cdd..8f5cdb33b 100755
--- a/git-version.sh
+++ b/git-version.sh
@@ -1,10 +1,28 @@
#!/bin/sh
+if [ "$1" = sysv ]; then
+ SYSV="INCLUDE"
+ SYSTEMD="IGNORE "
+elif [ "$1" = systemd ]; then
+ SYSV="IGNORE "
+ SYSTEMD="INCLUDE"
+else
+ echo You must provide either \"sysv\" or \"systemd\" as argument
+ exit 1
+fi
+
+echo "<!ENTITY % sysv \"$SYSV\">" > conditional.ent
+echo "<!ENTITY % systemd \"$SYSTEMD\">" >> conditional.ent
+
if ! git status > /dev/null; then
# Either it's not a git repository, or git is unavaliable.
# Just workaround.
- echo "<!ENTITY version \"unknown\">" > version.ent
- echo "<!ENTITY versiond \"unknown-systemd\">" >> version.ent
+ echo "<![ %sysv; [" > version.ent
+ echo "<!ENTITY version \"unknown\">" >> version.ent
+ echo "]]>" >> version.ent
+ echo "<![ %systemd; [" >> version.ent
+ echo "<!ENTITY version \"unknown-systemd\">" >> version.ent
+ echo "]]>" >> version.ent
echo "<!ENTITY releasedate \"unknown\">" >> version.ent
echo "<!ENTITY copyrightdate \"1999-2021\">" >> version.ent
exit 0
@@ -41,7 +59,11 @@ if [ "$(git diff HEAD | wc -l)" != "0" ]; then
versiond="$versiond+"
fi
-echo "<!ENTITY version \"$version\">" > version.ent
-echo "<!ENTITY versiond \"$versiond\">" >> version.ent
+echo "<![ %sysv; [" > version.ent
+echo "<!ENTITY version \"$version\">" >> version.ent
+echo "]]>" >> version.ent
+echo "<![ %systemd; [" >> version.ent
+echo "<!ENTITY version \"$versiond\">" >> version.ent
+echo "]]>" >> version.ent
echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
echo "<!ENTITY copyrightdate \"1999-$year\">" >> version.ent