Skip to content

Commit

Permalink
Bigboot progress meter (#82)
Browse files Browse the repository at this point in the history
* include percent complete in bigboot progress console output

* fix shellcheck and codespell findings
  • Loading branch information
swapdisk authored Dec 10, 2024
1 parent c7381c9 commit 55b071d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/bigboot_progress_meter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Improved console logging of bigboot progress to include percent complete
16 changes: 12 additions & 4 deletions roles/bigboot/files/bigboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,18 @@ if ! ret=$(echo Yes | /usr/sbin/parted "$boot_disk_device" ---pretend-input-tty
fi

# Output progress messages to help impatient operators recognize the server is not "hung"
( sleep 4
while t="$(ps -C sfdisk -o cputime=)"; do
echo "$name: Partition move is progressing, please wait! ($t)"
sleep 120
( sleep 9
while pid="$(ps -C sfdisk -o pid:1=)"; do
pct='??'
for fd in /proc/"$pid"/fd/*; do
if [[ "$(readlink "$fd")" == "$boot_disk_device" ]]; then
offset="$(awk '/pos:/ {print $2}' /proc/"$pid"/fdinfo/"${fd##*/}")"
pct="$((-100*offset/next_part_size+100))"
break
fi
done
echo "$name: Partition move is progressing, please wait! ($pct% complete)"
sleep 20
done ) &

# Shift next partition
Expand Down

0 comments on commit 55b071d

Please sign in to comment.