Skip to content

Commit

Permalink
a better solution for 'freifunk-version'
Browse files Browse the repository at this point in the history
  • Loading branch information
cremesk committed Nov 24, 2024
1 parent 9156cb0 commit abfdf68
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions salt/freifunk/base/ddmesh/usr/local/bin/freifunk-version
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

install_dir="$(uci -qX get ffdd.sys.install_dir)"
version="$(head -n3 "$install_dir"/init_server.sh | grep -oP '(?<=^#version=).+' | tr -d '"')"
rev="$(cd "$install_dir" && git describe --all --abbrev=0 | cut -f2 -d"/")"
commit="$(cd "$install_dir" && git show --oneline -s | awk '{print $1}')"
rev="$(git --git-dir=/srv/ffdd-server/.git describe --all --abbrev=0 | cut -f2 -d"/")"
commit="$(git --git-dir=/srv/ffdd-server/.git show --oneline -s | awk '{print $1}')"

printf '%s - %s (%s)\n' "$version" "$rev" "$commit"
if [ "$install_dir" != '' ]; then
printf '%s - %s (%s)\n' "$version" "$rev" "$commit"
else
printf 'n.a.\n'
fi

exit 0

0 comments on commit abfdf68

Please sign in to comment.