Started work on a function to get games from Steam.
This commit is contained in:
parent
07d81e6a74
commit
5273d7c552
@ -415,6 +415,38 @@ get_installer() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_steam() {
|
||||
# Arguments: $1 name of item for download, $2 url for game
|
||||
trap "exit 0" SIGINT
|
||||
# Check for steamcmd
|
||||
if ! command -v steamcmd &> /dev/null ; then
|
||||
dialog --backtitle "Audiogame Manager" \
|
||||
--infobox "This installer requires steamcmd. Please install steamcmd and try again." -1 -1
|
||||
exit 1
|
||||
fi
|
||||
# Get Steam user name.
|
||||
steamUser="$(dialog --ok-label "Continue" \
|
||||
--backtitle "Audiogame Manager" \
|
||||
--inputbox "Please enter your Steam user name:" -1 -1)"
|
||||
# Create message for dialog.
|
||||
local message="Make sure ${game} is available in your Steam library and press enter to continue. The URL for ${game} is $2"
|
||||
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 "Audiogame Manager" \
|
||||
--msgbox "$message" -1 -1
|
||||
# Download the game
|
||||
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "$HOME/.local/wine/$bottle/drive_c/Program Files/" +login "$steamUser" +app_update "$1" +quit || { dialog --backtitle "Audiogame Manager" \
|
||||
--infobox "Something went wrong. Please make sure you have a stable internet connection, and if the problem persists, contact audiogame-manager's developers." -1 -1
|
||||
exit 1; }
|
||||
# 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
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "${0##*/}"
|
||||
echo "Released under the terms of the Common Public Attribution License Version 1.0"
|
||||
|
Loading…
Reference in New Issue
Block a user