File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,38 @@ _discover_distro_repo() {
106106 _check_version_id
107107 DISTRO_REPO=" openSUSE_Leap_${VERSION_ID} "
108108 ;;
109- * )
109+ " " )
110110 _error " Unable to identify distribution. You may specify one with environment variable DISTRO_REPO"
111111 _error " Please, report to https://forum.crystal-lang.org/c/help-support/11"
112112 exit 1
113113 ;;
114+ * )
115+ # 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
118+
119+ case " $DISTRO_TYPE " in
120+ deb)
121+ DISTRO_REPO=" Debian_Unstable"
122+ ;;
123+ rpm)
124+ DISTRO_REPO=" RHEL_7"
125+ ;;
126+ * )
127+ _error " Unable to identify distribution type ($ID ). You may specify a repository with the environment variable DISTRO_REPO"
128+ _error " Please, report to https://forum.crystal-lang.org/c/help-support/11"
129+ exit 1
130+ ;;
131+ esac
114132 esac
115133}
116134
135+ _discover_distro_type () {
136+ DISTRO_TYPE=" "
137+ [[ $( command -v apt-get) ]] && DISTRO_TYPE=" deb" && return
138+ [[ $( command -v yum) ]] && DISTRO_TYPE=" rpm" && return
139+ }
140+
117141if [[ $EUID -ne 0 ]]; then
118142 _error " This script must be run as root"
119143 exit 1
149173
150174_install_apt () {
151175 if [[ -z $( command -v wget & > /dev/null) ]] || [[ -z $( command -v gpg & > /dev/null) ]]; then
176+ [[ -f /etc/apt/sources.list.d/crystal.list ]] && rm -f /etc/apt/sources.list.d/crystal.list
152177 apt-get update
153178 apt-get install -y wget gpg
154179 fi
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ @test " Elementary OS stable" {
4+ ./test-install-on-docker.sh elementary/docker:stable
5+ }
6+
7+ @test " Elementary OS unstable" {
8+ ./test-install-on-docker.sh elementary/docker:unstable
9+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ @test " Linux Mint 20" {
4+ ./test-install-on-docker.sh linuxmintd/mint20-amd64
5+ }
6+
7+ @test " Linux Mint 19" {
8+ ./test-install-on-docker.sh linuxmintd/mint19-amd64
9+ }
You can’t perform that action at this time.
0 commit comments