Skip to content

Commit ffbc28f

Browse files
fix: handle case where VERSION_ID is not defined (close #3)
1 parent 94a0e8d commit ffbc28f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525

2626
### Fixed
2727

28+
- do our best to determine `OS_VERSION` when `VERSION_ID` is not in /etc/os-release
2829
- `run_app_tests` now correctly upload code coverage if asked to

kash.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,20 @@
1818
. /etc/os-release
1919

2020
OS_ID=$ID
21-
OS_VERSION=$VERSION_ID
21+
OS_VERSION=${VERSION_ID:-}
22+
23+
# VERSION_ID is an optional field, do what we can to deduce when missing
24+
if [[ "$OS_VERSION" = "" ]]; then
25+
case "$OS_ID" in
26+
debian)
27+
OS_VERSION=$(cat /etc/debian_version)
28+
OS_VERSION=${OS_VERSION%%.*}
29+
;;
30+
*)
31+
OS_VERSION=unknown
32+
;;
33+
esac
34+
fi
2235

2336
echo "Running on ${OS_ID}-${OS_VERSION}"
2437

0 commit comments

Comments
 (0)