Add progress bars to some more operations, e.g. installing games. This required a bulk edit to all installer scripts, thanks Claud for the assist. Oh and send downloads through a progressbar.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Alerts, for when user needs to read something.
|
||||
alert() {
|
||||
play -qnV0 synth 3 pluck D3 pluck A3 pluck D4 pluck F4 pluck A4 delay 0 .1 .2 .3 .4 remix - chorus 0.9 0.9 38 0.75 0.3 0.5 -t
|
||||
@@ -51,10 +53,10 @@ download() {
|
||||
fi
|
||||
# Skip if the item is in cache.
|
||||
[[ -e "${cache}/${dest}" ]] && continue
|
||||
{ if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" ; then
|
||||
echo "Could not download \"$i\"..."
|
||||
if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" 2>&1 | agm_progressbox "Audio Game Manager" "Downloading \"$dest\"..."; then
|
||||
agm_infobox "Audio Game Manager" "Audio Game Manager" "Could not download \"$dest\". Installation cannot continue."
|
||||
exit 1
|
||||
fi; } | agm_progressbox "Audio Game Manager" "Downloading \"$dest\" from \"$i\""
|
||||
fi
|
||||
local downloadError=1
|
||||
case "${dest##*.}" in
|
||||
"pk3"|"zip")
|
||||
@@ -173,3 +175,29 @@ unix2dos() {
|
||||
sed -i 's/\r\{0,\}$/\r/' "$file"
|
||||
done
|
||||
}
|
||||
|
||||
# Progress wrapper for game installation operations
|
||||
install_with_progress() {
|
||||
local operation="$1"
|
||||
local message="$2"
|
||||
shift 2
|
||||
|
||||
case "$operation" in
|
||||
"unzip")
|
||||
unzip "$@" | agm_progressbox "Game Installation" "$message"
|
||||
;;
|
||||
"7z")
|
||||
7z "$@" | agm_progressbox "Game Installation" "$message"
|
||||
;;
|
||||
"cp"|"copy")
|
||||
cp -v "$@" | agm_progressbox "Game Installation" "$message"
|
||||
;;
|
||||
"find")
|
||||
find "$@" | agm_progressbox "Game Installation" "$message"
|
||||
;;
|
||||
*)
|
||||
# Default: run command with progress box
|
||||
"$operation" "$@" | agm_progressbox "Game Installation" "$message"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
Reference in New Issue
Block a user