I am trying to use "whiptail" to display progress to users while removing some RPM's. Using
{
echo 25
yum remove package_name
echo 50
yum remove package_name
echo 75
yum remove package_name
echo 100
sleep 1
} | whiptail --gauge "Removing RPM's" 6 60 0*
What i would like is to display message "Removing package_name" along with the progress bar, Like when redhat installs packages something like this How can i achieve that ?
Whiptail uses a weird syntax to update the gauge text. Have a look at the following script :
#!/bin/bash
{
sleep 0.5
echo -e "XXX\n0\nyum remove package_0... \nXXX"
sleep 2
echo -e "XXX\n25\nyum remove package_0... Done.\nXXX"
sleep 0.5
echo -e "XXX\n25\nyum remove package_1... \nXXX"
sleep 2
echo -e "XXX\n50\nyum remove package_1... Done.\nXXX"
sleep 0.5
echo -e "XXX\n50\nyum remove package_2... \nXXX"
sleep 2
echo -e "XXX\n75\nyum remove package_2... Done.\nXXX"
sleep 0.5
echo -e "XXX\n75\nyum remove package_3... \nXXX"
sleep 2
echo -e "XXX\n100\nyum remove package_3... Done.\nXXX"
sleep 1
} |whiptail --title "Yum Removal" --gauge "Please wait while installing" 6 60 0
Here, the key part is echo -n "XXX\n<new percent>\n<new_gauge_text>\nXXX"
. The XXX
string is used by whiptail to indicate modifications to the display.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With