Skip to content

Instantly share code, notes, and snippets.

@marshki
Last active January 6, 2021 18:14
Show Gist options
  • Save marshki/ef86921aecd9d10a8c3a314c2ce7796a to your computer and use it in GitHub Desktop.
Save marshki/ef86921aecd9d10a8c3a314c2ce7796a to your computer and use it in GitHub Desktop.
"Dialog" progress bar to monitor the extraction of a "tar" archive.
#!/usr/bin/env bash
#
# Untar progress bar
script=`basename "$0"`
program="Tar & Feather"
# Install pre-reqs:
sudo apt-get --yes install dialog pv
# Change dir to Desktop, then create file (optional, but done here for illustrative purposes):
cd /home/*/Desktop &&fallocate --length 2GB rando.img
# Create tar archive (optional, but done here for illustrative purposes):
sudo tar --create --verbose --gzip --file=/usr/local/rando.tgz rando.img
# Untar
untar_blob () {
(pv --numeric /usr/local/rando.tgz | tar --extract --gzip --directory=/usr/local) 2>&1|
dialog --backtitle "$script" --title "$program" --gauge "OPENING TAR ARCHIVE IN /usr/local..." 10 40
}
main () {
untar_blob
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment