Add installer script
This commit is contained in:
43
installer.sh
Normal file
43
installer.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
BINARY_NAME="crib"
|
||||
GITHUB_URL="https://github.com/SyedM-dev/crib/releases/download/v0.0.1-alpha/crib-linux-x86_64"
|
||||
|
||||
# 1️⃣ Check dependencies
|
||||
missing=()
|
||||
command -v ruby >/dev/null 2>&1 || missing+=("ruby")
|
||||
ldconfig -p | grep libmagic >/dev/null 2>&1 || missing+=("libmagic")
|
||||
|
||||
if [ ${#missing[@]} -ne 0 ]; then
|
||||
echo "Missing dependencies: ${missing[*]}"
|
||||
echo "Install them using your package manager:"
|
||||
echo "Ubuntu/Debian: sudo apt install ruby libmagic1"
|
||||
echo "Arch: sudo pacman -S ruby file"
|
||||
echo "Void: sudo xbps-install -Sy ruby file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2️⃣ Ask installation path
|
||||
echo "Install locally (~/.local/bin) or globally (/usr/bin)? [l/g]"
|
||||
read -r choice
|
||||
case "$choice" in
|
||||
l | L) INSTALL_DIR="$HOME/.local/bin" ;;
|
||||
g | G) INSTALL_DIR="/usr/bin" ;;
|
||||
*)
|
||||
echo "Invalid choice"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
# 3️⃣ Download the binary
|
||||
echo "Downloading binary..."
|
||||
curl -L "$GITHUB_URL" -o "$INSTALL_DIR/$BINARY_NAME"
|
||||
chmod +x "$INSTALL_DIR/$BINARY_NAME"
|
||||
|
||||
# 4️⃣ Optional: confirm
|
||||
echo "$BINARY_NAME installed to $INSTALL_DIR"
|
||||
echo "You can run it with: $BINARY_NAME"
|
||||
echo "Remember to add $INSTALL_DIR to PATH if not already."
|
||||
Reference in New Issue
Block a user