SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've seen alot of people asking how to do this lately, so I thought I'd post a script I wrote a while back to do it. You can use it too combine multiple CDs or ISOs into 1. You can also use it remaster the same. It builds a replica of the ISO/CDROM using symlinks vs actually copying the files to hard disk, so it's faster and doesn't require much hard disk space at all. mkisofs warns about doing it this way, but I've not had any problems at all doing, results may vary though. Anyway, here it is if you want it.
Code:
#!/bin/sh
#
# rebuildiso 0.1
#
# USE AT YOUR OWN RISK!
# It works fine for me, in it's present form, but I suggest you look it over
# thoroughly before using it.
#
# This script will rebuild an ISO from a current ISO or CDROM, allowing you to make
# modifications in between, without ever actually coping the files from the ISO/CDROM
# to hard disk. It does this by setting up a replica of the ISO/CDROMs's directory
# tree using links vs actual files. This saves time and space. It can also be used to
# combine multiple ISO/CDROMs into a single ISO, for say a DVD iso. Since it mounts
# the ISO/CDROMs on a loop device, you either need to run it as root or make fstab
# entries to allow a regular user to do it, which is a security risk in and of itself.
#
# NOTE: In order to combine multiple CDROMs you WILL need to have multiple CDROM drives
# available, since all ISO/CDROMs MUST stay mounted until the new ISO has been
# built. If you have a minimum of 2 CDROM drives, then you could use this script
# to combine those 2 into 1, then use that new ISO to build upon and so on, thereby
# combining as many as you want eventually into a single ISO. Hope that makes sense. :)
#
#
APPID="Slackware Install" # Default Application ID Name
VOLID="Slackware Install DVD" # Default Volume ID Name
NAME="slackware-dvd.iso" # Default filename of new ISO
#
# DO NOT SET THESE 2 VARIABLES TO ANYTHING YOU VALUE, AS THEY ARE REMOVED AT COMPLETION!!!!!!
MNTDIR="/mnt/rebuildiso" # Directory where the original ISO/CDROMs will be mounted
REPDIR="/tmp/rebuildiso" # Directory to build the replica in
EXITSTAT=0
# Codes:
# 1 -- mkisofs failed
# 2 -- $MNTDIR exists & we have no idea what is there (safe play is to abort)
# 3 -- $REPDIR exists & we have no idea what is there (safe play is to abort)
# 4 -- mkdir failed
# 5 -- mount -o loop failed
# 6 -- user abort
create_iso ()
{
cd $REPDIR
if [ -h isolinux/isolinux.bin ]; then
# mkisofs modifies isolinux.bin, so we need to remove the link to it
# and copy the actual file into the new tree
cp -H isolinux/isolinux.bin /tmp
rm isolinux/isolinux.bin
cp /tmp/isolinux.bin isolinux/
rm /tmp/isolinux.bin
fi
if [ -e isolinux/isolinux.boot ]; then
# mkisofs creates isolinux.boot, so just remove it if present
rm -f isolinux/isolinux.boot
fi
if [ -d isolinux ]; then
mkisofs -o $NAME -R -J -V "$APPID" -hide-rr-moved \
-v -d -N -no-emul-boot -boot-load-size 4 -boot-info-table \
-sort isolinux/iso.sort -b isolinux/isolinux.bin \
-c isolinux/isolinux.boot -A "$VOLID" -f .
if [ ! "$?" = "0" ]; then
EXITSTAT=1
echo "mkisofs failed!!!"
fi
else
echo
echo "There is no isolinux directory present. The ISO will not"
echo "be bootable! Not a problem if you'll be adding isolinux"
echo "later or don't care if it's bootable or not."
echo -n "Continue anyway? (y/n): "
read ANSWER
if [ "$ANSWER" = "y" ]; then
mkisofs -o $NAME -R -J -V "$APPID" -hide-rr-moved \
-v -d -N -A "$VOLID" -f .
if [ ! "$?" = "0" ]; then
EXITSTAT=1
echo "mkisofs failed!!!"
fi
else
echo "Aborted..."
exit 6
fi
fi
}
cleanup ()
{
cd /
for ((a=1; a <= NUM ; a++))
do
umount $MNTDIR/loop$a
rmdir $MNTDIR/loop$a
done
rm -rf $REPDIR
rm -f /tmp/.rebuildiso-save
rmdir $MNTDIR
}
if [ -f /tmp/.rebuildiso-save ]; then
# Get the settings from the saved build, if present
. /tmp/.rebuildiso-save
echo "Found a saved session at $REPDIR"
echo -n "Create the ISO from it? (y/n): "
read ANSWER
if [ "$ANSWER" = "y" ]; then
create_iso
cleanup
echo
if [ "$EXITSTAT" = "0" ]; then
echo "ISO $NAME build is complete..."
else
echo "ISO $NAME build failed!!!"
fi
else
rm /tmp/.rebuildiso-save
fi
exit $EXITSTAT
fi
while [ "$GOTALL" != "y" ]
do
# Here we collect all the information we need
echo
echo -n "How many ISO/CDROMs do you want to include?: "
read NUM
if (( NUM )); then
((a = 1))
while (( a <= NUM ))
do
echo
echo "What is the full path to ISO/CDROM #$a?"
echo -n "(ie /home/gomer/slack.iso, /dev/cdrom): "
read ISOS[$a]
if [ -f ${ISOS[$a]} ] || [ -b ${ISOS[$a]} ]; then
((a += 1))
else
echo
echo "${ISOS[$a]} either does not exist or is not a regular file or device!"
fi
done
((a = 1))
while (( a ))
do
echo
echo -n "What shall I name the new ISO? [`basename $NAME`]: "
read TMP
if [ -n "$TMP" ]; then
NAME=$TMP
fi
# Force it into /tmp/filename so we don't end up writing the new ISO inside $REPDIR
# when using the -o option to mkisofs
NAME="/tmp/`basename $NAME`"
if [ -e $NAME ]; then
echo
echo -n "$NAME already exists. Overwrite it? (y/n): "
read ANSWER
if [ "$ANSWER" = "y" ]; then
(( a = 0 ))
fi
else
(( a = 0 ))
fi
done
echo
echo -n "What should I use for the Application ID? [$APPID]: "
read TMP
if [ -n "$TMP" ]; then
APPID=$TMP
fi
echo
echo -n "What should I use for the Volume ID? [$VOLID]: "
read TMP
if [ -n "$TMP" ]; then
VOLID=$TMP
fi
echo "About to generate $NAME from the following ISO/CDROMs:"
for ((a=1; a <= NUM ; a++))
do
echo " ${ISOS[$a]}"
done
echo
echo -n "Proceed? (y/n): "
read GOTALL
fi
done
if [ -e $MNTDIR/loop1 ]; then
echo
echo "I can not proceed until you unmount anything in $MNTDIR"
echo "and remove the directory, since I have no way of knowing"
echo "for sure what is there."
exit 2
fi
if [ -e $REPDIR ]; then
echo
echo "I can not proceed until you remove $REPDIR, since I have"
echo "no way of knowing for sure what is there."
exit 3
fi
mkdir -p $REPDIR
if [ ! "$?" = "0" ]; then
echo "Failed to create $REPDIR"
exit 4
fi
for ((a=1; a <= NUM ; a++))
do
mkdir -p $MNTDIR/loop$a
if [ ! "$?" = "0" ]; then
echo "Failed to create $MNTDIR/loop$a"
exit 4
fi
mount -o loop ${ISOS[$a]} $MNTDIR/loop$a
if [ ! "$?" = "0" ]; then
echo "Could not mount ${ISOS[$a]}"
exit 5
fi
cd $MNTDIR/loop$a
(( x=1 ))
echo
echo -n "Adding ISO/CDROM #$a to $REPDIR ... "
for file in `find . | cut -c 3-`
do
if [ -d "$file" ]; then
mkdir -p $REPDIR/$file
else
ln -sf $MNTDIR/loop$a/$file $REPDIR/$file
fi
# Print progress
case $x in
1)
printf "\b|";;
2)
printf "\b/";;
3)
printf "\b-";;
*)
printf "\b\\"
x=1;;
esac
(( x++ ))
done
printf "\bDone!"
done
echo
cat << EOF
The directory tree for the new ISO is ready at $REPDIR.
If you would like to make some custom modifications to it
then you can exit this script now, make your mods, and then
rerun this script to build the ISO.
NOTE: Before you can modify any file, you will need to replace
the link with the actual file from the ISO/CDROM. All of
the ISO/CDROMs are mounted at $MNTDIR.
EOF
echo
echo -n "Proceed now? (y/n): "
read ANSWER
if [ "$ANSWER" = "n" ]; then
# Save the variables for later
cat << EOF > /tmp/.rebuildiso-save
# DO NOT MODIFY THIS FILE! IT'S INTEGRITY IS ASSUMED!"
NUM=$NUM
REPDIR="$REPDIR"
MNTDIR="$MNTDIR"
NAME="$NAME"
APPID="$APPID"
VOLID="$VOLID"
GOTALL="y"
EOF
exit 0
fi
create_iso
cleanup
echo
if [ "$EXITSTAT" = "0" ]; then
echo "ISO $NAME build is complete..."
else
echo "ISO $NAME build failed!!!"
fi
exit $EXITSTAT
# End of script
DaHammer!
You could, perhaps, contact slackMeUp member.... As long as I remember he was trying with a project of Slackware DVD GUI install. Perhaps your cooperation will greatly be appreciated?!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.