fixed zellij
This commit is contained in:
parent
d49530a51a
commit
b1012d36a5
1 changed files with 43 additions and 19 deletions
62
zellij.sh
62
zellij.sh
|
@ -17,12 +17,21 @@ command_exists() {
|
||||||
# CAUTION:
|
# CAUTION:
|
||||||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
# 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..
|
# not every package packagemanager has the same packagenames for their packages..
|
||||||
if command_exists curl; then
|
getImports() {
|
||||||
eval "$(curl -fsSL https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh)"
|
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
||||||
else
|
import="$(mktemp)"
|
||||||
echo "curl is required, but missing.."
|
if command_exists curl; then
|
||||||
exit 1
|
curl -fsSL $i -o $import
|
||||||
fi
|
else
|
||||||
|
echo "curl is required, but missing.."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$import"
|
||||||
|
sleep 0.3
|
||||||
|
rm "$import"
|
||||||
|
echo_warning "cleaned $import"
|
||||||
|
}
|
||||||
|
|
||||||
generic() {
|
generic() {
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
@ -47,7 +56,7 @@ generic() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fetch latest release from GitHub
|
# 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_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)
|
latest_version=${latest_release#v} # Remove 'v' prefix (e.g., v0.42.2 → 0.42.2)
|
||||||
|
|
||||||
|
@ -61,7 +70,7 @@ generic() {
|
||||||
ARCH="aarch64"
|
ARCH="aarch64"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "❌ Unsupported architecture: $ARCH" >&2
|
echo_error "❌ Unsupported architecture: $ARCH" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -70,30 +79,45 @@ generic() {
|
||||||
|
|
||||||
# Skip if already up-to-date
|
# Skip if already up-to-date
|
||||||
if [[ "$current_version" == "$latest_version" ]]; then
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download and install
|
# 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"
|
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/"
|
mv -f "$TMP_DIR/$BINARY_NAME" "$INSTALL_DIR/"
|
||||||
|
|
||||||
# Verify
|
# Verify
|
||||||
if [[ -f "$INSTALL_DIR/$BINARY_NAME" ]]; then
|
if [[ -f "$INSTALL_DIR/$BINARY_NAME" ]]; then
|
||||||
chmod +x "$INSTALL_DIR/$BINARY_NAME"
|
chmod +x "$INSTALL_DIR/$BINARY_NAME"
|
||||||
echo "🎉 Successfully installed $BINARY_NAME $latest_version to $INSTALL_DIR/"
|
echo_info "🎉 Successfully installed $BINARY_NAME $latest_version to $INSTALL_DIR/"
|
||||||
echo "💡 Ensure '$INSTALL_DIR' is in your PATH:"
|
echo_warning "💡 Ensure '$INSTALL_DIR' is in your PATH:"
|
||||||
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
|
echo_warning " export PATH=\"$INSTALL_DIR:\$PATH\""
|
||||||
else
|
else
|
||||||
echo "❌ Installation failed!" >&2
|
echo_error "❌ Installation failed!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$distro" in
|
setup() {
|
||||||
arch | opensuse) _install zellij ;;
|
if getImports; then
|
||||||
*) generic ;;
|
case "$1" in
|
||||||
esac
|
--silent | -s)
|
||||||
|
silent=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
silent=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if setup; then
|
||||||
|
case "$distro" in
|
||||||
|
arch | opensuse) _install zellij ;;
|
||||||
|
*) generic ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue