2022-03-12 20:07:16 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
license() {
|
|
|
|
cat << EOF
|
|
|
|
■The contents of this file are subject to the Common Public Attribution
|
|
|
|
License Version 1.0 (the ■License■); you may not use this file except in
|
|
|
|
compliance with the License. You may obtain a copy of the License at
|
|
|
|
https://opensource.org/licenses/CPAL-1.0. The License is based on the Mozilla Public License Version
|
|
|
|
1.1 but Sections 14 and 15 have been added to cover use of software over a
|
|
|
|
computer network and provide for limited attribution for the Original
|
|
|
|
Developer. In addition, Exhibit A has been modified to be consistent with
|
|
|
|
Exhibit B.
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an ■AS IS■ basis,
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
License.
|
|
|
|
|
|
|
|
The Original Code is linux-game-manager.
|
|
|
|
|
|
|
|
The Original Developer is not the Initial Developer and is . If
|
|
|
|
left blank, the Original Developer is the Initial Developer.
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is Billy "Storm Dragon" Wolfe. All portions of
|
|
|
|
the code written by Billy Wolfe are Copyright (c) 2020. All Rights
|
|
|
|
Reserved.
|
|
|
|
|
|
|
|
Contributor Michael Taboada.
|
|
|
|
|
|
|
|
Attribution Copyright Notice: linux-game-manager copyright 2022 Storm Dragon. All rights reserved.
|
|
|
|
|
|
|
|
Attribution Phrase (not exceeding 10 words): A Stormux project
|
|
|
|
|
|
|
|
Attribution URL: https://stormgames.wolfe.casa
|
|
|
|
|
|
|
|
Graphic Image as provided in the Covered Code, if any.
|
|
|
|
|
|
|
|
Display of Attribution Information is required in Larger
|
|
|
|
Works which are defined in the CPAL as a work which combines Covered Code
|
|
|
|
or portions thereof with code not governed by the terms of the CPAL.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
# Dialog accessibility
|
|
|
|
export DIALOGOPTS='--no-lines --visit-items'
|
|
|
|
|
|
|
|
|
2022-03-13 01:42:35 -05:00
|
|
|
# Check for updates
|
|
|
|
check_update() {
|
2022-03-15 01:12:04 -04:00
|
|
|
local url="$(git ls-remote --get-url)"
|
|
|
|
if [[ "$url" =~ ^ssh://|git@ ]] || [[ -z "$url" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
2022-07-22 04:56:18 -04:00
|
|
|
git remote update > /dev/null 2>&1
|
2022-03-15 02:07:13 -04:00
|
|
|
local upstream='@{u}'
|
|
|
|
local home="$(git rev-parse @)"
|
|
|
|
local remote="$(git rev-parse "$upstream")"
|
|
|
|
if [[ "$home" == "$remote" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
2022-03-13 01:42:35 -05:00
|
|
|
dialog --backtitle "Linux Game manager" \
|
2022-03-15 02:07:13 -04:00
|
|
|
--yesno "Updates are available. Would you like to update now?" -1 -1 --stdout || return
|
2022-03-13 01:42:35 -05:00
|
|
|
git pull
|
|
|
|
exit $?
|
|
|
|
}
|
|
|
|
|
2022-03-27 13:56:35 -04:00
|
|
|
# Check architecture compatibility
|
|
|
|
check_architecture() {
|
|
|
|
local architecture="$(uname -m)"
|
|
|
|
for i in "$@" ; do
|
|
|
|
if [[ "${architecture}" == "$i" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
dialog --backtitle "Linux Game Manager" \
|
|
|
|
--infobox "This game is not compatible with $architecture architecture." -1 -1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-07-22 02:20:17 -04:00
|
|
|
# Check dependencies required for games
|
|
|
|
check_dependencies() {
|
|
|
|
local dependencies
|
|
|
|
for i in "${@}"; do
|
2022-12-06 10:17:27 -05:00
|
|
|
if [[ "$i" =~ ^python ]]; then
|
|
|
|
if ! python3 -c "import ${i#*:}" &> /dev/null ; then
|
|
|
|
dependencies+=("${i%:*}")
|
|
|
|
fi
|
|
|
|
elif ! command -v "$i" > /dev/null 2>&1 ; then
|
2022-07-22 02:20:17 -04:00
|
|
|
dependencies+=("$i")
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ "${#dependencies[@]}" -eq 0 ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo "missing dependencies. Please install the following:"
|
|
|
|
echo
|
|
|
|
for i in "${dependencies[@]}" ; do
|
|
|
|
echo "$i"
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-03-27 02:17:24 -04:00
|
|
|
# Function to open a terminal emulator
|
|
|
|
terminal_emulator() {
|
|
|
|
terminals=(
|
|
|
|
"lxterminal"
|
|
|
|
"mate-terminal"
|
|
|
|
"gnome-terminal"
|
|
|
|
)
|
|
|
|
for i in "${terminals[@]}" ; do
|
|
|
|
if command $i --working-directory="${game%/*}" -e $* ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "No suitable terminal emulators found, please install one of:"
|
|
|
|
for i in "${terminals[@]}" ; do
|
|
|
|
echo "$i"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-03-12 20:07:16 -05:00
|
|
|
# Function to open urls
|
|
|
|
open_url() {
|
2022-03-13 14:39:06 -04:00
|
|
|
xdg-open "${*}" 2> /dev/null
|
2022-03-12 20:07:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# Create desktop launcher file
|
|
|
|
desktop_launcher() {
|
|
|
|
local desktopFile="${HOME}/linux-game-manager.desktop"
|
|
|
|
if [[ -e "${desktopFile}" ]]; then
|
|
|
|
echo "the file ${desktopFile} exists. Cannot create the launcher."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
local dotDesktop
|
|
|
|
local terminal
|
|
|
|
# Try to find an accessible terminal
|
|
|
|
for i in mate-terminal lxterminal terminator gnome-terminal ; do
|
2022-07-22 04:56:18 -04:00
|
|
|
if command -v $i > /dev/null 2>&1 ; then
|
2022-03-12 20:07:16 -05:00
|
|
|
terminal="$i"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
dotDesktop=('[Desktop Entry]'
|
|
|
|
'Name=Linux game manager'
|
|
|
|
'GenericName=Linux game Manager'
|
|
|
|
'Comment=Install and launch games that are accessible to the blind'
|
|
|
|
"Exec=${terminal} -t \"Linux Game Manager\" -e \"/usr/bin/bash -c 'nohup $(readlink -e "$0") 2> /dev/null'\""
|
|
|
|
'Terminal=false'
|
|
|
|
'Type=Application'
|
|
|
|
'StartupNotify=false'
|
|
|
|
'Keywords=game;'
|
|
|
|
'Categories=Game;'
|
|
|
|
'Version=1.0')
|
|
|
|
for i in "${dotDesktop[@]}" ; do
|
|
|
|
echo "$i" >> "${desktopFile}"
|
|
|
|
done
|
|
|
|
desktop-file-install --dir "${HOME}/.local/share/applications" -m 755 "${desktopFile}"
|
|
|
|
xdg-desktop-icon install ~/.local/share/applications/linux-game-manager.desktop
|
|
|
|
rm "${desktopFile}"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
clear_cache() {
|
|
|
|
local answer
|
|
|
|
if [[ ! -d "${cache}" ]]; then
|
|
|
|
echo "No cache found at ${cache}."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
while ! [[ "${answer,,}" =~ ^yes$|^no$ ]]; do
|
|
|
|
echo "This will delete all contents of ${cache}. Are you sure you want to continue?"
|
|
|
|
echo "Please type yes or no."
|
|
|
|
echo
|
|
|
|
read -r answer
|
|
|
|
done
|
|
|
|
if [[ "$answer" == "no" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# All safety checks done. Delete the cache.
|
|
|
|
rm -rfv "${cache}"
|
|
|
|
echo "Cache deleted."
|
|
|
|
}
|
|
|
|
|
|
|
|
download() {
|
|
|
|
local source=($@)
|
|
|
|
for i in "${source[@]}" ; do
|
|
|
|
local dest="${i##*/}"
|
|
|
|
dest="${dest//%20/ }"
|
2022-10-26 17:40:04 -04:00
|
|
|
dest="${dest%\?*}"
|
2022-03-12 20:07:16 -05:00
|
|
|
# Remove the destination file if it is empty.
|
|
|
|
test -s "${cache}/${dest}" || rm -f "${cache}/${dest}" 2> /dev/null
|
|
|
|
if [[ "${redownload}" == "true" ]] && [[ -e "${cache}/${dest}" ]]; then
|
2022-03-13 14:39:06 -04:00
|
|
|
rm -v "${cache}/${dest}"
|
2022-03-12 20:07:16 -05:00
|
|
|
fi
|
|
|
|
# Skip if the item is in cache.
|
|
|
|
test -e "${cache}/${dest}" && continue
|
|
|
|
if ! wget -4 -O "${cache}/${dest}" "${i}" ; then
|
|
|
|
echo "Could not download \"$i\"..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
get_installer() {
|
2022-03-13 14:39:06 -04:00
|
|
|
trap "exit 0" SIGINT
|
|
|
|
# If the file is in cache nothing else needs to be done.
|
|
|
|
if [[ -f "${cache}/$1" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# Create message for dialog.
|
|
|
|
local message="Make sure $1 is available in either your Downloads or Desktop directory and press enter to continue."
|
|
|
|
if [[ -n "$2" ]]; then
|
|
|
|
message+="\n\nThe last good known URL for $game is:"
|
|
|
|
message+="\n$2"
|
|
|
|
fi
|
|
|
|
if echo "$2" | xclip -selection clipboard 2> /dev/null ; then
|
|
|
|
message+="\n\nThe URL has been copied to the clipboard."
|
|
|
|
fi
|
|
|
|
dialog --ok-label "Continue" \
|
|
|
|
--backtitle "Linux Game Manager" \
|
|
|
|
--msgbox "$message" -1 -1
|
|
|
|
# Search the Desktop and Downloads directories for the installation file
|
|
|
|
for i in ~/Downloads ~/Desktop ; do
|
|
|
|
find $i -type f -name "$1" -exec mv -v {} "${cache}/" \;
|
|
|
|
done
|
|
|
|
# If the file is still not available abort.
|
|
|
|
if [[ ! -f "${cache}/$1" ]]; then
|
|
|
|
echo "couldn't find $1. Please download the file and try again."
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-12 20:07:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
help() {
|
|
|
|
echo "${0##*/}"
|
|
|
|
echo "Released under the terms of the Common Public Attribution License Version 1.0"
|
|
|
|
echo -e "This is a Stormux project: https://stormux.org\n"
|
|
|
|
echo -e "Usage:\n"
|
|
|
|
echo "With no arguments, open the game launcher."
|
|
|
|
for i in "${!command[@]}" ; do
|
|
|
|
echo "-${i/:/ <parameter>}: ${command[${i}]}"
|
|
|
|
done | sort
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# main script
|
|
|
|
|
|
|
|
add_launcher() {
|
|
|
|
local launchSettings="${game}|${*}"
|
|
|
|
if ! grep -F -q -x "${launchSettings}" "${configFile}" 2> /dev/null ; then
|
|
|
|
echo "${launchSettings}" >> "${configFile}"
|
|
|
|
sort -o "${configFile}" "${configFile}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Install games
|
|
|
|
game_installer() {
|
2022-03-12 23:02:33 -05:00
|
|
|
mapfile -t installedGames < <(sed '/^$/d' "${configFile}" 2> /dev/null | cut -d '|' -f1)
|
2022-03-12 20:07:16 -05:00
|
|
|
# Create the menu of installed games
|
|
|
|
declare -a menuList
|
|
|
|
for i in "${gameList[@]}" ; do
|
|
|
|
local menuItem="$i"
|
|
|
|
for j in "${installedGames[@]}" ; do
|
|
|
|
if [[ "$j" == "$menuItem" ]]; then
|
|
|
|
unset menuItem
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ -n "$menuItem" ]]; then
|
|
|
|
menuList+=("$menuItem" "$menuItem")
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ ${#menuList[@]} -eq 0 ]]; then
|
|
|
|
echo "All games are already installed."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
menuList+=("Donate" "Donate")
|
|
|
|
game="$(dialog --backtitle "Game Installer" \
|
|
|
|
--clear \
|
|
|
|
--no-tags \
|
|
|
|
--menu "Please select a game to install" 0 0 0 "${menuList[@]}" --stdout)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# launch games that are installed
|
|
|
|
game_launcher() {
|
|
|
|
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null)
|
2022-03-13 14:39:06 -04:00
|
|
|
# Create the menu of installed games
|
|
|
|
declare -a menuList
|
|
|
|
for i in "${lines[@]}" ; do
|
|
|
|
menuList+=("${i#*|}" "${i%|*}")
|
|
|
|
done
|
|
|
|
# Web based games and donation
|
|
|
|
menuList+=("Aliens" "Aliens")
|
2022-08-09 19:27:15 -04:00
|
|
|
menuList+=("Cacophony" "Cacophony")
|
2022-03-23 22:52:59 -04:00
|
|
|
menuList+=("Battle Weary" "Battle Weary")
|
2022-03-15 01:24:46 -04:00
|
|
|
menuList+=("QuentinC Play Room" "QuentinC Play Room")
|
2022-03-14 14:41:18 -04:00
|
|
|
menuList+=("Trigaea" "Trigaea")
|
2022-03-13 14:39:06 -04:00
|
|
|
menuList+=("Donate" "Donate")
|
|
|
|
game="$(dialog --backtitle "Linux Game Launcher" \
|
2022-03-12 20:07:16 -05:00
|
|
|
--clear \
|
|
|
|
--no-tags \
|
|
|
|
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
|
2022-03-13 14:39:06 -04:00
|
|
|
local menuCode=$?
|
|
|
|
if [[ $menuCode -eq 1 ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
2022-03-27 02:17:24 -04:00
|
|
|
# Remove any trailing | from game variable.
|
|
|
|
game="${game%|}"
|
2022-03-13 14:39:06 -04:00
|
|
|
case "${game}" in
|
|
|
|
"Aliens")
|
|
|
|
open_url "https://files.jantrid.net/aliens/"
|
2022-03-13 03:00:13 -04:00
|
|
|
;;
|
2022-03-23 22:52:59 -04:00
|
|
|
"Battle Weary")
|
|
|
|
open_url "https://lonespelunker.itch.io/battle-weary"
|
|
|
|
;;
|
2022-08-09 19:27:15 -04:00
|
|
|
"Cacophony")
|
|
|
|
open_url "https://tianmaru.itch.io/cacophony"
|
|
|
|
;;
|
2022-03-15 01:24:46 -04:00
|
|
|
"QuentinC Play Room")
|
|
|
|
open_url "https://qcsalon.net/"
|
|
|
|
;;
|
2022-03-14 14:41:18 -04:00
|
|
|
"Trigaea")
|
|
|
|
open_url "https://ryngm.itch.io/trigaea"
|
|
|
|
;;
|
2022-03-13 14:39:06 -04:00
|
|
|
"Donate")
|
|
|
|
open_url "https://ko-fi.com/stormux"
|
2022-03-17 18:12:18 -04:00
|
|
|
;;
|
2022-03-27 02:17:24 -04:00
|
|
|
*".tin")
|
2022-03-27 02:56:41 -04:00
|
|
|
git -C "${game%/*}" pull | \
|
|
|
|
dialog --progressbox "Checking for updates, please wait..." -1 -1
|
2022-03-27 02:17:24 -04:00
|
|
|
if [[ -n "${COLORTERM}" ]]; then
|
|
|
|
terminal_emulator tt++ ${game##*/}
|
|
|
|
else
|
2022-03-27 02:56:41 -04:00
|
|
|
pushd "${game%/*}"
|
2022-03-27 02:17:24 -04:00
|
|
|
exec tt++ ${game##*/}
|
|
|
|
fi
|
|
|
|
;;
|
2022-11-05 17:53:48 -04:00
|
|
|
*doom*)
|
|
|
|
exec ${game}
|
|
|
|
;;
|
2022-12-06 02:31:28 -05:00
|
|
|
*"main.py")
|
|
|
|
pushd "${game%/*}"
|
2022-12-08 13:40:44 -05:00
|
|
|
git pull -q
|
2022-12-06 02:31:28 -05:00
|
|
|
python3 ${game}
|
|
|
|
;;
|
2022-03-17 18:12:18 -04:00
|
|
|
*)
|
|
|
|
pushd "${game%/*}"
|
2022-03-27 02:17:24 -04:00
|
|
|
exec ${game}
|
2022-03-13 00:55:04 -05:00
|
|
|
;;
|
2022-03-13 14:39:06 -04:00
|
|
|
esac
|
2022-03-17 18:12:18 -04:00
|
|
|
exit 0
|
2022-03-12 20:07:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# If display isn't set assume we are launching from console and an X environment is running using display :0
|
2022-03-13 01:49:04 -05:00
|
|
|
# Warning, launching games from console is not recommended.
|
2022-03-12 20:07:16 -05:00
|
|
|
if [[ -z "$DISPLAY" ]]; then
|
|
|
|
export DISPLAY=":0"
|
|
|
|
fi
|
|
|
|
# Settings file
|
|
|
|
cache="${XDG_CACHE_HOME:-$HOME/.cache}/linux-game-manager"
|
|
|
|
configFile="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/linux-game-manager/games.conf"
|
|
|
|
mkdir -p "${cache}"
|
|
|
|
mkdir -p "${configFile%/*}"
|
|
|
|
# Load any arguments from settings.conf file
|
|
|
|
if [[ -r "${configFile%/*}/settings.conf" ]]; then
|
|
|
|
source "${configFile%/*}/settings.conf"
|
|
|
|
fi
|
|
|
|
unset noCache
|
|
|
|
|
|
|
|
# The list of games available for installation.
|
|
|
|
# Use menu friendly names.
|
|
|
|
gameList=(
|
2022-03-13 00:55:04 -05:00
|
|
|
"Aliens"
|
2022-03-27 02:56:41 -04:00
|
|
|
"Alter Aeon"
|
2022-03-13 17:03:21 -04:00
|
|
|
"Audo"
|
2022-03-22 14:27:45 -04:00
|
|
|
"Auroboros"
|
2022-03-23 22:52:59 -04:00
|
|
|
"Battle Weary"
|
2022-03-13 16:47:20 -04:00
|
|
|
"Bladius"
|
2022-08-09 19:27:15 -04:00
|
|
|
"Cacophony"
|
2022-03-14 12:40:17 -04:00
|
|
|
"Chimera"
|
2022-08-09 18:58:25 -04:00
|
|
|
"Echo Command"
|
2022-03-12 23:52:34 -05:00
|
|
|
"E.X.O."
|
2022-03-27 02:56:41 -04:00
|
|
|
"EmpireMUD"
|
2022-07-12 14:41:29 -04:00
|
|
|
"End of Time"
|
2022-03-12 20:07:16 -05:00
|
|
|
"Fantasy Story II"
|
2022-10-26 17:40:04 -04:00
|
|
|
"Freedoom"
|
2022-03-13 14:39:06 -04:00
|
|
|
"Monkey Spank"
|
2022-03-13 03:46:12 -04:00
|
|
|
"Numnastics"
|
2022-03-16 13:53:13 -04:00
|
|
|
"Onslaught"
|
2022-03-27 02:17:24 -04:00
|
|
|
"QuentinC Play Room"
|
2022-08-29 22:36:40 -04:00
|
|
|
"Periphery Synthetic EP"
|
2022-03-12 23:52:34 -05:00
|
|
|
"S.E.A."
|
2022-12-06 02:31:28 -05:00
|
|
|
"Slay the Text"
|
2022-09-02 21:47:01 -04:00
|
|
|
"SoundRTS"
|
2022-03-12 21:39:38 -05:00
|
|
|
"soundStrider"
|
2022-03-27 02:17:24 -04:00
|
|
|
"StickMUD"
|
2022-03-15 16:12:50 -04:00
|
|
|
"System Fault"
|
2022-03-14 14:41:18 -04:00
|
|
|
"Trigaea"
|
2022-03-14 12:40:17 -04:00
|
|
|
"Wurmus"
|
2022-03-12 20:07:16 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
# Check for required packages
|
|
|
|
requiredPackages=(
|
|
|
|
"curl"
|
2022-03-12 21:39:38 -05:00
|
|
|
"dialog"
|
2022-03-12 20:07:16 -05:00
|
|
|
"unzip"
|
|
|
|
"wget"
|
|
|
|
)
|
2022-03-15 00:38:09 -04:00
|
|
|
for i in "${requiredPackages[@]}" ; do
|
2022-07-22 04:56:18 -04:00
|
|
|
if ! command -v $i > /dev/null 2>&1 ; then
|
2022-03-12 20:07:16 -05:00
|
|
|
echo "Please install $i before continuing."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
2022-03-13 01:42:35 -05:00
|
|
|
check_update
|
2022-03-12 20:07:16 -05:00
|
|
|
# With no arguments, open the game launcher.
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
game_launcher
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Array of command line arguments
|
|
|
|
declare -A command=(
|
|
|
|
[C]="Clear the cache. All game installers will be deleted."
|
|
|
|
[D]="Create desktop shortcut. You can launch Linux Game Manager from the desktop or applications menu."
|
|
|
|
[h]="This help screen."
|
|
|
|
[i]="Install games."
|
|
|
|
[L]="Display license information."
|
|
|
|
[N]="No cache, delete the installer after it has been extracted."
|
|
|
|
[R]="Redownload. Removes old versions of packages from cache before installing."
|
2022-03-12 23:59:55 -05:00
|
|
|
[t]="Total games. Show how many games are currently available."
|
2022-03-12 20:07:16 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
# Convert the keys of the associative array to a format usable by getopts
|
|
|
|
args="${!command[*]}"
|
|
|
|
args="${args//[[:space:]]/}"
|
|
|
|
while getopts "${args}" i ; do
|
|
|
|
case "$i" in
|
2022-03-13 14:39:06 -04:00
|
|
|
C) clear_cache ;;
|
|
|
|
D) desktop_launcher ;;
|
|
|
|
h) help ;;
|
|
|
|
i) game_installer ;;
|
|
|
|
L) license ;;
|
|
|
|
N) noCache="true" ;;
|
|
|
|
R) redownload="true" ;;
|
2022-03-12 23:59:55 -05:00
|
|
|
t)
|
|
|
|
dialog --backtitle "Linux Game Manager" \
|
|
|
|
--infobox "There are currently ${#gameList[@]} games available." -1 -1
|
2022-03-15 02:16:52 -04:00
|
|
|
exit 0
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-12 20:07:16 -05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Install game based on the selection above.
|
|
|
|
installPath="${HOME}/.local/games"
|
|
|
|
mkdir -p "${installPath}"
|
|
|
|
case "${game}" in
|
2022-08-09 19:27:15 -04:00
|
|
|
"Aliens"|"Battle Weary"|"Cacophony"|"QuentinC Play Room"|"Trigaea")
|
2022-03-13 00:55:04 -05:00
|
|
|
dialog --backtitle "Linux Game manager" \
|
|
|
|
--infobox "${game} is a web based game and does not need to be installed." -1 -1
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-27 02:56:41 -04:00
|
|
|
"Alter Aeon")
|
2022-07-22 02:20:17 -04:00
|
|
|
check_dependencies git sox tt++
|
2022-03-27 02:56:41 -04:00
|
|
|
git -C "${installPath}/" clone --recurse-submodules https://github.com/lilmike/tintin-alteraeon.git | \
|
|
|
|
dialog --progressbox "Installing \"${game}\", please wait..." -1 -1
|
|
|
|
add_launcher "${installPath}/tintin-alteraeon/aa.tin"
|
|
|
|
;;
|
2022-03-13 17:03:21 -04:00
|
|
|
"Audo")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-13 17:03:21 -04:00
|
|
|
get_installer "Audo-linux-x64.zip" "https://shiftbacktick.itch.io/audo"
|
|
|
|
mkdir -p "${installPath}/Audo"
|
|
|
|
unzip -d "${installPath}/Audo" "${cache}/Audo-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/Audo/Audo"
|
|
|
|
;;
|
2022-03-22 14:27:45 -04:00
|
|
|
"Auroboros")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-22 14:27:45 -04:00
|
|
|
get_installer "Auroboros-linux-x64.zip" "https://shiftbacktick.itch.io/auroboros"
|
|
|
|
mkdir -p "${installPath}/Auroboros"
|
|
|
|
unzip -d "${installPath}/Auroboros" "${cache}/Auroboros-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/Auroboros/Auroboros"
|
2022-03-14 12:45:27 -04:00
|
|
|
;;
|
2022-03-13 16:47:20 -04:00
|
|
|
"Bladius")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-13 16:47:20 -04:00
|
|
|
get_installer "Bladius-linux-x64.zip" "https://shiftbacktick.itch.io/bladius"
|
|
|
|
mkdir -p "${installPath}/Bladius"
|
|
|
|
unzip -d "${installPath}/Bladius" "${cache}/Bladius-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/Bladius/Bladius"
|
|
|
|
;;
|
2022-03-14 12:40:17 -04:00
|
|
|
"Chimera")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-14 12:40:17 -04:00
|
|
|
get_installer "Chimera-linux-x64.zip" "https://shiftbacktick.itch.io/chimera"
|
|
|
|
mkdir -p "${installPath}/Chimera"
|
|
|
|
unzip -d "${installPath}/Chimera" "${cache}/Chimera-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/Chimera/Chimera"
|
|
|
|
;;
|
2022-08-09 18:58:25 -04:00
|
|
|
"Echo Command")
|
|
|
|
check_architecture x86_64
|
|
|
|
get_installer "Echo Command.tar.xz" "https://pancakedev.itch.io/echo-command"
|
|
|
|
mkdir -p "${installPath}/Echo-Command"
|
|
|
|
tar xf "${cache}/Echo Command.tar.xz" -C "${installPath}/Echo-Command"
|
|
|
|
ln -sr "${installPath}/Echo-Command/Echo Command.x86_64" "${installPath}/Echo-Command/Echo_Command.x86_64"
|
|
|
|
add_launcher "${installPath}/Echo-Command/Echo_Command.x86_64"
|
|
|
|
;;
|
2022-03-12 23:52:34 -05:00
|
|
|
"E.X.O.")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-12 23:52:34 -05:00
|
|
|
get_installer "EXO-linux-x64.zip" "https://shiftbacktick.itch.io/exo"
|
|
|
|
mkdir -p "${installPath}/E.X.O."
|
|
|
|
unzip -d "${installPath}/E.X.O." "${cache}/EXO-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/E.X.O./EXO"
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-27 02:56:41 -04:00
|
|
|
"EmpireMUD")
|
2022-07-22 02:20:17 -04:00
|
|
|
check_dependencies git sox tt++
|
2022-03-27 02:56:41 -04:00
|
|
|
git -C "${installPath}/" clone --recurse-submodules https://github.com/lilmike/tintin-empiremud.git | \
|
|
|
|
dialog --progressbox "Installing \"${game}\", please wait..." -1 -1
|
|
|
|
add_launcher "${installPath}/tintin-empiremud/em.tin"
|
|
|
|
;;
|
2022-07-12 14:41:29 -04:00
|
|
|
"End of Time")
|
2022-07-22 02:20:17 -04:00
|
|
|
check_dependencies git opusdec sox tt++
|
2022-07-12 14:41:29 -04:00
|
|
|
git -C "${installPath}/" clone https://git.2mb.codes/~stormdragon2976/tintin-endoftime | \
|
|
|
|
dialog --progressbox "Installing \"${game}\", please wait..." -1 -1
|
|
|
|
add_launcher "${installPath}/tintin-endoftime/eot.tin"
|
|
|
|
;;
|
2022-03-12 20:07:16 -05:00
|
|
|
"Fantasy Story II")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-12 20:07:16 -05:00
|
|
|
get_installer "FS2_2.6_Linux.zip" "https://drive.google.com/file/d/187OaD1HhPoty85yJafZyvfqD5_G3P04c/view?usp=sharing"
|
2022-03-12 21:39:38 -05:00
|
|
|
unzip -d "${installPath}" "${cache}/FS2_2.6_Linux.zip"
|
2022-03-12 20:07:16 -05:00
|
|
|
chmod +x "${installPath}/FS2_2.6_Linux/FS2.x86_64"
|
|
|
|
add_launcher "${installPath}/FS2_2.6_Linux/FS2.x86_64" "-ESpeakApplication=espeak-ng"
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-10-26 17:40:04 -04:00
|
|
|
"Freedoom")
|
2022-11-05 17:03:33 -04:00
|
|
|
doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null)"
|
|
|
|
if [[ ${#doomPath} -lt 5 ]]; then
|
2022-10-26 17:40:04 -04:00
|
|
|
dialog --backtitle "Linux Game Manager" \
|
|
|
|
--yesno "Do you want Linux Game Manager to install freedoom and gzdoom for you? If you want to do this manually, select no." -1 -1 --stdout || exit 0
|
|
|
|
if command -v yay &> /dev/null ; then
|
2022-10-26 17:42:24 -04:00
|
|
|
yay -Sy --noconfirm --sudoloop freedoom gzdoom
|
2022-10-27 15:58:38 -04:00
|
|
|
elif command -v slapt-get &> /dev/null ; then
|
2022-10-27 17:02:25 -04:00
|
|
|
su -c 'slapt-get -i freedoom gzdoom'
|
2022-11-05 15:30:12 -04:00
|
|
|
elif command -v dnf &> /dev/null ; then
|
2022-11-05 21:32:47 -04:00
|
|
|
sudo dnf copr -y enable nalika/gzdoom
|
2022-11-05 17:17:11 -04:00
|
|
|
sudo dnf -q -y install freedoom
|
|
|
|
sudo dnf -q -y install gzdoom
|
2022-10-26 17:40:04 -04:00
|
|
|
else
|
|
|
|
dialog --backtitle "Linux Game Manager" --msgbox "No supported package managers found. Please install the freedoom and gzdoom packages manually." -1 -1
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
2022-11-05 17:44:10 -04:00
|
|
|
doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)"
|
2022-11-01 16:23:45 -04:00
|
|
|
download "https://www.dropbox.com/s/rsswh6m8hhjwp7g/Toby%20Acc%20Mod%20V5-1%20Update%20Fix.zip?dl=0" "https://www.dropbox.com/s/zzi4x9y6rg9yvja/TobyDoom2Deluxe_LevelsOnly.zip?dl=0"
|
2022-11-05 16:15:01 -04:00
|
|
|
if [[ ! -e "${doomPath}/TobyDeluxeMapPack_V5-1.pk3" ]]; then
|
|
|
|
if sudo unzip -d "${doomPath}" "${cache}/Toby Acc Mod V5-1 Update Fix.zip" ; then
|
|
|
|
sudo unzip -d "${doomPath}" "${cache}/TobyDoom2Deluxe_LevelsOnly.zip"
|
2022-10-26 17:40:04 -04:00
|
|
|
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom"
|
2022-11-05 16:15:01 -04:00
|
|
|
cp "${doomPath}/gzdoom.ini" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/"
|
|
|
|
grep -qx "Path=${doomPath}" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini" || \
|
|
|
|
sed -i "s;^\[IWADSearch.Directories\]$;[IWADSearch.Directories]\nPath=${doomPath};" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
|
2022-10-27 17:08:04 -04:00
|
|
|
sed -i 's/Mouse1=+attack/Control+=attack/' "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
|
2022-10-26 17:40:04 -04:00
|
|
|
else
|
|
|
|
dialog --backtitle "Linux Game Manager" \
|
2022-11-05 16:49:16 -04:00
|
|
|
--msgbox "Unable to extract files to ${doomPath}. Please extract ${cache}/Toby Acc Mod V5-1 Update Fix.zip manually." -1 -1 --stdout
|
2022-10-26 17:40:04 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2022-11-05 16:15:01 -04:00
|
|
|
add_launcher "$(command -v gzdoom) ${doomPath}/TobyAccModV5-1.pk3"
|
2022-10-26 17:40:04 -04:00
|
|
|
# Add in the Toby Mod Delux option
|
|
|
|
game="Freedoom Toby Mod Delux"
|
2022-11-05 16:15:01 -04:00
|
|
|
add_launcher "$(command -v gzdoom) ${doomPath}/TobyDeluxeMapPack_V5-1.pk3"
|
2022-11-01 16:23:45 -04:00
|
|
|
# Add in the Toby Mod Delux 2 option
|
|
|
|
game="Freedoom Toby Mod Delux 2"
|
2022-11-05 16:15:01 -04:00
|
|
|
add_launcher "$(command -v gzdoom) ${doomPath}/TobyD2Deluxe.pk3"
|
2022-10-26 17:40:04 -04:00
|
|
|
;;
|
2022-03-13 14:39:06 -04:00
|
|
|
"Monkey Spank")
|
2022-12-08 13:40:44 -05:00
|
|
|
check_dependencies python-pygame:pygame python-xdg:xdg python-pyperclip:pyperclip python-requests:requests python-setproctitle:setproctitle
|
2022-03-13 14:39:06 -04:00
|
|
|
git -C "${installPath}" clone --recurse-submodules https://gitlab.com/stormdragon2976/monkeyspank.git
|
|
|
|
add_launcher "${installPath}/monkeyspank/monkeyspank"
|
|
|
|
;;
|
2022-03-13 03:46:12 -04:00
|
|
|
"Numnastics")
|
2022-12-08 13:40:44 -05:00
|
|
|
check_dependencies python-pygame:pygame python-xdg:xdg python-pyperclip:pyperclip python-requests:requests python-setproctitle:setproctitle
|
2022-03-13 03:46:12 -04:00
|
|
|
git -C "${installPath}" clone --recurse-submodules https://gitlab.com/stormdragon2976/numnastics.git
|
|
|
|
add_launcher "${installPath}/numnastics/numnastics"
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-16 13:53:13 -04:00
|
|
|
"Onslaught")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-16 13:53:13 -04:00
|
|
|
get_installer "onslaught.AppImage" "https://lightsoutgames.itch.io/onslaught"
|
|
|
|
mkdir -p "${installPath}/Onslaught"
|
|
|
|
cp -v "${cache}/onslaught.AppImage" "${installPath}/Onslaught/onslaught.AppImage"
|
|
|
|
chmod +x "${installPath}/Onslaught/onslaught.AppImage"
|
|
|
|
add_launcher "${installPath}/Onslaught/onslaught.AppImage"
|
|
|
|
;;
|
2022-08-29 22:36:40 -04:00
|
|
|
"Periphery Synthetic EP")
|
|
|
|
check_architecture x86_64
|
|
|
|
get_installer "periphery-synthetic-ep-linux-x64.zip" "https://shiftbacktick.itch.io/periphery-synthetic-ep"
|
|
|
|
mkdir -p "${installPath}/periphery-synthetic-ep"
|
|
|
|
unzip -d "${installPath}/periphery-synthetic-ep" "${cache}/periphery-synthetic-ep-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/periphery-synthetic-ep/periphery-synthetic-ep"
|
|
|
|
;;
|
2022-03-12 23:52:34 -05:00
|
|
|
"S.E.A.")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-12 23:52:34 -05:00
|
|
|
get_installer "SEA-linux-x64.zip" "https://shiftbacktick.itch.io/sea"
|
|
|
|
mkdir -p "${installPath}/S.E.A."
|
|
|
|
unzip -d "${installPath}/S.E.A." "${cache}/SEA-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/S.E.A./SEA"
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-12-06 02:31:28 -05:00
|
|
|
"Slay the Text")
|
2022-12-06 10:17:27 -05:00
|
|
|
check_dependencies python-ansimarkup:ansimarkup
|
2022-12-06 02:31:28 -05:00
|
|
|
git -C "${installPath}/" clone https://github.com/Difio3333/slaythetext.git | \
|
|
|
|
dialog --progressbox "Installing \"${game}\", please wait..." -1 -1
|
|
|
|
add_launcher "${installPath}/slaythetext/main.py"
|
|
|
|
;;
|
2022-09-02 21:47:01 -04:00
|
|
|
"SoundRTS")
|
2022-12-06 10:17:27 -05:00
|
|
|
check_dependencies pip3
|
2022-09-02 21:47:01 -04:00
|
|
|
mkdir -p "${installPath}"
|
|
|
|
git -C "${installPath}" clone "https://github.com/soundmud/soundrts.git"
|
2022-09-09 08:53:33 -04:00
|
|
|
git -C "${installPath}/soundrts" checkout v1.3.5
|
2022-09-02 21:47:01 -04:00
|
|
|
sed -i 's;git+https://github.com/soundmud/accessible_output2;accessible_output2;' "${installPath}/soundrts/requirements.txt"
|
|
|
|
pip3 install --user -r "${installPath}/soundrts/requirements.txt"
|
|
|
|
chmod +x "${installPath}/soundrts/soundrts.py"
|
|
|
|
sed -i '1c\#!/usr/bin/env python3' "${installPath}/soundrts/soundrts.py"
|
|
|
|
add_launcher "${installPath}/soundrts/soundrts.py"
|
|
|
|
;;
|
2022-03-12 21:39:38 -05:00
|
|
|
"soundStrider")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-12 21:39:38 -05:00
|
|
|
get_installer "soundStrider-linux-x64.zip" "https://shiftbacktick.itch.io/soundstrider"
|
|
|
|
mkdir -p "${installPath}/soundStrider"
|
|
|
|
unzip -d "${installPath}/soundStrider" "${cache}/soundStrider-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/soundStrider/soundStrider"
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-27 02:17:24 -04:00
|
|
|
"StickMUD")
|
2022-07-22 02:20:17 -04:00
|
|
|
check_dependencies git sox tt++
|
2022-03-27 02:17:24 -04:00
|
|
|
git -C "${installPath}/" clone --recurse-submodules https://github.com/stormdragon2976/tintin-stickmud.git | \
|
|
|
|
dialog --progressbox "Installing \"${game}\", please wait..." -1 -1
|
|
|
|
add_launcher "${installPath}/tintin-stickmud/stickmud.tin"
|
|
|
|
;;
|
2022-03-15 16:09:54 -04:00
|
|
|
"System Fault")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-15 16:09:54 -04:00
|
|
|
get_installer "system-fault-linux-x86_64.AppImage" "https://lightsoutgames.itch.io/systemfault"
|
2022-03-15 16:35:53 -04:00
|
|
|
mkdir -p "${installPath}/System_Fault"
|
|
|
|
cp -v "${cache}/system-fault-linux-x86_64.AppImage" "${installPath}/System_Fault/system-fault-linux-x86_64.AppImage"
|
|
|
|
chmod +x "${installPath}/System_Fault/system-fault-linux-x86_64.AppImage"
|
|
|
|
add_launcher "${installPath}/System_Fault/system-fault-linux-x86_64.AppImage"
|
2022-03-15 16:09:54 -04:00
|
|
|
;;
|
2022-03-14 12:40:17 -04:00
|
|
|
"Wurmus")
|
2022-03-27 13:56:35 -04:00
|
|
|
check_architecture x86_64
|
2022-03-14 12:40:17 -04:00
|
|
|
get_installer "Wurmus-linux-x64.zip" "https://shiftbacktick.itch.io/wurmus"
|
|
|
|
mkdir -p "${installPath}/Wurmus"
|
|
|
|
unzip -d "${installPath}/Wurmus" "${cache}/Wurmus-linux-x64.zip"
|
|
|
|
add_launcher "${installPath}/Wurmus/Wurmus"
|
|
|
|
;;
|
2022-03-12 20:07:16 -05:00
|
|
|
"Donate")
|
|
|
|
open_url "https://ko-fi.com/stormux"
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-12 20:07:16 -05:00
|
|
|
*)
|
|
|
|
[[ -n "${game}" ]] && echo "Game \"${game}\" not found."
|
|
|
|
exit 1
|
2022-03-13 14:39:06 -04:00
|
|
|
;;
|
2022-03-12 20:07:16 -05:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|