fixed zellij

This commit is contained in:
pika 2025-05-11 14:59:24 +02:00
parent d49530a51a
commit b1012d36a5

View file

@ -17,12 +17,21 @@ command_exists() {
# CAUTION:
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
# not every package packagemanager has the same packagenames for their packages..
if command_exists curl; then
eval "$(curl -fsSL https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh)"
else
echo "curl is required, but missing.."
exit 1
fi
getImports() {
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
import="$(mktemp)"
if command_exists curl; then
curl -fsSL $i -o $import
else
echo "curl is required, but missing.."
exit 1
fi
source "$import"
sleep 0.3
rm "$import"
echo_warning "cleaned $import"
}
generic() {
set -euo pipefail
@ -47,7 +56,7 @@ generic() {
fi
# Fetch latest release from GitHub
echo "🔍 Checking latest release of $REPO..."
echo_info "🔍 Checking latest release of $REPO..."
latest_release=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
latest_version=${latest_release#v} # Remove 'v' prefix (e.g., v0.42.2 → 0.42.2)
@ -61,7 +70,7 @@ generic() {
ARCH="aarch64"
;;
*)
echo "❌ Unsupported architecture: $ARCH" >&2
echo_error "❌ Unsupported architecture: $ARCH" >&2
exit 1
;;
esac
@ -70,30 +79,45 @@ generic() {
# Skip if already up-to-date
if [[ "$current_version" == "$latest_version" ]]; then
echo "✅ Already on the latest version ($latest_version). No action needed."
echo_note "✅ Already on the latest version ($latest_version). No action needed."
exit 0
fi
# Download and install
echo "⬇️ Downloading $BINARY_NAME $latest_version for $ARCH..."
echo_info "⬇️ Downloading $BINARY_NAME $latest_version for $ARCH..."
curl -sL "$download_url" | tar -xz -C "$TMP_DIR"
echo "🛠️ Installing to $INSTALL_DIR..."
echo_info "🛠️ Installing to $INSTALL_DIR..."
mv -f "$TMP_DIR/$BINARY_NAME" "$INSTALL_DIR/"
# Verify
if [[ -f "$INSTALL_DIR/$BINARY_NAME" ]]; then
chmod +x "$INSTALL_DIR/$BINARY_NAME"
echo "🎉 Successfully installed $BINARY_NAME $latest_version to $INSTALL_DIR/"
echo "💡 Ensure '$INSTALL_DIR' is in your PATH:"
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo_info "🎉 Successfully installed $BINARY_NAME $latest_version to $INSTALL_DIR/"
echo_warning "💡 Ensure '$INSTALL_DIR' is in your PATH:"
echo_warning " export PATH=\"$INSTALL_DIR:\$PATH\""
else
echo "❌ Installation failed!" >&2
echo_error "❌ Installation failed!" >&2
exit 1
fi
}
case "$distro" in
arch | opensuse) _install zellij ;;
*) generic ;;
esac
setup() {
if getImports; then
case "$1" in
--silent | -s)
silent=true
;;
*)
silent=false
;;
esac
fi
}
if setup; then
case "$distro" in
arch | opensuse) _install zellij ;;
*) generic ;;
esac
fi