This commit is contained in:
2026-01-28 22:45:37 +00:00
parent 900f167d79
commit 216f121624

View File

@@ -5,37 +5,36 @@ set -eu
install() { install() {
BINARY_NAME="crib" BINARY_NAME="crib"
VERSION="v0.0.1-alpha" VERSION="v0.0.1-alpha"
RUBY_VERSION="3.4"
if [ -z "$RUBY_VERSION" ]; then if ldconfig -p | grep -q libruby.so.3.4; then
if ldconfig -p | grep -q libruby.so.3.4; then HAVE_34=1
HAVE_34=1 fi
fi if ldconfig -p | grep -q libruby-3.2.so; then
if ldconfig -p | grep -q libruby-3.2.so; then HAVE_32=1
HAVE_32=1 fi
fi
if [ "$HAVE_34" = "1" ] && [ "$HAVE_32" = "1" ]; then if [ "$HAVE_34" = "1" ] && [ "$HAVE_32" = "1" ]; then
echo "Multiple Ruby versions detected." echo "Multiple Ruby versions detected."
echo "Select Ruby ABI:" echo "Select Ruby ABI:"
echo " 1) Ruby 3.4" echo " 1) Ruby 3.4"
echo " 2) Ruby 3.2" echo " 2) Ruby 3.2"
read -r choice read -r choice
case "$choice" in case "$choice" in
1) RUBY_VERSION="3.4" ;; 1) RUBY_VERSION="3.4" ;;
2) RUBY_VERSION="3.2" ;; 2) RUBY_VERSION="3.2" ;;
*) *)
echo "Invalid choice" echo "Invalid choice"
exit 1
;;
esac
elif [ "$HAVE_34" = "1" ]; then
RUBY_VERSION="3.4"
elif [ "$HAVE_32" = "1" ]; then
RUBY_VERSION="3.2"
else
echo "No compatible Ruby library found need Ruby 3.2 or 3.4."
exit 1 exit 1
fi ;;
esac
elif [ "$HAVE_34" = "1" ]; then
RUBY_VERSION="3.4"
elif [ "$HAVE_32" = "1" ]; then
RUBY_VERSION="3.2"
else
echo "No compatible Ruby library found need Ruby 3.2 or 3.4."
exit 1
fi fi
GITHUB_URL="https://github.com/SyedM-dev/crib/releases/download/$VERSION/crib-linux-x86_64-ruby$RUBY_VERSION" GITHUB_URL="https://github.com/SyedM-dev/crib/releases/download/$VERSION/crib-linux-x86_64-ruby$RUBY_VERSION"