Last active
January 6, 2021 18:14
-
-
Save marshki/ef86921aecd9d10a8c3a314c2ce7796a to your computer and use it in GitHub Desktop.
"Dialog" progress bar to monitor the extraction of a "tar" archive.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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