View Single Post
  #1  
Old 30th June 2008, 19:07
nightfire nightfire is offline
Junior Member
 
Join Date: May 2008
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
Default Help With GUI Menu

OK, I very, very, very new at this and don't know what I doing. I'm really trying so try to be kind . Here is what I'm trying to do. I have this script that I'm working on.


Code:
#!/bin/sh 

# this is my first menu script. 
# I'm tring to get Zenity to work with it So I can have a full GUI Menu 
if [ $(whoami) != "root" ] ; then 
      zenity --error \ 
          --text="Please Run This as Root" 
exit 1 
fi 



clear; 
        echo "Hello, What would you like me to install for you? " 
        
        sleep 1 
        
# GUI Menu I am Tring to get to work 
#zenity --height=600 --width=800 \ 
#         --title="Install Menu" \ 
#         --text="Pick your Poison" \ 
#         --list \ 
#         --checklist \ 
#         --column="Pick This" \ 
#    --column="#" \ 
#    --column="Program" \ 
#         --column="Action" \ 
#          "False" "1" "Backgrounds" "(These are a colection from the all over the internet)" \ 
#          "False" "2" "Backgrounds" "(These are a colection from http://wallpapers-n-etc.com)" \ 
#          "False" "3" "icons" "(This will install some extra icon sets from gnome-look)" \ 
#          "False" "4" "Video setup" "(This will install DVD Playback Codecs and Players)" \ 
#          "False" "5" "themes" "(This will add some Extra Themes for gnome)" \ 
#          "False" "6" "compiz fusion" "(This will install Compiz Fusion from Fedora Repo)" \ 
#          "False" "7" "awn" "(This will install the AWN Dock)" \ 
          







#The Menu 
        echo "..........................." 
        echo "...........MENU............" 
        echo 
        echo "1 Backgrounds 1" "(These are a colection from the all over the internet)" 
   echo "2 Backgrounds 2" "(These are a colection from http://wallpapers-n-etc.com)" 
        echo "3 icons"  "(This will install some extra icon sets from gnome-look)" 
#        echo "4 Video setup"  "(This will install DVD Playback Codecs and Players)" 
#Still working on this 
        echo "5 themes"  "(This will add some Extra Themes for gnome)" 
        echo "6 compiz fusion"  "(This will install Compiz Fusion from Fedora Repo)" 
        echo "7 awn"  "(This will install the AWN Dock)" 

#Execute Menu Choice        
        read choice 
       
        while [[ $choice != 0 ]] 
        do 
           case $choice in 
             1)  clear; 
       rpm -Uvh 'http://192.168.2.4/downloads/nfbackgrounds-1-1.fc9.noarch.rpm' 
       P=nfbackgrounds 
       rpm -qa "$P" > tl 
       my_size=$( wc -l < t1 ) 
       echo "Checking install status" 
       if [[ $( rpm -qa $P ) =~ ${P} ]] 
       then 
        zenity --info \ 
                --text="Backgrounds were installed.  Right click on desktop to change Background" 
       else 
         zenity --error \ 
             --text="Backgrounds Were not installed" 
       fi 
       rm t1                
                 ;; 
        2)  clear; 
       rpm -Uvh 'http://192.168.2.3/downloads/nfbackground2-1-1.fc9.noarch.rpm' 
       P=nfbackgrounds2 
       rpm -qa "$P" > t1 
       my_size=$( wc -l < t1 ) 
       echo "Checking install status" 
       if [[ $( rpm -qa $P ) =~ ${P} ]] 
       then 
        zenity --info \ 
                --text="Backgrounds were installed.  Right click on desktop to change Background" 
       else 
         zenity --error \ 
             --text="Backgrounds Were not installed" 
       fi 
       rm t1                
       ;; 
             3)  clear; 
       yum -y install wget 
       wget 192.168.2.4/downloads/nficons.tar.gz 
       tar zxvf nficons.tar.gz -C /usr/share/icons 
       rm nficons.tar.gz 
                 ;; 
             4)  clear; 
                 su -c 'rpm -i http://rpm.livna.org/livna-release-8.rpm' 
       wget 192.168.2.4/downloads/dvdplayback.sh 
       sh dvdplayback.sh 
       rm dvdplayback.sh 
                 ;; 
             5)  clear; 
       yum -y install wget 
                 wget 192.168.2.4/downloads/nfthemesf8.tar.gz 
                 tar zxvf nfthemesf8.tar.gz -C /usr/share/themes 
       rm nfthemesf8.tar.gz 
       ;; 
             6)  clear; 
                 yum -y install ccsm emerald-themes compizconfig-backend-kconfig compizconfig-backend-gconf fusion-icon* emerald compiz-fusion compiz-fusion-gnome libcompizconfig compiz-gnome compiz-bcop compiz compizconfig-python compiz-fusion-extras compiz-fusion-extras-gnome compiz-kde 
       P=compiz-fusion-gnome 
       rpm -qa "$P" > t1 
       my_size=$( wc -l < t1 ) 
       echo "Checking install status" 
       if [[ $( rpm -qa $P ) =~ ${P} ]] 
       then 
        zenity --info \ 
                --text="compiz fusion was installed." 
       else 
         zenity --error \ 
             --text="compiz fusion was not installed" 
       fi 
       rm t1 
                 ;; 
             7)  clear; 
                 yum -y install avant-window-navigator awn-extras 
                 P=avant-window-navigator 
       rpm -qa "$P" > t1 
       my_size=$( wc -l < t1 ) 
       echo "Checking install status" 
       if [[ $( rpm -qa $P ) =~ ${P} ]] 
       then 
        zenity --info \ 
                --text="avant-window-navigator was installed." 
       else 
         zenity --error \ 
             --text="avant-window-navigator was not installed" 
       rm tl 
       fi 
       ;; 
             *)  clear; 
                 echo "You have entered an invalid option!" 
                 ;; 
           esac 

#Menu Loop 
        echo "..........................." 
        echo "...........MENU............" 
        echo 
        echo "1 Backgrounds 1" "(These are a colection from the all over the internet)" 
   echo "2 Backgrounds 2" "(These are a colection from http://wallpapers-n-etc.com)" 
        echo "3 icons"  "(This will install some extra icon sets from gnome-look)" 
#        echo "4 Video setup"  "(This will install DVD Playback Codecs and Players)" 
        echo "5 themes"  "(This will add some Extra Themes for gnome)" 
        echo "6 compiz fusion"  "(This will install Compiz Fusion from Fedora Repo)" 
        echo "7 awn"  "(This will install the AWN Dock)" 

         read choice 
      done
Now what I'm trying to get working is the Zenity Menu. If I take the away the #'s the menu comes up the way I want it to. But my problem is how do I get it to run the commands that I have listed here 1-7? This is where I'm stuck. Hope I'm making sense and someone can help. If i run the script as is It work fine but it has to loop back after one command. I want it to have a GUI and be able to select more then one item to install at a time.
Thanks in advance for the help.
__________________
Thanks,
Night Fire
Linux Tips, Tricks and Guides for Fedora 8
Reply With Quote
Sponsored Links