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"
|
||||
|
||||
if [[ "$dialogType" == "yad" ]]; then
|
||||
# Use a text-info dialog with improved real-time output display
|
||||
# Force line buffering and use named pipe for better responsiveness
|
||||
local tmpPipe
|
||||
tmpPipe=$(mktemp -u)
|
||||
mkfifo "$tmpPipe"
|
||||
# Use accessible form approach without temp files
|
||||
# Process command output first to get summary info
|
||||
local lineCount=0
|
||||
local lastLine="Starting..."
|
||||
local allOutput=""
|
||||
|
||||
# Start yad in background reading from the pipe
|
||||
yad --text-info \
|
||||
# Collect output while command runs
|
||||
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" \
|
||||
--text="$text" \
|
||||
--width=600 \
|
||||
--height=400 \
|
||||
--timeout=1 \
|
||||
--timeout-indicator=bottom \
|
||||
--button="Close:0" \
|
||||
--tail \
|
||||
--auto-scroll \
|
||||
--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"
|
||||
--field="$text - Completed:LBL" \
|
||||
--field="Total steps: $lineCount:LBL" \
|
||||
--field="Last action::LBL" \
|
||||
--field="$lastLine:RO" \
|
||||
--selectable-labels \
|
||||
--button="OK:0" \
|
||||
--width=500 \
|
||||
--height=200
|
||||
else
|
||||
dialog --title "$title" \
|
||||
--progressbox "$text" 20 70
|
||||
|
@@ -526,6 +526,7 @@ while getopts "${args}" i ; do
|
||||
i) game_installer;;
|
||||
I)
|
||||
export game="${OPTARG}"
|
||||
export noninteractiveInstall="true"
|
||||
break;;
|
||||
k) kill_game;;
|
||||
L) license;;
|
||||
@@ -552,7 +553,9 @@ done
|
||||
# If agmNoLaunch is set, exit (script is being sourced)
|
||||
[[ "$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
|
||||
|
||||
# Install the specified game noninteractively
|
||||
@@ -565,3 +568,4 @@ else
|
||||
agm_msgbox "Audio Game Installer" "" "Error: Game '${game}' not found in .install directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
Reference in New Issue
Block a user