Last active
July 20, 2025 14:41
-
-
Save zahin-mohammad/b3c38d1ebd6ca1cae174606a28283398 to your computer and use it in GitHub Desktop.
Gauntlet: install, update, un-install script for ubuntu 24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
REPO="project-gauntlet/gauntlet" | |
FILENAME="gauntlet-x86_64-linux.tar.gz" | |
BIN_PATH="/usr/local/bin/gauntlet" | |
INSTALL_DIR="$HOME/.local/share/applications/gauntlet" | |
DESKTOP_TARGET="$HOME/.local/share/applications/gauntlet.desktop" | |
SYSTEMD_USER_SERVICE="$HOME/.config/systemd/user/gauntlet.service" | |
WORK_DIR="$HOME/Downloads" | |
function install_or_update() { | |
echo "π¦ Downloading latest Gauntlet release..." | |
# Fetch latest release URL | |
LATEST_URL=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" \ | |
| grep browser_download_url \ | |
| grep "$FILENAME" \ | |
| cut -d '"' -f 4) | |
if [[ -z "$LATEST_URL" ]]; then | |
echo "β Failed to find release for $FILENAME" | |
exit 1 | |
fi | |
cd "$WORK_DIR" | |
curl -L -o "$FILENAME" "$LATEST_URL" | |
echo "π Extracting..." | |
tar -xzf "$FILENAME" | |
echo "π§ Installing binary to $BIN_PATH..." | |
sudo mv -f gauntlet "$BIN_PATH" | |
sudo chmod +x "$BIN_PATH" | |
echo "π¨ Setting up desktop integration..." | |
mkdir -p "$INSTALL_DIR" | |
mv -f gauntlet.png gauntlet.desktop "$INSTALL_DIR" | |
sed -i "s|^Exec=.*|Exec=$BIN_PATH|" "$INSTALL_DIR/gauntlet.desktop" | |
sed -i "s|^Icon=.*|Icon=$INSTALL_DIR/gauntlet.png|" "$INSTALL_DIR/gauntlet.desktop" | |
chmod +x "$INSTALL_DIR/gauntlet.desktop" | |
cp -f "$INSTALL_DIR/gauntlet.desktop" "$DESKTOP_TARGET" | |
echo "βοΈ Installing systemd user service..." | |
mkdir -p "$(dirname "$SYSTEMD_USER_SERVICE")" | |
mv -f gauntlet.service "$SYSTEMD_USER_SERVICE" | |
sed -i "s|^ExecStart=.*|ExecStart=$BIN_PATH --minimized|" "$SYSTEMD_USER_SERVICE" | |
systemctl --user daemon-reload | |
systemctl --user enable gauntlet | |
systemctl --user restart gauntlet | |
echo "β Gauntlet installed and running!" | |
} | |
function uninstall() { | |
echo "π Uninstalling Gauntlet..." | |
if systemctl --user is-active --quiet gauntlet; then | |
echo "βΉοΈ Stopping gauntlet systemd user service..." | |
systemctl --user stop gauntlet | |
fi | |
if systemctl --user is-enabled --quiet gauntlet; then | |
echo "β Disabling gauntlet systemd user service..." | |
systemctl --user disable gauntlet | |
fi | |
echo "π§Ή Removing systemd service file..." | |
rm -f "$SYSTEMD_USER_SERVICE" | |
echo "π§Ή Removing installed binary..." | |
sudo rm -f "$BIN_PATH" | |
echo "π§Ή Removing desktop entries and icon..." | |
rm -f "$DESKTOP_TARGET" | |
rm -rf "$INSTALL_DIR" | |
systemctl --user daemon-reload | |
echo "β Gauntlet has been fully uninstalled." | |
} | |
# --- Entry Point --- | |
case "$1" in | |
install) | |
install_or_update | |
;; | |
update) | |
install_or_update | |
;; | |
uninstall) | |
uninstall | |
;; | |
*) | |
echo "Usage: $0 {install|update|uninstall}" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment