Skip to content

Instantly share code, notes, and snippets.

@zahin-mohammad
Last active July 20, 2025 14:41
Show Gist options
  • Save zahin-mohammad/b3c38d1ebd6ca1cae174606a28283398 to your computer and use it in GitHub Desktop.
Save zahin-mohammad/b3c38d1ebd6ca1cae174606a28283398 to your computer and use it in GitHub Desktop.
Gauntlet: install, update, un-install script for ubuntu 24
#!/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