Added yad dialogues if in GUI session, retains the dialog interface if in console.
This commit is contained in:
@ -59,18 +59,15 @@ download() {
|
||||
{ if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" ; then
|
||||
echo "Could not download \"$i\"..."
|
||||
exit 1
|
||||
fi; } | dialog --backtitle "Audio Game Manager" \
|
||||
--progressbox "Downloading \"$dest\" from \"$i\"" -1 -1
|
||||
fi; } | agm_progressbox "Audio Game Manager" "Downloading \"$dest\" from \"$i\""
|
||||
local downloadError=1
|
||||
case "${dest##*.}" in
|
||||
"pk3"|"zip")
|
||||
unzip -tq "${cache}/${dest}" | dialog --backtitle "Audio Game Manager" \
|
||||
--progressbox "Validating ${dest##*.} file" -1 -1 --stdout
|
||||
unzip -tq "${cache}/${dest}" | agm_progressbox "Audio Game Manager" "Validating ${dest##*.} file"
|
||||
downloadError=$?
|
||||
;;
|
||||
"7z")
|
||||
7z t "${cache}/${dest}" | dialog --backtitle "Audio Game Manager" \
|
||||
--progressbox "Validating 7z file" -1 -1 --stdout
|
||||
7z t "${cache}/${dest}" | agm_progressbox "Audio Game Manager" "Validating 7z file"
|
||||
downloadError=$?
|
||||
;;
|
||||
"exe")
|
||||
@ -95,8 +92,7 @@ download() {
|
||||
esac
|
||||
if [[ $downloadError -ne 0 ]]; then
|
||||
rm -fv "${cache}/${dest}"
|
||||
dialog --backtitle "Audio Game Manager" \
|
||||
--infobox "Error downloading \"${dest}\". Installation cannot continue." -1 -1 --stdout
|
||||
agm_infobox "Audio Game Manager" "Audio Game Manager" "Error downloading \"${dest}\". Installation cannot continue."
|
||||
alert
|
||||
exit 1
|
||||
fi
|
||||
@ -118,9 +114,7 @@ get_installer() {
|
||||
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
|
||||
agm_msgbox "Audiogame Manager" "Audiogame Manager" "$message"
|
||||
# Search the Desktop and Downloads directories for the installation file
|
||||
for i in ~/Downloads ~/Desktop ; do
|
||||
find $i -type f -name "$1" -exec cp -v {} "${cache}/" \;
|
||||
@ -137,26 +131,19 @@ get_steam() {
|
||||
trap "exit 0" SIGINT
|
||||
echo "manual intervention required."
|
||||
alert
|
||||
dialog --backtitle "Audiogame Manager" \
|
||||
--yes-label "Continue with Steam" \
|
||||
--no-label "Install manually" \
|
||||
--extra-button \
|
||||
--extra-label "Exit" \
|
||||
--yesno "To install the game manually, place files in \"${WINEPREFIX}/drive_c/Program Files/${game}\"" -1 -1 --stdout
|
||||
agm_yesno "Audiogame Manager" "Audiogame Manager" "To install the game manually, place files in \"${WINEPREFIX}/drive_c/Program Files/${game}\". Continue with Steam installation?"
|
||||
case $? in
|
||||
0) echo "The next steps will install through steamcmd." ;;
|
||||
1)
|
||||
mkdir -p "${WINEPREFIX}/drive_c/Program Files/${game}"
|
||||
dialog --backtitle "Audiogame Manager" \
|
||||
--msgbox "Place game files in \"${WINEPREFIX}/drive_c/Program Files/${game}\" and press enter to continue." -1 -1 --stdout
|
||||
agm_msgbox "Audiogame Manager" "Audiogame Manager" "Place game files in \"${WINEPREFIX}/drive_c/Program Files/${game}\" and press enter to continue."
|
||||
return
|
||||
;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
# 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
|
||||
agm_infobox "Audiogame Manager" "Audiogame Manager" "This installer requires steamcmd. Please install steamcmd and try again."
|
||||
exit 1
|
||||
fi
|
||||
# Create message for dialog.
|
||||
@ -164,17 +151,12 @@ get_steam() {
|
||||
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
|
||||
agm_msgbox "Audiogame Manager" "Audiogame Manager" "$message"
|
||||
# Get Steam user name.
|
||||
steamUser="$(dialog --ok-label "Continue" \
|
||||
--backtitle "Audiogame Manager" \
|
||||
--inputbox "Please enter your Steam user name:" -1 -1 --stdout)"
|
||||
steamUser="$(agm_inputbox "Audiogame Manager" "Audiogame Manager" "Please enter your Steam user name:" "")"
|
||||
# Download the game
|
||||
mkdir -p "${WINEPREFIX}/drive_c/Program Files/${game}"
|
||||
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "${WINEPREFIX}/drive_c/Program Files/$game" +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
|
||||
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "${WINEPREFIX}/drive_c/Program Files/$game" +login "$steamUser" +app_update "$1" +quit || { agm_infobox "Audiogame Manager" "Audiogame Manager" "Something went wrong. Please make sure you have a stable internet connection, and if the problem persists, contact audiogame-manager's developers."
|
||||
exit 1; }
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user