#!/bin/bash
#===============================================================================
#
# FILE: deand.sh
#
# USAGE: ./deand.sh
#
# DESCRIPTION: To mount partition and then the iso
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Parag Kalra (), paragkalra@gmail.com, www.paragkalra.com
# COMPANY: As of now Persistent System LTD, www.persistentsys.com
# VERSION: 1.0
# CREATED: Thursday 29 January 2009 08:04:14 IST IST
# REVISION: 2
#===============================================================================
#-------------------------------------------------------------------------------
# Creating "/temp" if it doesn't exist
#-------------------------------------------------------------------------------
if [ ! -d /temp ]
then
mkdir /temp
fi
#-------------------------------------------------------------------------------
# Creating /iso if it doesn't exist
#-------------------------------------------------------------------------------
if [ ! -d /iso ]
then
mkdir /iso
fi
echo " "
#-------------------------------------------------------------------------------
# Mounting partition and then the iso
#-------------------------------------------------------------------------------
if ! mount | grep sda1
then
echo -e "Mounting partition\n"
mount /dev/sda1 /temp
else
echo -e "Partition sda1 already mounted. \n"
fi
#=== FUNCTION ================================================================
# NAME: isomount()
# DESCRIPTION: To mount the respective iso
# PARAMETERS: isoname
# RETURNS: nothing
#===============================================================================
function isomount
{
echo -e "You have selected $1 hence mounting $1 iso\n"
mount -o loop /temp/root/linuxcbt-$1/linuxcbt-$1.iso /iso
}
# ---------- end of function isomount ----------
echo -e "Please enter the ISO you want to mount: \n1. rhel4\n2. sendmail\n3. samba\n4. security\n5. rhel5dvd\n6. postfix\n7. qmail"
read iso
case $iso in
rhel4)
isomount rhel4
;;
samba)
isomount samba
;;
security)
isomount security
;;
sendmail)
isomount sendmail
;;
postfix)
isomount postfix
;;
qmail)
isomount qmail
;;
rhel5dvd)
echo -e "You have selected $iso hence trying to mount $iso \n"
if ! mount | grep rhel5iso
then
echo -ec"Mounting $iso \n"
mount -o loop /temp/root/RHEL-5.1-i386-DVD.iso /share/rhel5iso
else
echo -e "$iso already mounted. \n"
fi
;;
esac
# --- end of case ---
Friday, January 30, 2009
Script to mount multiple isos.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment