Skip to content

Commit 99f4359

Browse files
Improve error handling missing file
1 parent a8dabfd commit 99f4359

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/scripts/install.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,21 @@ _warn() {
5353

5454
_check_version_id() {
5555
if [[ -z "${VERSION_ID}" ]]; then
56-
cat /etc/os-release
57-
_error "Unable to identify distribution. Please, report to https://forum.crystal-lang.org/c/help-support/11"
56+
_error "Unable to identify distribution repository for ${ID}. Please, report to https://forum.crystal-lang.org/c/help-support/11"
5857
exit 1
5958
fi
6059
}
6160

6261
_discover_distro_repo() {
63-
source /etc/os-release
62+
if [[ -r /etc/os-release ]]; then
63+
source /etc/os-release
64+
elif [[ -r /usr/lib/os-release ]]; then
65+
source /usr/lib/os-release
66+
else
67+
_error "Unable to identify distribution. Please, report to https://forum.crystal-lang.org/c/help-support/11"
68+
exit 1
69+
fi
70+
6471
case "$ID" in
6572
debian)
6673
if [[ -z "${VERSION_ID:+}" ]]; then

0 commit comments

Comments
 (0)