diff --git a/README.md b/README.md index 4a5e783..f6b3079 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,8 @@ development mode (credentials required) * git clone git@artcode.re:pvincent/debian-bash.git -C ~/DEV/BASH * sudo ln -s $HOME/DEV/BASH/debian-bash /opt/debian-bash * sudo /opt/debian-bash/install.sh --host + +useful library +-------------- + +* source /opt/debian-bash/lib/functions.sh diff --git a/tools/wget_semver b/tools/wget_semver index 9d2b1e5..3aaf7ea 100755 --- a/tools/wget_semver +++ b/tools/wget_semver @@ -15,11 +15,19 @@ function usage { } function get_github { - release=$( git ls-remote --tags --sort="v:refname" \ - git://github.com/$REPO_NAME \ + local all_releases=$( git ls-remote --tags --sort="v:refname" git://github.com/$REPO_NAME ) + + # extract only VERSION without 'v' + local non_v_release=$( echo "$all_releases" \ + | grep -v "refs/tags/v" | grep -v dev | grep -v rc | tail -n1 | cut -f2 | cut -d '/' -f3 ) + non_v_release=${non_v_release%^\{\}} # remove extra characters ^{} from github + [ -n "$non_v_release" ] && echo $non_v_release && return + + # extract remaining version including 'v' + local v_release=$( echo "$all_releases" \ | grep -v dev | grep -v rc | tail -n1 | cut -f2 | cut -d '/' -f3 ) - release=${release%^\{\}} # remove extra characters ^{} from github - echo $release + v_release=${v_release%^\{\}} # remove extra characters ^{} from github + echo $v_release } function get_artcode {