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.
This commit is contained in:
Pierre Labastie 2021-09-01 11:08:49 +02:00
parent 2f142598a9
commit 4467b18d3f
4 changed files with 48 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
lfs-bootscripts-*.tar.xz
conditional.ent
version.ent
appendices/*.script

View File

@ -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..."

View File

@ -1,28 +1,39 @@
<!-- Automatically generated by git-version.sh -->
<!ENTITY % conditional-entities SYSTEM "conditional.ent">
%conditional-entities;
<!-- version info automatically generated by git
comment the following two lines for release -->
comment out the following two lines for release -->
<!ENTITY % version-entities SYSTEM "version.ent">
%version-entities;
<!-- uncomment and edit the following four lines
for releases (including -rc) -->
<!--
<![ %sysv; [
<!ENTITY version "10.2-rc1">
<!ENTITY versiond "10.2-systemd-rc1">
]]>
<![ %systemd; [
<!ENTITY version "10.2-systemd-rc1">
]]>
<!ENTITY releasedate "August 26th, 2021">
<!ENTITY copyrightdate "1999-2021">
-->
<!ENTITY short-version "svn"> <!-- Used below in &blfs-book;
<![ %sysv; [
<!ENTITY short-version "svn"> <!-- Used below in &blfs-book;
Change to x.y for release but not -rc releases -->
<!ENTITY generic-version "development"> <!-- Use "development" or "x.y[-pre{x}]" -->
<!ENTITY short-versiond "systemd"> <!--Change to stable-systemd for release -->
<!ENTITY generic-versiond "systemd">
]]>
<![ %systemd; [
<!ENTITY short-version "systemd"> <!--Change to stable-systemd for release -->
<!ENTITY generic-version "systemd">
]]>
<!ENTITY lfs-root "https://www.linuxfromscratch.org/">
<!ENTITY blfs-root "&lfs-root;blfs/">
<!ENTITY blfs-book "&blfs-root;view/&short-version;/">
<!ENTITY blfs-systemd-book "&blfs-root;view/&short-versiond;/">
<!ENTITY blfs-book "&blfs-root;view/&short-version;/">
<!ENTITY faq-root "&lfs-root;faq/">
<!ENTITY hints-root "&lfs-root;hints/downloads/files/">
<!ENTITY hints-index "&lfs-root;hints/list.html">
@ -33,12 +44,12 @@
<!ENTITY errata "&lfs-root;lfs/errata/&generic-version;/">
<!ENTITY secadv "&lfs-root;lfs/advisories/">
<!ENTITY min-kernel "3.2">
<!--
<!ENTITY patches-rootd "&lfs-root;patches/lfs/&generic-versiond;/">
<!ENTITY downloads-rootd "&lfs-root;lfs/downloads/&generic-versiond;/">
<!ENTITY test-resultsd "&lfs-root;lfs/build-logs/&generic-versiond;/">
<!ENTITY erratad "&lfs-root;lfs/errata/&generic-versiond;/">
-->
<!ENTITY lfs-ticket-root "https://wiki.linuxfromscratch.org/lfs/ticket/">
<!ENTITY anduin-sources "https://anduin.linuxfromscratch.org/LFS">

View File

@ -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