Changeset 8307474 for git-version.sh
- Timestamp:
- 12/04/2021 03:28:15 PM (2 years ago)
- Branches:
- lazarus
- Children:
- e6974d1
- Parents:
- b22e4ceb (diff), edd2feb7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
git-version.sh
rb22e4ceb r8307474 1 1 #!/bin/sh 2 3 if [ "$1" = sysv ]; then 4 SYSV="INCLUDE" 5 SYSTEMD="IGNORE " 6 elif [ "$1" = systemd ]; then 7 SYSV="IGNORE " 8 SYSTEMD="INCLUDE" 9 else 10 echo You must provide either \"sysv\" or \"systemd\" as argument 11 exit 1 12 fi 13 14 echo "<!ENTITY % sysv \"$SYSV\">" > conditional.ent 15 echo "<!ENTITY % systemd \"$SYSTEMD\">" >> conditional.ent 2 16 3 17 if ! git status > /dev/null; then 4 18 # Either it's not a git repository, or git is unavaliable. 5 19 # Just workaround. 6 echo "<!ENTITY version \"unknown\">"> version.ent7 echo "<!ENTITY version d \"unknown-systemd\">">> version.ent20 echo "<!ENTITY year \"????\">" > version.ent 21 echo "<!ENTITY version \"unknown\">" >> version.ent 8 22 echo "<!ENTITY releasedate \"unknown\">" >> version.ent 9 echo "<!ENTITY copyrightdate \"1999-2021\">">> version.ent23 echo "<!ENTITY pubdate \"unknown\">" >> version.ent 10 24 exit 0 11 25 fi … … 19 33 year=$(date --date "$commit_date" "+%Y") 20 34 month=$(date --date "$commit_date" "+%B") 21 month_digit=$(date --date "$commit_date" "+%m")22 35 day_digit=$(date --date "$commit_date" "+%d") 23 36 day=$(echo $day_digit | sed 's/^0//') … … 33 46 34 47 sha="$(git describe --abbrev=1)" 35 if git describe --all --match trunk > /dev/null 2> /dev/null; then 36 sha=$(echo "$sha" | sed 's/-g[^-]*$//') 37 fi 38 version="$sha" 48 version=$(echo "$sha" | sed 's/-g[^-]*$//') 39 49 40 50 if [ "$(git diff HEAD | wc -l)" != "0" ]; then … … 42 52 fi 43 53 44 echo "<!ENTITY day \"$day_digit\">" > version.ent 45 echo "<!ENTITY month \"$month_digit\">" >> version.ent 46 echo "<!ENTITY year \"$year\">" >> version.ent 47 echo "<!ENTITY copyrightdate \"2001-$year\">" >> version.ent 54 echo "<!ENTITY year \"$year\">" > version.ent 48 55 echo "<!ENTITY version \"$version\">" >> version.ent 49 56 echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
Note:
See TracChangeset
for help on using the changeset viewer.