aboutsummaryrefslogtreecommitdiffstats
path: root/git-version.sh
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-09-13 14:08:06 +0800
committerXi Ruoyao <xry111@xry111.site>2023-09-13 14:10:38 +0800
commitc858ba4e17a445591520ddcea8b288b8e3d6db42 (patch)
treebff7bbb44640cbe51c61d8f4a390ae650527a958 /git-version.sh
parenta9dc9724ae2a954405dd4dbc6a1593f1b469c3dd (diff)
build: Add "make dist"
For creating a tarball without .git directory easier. The tarball will include version.ent and LFS-RELEASE files so the book rendered from it won't show "unknown" for all dates.
Diffstat (limited to 'git-version.sh')
-rwxr-xr-xgit-version.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/git-version.sh b/git-version.sh
index 7a430fec3..4a3c6d1e4 100755
--- a/git-version.sh
+++ b/git-version.sh
@@ -17,6 +17,11 @@ 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.
+
+ if [ -e LFS-RELEASE ]; then
+ exit 0
+ fi
+
echo "<![ %sysv; [" > version.ent
echo "<!ENTITY version \"unknown\">" >> version.ent
echo "]]>" >> version.ent
@@ -65,3 +70,5 @@ echo "<!ENTITY version \"$versiond\">" >> version.ent
echo "]]>" >> version.ent
echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
echo "<!ENTITY copyrightdate \"1999-$year\">" >> version.ent
+
+[ -z "$DIST" ] || echo $version > "$DIST"