diff options
author | Taylor Holberton <tay10r@protonmail.com> | 2020-06-03 09:31:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 09:31:46 -0400 |
commit | 60dfa38cc34de061d6e8938528132b838d7ec696 (patch) | |
tree | db768121417e35b9a043e90755562e61a7133837 | |
parent | 6ef70e16da9c83db73861561d32830f6448db55d (diff) | |
parent | 8199576bfcfde313439413d7c46adca359f67552 (diff) |
Merge pull request #157 from E5ten/version-posix-sh
scripts/version.sh: switch from bash to POSIX sh
-rwxr-xr-x | scripts/version.sh | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/scripts/version.sh b/scripts/version.sh index 8876c40..9ed27a9 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # @@ -58,13 +58,13 @@ check_files() # TINYALSA_VERSION_MAJOR get_version_part() { - local V=$(grep -m 1 "^#define\([ \t]*\)$1" ${VERSION_FILE} | sed 's/[^0-9]*//g') + set -- "$1" "$(grep -m 1 "^#define\([ \t]*\)$1" ${VERSION_FILE} | sed 's/[^0-9]*//g')" - if [ -z ${V} ]; then + if [ -z "$2" ]; then die "Could not get $1 from ${VERSION_FILE}" fi - echo ${V} + echo "$2" } @@ -136,13 +136,7 @@ print_version() bump_version() { - local PART="patch" - - if [ ! -z $1 ]; then - PART="$1" - fi - - case "$PART" in + case "${1:-patch}" in major) VERSION_MAJOR=$((VERSION_MAJOR+1)) VERSION_MINOR=0 @@ -170,14 +164,16 @@ bump_version() check_version() { - local LOG_VERSION=$(grep -m 1 "^tinyalsa (" ${CHANGELOG_FILE}| sed "s/[^0-9.]*//g") - local REF_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" + # set $1 to log version, and $2 to ref version + set -- \ + "$(grep -m 1 "^tinyalsa (" ${CHANGELOG_FILE}| sed "s/[^0-9.]*//g")" \ + "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" - if [ "${LOG_VERSION}" != "${REF_VERSION}" ]; then - die "Changelog version (${LOG_VERSION}) does not match package version (${REF_VERSION})." + if [ "$1" != "$2" ]; then + die "Changelog version ($1) does not match package version ($2)." fi - printf "Changelog version (${LOG_VERSION}) OK!${LF}" + printf "Changelog version ($1) OK!${LF}" return 0 } |