>Есть задача -- собрать из четырех ISO файлов дистрибутива RedHat Enterprise Server
>один DVD, с которого можно было бы грузиьтся и устанавливать RHES.
>
>Возможно и такое?
>Если возможно, то как?когда-то объединял RHEL4 - 4 CD на 1 DVD, с помощью скрипта, который выдернул где-то из инета.
#!/bin/bash
# Take Red Hat Linux/Fedora Core Linux CD images and build a DVD image
#
# Copyright (c) 2004, DMA <dma[!]mail.ur.ru>
#
# The main ideas were taken from Chris Adams's <cmadams[!]iruntheinter.net> and
# Chris Kloiber's <ckloiber[!]redhat.com> scripts.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
usage()
{
echo "Usage: $cmd <ISO directory> <DVD image>" 1>&2
echo " ISO directory: directory holding CD images" 1>&2
echo " DVD image: name of DVD image output file" 1>&2
echo "" 1>&2
echo "The following RPMs must be installed:" 1>&2
echo " $PKGREQ" 1>&2
echo
exit 1
}
cleanup()
{
tree=$start/.tree
rm -rf $tree
mnted=`grep "iso9660" /proc/mounts | grep "$start" | cut -d' ' -f2`
for d in $mnted; do
umount $d
rmdir $d
done
}
#PKGREQ="anaconda anaconda-runtime mkisofs"
PKGREQ="anaconda-runtime mkisofs"
PATH=/usr/local/bin:/usr/bin:/bin
PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
[ "`id -u`" != 0 ] && usage "This must be run as root"
# Check the input directory
start=`/bin/pwd`
base=$1
shift
if [ "$base" = "" -o ! -d "$base" ]; then
usage "Invalid ISO directory"
fi
if [ ${base#/} = $base ]; then
base=$start/$base
fi
# Find the output file name
dvd=$1
if [ "$dvd" = "" ]; then
usage "Invalid DVD image name"
fi
if [ -e $dvd ]; then
echo "DVD image \"$dvd\" already exists"
exit 1
fi
if [ ${dvd#/} = $dvd ]; then
dvd=$base/$dvd
fi
# Make sure necessary tools exist
for p in $PKGREQ; do
rpm -q $p 2> /dev/null | grep -q $p && continue
usage "$p not installed"
done
# If the loopback module isn't loaded, load it (with a higher max_loop)
modprobe loop max_loop=16 > /dev/null 2>&1
# Cleanup
cleanup
mnted=""
# Mount all the CD images
mnt=0
volid=""
appid=""
discs=""
sysid=""
for f in $base/*.iso; do
if [ "$volid" = "" ]; then
volid=`isoinfo -d -i $f | grep "^Volume id:" | cut -d' ' -f3-`
appid=`isoinfo -d -i $f | grep "^Application id:" | cut -d' ' -f3-`
sysid=`isoinfo -d -i $f | grep "^System id:" | cut -d' ' -f3-`
fi
mnt=$(($mnt + 1))
idir=$start/.disc$mnt
mnted="$mnted $idir"
mkdir -p $idir
echo "Mounting `basename $f`"
mount -o ro,loop -t iso9660 $f $idir
disc=`tail +4 $idir/.discinfo | head -1`
discs="$discs $disc"
done
discs=`echo $discs | tr ' ' '\n' | sort -un | tr '\n' , | sed 's/,$//'`
# Make a symlink tree to the CD images
mkdir -p $tree
for mnt in $mnted; do
echo "Symlinking to `basename $mnt` ..."
cd $mnt
find . -depth -type d -print | while read d; do
[ ! -d $tree/$d ] && mkdir -p $tree/$d
find $d -maxdepth 1 -not -type d -print | while read f; do
[ -e $tree/$f ] && continue
ln -s $mnt/$f $tree/$f
done
done
done
find $tree -name TRANS.TBL -print | xargs -i rm -f {}
# Set up the boot image
cd $tree/isolinux
cp isolinux.bin isolinux.bin.new
rm -f isolinux.bin
mv isolinux.bin.new isolinux.bin
rm -f boot.cat
# Make the full discinfo file
cd $tree
if [ -e $tree/.discinfo ]; then
awk '{ if ( NR == 4 ) { print cds } else { print ; } }' cds="$discs" $tree/.discinfo > $tree/.discinfo.new
mv $tree/.discinfo.new $tree/.discinfo
fi
#
## Out with the old and in with the new...
#echo "Removing any existing anaconda packages..."
#rpm -qa | grep anaconda | xargs -i rpm -e {}
#echo "Installing anaconda from the new media..."
#
#distr="RedHat"
#if [ ! -e $tree/$distr ]; then
# $distr="Fedora"
#fi
#rpm -Uvh $tree/$distr/RPMS/anaconda-runtime* 2>/dev/bull
#export PYTHONPATH=$PYTHONPATH:/usr/lib/anaconda-runtime:/usr/lib/anaconda
#
#echo "Determining Package Order ..."
#/usr/lib/anaconda-runtime/pkgorder $tree i386 >$tree/RedHat/base/pkgorder
#
#echo "Generating new hdlist ..."
#rm -f $tree/RedHat/base/hdlist $tree/RedHat/base/hdlist2
#/usr/lib/anaconda-runtime/genhdlist --withnumbers --fileorder $tree/RedHat/base/pkgorder $tree
# Make the ISO
echo "Building the DVD ISO image \"$dvd\" for \"$volid\" ..."
mkdir -p `dirname $dvd`
mkisofs -sysid "$sysid" -A "$volid" -V "$appid" -o $dvd -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -T -r -f -q -l . 2>/dev/null
#cleanup
# Set the MD5SUM in the ISO
echo "Setting DVD MD5 sum ..."
#/usr/lib/anaconda-runtime/implantisomd5 --force $dvd
# Don't like forced mediacheck? Try this instead.
/usr/lib/anaconda-runtime/implantisomd5 --supported-iso --force $dvd
# Clean up
echo "Cleaning up ..."
cleanup