Yum. sh
#! /Bin/bash read-p "Enter the image file path (for example,/root/rhel5u5. iso): "jingxiang read-p", enter a mount point (for example,/iso ): "gzd mount-t iso9660" $ jingxiang "" $ gzd "-o loop &>/dev/null if [$? -Eq 0] then if [-f/etc/yum. repos. d/rehl-debuginfo.repo] then echo "the original configuration file is being renamed, please wait... "sleep 2 mv/etc/yum. repos. d/rhel-debuginfo.repo/etc/yum. repos. rhel-debuginfo.repo.bak else if [-f/etc/yum. repos. d/iso. repo] then echo "iso. repo already exists. You do not need to create it again. Continue... "sleep 2 else echo" is creating iso. repo file. Please wait... "sleep 2 touch/etc/yum. repos. d/iso. repo fi echo "the configuration file is being written. Please wait... "sleep 2 echo" [rhel-server] ">/etc/yum. repos. d/iso. repo echo "name = yum server">/etc/yum. repos. d/iso. repo echo "baseurl = file: // $ gzd/Server">/etc/yum. repos. d/iso. repo echo "enabled = 1">/etc/yum. repos. d/iso. repo echo "gpgcheck = 0">/etc/yum. repos. d/iso. repo echo "deleting cached files. Please wait... "sleep 1 yum clean all &>/dev/null echo" the cache has been cleared and is being tested... "sleep 1 yum list & echo" test successful... "echo" Copyright @ Night really gray _ personal blog: http://www.graynight.org/"sleep 1 fi else echo" Please check whether the input directory is correct, whether the file exists... execute "exit fi" again.