Skip to content

Commit

Permalink
Added dekstop file installer for steam deck
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne authored May 27, 2024
2 parents a9a3d03 + 7703ef0 commit b0ce2aa
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
68 changes: 68 additions & 0 deletions SteamDeck/pokerogue-deck-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

if ! command -v zenity &> /dev/null
then
echo "Zenity is not installed. Please install it and try again."
exit 1
fi

TEMP_DIR=$(mktemp -d)

cleanup() {
rm -rf "$TEMP_DIR"
}
trap cleanup EXIT

POKEROGUE_DIR="$HOME/.local/bin/Pokerogue"
if [ -d "$POKEROGUE_DIR" ]; then
CHOICE=$(zenity --list --title="Pokerogue Installer" --radiolist --column "Select" --column "Action" TRUE "Install/Update Pokerogue" FALSE "Uninstall Pokerogue" FALSE "Exit" --width=300 --height=328)
else
CHOICE=$(zenity --list --title="Pokerogue Installer" --radiolist --column "Select" --column "Action" TRUE "Install/Update Pokerogue" FALSE "Exit" --width=300 --height=286)
fi

if [ $? -ne 0 ]; then
exit 0
fi

if [ "$CHOICE" == "Install/Update Pokerogue" ]; then
echo "Downloading the latest release of Pokerogue..."
if curl -L -o "$TEMP_DIR/Pokerogue-Linux.zip" $(curl -s https://api.github.com/repos/Odizinne/Pokerogue-Standalone/releases/latest | grep "browser_download_url.*Pokerogue-Linux.zip" | cut -d '"' -f 4); then
echo "Download completed successfully."
else
zenity --error --title="Error" --text="Failed to download the latest release. Please check your internet connection and try again."
exit 1
fi

echo "Extracting Pokerogue-Linux.zip..."
unzip "$TEMP_DIR/Pokerogue-Linux.zip" -d "$TEMP_DIR"

EXTRACTED_DIR=$(find "$TEMP_DIR" -maxdepth 1 -type d -not -name '.*' -not -name 'Pokerogue-Linux' -print -quit)

cd "$EXTRACTED_DIR"

echo "Making the install.sh script executable..."
chmod +x install.sh

echo "Running the install.sh script..."
./install.sh

zenity --info --title="Installation Complete" --text="Pokerogue has been successfully installed/updated."
elif [ "$CHOICE" == "Uninstall Pokerogue" ]; then
UNINSTALL_SCRIPT="$POKEROGUE_DIR/uninstall.sh"
if [ -f "$UNINSTALL_SCRIPT" ]; then
echo "Making the uninstall.sh script executable..."
chmod +x "$UNINSTALL_SCRIPT"
echo "Running the uninstall.sh script..."
"$UNINSTALL_SCRIPT"
zenity --info --title="Uninstallation Complete" --text="Pokerogue has been successfully uninstalled."
else
zenity --error --title="Error" --text="Uninstall script not found at $UNINSTALL_SCRIPT"
exit 1
fi
elif [ "$CHOICE" == "Exit" ]; then
exit 0
else
zenity --error --title="Error" --text="Invalid choice. Please try again."
exit 1
fi

9 changes: 9 additions & 0 deletions SteamDeck/pokerogue-installer.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Version=1.0
Name=Install Pokerogue
Comment=Install Pokerogue on the Steam Deck
Exec=bash -c "curl -fsSL https://raw.githubusercontent.com/Odizinne/Pokerogue-Standalone/main/SteamDeck/pokerogue-deck-install.sh | bash"
Icon=application-x-executable
Terminal=true
Type=Application
Categories=Utility;

0 comments on commit b0ce2aa

Please sign in to comment.