Chinaunix首页 | 论坛 | 博客
  • 博客访问: 85374
  • 博文数量: 11
  • 博客积分: 580
  • 博客等级: 中士
  • 技术积分: 182
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-24 16:00
文章分类

全部博文(11)

文章存档

2012年(10)

2008年(1)

分类: LINUX

2008-06-25 14:12:07

 


[root@localhost ~]# cd ~peter
[root@localhost peter]# ls
mkdvd.sh                      rhel-5-server-i386-disc3.iso
RHEL5                         rhel-5-server-i386-disc4.iso
rhel-5-server-i386-disc1.iso  rhel-5-server-i386-disc5.iso
rhel-5-server-i386-disc2.iso
[root@localhost peter]# cat mkdvd.sh
#!/bin/bash
#hris 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 -boot-load-size 4 -boot-info-table .
/usr/lib/anaconda-runtime/implantisomd5 --force $2

cleanup
echo ""
echo "Process Complete!"
echo ""
[root@localhost peter]#

 

 

  ./mkdvd.sh /home/peter /home/peter/RHEL5/DVD.iso

 

 

 

[root@localhost peter]# ll
total 2810104
-rwxrwxrwx  1 root  root       2310 Aug 24 13:01 mkdvd.sh
drwxr-xr-x  2 root  root       4096 Aug 24 13:41 RHEL5
-rwxr--r--  1 peter peter 660252672 Aug 24 12:48 rhel-5-server-i386-disc1.iso
-rwxr--r--  1 peter peter 660840448 Aug 24 12:49 rhel-5-server-i386-disc2.iso
-rwxr--r--  1 peter peter 660516864 Aug 24 12:50 rhel-5-server-i386-disc3.iso
-rwxr--r--  1 peter peter 658784256 Aug 24 12:51 rhel-5-server-i386-disc4.iso
-rwxr--r--  1 peter peter 234301440 Aug 24 12:52 rhel-5-server-i386-disc5.iso
[root@localhost peter]#

阅读(974) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~