LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 05-25-2004, 12:24 PM   #1
GufyMike
Member
 
Registered: Apr 2004
Location: Los(t) Angeles
Distribution: Fedora Core2, RH9, FreeBSD, Debian, Knoppix,
Posts: 53

Rep: Reputation: 15
Custom yum menu script.


Hey,

I remeber back aways a thread about sharing our scripts and conf files after install and as the thread starter sorry this is going to be long. Well here is a custom Bash Shell Script. It will install yum (for those who don't have it). Update yum and installed packages , List packages and and remove packages. Pretty much it will do all the jobs of installing and maintaining software that yum can do.

If you run into any errors or bugs email me or pm me.

Just copy the code to a text file and namethe file : yummenu; chmod to 555 and run as root (so functions only work as root) in a terminal or ssh session. To run it from a command prompt type:
$./yummenu
from the same dir as yummenu. I will paste the code for it in the next post.

Here is a copy of my yum.conf (i'm running FC2):

Code:
# $Id: yum-fd.conf 378 2004-04-30 16:33:52Z dude $

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=fedora-release
gpgcheck=1
tolerant=1
exactarch=1

[core]
name=Fedora Linux $releasever - $basearch - core
baseurl=h*tp://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/core
[core alt]
name=Secsup.org $releasever - $basearch - core 
baseurl=h*tp://redhat.secsup.org/fedora/core/2/i386/os/

[updates]
name=Fedora Linux $releasever - $basearch - updates
baseurl=h*tp://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/updates

[update alt]
name=Secsup.org $releasever - $basearch - core
baseurl=h*tp://redhat.secsup.org/fedora/core/updates/2/i386/

[freshrpms]
name=Fedora Linux $releasever - $basearch - freshrpms
baseurl=h*tp://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms

#[tupdates]
#name=Fedora Linux $releasever - $basearch - testing updates
#baseurl=h*tp://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/tupdates

[livna-stable]
name=Livna.org Fedora Compatible Packages (stable)
baseurl=ht*p://rpm.livna.org/fedora/$releasever/$basearch/yum/stable
gpgcheck=1

[FedoraUS]
name=Fedora US $releasever - $basearch - Latest Packages
baseurl=ht*p://download.fedora.us/fedora/fedora/2/i386/SRPMS.os/

[newrpms.sunsite.dk]
name=Fedora Core 2 NewRPMS.sunsite.dk
baseurl=ht*p://newrpms.sunsite.dk/apt/redhat/en/i386/fc2

[dag]
name=Dag RPM Repository for Fedora Core 2
baseurl=ht*p://apt.sw.be/fedora/$releasever/en/$basearch/dag

[dries]
name=Extra Fedora rpms dries - $releasever - $basearch
baseurl=ht*p://dries.studentenweb.org/yum/fedora/linux/$releasever/$basearch/dries
Please replace ht*p or h*tp with http
 
Old 05-25-2004, 12:31 PM   #2
GufyMike
Member
 
Registered: Apr 2004
Location: Los(t) Angeles
Distribution: Fedora Core2, RH9, FreeBSD, Debian, Knoppix,
Posts: 53

Original Poster
Rep: Reputation: 15
Here is the source for yummenu

Code:
#!/bin/bsh
#
#  Author: Mike Ramirez email: webmaster@5150wtwm.com
#  date 5-25-2004
# 
#This menu will help you update and install packages with yum.  No
#Knowledge of Yum is needed.  Do NOT edit anything unless you know how to Script
#for the Bash Shell.
leave=no
while [ $leave = no ]
do
echo Please choose one.
echo 	1. Update yum and distrobution
echo 	2. List Packages
echo 	3. Install Packages or Yum
echo 	4. Uninstall Packages
echo 	5. Clean Yum Cache
echo 	6. Search...
echo 	7. Package Info
echo 	8. Exit
echo Enter Choice:  
read selection


case $selection in
	1)
	
		echo Make your selection
		echo 	1. Check For Updates
		echo 	2. Update All Installed Packages
		echo 	3. Update Specific Packages
		echo 	4. Back To Main Menu
		read Uselection
			case $Uselection in
			1)
			echo This will Check for Updates ONLY.
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				yum -y check-update
			fi
			;;
			2)
			echo This will Check for Upadates and install them to
			echo installed software.
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				yum -y update
			fi
			;;
			3)
			instagain=1
			while [ $instagain = 1 ]
			do
				echo Enter package name to be Updated
				read pkgname
				echo This will Update $pkgname
				echo Do you want to continue?  [y/n]
				read yorn
				if [ $yorn = y ]
				then
					yum -y update $pkgname
					echo Would you like to update another package? 
					echo Do you want to continue? [y/n]
					read yorn
					if [ $yorn = y ]
					then 
						instagain=1
					else 
						instagain=0
					fi
				else
					instagain=0
				fi
			done			
			;;
			4)
			;;
			esac
	;;
	2)
	echo Make your Selection
	echo  	1. List All Available Packages
	echo 	2. List a Specific Package
	echo 	3. List Installed Packages
	echo 	4. List Packages installed not in your in yum.conf repositories.
	echo 	5. Back To Main Menu
	read Uselection
	case $Uselection in
		1)
		echo Please enter a path to save output to:
		echo Do not use a trailing '/'
		read Lpath
		echo This will Generate packages.list to $Lpath
		echo Do you want to continue?  [y/n]
		read yorn
		if [ $yorn = y ]
		then
			echo Generating list...
			yum list > $Lpath/packages.list
			echo List saved to $Lpatn/packages.list
		fi
		;;
		2)
		instagain=1
			while [ $instagain = 1 ]
				do
					echo Enter package name to be Listed
					read pkgname
					yum -y list $pkgname
					echo Would you like to list another package? [y/n]
					read yorn
					if [ $yorn = y ]
					then 
						instagain=1
					else 
						instagain=0
					fi
				done						
		;;
		3)
		echo Please enter a path to save output to:
		echo Do not use a trailing '/'
		read Lpath
		echo This will generate installed.list to $Lpath
		echo Do you want to continue?  [y/n]
		read yorn
		if [ $yorn = y ]
		then
			echo generating list...
			yum list installed > $Lpath/installed.list
			echo List saved to $Lpath/installed.list
		fi
		;;
		4)
		echo Please enter a path to save output to:
		echo do not use a trailing '/'
		read Lpath
		echo This will generate extras.list to $Lpath
		echo Do you want to continue?  [y/n]
		read yorn
		if [ $yorn = y ]
		then
			echo generating list...
			yum list extras > $Lpath/extras.list
			echo List saved to $Lpath/extras.list
		fi
		;;
		5)
		;;
	esac
	;;
	3)
	echo 1. Install Package
	echo 2. Install yum
	echo 3. Install yum as a service for automatic updates
	echo 4. Back To Main Menu
	read Iselection 
	case $Iselection in 
		1)
		instagain=1
		while [ $instagain = 1 ]
			do
				echo Enter package name to be Installed:
				read pkgname
#edit yum -y update $pkgname to yum -y install $pkgname
				yum -y install $pkgname
				echo Would you like to install another package? 
				echo Do you want to continue? [y/n]
				read yorn
				if [ $yorn = y ]
				then 
					instagain=1
				else 
					instagain=0
				fi	
			done
			
			
		;;
		2)
		echo You must have an internet connection for this to work.
		echo Please choose correct version:  
		echo 1. RedHat 9
		echo 2. RedHat 8 *requires librpm404 and rpm404-python
		echo 3. RedHat 7.3 and lower
		echo 4. Fedora Core 2
		echo 5. Fedora Core 1
		echo 6. Yum Source Install *wget tar and gcc must be installed
		echo 7. Back To Main Menu
		read Vselection
		case $Vselection in
			1)
			echo installing yum for RedHat 9 updating headers and
			echo installed software 
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				rpm -Uvh h*tp://www.linux.duke.edu/projects/yum/download/2.0/yum-2.0.7-1.noarch.rpm
				rpm -Uvh ftp://ftp.quicknet.nl/pub/Linux/ftp....e-9-3.i386.rpm
				echo Updating Headers and Installed software.
				yum -y update 						
			fi
			;;
			2)
			echo installing yum for RedHat 8 updating headers and
			echo installed software. 
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				rpm -Uvh h*tp://www.linux.duke.edu/projects/yum/download/1.0/yum-1.0.3-1_80.noarch.rpm
				echo Updating Headers and Installed software.
				yum -y update 			
			fi
			;;
			3)
			echo installing yum for RedHat 7..3 or lower and
			echo updating and installing software. 
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				rpm -Uvh ht*p://www.linux.duke.edu/projects/yum/download/1.0/yum-1.0.3-1_73.noarch.rpm
				echo Updating Headers and Installed software.
				yum -y update
			fi
			;;
			4)
			echo installing yum for Fedora Core 1 and updating
			echo headers and installed software
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				rpm -Uvh  ht*p://www.linux.duke.edu/projects/yum/download/2.0/yum-2.0.7-1.noarch.rpm
				echo Updating Headers and Installed software.
				yum -y update
			fi
			;;
			5)
			echo installing yum for Fedora Core 2 and updating
			echo headers and installed software 
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				rpm -Uvh  ftp://ftp.linux.ncsu.edu/pub/fedora/...1.1.noarch.rpm
				echo Updating Headers and Installed software.
				yum -y update
			fi
			;;
			6)
			echo installing yum sources 2.0.7 and updating headers
			echo and installed software 
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then
				echo Getting yum 2.0.7
				wget ht*p://www.linux.duke.edu/projects/yum/download/2.0/yum-2.0.7.tar.gz /root/
				echo untarring yum-2.0.7.tar.gz
				tar -zxvf /root/yum-2.0.7.tar.gz
				cd /root/yum-2.0.7
				echo installing yum...
				./configure; make; make install
				echo Updating Headers and Installed software.
				yum -y update
			fi
			;;
			7)
			;;
		esac
		;;
		3)
		echo Setting up Automatic Updates 
		echo Do you want to continue? [y/n]
		read yorn
		if [ $yorn = y]
		then
			/sbin/chkconfig --add yum
			/sbin/service yum start
			echo Done.
		fi
		;;
	esac			
	;;
	4)
	echo Please enter the name of the package to be uninstalled:
	read pkgname
	echo This will remove $pkgname
	echo Do you want to continue? [y/n]
	read yorn
	if [ $yorn = y ]
	then
		yum -y remove $pkgname
	fi
	;;
	5)
	echo Please make a choice to clean out your yum cache:
	echo 	1. All
	echo 	2. Packages
	echo 	3. Old Headers
	echo 	4. Headers note: doing this will repuire you to download the
	echo   	   headers next time you run yum
	echo 	5. Back To Main Menu
	read cselection
	case $cselection in
		1)
		echo This will clean packages and old headers 
		echo do you want to continue? [y/n]
		read yorn
		if [$yorn = y ]
		then
			yum clean
		fi
		;;
		2)
		echo This will clean packages yum has downloaded
		echo do you want to continue? [y/n]
		read yorn
		if [$yorn = y ]
		then
			yum clean packages
		fi
		;;
		3)
		echo This will old headers 
		echo do you want to continue? [y/n]
		read yorn
		if [$yorn = y ]
		then
			yum clean oldheaders
		fi
		;;
		4) 
		echo This will clean ALL headers and need to download them again
		echo next time yum is run. 
		echo do you want to continue? [y/n]
		read yorn
		if [$yorn = y ]
		then
			yum clean headers
		fi
		;;
		5)
		;;
	esac
	;;
	6)
	echo Search for a RPM by keyword.  
	echo Wildcards can be used.
	echo Enter a keyword to search for:   
	read Skeyword
	yum -y search $Skeyword
	;;
	7)
	echo Find out more about a specific package.
	echo 	1. List Description and Summary
	echo 	2. Find out which package provides a feature or file
	echo 	3. Back to Main menu
	read Sselection
	case $Sselection in
		1)
		echo Please choose an option:
		echo 	1. Find out more about a Specific Package
		echo 	2. Find out more about a ALL Packages Installed
		echo 	3. Back To Main Menu
		read Iselection
		case $Iselection in
			1)
			echo Please enter a package name:  
			read pkgname
			yum -y info pkgname
			;;
			2)
			echo Please enter a package name:
			read pkgname
			echo Please enter the path to save $pkgname info to do
			echo not use trailing '/' :  
			read  Ipath
			echo This will generate $pkgname.info to DIR $Ipath
			echo Do you want to continue? [y/n]
			read yorn
			if [ $yorn = y ]
			then   
				echo working...
				yum -y info > $Ipath/$pkgname.info
				echo Info saved to $Ipath/$pkgname.info
			fi
			;;
			3)
			;;
		esac
		;;
		2)
		echo Output will be saved to a file in a dir you choose.
		echo Do not use a trailing '/' in path.
		echo Please select a path:  
		read Ppath
		echo Please Enter a Package Name to display File List:  
		read pkgname
		echo This will generate $pkgname.info to DIR $Ppath
		echo Do you want to continue? [y/n]
		read yorn
		if [ $yorn = y]
		then
			echo Working...
			yum -y provides $pkgname > $Ppath/$pkgname.info
			echo Info saved to $Ppath/$pkgname.info
		fi
		;;
		3)Back to Main Menu
	esac
	;;
	8)
	echo Do you really want to quit? [y/n]
	read yorn
	if [ $yorn = y ]
	then
		echo GoodBye!
		leave=yes
	fi
	;;
esac
done
There are no comments because, the Script will tell you what its doing.
ALso for the installation of yum to work you must chang h*tp or ht*p to http

Thanx to everyone here who has asked and answered post they helped me get through my initial woes. I hope this helps some of you as much as you have helped me.

Mike

Last edited by GufyMike; 05-25-2004 at 08:18 PM.
 
Old 05-25-2004, 12:38 PM   #3
lramos85
Member
 
Registered: Sep 2003
Location: Riverside, Ca
Distribution: Gentoo, FC3
Posts: 125

Rep: Reputation: 15
Thank You, thats pretty cool.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't create custom menu.xml for openbox LogicNZ Linux - Newbie 6 07-19-2008 10:37 AM
System Settings menu missing from Gnome after yum updates jrbiochem Linux - Software 0 11-21-2005 06:28 AM
Custom shell menu? Darkfin Linux - Newbie 1 04-24-2005 09:37 AM
Custom Fluxbox Menu TomalakBORG Linux - Software 3 02-27-2005 06:53 PM
Custom Gnome Menu semaphore Linux - Newbie 5 03-04-2004 09:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 08:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration