Skip to content

Instantly share code, notes, and snippets.

@shamun
Created November 21, 2011 19:07
Show Gist options
  • Save shamun/1383572 to your computer and use it in GitHub Desktop.
Save shamun/1383572 to your computer and use it in GitHub Desktop.
#!/bin/bash
_temp="/tmp/answer.$$"
PN=`basename "$0"`
VER='0.31'
dialog 2>$_temp
DVER=`cat $_temp | head -1`
########################################
### Progress/Tail/Verion
########################################
gauge()
{
{
for I in $(seq 1 100) ; do
echo $I
sleep 0.01
done
echo 100;
} | dialog --backtitle "Please wait.." \
--gauge "Progress" 6 60 0
}
tailbox()
{
dialog --backtitle "Watcher"\
--tailbox /var/log/messages 200 200
}
version()
{
dialog --backtitle "Verion" \
--msgbox "$PN - Version $VER\n" 9 52
}
########################################
### Important setup
########################################
stepOne()
{
chmod +x /var/tmp/install.1.sh;
chmod +x /var/tmp/install.2.sh;
# run
go1=`/var/tmp/install.1.sh`;
}
########################################
### Main
########################################
installAll()
{
gauge;
stepOne;
tailbox;
}
### create main menu using dialog
main_menu() {
dialog --backtitle "Shell" --title " Main Menu - V. $VER "\
--cancel-label "Quit" \
--menu "Move using [UP] [DOWN], [Enter] to select" 17 60 10\
All "Install everything"\
Version "Show program version info"\
Quit "Exit program" 2>$_temp
opt=${?}
if [ $opt != 0 ]; then
rm $_temp;
exit;
fi
menuitem=`cat $_temp`
echo "menu=$menuitem"
case $menuitem in
All) installAll;;
Version) version;;
Quit) rm $_temp; exit;;
esac
}
while true; do
main_menu
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment