Mandriva CD -e kopeerimine DVD -ks
Allikas: Pingviini Viki
Kui sa oled alla laadinud Mandriva CD ISOd ja soovid neid kokku panna üheks DVD ISOks siis selleks võid sa kasutada mdvcd2dvd skripti, mille sa võid alla laadida siit.
Skripti kasutamiseks pead sa ta kas lahtipakkima, kui sa laadisid selle alla ülalolevast lingist
gunzip mdvcd2dvd.sh.gz
ja andma talle käivitamis õigused, või kui sa kopeerisid selle allolevast tekstist ja salvestasid faili:
chmod +x mdvcd2dvd.sh
Skript peab olema ühes ja samas kataloogis koos CD ISO -ga.
Praegune skript näeb välja nii:
#!/bin/sh
# mdvcd2dvd.sh
# Converts set of Mandriva CD iso images to a single DVD iso image.
# Copyright (C) 2005, R.James <upsnag@charter.net>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 or later.
# 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.
# Usage:
# Put this script in the directory containing the iso's or in your PATH.
# Must be root to run. Add execute permissions if necessary.
# The directory containing the CD iso files must be current.
# Burning:
# /usr/bin/growisofs -Z /dev/<yourDVDwriter>=/destination/dvd.iso
# Lots of disk space required to work, 3X the distribution size at least.
# Changelog: 2005-10-16 R.James <upsnag@charter.net>
# Remove Bugs/ToDo because described problem disappeared after LE2005.
# Make GPL agreement more verbose. Fix syntax error in md5sum check section.
# Make some default responses (when just pressing enter) more reasonable.
# Must be run as root.
if [ $UID -ne 0 ]; then
echo ""
echo "You must run this as root."
echo ""
exit 1
fi
# Make sure we have some CD iso's in current dir.
isolist=`ls -1 *CD*.iso` 2> /dev/null
if [ "$isolist" = "" ]; then
echo ""
echo "Error: No *.iso files found in current directory."
echo ""
exit 1
fi
# Verify that these are the correct iso files.
clear
echo ""
ls -1 *CD*.iso
echo ""
echo -n "Are these the Mandriva iso files I should combine into DVD? [Y/n]: "
read response
if [ -z $response ]; then
response=y
fi
echo ""
case $response in
[Nn]*) echo "Please cd to directory with Mandriva iso files and try again."
echo ""
exit 0 ;;
esac
# Look for md5 file and offer check the md5sums.
md5file=`ls -1 | grep -m1 md5`
if [ "$md5file" != "" ]; then
echo -n "Shall I check the md5sums first? [Y/n]: "
read response
if [ -z $response ]; then
response=y
fi
case $response in
[Yy]*) echo "Checking md5sums. Please be patient..."
md5sum --check $md5file
if [ $? -ne 0 ]; then
echo ""
echo "There is a problem with the md5sums."
echo ""
exit 1
fi ;;
esac
fi
# Determine a good default image name then let user decide.
defname=`ls -1 *.iso | grep CD1 | sed 's/CD1/DVD/'`
if [ "$defname" = "" ]; then
defname=Mandriva_DVD.iso
fi
echo ""
echo -n "Name of DVD iso file to create? [$defname]: "
read response
if [ -z $response ]; then
isoname=$defname
else
isoname=$response
fi
# The iso image name determines the temporary build dir name.
isodir=`echo $isoname | sed 's/.iso//'`
# Offer to delete any existing file or dir with the same name.
for chkfile in $isoname $isodir; do
if [ -d $chkfile ] || [ -f $chkfile ]; then
echo ""
echo "$chkfile already exists."
echo -n "Shall I delete it and proceed? [y/N]: "
read response
if [ -z $response ]; then
response=n
fi
case $response in
[Yy]*) echo "Deleting old $chkfile..."
rm -Rf $chkfile ;;
*) echo "Script terminated by user."
echo ""
exit 0 ;;
esac
fi
done
# Mount each CD iso and copy required files to build dir.
mkdir $isodir
mkdir /mnt/cdtmp 2> /dev/null
# This umount is just in case the prior run died unexpectedly.
umount /mnt/cdtmp 2> /dev/null
i=0
echo ""
for iso in $isolist; do
let i=i+1
mount -o loop,ro,noatime $iso /mnt/cdtmp
case $i in
1) echo "Copying CD1..."
ls -1 /mnt/cdtmp/media
cp -a /mnt/cdtmp/* $isodir
echo "Updating package index..."
pkgidx=`ls -1 $isodir | grep -m1 .idx`
chmod 644 $isodir/$pkgidx
sed --in-place 's/Disc[1-9]/DVD/g' $isodir/$pkgidx
volname=`grep -m1 DVD $isodir/$pkgidx | sed 's/\ .*//'` ;;
*) echo "Copying CD$i..."
ls -1 /mnt/cdtmp/media
cp -a /mnt/cdtmp/media/* $isodir/media ;;
esac
echo ""
umount /mnt/cdtmp 2> /dev/null
done
# Generate the image file.
mkisofs -J -R -T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 8 -boot-info-table -V $volname -o $isoname $isodir
# Offer to clean up.
echo ""
echo -n "Shall I delete the temporary build directory? [Y/n]: "
read response
if [ -z $response ]; then
response=y
fi
case $response in
[Yy]*) echo "Deleting directory: $isodir..."
rm -Rf $isodir ;;
*) echo "Preserved directory: $isodir" ;;
esac
rmdir /mnt/cdtmp
echo ""
echo "$isoname complete!"
echo ""
exit 0

