linux 中如何将两个iso合成一个
来源:互联网 发布:小米手机怎么迁移数据 编辑:程序博客网 时间:2024/06/01 09:50
如何将两个iso合成一个
如何将两张iso镜像文件合成一个iso镜像
- 环境我们拿centos 6.9 版本中的两个镜像合成一个完整和做启动光盘。
- 从centso官网上下载一个光盘合成脚本https://wiki.centos.org/
- 我这已经下载好了我把脚本内容贴出来,可以直接用
#!/bin/bash# by Chris Kloiber <ckloiber@redhat.com># Mods under CentOS by Phil Schaffner <pschaff2@verizon.net># 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.# Modified to add sanity checks and fix CentOS4 syntax errors# TODO:# Add checks for available disk space on devices holding output and# temp files.# Add optional 3rd parameter to specify location of temp directory.# Create .discinfo if not present.OS_VER=\$((test -e /etc/fedora-release && rpm -qf /etc/fedora-release --qf "FC%{VERSION}") \|| (test -e /etc/redhat-release && rpm -qf /etc/redhat-release --qf "EL%{VERSION}") \|| echo OS_unknown)case "$OS_VER" in EL[45]*|FC?) IMPLANT=/usr/lib/anaconda-runtime/implantisomd5 if [ ! -f $IMPLANT ]; then echo "Error: $IMPLANT Not Found!" echo "Please install anaconda-runtime and try again." exit 1 fi ;; EL6*|FC1?) IMPLANT=/usr/bin/implantisomd5 if [ ! -f $IMPLANT ]; then echo "Error: $IMPLANT Not Found!" echo "Please install isomd5sum and try again." exit 1 fi ;; OS_unknown) echo "Unknown OS." exit 1 ;; *) echo "Fix this script for $OS_VER" exit 1esacif [ $# -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 1fiDVD_DIR=`dirname $2`DVD_FILE=`basename $2`echo "DVD directory is $DVD_DIR"echo "ISO file is $DVD_FILE"if [ "$DVD_DIR" = "." ]; then echo "Destinaton Directory $DVD_DIR does not exist" exit 1else if [ ! -d "/$DVD_DIR" ]; then echo "Destinaton Directory $DVD_DIR must be an absolute path" exit 1 else if [ "$DVD_FILE" = "" ] || [ -d "$DVD_DIR/$DVD_FILE" ]; then echo "Null ISO file name." exit 1 fi fifiwhich mkisofs >&/dev/nullif [ "$?" != 0 ]; then echo "mkisofs Not Found" echo "yum install mkisofs"fiwhich createrepo >&/dev/nullif [ "$?" != 0 ]; then echo "createrepo Not Found" echo "yum install createrepo"fiif [ -f $2 ]; then echo "DVD ISO destination $2 already exists. Remove first to recreate." exit 1fi# Make sure there is enough free space to hold the DVD image on the filesystem# where the home directory resides, otherwise change ~/mkrhdvd to point to# a filesystem with sufficient free space.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 }cleanupmkdir -p $LOOPmkdir -p $DVDls $1/*.iso &>/dev/nullif [ "$?" = 0 ]; then echo "Found ISO CD images..." CDS=`expr 0` DISKS="1" [ -w / ] || { # Very portable, but perhaps not perfect, test for superuser. echo "Only 'root' may use this script for loopback mounts" 1>&2 exit 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 doneelse if [ -f $1/isolinux/isolinux.bin ]; then echo "Found FTP-like tree..." if [ -e $1/.discinfo ]; then cp -av $1/.discinfo $DVD else# How does one construct a legal .discinfo file if none is found? echo "Error: No .discinfo file found in $1" cleanup exit 1 fi cp -av $1/* $DVD else echo "Error: No CD images nor FTP-like tree found in $1" cleanup exit 1 fifiif [ -e $DVD/.discinfo ]; then awk '{ if ( NR == 4 ) { print disks } else { print ; } }' disks="ALL" $DVD/.discinfo > $DVD/.discinfo.new mv $DVD/.discinfo.new $DVD/.discinfoelse echo "Error: No .discinfo file found in $DVD" cleanup exit 1firm -rf $DVD/isolinux/boot.catfind $DVD -name TRANS.TBL | xargs rm -fcd $DVDcreaterepo -g repodata/comps.xml ./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 $DVDif [ "$?" = 0 ]; then echo "" echo "Image complete, create md5sum..."# $IMPLANT --force $2# Don't like forced mediacheck? Try this instead. $IMPLANT --supported-iso --force $2 echo "Start cleanup..." cleanup echo "" echo "Process Complete!" echo "Wrote DVD ISO image to $DVD_DIR/$DVD_FILE" echo ""else echo "ERROR: Image creation failed, start cleanup..." cleanup echo "" echo "Failed to create ISO image $DVD_DIR/$DVD_FILE" echo ""fi
- 现在把两张centos镜像挂载到/mnt上面
mount /dev/cdrom /mnt/ 把iso镜像挂载到mnt上 mkdir /app/iso1 创建一个文件夹 cp -rp /mnt/* /app/iso1 将第一张光盘里面所有的内容全部复制过去 然后在复制二张光盘的,也是要先把光盘挂载到mnt上,注意一点由于第一张全部复制的,所有第二张盘只要复制包文件 cp -r /mnt/Packages/* iso1/Packages/ 然后在运行脚本 ./mkdvdiso.sh --help 但是在查看帮助时让我们安装一个校验光盘的包,给装上就好了rpm -iv /mnt/Packages/isomd5sum-devel-1.0.6-1.el6. ./mkdvdiso.sh /app/iso1 /app/centso6.9.iso 运行脚本
- 这样就成功,现在我们用ftp服务器给传到win7上。
阅读全文
0 0
- linux 中如何将两个iso合成一个
- 谈JAVA中如何将两个byte数组合成一个数组
- VB中如何将两个单字节合成一个双字节,例如我输入两个byte类型变量
- C#中如何把串口接收的两个字节,合成一个short整型
- 利用XSLT将两个XML文件合成一个XML文件
- 利用XSLT将两个XML文件合成一个XML文件
- 利用XSLT将两个XML文件合成一个XML文件
- 将两个有序链表合成一个有序链表
- SQL Server中如何将一个字段的多个记录值合成一起显示
- 如何把两个UIImage合成一个 iphone编程 ios编程
- 如何把两个PDF合成一个PDF文件
- ubuntu如何将一个.iso转化为.img
- 两个LIST 合成一个DICT
- 将两个顺序表合成一个新的顺序表,并进行排序
- 将两个有序递增的链表合成一个有序递增的链表
- 每日一算法2--将两个ASCII字符合成一个字节
- 将两个有序链表head1、head2合成一个有序链表
- 将两个各自有序的链表,合成一个有序的链表
- 用线性回归进行糖尿病预测
- swagger
- 转载的动态表白程序
- Spring MVC基础
- 《数字技术》连载16: 第2章 数字器件 第11节 JK 触发器
- linux 中如何将两个iso合成一个
- dp专题:编辑距离
- mongodb之索引学习
- Linux下JDK1.7升级1.8版本
- UE4简单的对物体进行可破坏效果的制作
- T-SQL编程上课例题
- JS:根据出生日期 得到年龄
- 面试题总结——JAVA高级工程师(三)
- MongoDB基础操作