commit 3e3b106fce77a680fef59b4d2a0113921d392fed parent 0e283566910a912eb43187d93c5dae3231352c3d Author: Coutinho de Souza <dev@onemoresuza.com> Date: Wed, 17 Jul 2024 11:14:03 -0300 scripts/version: achieve shellcheck compliance Diffstat:
M | scripts/version | | | 18 | ++++++------------ |
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/scripts/version b/scripts/version @@ -1,22 +1,16 @@ #!/bin/sh # Distro packagers may set the LOCALVER variable to add their distribution to # the version, e.g. 1.0-alpine. -VERSION=${VERSION:-dev} +VERSION="${VERSION:-"dev"}" ver=$(git describe 2>/dev/null) -if [ $? -ne 0 ] -then +# shellcheck disable=SC2181 +if [ $? -ne 0 ]; then ver="dev+$(git log -1 --format='%h' 2>/dev/null)" - if [ $? -ne 0 ] - then + if [ $? -ne 0 ]; then # git presumed unavailable - ver=$VERSION + ver="$VERSION" fi fi -localver=${LOCALVER:-} -if [ ${#localver} != 0 ] -then - ver="$ver-$localver" -fi -echo $ver +printf -- '%s' "$ver${LOCALVER:+"-$LOCALVER"}"