Skip to content

Instantly share code, notes, and snippets.

@PPartisan
Created June 30, 2026 17:56
Show Gist options
  • Select an option

  • Save PPartisan/770bbae1bbe9452788751456f3fdf57d to your computer and use it in GitHub Desktop.

Select an option

Save PPartisan/770bbae1bbe9452788751456f3fdf57d to your computer and use it in GitHub Desktop.
Roky Install Script
#!/bin/bash
# VARIABLES
REPO="PPartisan/Roky"
APP_NAME="roky"
INSTALL_DIR="/opt/$APP_NAME"
LINK_DIR="/usr/local/bin"
# MAIN
if [ $# -eq 0 ]; then
echo "Roky Installation Assistant"
echo "---------------------------"
echo "Usage: install_roky [version | latest]"
echo ""
echo "Examples:"
echo " install_roky latest # Installs the latest stable release"
echo " install_roky 0.1.2-beta # Installs a specific release version"
echo " install_roky v0.1.2-beta # Also valid"
exit 0
fi
if ! command -v gh &> /dev/null; then
echo "Error: GitHub CLI (gh) is not installed."
exit 1
fi
if ! command -v unzip &> /dev/null; then
echo "Error: 'unzip' is not installed. Please install it via your package manager."
exit 1
fi
if [ "$1" == "latest" ]; then
echo "Fetching the newest release (including pre-releases)..."
TARGET=$(gh release list --repo "$REPO" --limit 1 --json tagName -q ".[0].tagName")
if [ -z "$TARGET" ]; then
echo "Error: Could not find any releases for $REPO."
exit 1
fi
echo "Targeting version: $TARGET"
else
if [[ "$1" == v* ]]; then
TARGET="$1"
else
TARGET="v$1"
fi
echo "Fetching release $TARGET..."
fi
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR" || exit 1
echo "Downloading..."
gh release download $TARGET --repo "$REPO" --clobber --pattern "*.zip"
ZIP_FILE=$(ls -1 *.zip 2>/dev/null | head -n 1)
if [ -z "$ZIP_FILE" ]; then
echo "Error: No zip file was downloaded."
cd - &> /dev/null || exit
rm -rf "$TMP_DIR"
exit 1
fi
echo "Extracting $ZIP_FILE..."
mkdir extracted
unzip -q "$ZIP_FILE" -d extracted/
EXTRACTED_ROOT=$(find extracted -type d -name "bin" | head -n 1 | xargs dirname)
if [ -z "$EXTRACTED_ROOT" ]; then
echo "Error: Could not find the expected 'bin' directory inside the zip."
exit 1
fi
echo "Installing to $INSTALL_DIR..."
echo "You may be prompted for your password to write to system directories."
if [ -d "$INSTALL_DIR" ]; then
echo "Removing previous installation to prevent conflicts..."
sudo rm -rf "$INSTALL_DIR"
fi
sudo mv "$EXTRACTED_ROOT" "$INSTALL_DIR"
sudo chmod +x "$INSTALL_DIR/bin/Roky"
echo "Creating global symlink in $LINK_DIR..."
sudo ln -sf "$INSTALL_DIR/bin/Roky" "$LINK_DIR/$APP_NAME"
cd - &> /dev/null || exit
rm -rf "$TMP_DIR"
echo "Success! $APP_NAME has been successfully installed."
echo "You can now run it from anywhere by typing: $APP_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment