More improvements to progress bars. Hopefully fixed a bug that was causing games to install twice.
This commit is contained in:
@@ -226,40 +226,30 @@ agm_progressbox() {
|
|||||||
local text="$2"
|
local text="$2"
|
||||||
|
|
||||||
if [[ "$dialogType" == "yad" ]]; then
|
if [[ "$dialogType" == "yad" ]]; then
|
||||||
# Use a text-info dialog with improved real-time output display
|
# Use accessible form approach without temp files
|
||||||
# Force line buffering and use named pipe for better responsiveness
|
# Process command output first to get summary info
|
||||||
local tmpPipe
|
local lineCount=0
|
||||||
tmpPipe=$(mktemp -u)
|
local lastLine="Starting..."
|
||||||
mkfifo "$tmpPipe"
|
local allOutput=""
|
||||||
|
|
||||||
# Start yad in background reading from the pipe
|
# Collect output while command runs
|
||||||
yad --text-info \
|
while IFS= read -r line; do
|
||||||
|
((lineCount++))
|
||||||
|
lastLine="$line"
|
||||||
|
allOutput="${allOutput}${line}\n"
|
||||||
|
done < <(stdbuf -oL cat)
|
||||||
|
|
||||||
|
# Show completion dialog with accessible summary
|
||||||
|
yad --form \
|
||||||
--title="$title" \
|
--title="$title" \
|
||||||
--text="$text" \
|
--field="$text - Completed:LBL" \
|
||||||
--width=600 \
|
--field="Total steps: $lineCount:LBL" \
|
||||||
--height=400 \
|
--field="Last action::LBL" \
|
||||||
--timeout=1 \
|
--field="$lastLine:RO" \
|
||||||
--timeout-indicator=bottom \
|
--selectable-labels \
|
||||||
--button="Close:0" \
|
--button="OK:0" \
|
||||||
--tail \
|
--width=500 \
|
||||||
--auto-scroll \
|
--height=200
|
||||||
--filename="$tmpPipe" &
|
|
||||||
local yadPid=$!
|
|
||||||
|
|
||||||
# Process input and write to pipe with unbuffered output
|
|
||||||
{
|
|
||||||
stdbuf -oL cat
|
|
||||||
echo "=== Operation completed ==="
|
|
||||||
} > "$tmpPipe" &
|
|
||||||
local catPid=$!
|
|
||||||
|
|
||||||
# Wait for either process to finish
|
|
||||||
wait $catPid 2>/dev/null
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
sleep 1 # Brief pause to ensure yad displays the completion message
|
|
||||||
kill $yadPid 2>/dev/null
|
|
||||||
rm -f "$tmpPipe"
|
|
||||||
else
|
else
|
||||||
dialog --title "$title" \
|
dialog --title "$title" \
|
||||||
--progressbox "$text" 20 70
|
--progressbox "$text" 20 70
|
||||||
|
@@ -526,6 +526,7 @@ while getopts "${args}" i ; do
|
|||||||
i) game_installer;;
|
i) game_installer;;
|
||||||
I)
|
I)
|
||||||
export game="${OPTARG}"
|
export game="${OPTARG}"
|
||||||
|
export noninteractiveInstall="true"
|
||||||
break;;
|
break;;
|
||||||
k) kill_game;;
|
k) kill_game;;
|
||||||
L) license;;
|
L) license;;
|
||||||
@@ -552,7 +553,9 @@ done
|
|||||||
# If agmNoLaunch is set, exit (script is being sourced)
|
# If agmNoLaunch is set, exit (script is being sourced)
|
||||||
[[ "$agmNoLaunch" == "true" ]] && exit 0
|
[[ "$agmNoLaunch" == "true" ]] && exit 0
|
||||||
|
|
||||||
# If no game specified, exit
|
# Only proceed with noninteractive installation if explicitly requested
|
||||||
|
if [[ "$noninteractiveInstall" == "true" ]]; then
|
||||||
|
# If no game specified for noninteractive install, exit
|
||||||
[[ ${#game} -lt 1 ]] && exit 0
|
[[ ${#game} -lt 1 ]] && exit 0
|
||||||
|
|
||||||
# Install the specified game noninteractively
|
# Install the specified game noninteractively
|
||||||
@@ -565,3 +568,4 @@ else
|
|||||||
agm_msgbox "Audio Game Installer" "" "Error: Game '${game}' not found in .install directory"
|
agm_msgbox "Audio Game Installer" "" "Error: Game '${game}' not found in .install directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user