免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1970 | 回复: 1
打印 上一主题 下一主题

创建FreeBSD的DVD.iso安装光盘 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-18 01:42 |只看该作者 |正序浏览
准备刻一张FreeBSD-7.0-RELEASE的DVD,网上很多介绍都是在Windows下使用什么iso提取工具的,貌似很麻烦。参考了一些FreeBSD高手的实现,我写了一个简单的脚本,主要功能是从3张disc*.iso创建出一个dvd.iso
1,准备工作:
工作目录 work/ 和 3张disc*.iso, 比如
work/
7.0-RELEASE-i386-disc1.iso
work/
7.0-RELEASE-i386-disc2.iso
work/
7.0-RELEASE-i386-disc3.iso
2,用以下代码创建脚本文件,比如 mkdvd.sh,放在work目录下。用root用户执行,将在work目录下产生一个7.0-RELEASE-i386-dvd.iso的文件。
#!/bin/sh
disc1=`ls | grep "disc1.iso"`
disc2=`ls | grep "disc2.iso"`
disc3=`ls | grep "disc3.iso"`
dvd=`echo $disc1 | sed "s/disc1/dvd/"`
## Prepare temporary dir to store dvd files
if test -e tmp && test -d tmp
then
    rm -fr tmp
fi
mkdir tmp
## Extract contents of each disc*.iso to temporary dir
for disc in $disc3 $disc2 $disc1
do
    mdconfig -a -f $disc -u 66
    if test -e /dev/md66
    then
    echo Extract $disc ...
    mount -t cd9660 /dev/md66 /mnt
    tar -cf - -C /mnt . | tar -xf - -C tmp/
    umount /mnt
    mdconfig -d -u 66
    else
    echo Can not create memory disk.
    exit -1
    fi
done
## Merge index to point to the first disc
echo Merge index ...
cd tmp
cat INDEX | sed "s/||2/||1/g" > index
cat index | sed "s/||3/||1/g" > INDEX
cat INDEX | sed "s/|3/|1/g"   > index
mv  index INDEX
cd ..
## Make dvd iso file
echo Make $dvd ...
mkisofs -R -no-emul-boot -b boot/cdboot -o $dvd tmp
rm -fr tmp
exit 0


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/29188/showart_1084873.html

论坛徽章:
0
2 [报告]
发表于 2008-07-22 13:28 |只看该作者
可以在linux下运行吗?
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP