diff --git a/build_tools/git_version_gen.sh b/build_tools/git_version_gen.sh index 791ac8ff7..b7faccbf4 100755 --- a/build_tools/git_version_gen.sh +++ b/build_tools/git_version_gen.sh @@ -1,11 +1,14 @@ -#!/bin/bash +#!/bin/sh # Originally from the git sources (GIT-VERSION-GEN) # Presumably (C) Junio C Hamano # Reused under GPL v2.0 # Modified for fish by David Adam +# Obtain directory containing this script in POSIX-compatible manner +# See https://stackoverflow.com/a/43919044/17027 (public domain) +a="/$0"; a="${a%/*}"; a="${a:-.}"; a="${a#/}/"; BASEDIR=$(cd "$a"; pwd) # Find the fish git directory as two levels up from this directory. -GIT_DIR=$(dirname $(dirname "${BASH_SOURCE[0]}")) +GIT_DIR=$(dirname $(dirname "$a")) FBVF=FISH-BUILD-VERSION-FILE DEF_VER=unknown