Merge RHEL5CDiso into a dvd script

Source: Internet
Author: User
Tags ftp site
Combine RHEL5CDiso into a dvd script-Linux general technology-Linux programming and kernel information. The following is a detailed description. After merging, start with the dvd. iso in vmware and install rhel5.
Usage:./script. sh/TheCdIsoPath/home/username/dvd. iso

#! /Bin/bash

# By Chris Kloiber

# A quick hack that will create a bootable DVD iso of a Red Hat Linux
# Distribution. Feed it either a directory containing the downloaded
# Iso files of a distribution, or point it at a directory containing
# The "RedHat", "isolinux", and "images" directories.

# This version only works with "isolinux" based Red Hat Linux versions.

# Lots of disk space required to work, 3X the distribution size at least.

# GPL version 2 applies. No warranties, yadda, yadda. Have fun.


If [$ #-lt 2]; then
Echo "Usage: 'basename $ 0' source/destination/DVD. iso"
Echo ""
Echo "The 'source' can be either a directory containing a single"
Echo "set of isos, or an exploded tree like an ftp site ."
Exit 1
Fi

Cleanup (){
[$ {LOOP: =/tmp/loop} = "/"] & echo "LOOP mount point =\/, dying! "& Exit
[-D $ LOOP] & rm-rf $ LOOP
[$ {DVD := ~ /Mkrhdvd} = "/"] & echo "DVD data location is \/, dying! "& Exit
[-D $ DVD] & rm-rf $ DVD
}

Cleanup
Mkdir-p $ LOOP
Mkdir-p $ DVD

If [! 'Ls $1/*. iso 2> & 1>/dev/null; echo $? ']; Then
Echo "Found iso cd images ..."
CDS = 'expr 0'
DISKS = "1"

For f in 'ls $1/*. iso '; do
Mount-o loop $ f $ LOOP
Cp-av $ LOOP/* $ DVD
If [-f $ LOOP/. discinfo]; then
Cp-av $ LOOP/. discinfo $ DVD
CDS = 'expr $ CDS + 1'
If [$ CDS! = 1]; then
DISKS = 'echo $ {DISKS}, $ {CDS }'
Fi
Fi
Umount $ LOOP
Done
If [-e $ DVD/. discinfo]; then
Awk '{if (NR = 4) {print disks} else {print;}' disks = "$ DISKS" $ DVD/. discinfo> $ DVD/. discinfo. new
Mv $ DVD/. discinfo. new $ DVD/. discinfo
Fi
Else
Echo "Found FTP-like tree ..."
Cp-av $1/* $ DVD
[-E $1/. discinfo] & cp-av $1/. discinfo $ DVD
Fi

Rm-rf $ DVD/isolinux/boot. cat
Find $ DVD-name TRANS. TBL | xargs rm-f

Cd $ DVD
Mkisofs-J-R-v-T-o $2-B isolinux/isolinux. bin-c isolinux/boot. cat-no-emul-boot-load-size 4-boot-info-table.
/Usr/lib/anaconda-runtime/implantisomd5 -- force $2

Cleanup
Echo ""
Echo "Process Complete! "
Echo ""


Use: This is my script and the test is normal. The merged DVD is installed normally.
./Mkdvd. iso/tmp // root/rhel5dvd. iso
Note 1: CDROM iso files and merged output dvd iso files cannot be in the same directory
NOTE 2:/tmp refers to the directory of five ISO files that have saved REHL5.
NOTE 3: directly download this script:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.