11.0
11.0-rc1
11.0-rc2
11.0-rc3
11.1
11.1-rc1
11.2
11.2-rc1
11.3
11.3-rc1
arm
bdubbs/gcc13
ml-11.0
multilib
s6-init
trunk
xry111/arm64
xry111/clfs-ng
xry111/glibc-2.34
xry111/glibc-2.37
xry111/kcfg-revise
xry111/lfs-next
xry111/pip3
xry111/queue-11.3
xry111/rust-wip-20221008
xry111/tester-nohack
xry111/usr-move
Last change
on this file since 59483809 was 59483809, checked in by Xi Ruoyao <xry111@…>, 2 years ago |
automatically generate version info from git HEAD
|
-
Property mode
set to
100755
|
File size:
1.4 KB
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 |
|
---|
3 | if ! git status; then
|
---|
4 | # Either it's not a git repository, or git is unavaliable.
|
---|
5 | # Just workaround.
|
---|
6 | echo "<!ENTITY version \"unknown\">" > version.ent
|
---|
7 | echo "<!ENTITY versiond \"unknown-systemd\">" >> version.ent
|
---|
8 | echo "<!ENTITY releasedate \"unknown\">" >> version.ent
|
---|
9 | echo "<!ENTITY copyrightdate \"1999-2021\">" >> version.ent
|
---|
10 | exit 0
|
---|
11 | fi
|
---|
12 |
|
---|
13 | export LC_ALL=en_US.utf8
|
---|
14 | export TZ=US/Pacific
|
---|
15 |
|
---|
16 | commit_date=$(git show -s --format=format:"%cd" --date=local)
|
---|
17 | short_date=$(date --date "$commit_date" "+%Y%m%d")
|
---|
18 |
|
---|
19 | year=$(date --date "$commit_date" "+%Y")
|
---|
20 | month=$(date --date "$commit_date" "+%B")
|
---|
21 | month_digit=$(date --date "$commit_date" "+%m")
|
---|
22 | day=$(date --date "$commit_date" "+%d")
|
---|
23 |
|
---|
24 | case $day in
|
---|
25 | "1" | "21" | "31" ) suffix="st";;
|
---|
26 | "2" | "22" ) suffix="nd";;
|
---|
27 | "3" | "23" ) suffix="rd";;
|
---|
28 | * ) suffix="th";;
|
---|
29 | esac
|
---|
30 |
|
---|
31 | full_date="$month $day$suffix, $year"
|
---|
32 |
|
---|
33 | sha="g$(git describe --always)"
|
---|
34 | version="GIT-$short_date-$sha"
|
---|
35 | versiond="GIT-$short_date-$sha-systemd"
|
---|
36 |
|
---|
37 | if [ "$(git diff HEAD | wc -l)" != "0" ]; then
|
---|
38 | version="$version-MODIFIED"
|
---|
39 | versiond="$versiond-MODIFIED"
|
---|
40 | fi
|
---|
41 |
|
---|
42 | echo "<!ENTITY version \"$version\">" > version.ent
|
---|
43 | echo "<!ENTITY versiond \"$versiond\">" >> version.ent
|
---|
44 | echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
|
---|
45 | echo "<!ENTITY copyrightdate \"1999-$year\">" >> version.ent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.