Open gabriel-ss opened 1 month ago
Hey there, @straight-shoota, sorry to bother, do you have any thoughts on this one?
The installer seems to work just fine in an Amazon Linux 2023 image: docker run --rm -it amazonlinux:2023 /bin/sh -c 'curl https://crystal-lang.org/install.sh | bash'
.
Nevertheless, the suggested changes look reasonable. I'm not very familiar with the RPM ecosystem though, so I trust your judgement.
Probably best to have both changes in separate PRs because they're not directly related.
In companion with the first change, it probably makes sense to rename $DISTRO_TYPE
to something more descriptive like $PACKAGE_MANAGER
?
It does indeed work on amazonlinux:2023
since in that image yum
is a symlink to the full dnf. The public.ecr.aws/lambda/provided:al2023
image is a striped down version used by aws lambdas that, among other things, doesn't include the symlink nor the full dnf.
I agree with your points. I'll make two separate PRs and rename the variable as you suggested.
Thank you for your time!
Done! Got a little confused by the default github behavior of branches on forks, but it's fixed now. Both #323 and #324 should resolve the issue if merged.
I was setting up a pipeline today on an amazon linux 2023-based container and got caught by surprise when the crystal installer script didn't work. I found it odd since I used it dozens of times to install the compiler on older amazon linux 2 containers, so I did a little debugging and found what was happening.
The script cleverly tries to infer the correct source from the installed package manager when the information provided by the os-release is not enough. The problem with this is that it assumes that every unknown distro using rpm will manage packages with yum. When an unknown distro uses dnf (like the newer versions of AL), the script just fails. Replacing
with
should solve the problem with distros using the full version of dnf.
The other problem that I found is that the script is not compatible with microdnf. The script currently tries to install the config-manager dnf command to add the crystal repo, which not only can bring a lot of unneded python depencies but also makes it incompatible with microdnf. Since microdnf will eventually replace the old python based dnf, I think supporting it is a good idea. By modifing
to use the same process used by _install_yum
both microdnf and dnf work as expected (tested the modified script on a Fedora 40 and a Fedora Rawhide containers).
Combining both modifications allows the script to successfully install crystal on
public.ecr.aws/lambda/provided:al2023
, which is based on fedora and uses microdnf. Is there a chance to see those changes being implemented? I could prepare a PR if there is interest on it.