歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

將Linux CD鏡像文件合並成DVD鏡像文件的方法

環境:Linux操作系統的計算機或服務器、Linux的CD鏡像文件(後綴名為.iso)。

步驟:

1、創建一個目錄-----------------mkdir(創建目錄命令)

2、將linux的CD光盤鏡像全部拷貝在此目錄中,並將鏡像名依次命名為disk1.iso、disk2.iso、disk3.iso …----------------------------cp(拷貝文件命令)    mv(重命名命令)

3、在此目錄中創建convert2dvd.sh文件----------------------touch(創建文件命令)

4、編輯convert2dvd.sh文件--------------------vi編輯命令

在文件中輸入以下內容:

#/bin/bash
# by Chris Kloiber <[email protected]>
# 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..."
rsync -avP --exclude SRPMS $1/* $DVD
# 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
# My thanks to Mubashir Cheema for suggesting this fix.
# cd $DVD
mkisofs -J -R -v -T -o $2 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 8 -boot-info-table $DVD
/usr/lib/anaconda-runtime/implantisomd5 --force $2
# Don't like forced mediacheck? Try this instead.
# /usr/lib/anaconda-runtime/implantisomd5 --supported-iso --force $2
cleanup
echo ""
echo "Process Complete!"
echo ""

保存並退出

5、將該目錄中的convert2dvd.sh、CD鏡像文件的權限改為可執行-----chmod(改變權限命令)

6、在目錄中執行convert2dvd.sh文件並設置相關參數

   ./convert2dvd.sh  CD鏡像文件目錄  目標文件目錄/轉換後的鏡像文件名

   例如:./convert2dvd.sh  /root/as4u4/  /root/as4u4/mydvd.iso

 稍候便可轉換成功

Copyright © Linux教程網 All Rights Reserved