crystal-lang / distribution-scripts

40 stars 24 forks source link

Add OpenSUSE support in BinTray install.sh #74

Closed RespiteSage closed 3 years ago

RespiteSage commented 4 years ago

The new BinTray install.sh script fails on OpenSUSE Tumbleweed 20200817 (and, I suspect, most OpenSUSE distributions).

In _discover_distro_type, execution continues until if hash apt-get 2>/dev/null, which evaluates as true and sets DISTRO_TYPE to "deb", when, by default, OpenSUSE uses Zypper, which is RPM-based. Actually, the reason for that if evaluating to true is that, for some reason, apt-get "forwards" to Zypper by default on OpenSUSE instead of just not existing. DISTRO_TYPE equal to "deb" later causes apt-key to fail because there is no such command.

That is, of course, only the first issue. The script as it stands seems to support only Yum and Apt, whereas OpenSUSE support would likely require the use of Zypper. I hope to put in a PR for this myself, but at least this issue will exist if I don't get around to it.

j8r commented 4 years ago

OpenSuse has an apt-get symlink to zypper?! What about dpkg, could do the trick if it does not symlink to rpm.

By the way, just check for zypper at first, and it will be also good.

RespiteSage commented 4 years ago

OpenSuse has an apt-get symlink to zypper?!

Actually, it's more complicated than this... apt-get in /usr/bin/ is symlinked to /usr/bin/aptitude, which is a perl script that appears to convert apt arguments to zypper arguments (e.g. --with-recommends becomes --recommends) and then calls zypper with those arguments.

aboe76 commented 3 years ago

I think to have suse support the install script needs to be adjusted as follows: add _match_etc_issue "rpm" "Suse" && return in the discover_distro_type() function

and create a new exception based rpm -E %{sle_version} or %{suse_version} when these are not empty (you are running a suse/opensuse system)

then use:

crystal.repo
[crystal]
name=crystal
enabled=1
baseurl=https://dl.bintray.com/crystal/rpm/all/x86_64/stable/
type=rpm-md
gpgcheck=1
gpgkey=http://bintray.com/user/downloadSubjectPublicKey?username=bintray

and at last the install command for Suse should be:

zypper install -y --gpg-auto-import-keys $CRYSTAL_PACKAGE
straight-shoota commented 3 years ago

This has been resolved by #91. Packages for openSUSE are now available through OBS (https://crystal-lang.org/install/on_opensuse/).