From 4467b18d3f43db4116864efa4171062c5d000602 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 1 Sep 2021 11:08:49 +0200 Subject: [PATCH] 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. --- .gitignore | 1 + Makefile | 2 +- general.ent | 29 ++++++++++++++++++++--------- git-version.sh | 30 ++++++++++++++++++++++++++---- 4 files changed, 48 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index e5fb52276..0d2478625 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ lfs-bootscripts-*.tar.xz +conditional.ent version.ent appendices/*.script diff --git a/Makefile b/Makefile index fa3a9ce63..597ae1faa 100644 --- a/Makefile +++ b/Makefile @@ -189,7 +189,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \ $(BASEDIR)/md5sums version: - $(Q)./git-version.sh + $(Q)./git-version.sh $(REV) #dump-commands: validate # @echo "Dumping book commands..." diff --git a/general.ent b/general.ent index 836043835..4d609a82b 100644 --- a/general.ent +++ b/general.ent @@ -1,28 +1,39 @@ + + +%conditional-entities; + + comment out the following two lines for release --> %version-entities; - - - - +]]> + + +]]> - + @@ -33,12 +44,12 @@ - + 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 "" > conditional.ent +echo "" >> conditional.ent + if ! git status > /dev/null; then # Either it's not a git repository, or git is unavaliable. # Just workaround. - echo "" > version.ent - echo "" >> version.ent + echo " version.ent + echo "" >> version.ent + echo "]]>" >> version.ent + echo "> version.ent + echo "" >> version.ent + echo "]]>" >> version.ent echo "" >> version.ent echo "" >> version.ent exit 0 @@ -41,7 +59,11 @@ if [ "$(git diff HEAD | wc -l)" != "0" ]; then versiond="$versiond+" fi -echo "" > version.ent -echo "" >> version.ent +echo " version.ent +echo "" >> version.ent +echo "]]>" >> version.ent +echo "> version.ent +echo "" >> version.ent +echo "]]>" >> version.ent echo "" >> version.ent echo "" >> version.ent