Skip to content

Commit 5f6fcad

Browse files
authored
Update distro inference strategy to handle dnf based systems (#323)
1 parent 4d682a2 commit 5f6fcad

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

packages/scripts/install.sh

+14-10
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,20 @@ _discover_distro_repo() {
113113
;;
114114
*)
115115
# If there's no dedicated repository for the distro, try to figure out
116-
# if the distro is apt or rpm based and use a default repository.
117-
_discover_distro_type
116+
# if the distro is apt, dnf or rpm based and use a default repository.
117+
_discover_package_manager
118118

119-
case "$DISTRO_TYPE" in
120-
deb)
119+
case "$PACKAGE_MANAGER" in
120+
apt)
121121
DISTRO_REPO="Debian_Unstable"
122122
;;
123-
rpm)
123+
dnf)
124+
DISTRO_REPO="Fedora_Rawhide"
125+
;;
126+
yum)
124127
DISTRO_REPO="RHEL_7"
125128
;;
126-
*)
129+
unsupported_package_manager)
127130
_error "Unable to identify distribution type ($ID). You may specify a repository with the environment variable DISTRO_REPO"
128131
_error "Please, report to https://forum.crystal-lang.org/c/help-support/11"
129132
exit 1
@@ -132,10 +135,11 @@ _discover_distro_repo() {
132135
esac
133136
}
134137

135-
_discover_distro_type() {
136-
DISTRO_TYPE=""
137-
[[ $(command -v apt-get) ]] && DISTRO_TYPE="deb" && return
138-
[[ $(command -v yum) ]] && DISTRO_TYPE="rpm" && return
138+
_discover_package_manager() {
139+
[[ $(command -v apt-get) ]] && PACKAGE_MANAGER="apt" && return
140+
[[ $(command -v dnf) ]] && PACKAGE_MANAGER="dnf" && return
141+
[[ $(command -v yum) ]] && PACKAGE_MANAGER="yum" && return
142+
PACKAGE_MANAGER="unsupported_package_manager"
139143
}
140144

141145
if [[ $EUID -ne 0 ]]; then

0 commit comments

Comments
 (0)