3 if [ "$1" = sysv
]; then
6 elif [ "$1" = systemd
]; then
10 echo You must provide either
\"sysv
\" or
\"systemd
\" as argument
14 echo "<!ENTITY % sysv \"$SYSV\">" > conditional.ent
15 echo "<!ENTITY % systemd \"$SYSTEMD\">" >> conditional.ent
17 if [ -e LFS-RELEASE
]; then
21 if ! git status
> /dev
/null
; then
22 # Either it's not a git repository or git is unavailable.
24 echo "<![ %sysv; [" > version.ent
25 echo "<!ENTITY version \"unknown\">" >> version.ent
26 echo "]]>" >> version.ent
27 echo "<![ %systemd; [" >> version.ent
28 echo "<!ENTITY version \"unknown-systemd\">" >> version.ent
29 echo "]]>" >> version.ent
30 echo "<!ENTITY releasedate \"unknown\">" >> version.ent
31 echo "<!ENTITY copyrightdate \"1999-2023\">" >> version.ent
35 export LC_ALL
=en_US.utf8
36 export TZ
=America
/Chicago
38 commit_date
=$
(git show
-s --format=format
:"%cd" --date=local)
40 year
=$
(date --date "$commit_date" "+%Y")
41 month
=$
(date --date "$commit_date" "+%B")
42 month_digit
=$
(date --date "$commit_date" "+%m")
43 day
=$
(date --date "$commit_date" "+%d" |
sed 's/^0//')
46 "1" |
"21" |
"31" ) suffix
="st";;
47 "2" |
"22" ) suffix
="nd";;
48 "3" |
"23" ) suffix
="rd";;
52 full_date
="$month $day$suffix, $year"
54 sha
="$(git describe --abbrev=1)"
55 rev=$
(echo "$sha" |
sed 's/-g[^-]*$//')
57 versiond
="$rev-systemd"
59 if [ "$(git diff HEAD | wc -l)" != "0" ]; then
60 version
="$version-wip"
61 versiond
="$versiond-wip"
64 echo "<![ %sysv; [" > version.ent
65 echo "<!ENTITY version \"$version\">" >> version.ent
66 echo "]]>" >> version.ent
67 echo "<![ %systemd; [" >> version.ent
68 echo "<!ENTITY version \"$versiond\">" >> version.ent
69 echo "]]>" >> version.ent
70 echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
71 echo "<!ENTITY copyrightdate \"1999-$year\">" >> version.ent
73 [ -z "$DIST" ] ||
echo $version > "$DIST"