Auto Install for Mandrake Linux
Prev Next

Creating an Updated Installation CD Set

There are a couple of reasons for doing this

1. You are tired of installing everything, then having to run rpmdrake to install all updates.

2. You are tired of doing more than you really need to...

Creating updated CDs provides you with a some benefits, Nice new shiny up to date date CDs that you can use for installing, up date your NFS Server file set (for network installs), learn something new.

The following is a simple manual approach to creating a set of updated CDs. I expect that you will adapt it to suit your environment and personal preferences.

NOTE: The CD images that you create are for the newer 800MB disks. If you still want to use the 650MB size, then you will have modify the configuration file and add additional disk definitions.

Creating a Mastering File Set

The first step is to install the package mkcd-3.0.4-1mdk (or later) and all of its dependencies, then create a mirror image of the installation CDs in a working directory and make a few adjustments. As a regular user:

1. Create Working directories as follows:

mkdir -p master_cd/cd

cd master_cd

2. Obtain an initial image of the CD-ROM's directory hierarchy and files.

Insert and Mount the first CD (Installation) then,

cp -a /mnt/cdrom/* cd

chmod -R u+w cd

Un-mount the first CD, then repeat the above for each of the second and third CDs.

3. Create the new Master RPMS sets using the following:

mkdir myRPMS

mv cd/Mandrake/RPMS/* myRPMS

mv cd/Mandrake/RPMS2/* myRPMS

mv cd/Mandrake/RPMS3/* myRPMS

rm -rf cd/Mandrake/RPMS

rm -rf cd/Mandrake/RPMS2

rm -rf cd/Mandrake/RPMS3

mkdir myRPMS4

mv cd/Mandrake/RPMS4/* myRPMS4

rm -rf cd/Mandrake/RPMS4

4. Create a CD configuration file called myCD.conf (similar to the following) and place it in the master_cd directory. If you want to save yourself a lot of typing, look in cd/misc/doc and you will find a template called 9.0.conf. Modify it so that appears similar to the following (you can experiment with the other stuff there some other time), but adjust the full path names to reflect your setup:

#


9.0


LIST 1 /home/david/master_cd/cd/misc/doc/main

/home/david/master_cd/myRPMS


LIST 2 /home/david/master_cd/cd/misc/doc/contrib

##/home/david/master_cd/myRPMS4


DISC 1 734000000 MY-DLE-90EN DISC 1 Download Edition Installation CD (x86)

dir rpms Mandrake/RPMS

generic --synthesis rpms 1

advertising /home/david/master_cd/cd/Mandrake/share/advertising/00-thanks.png

/home/david/master_cd/cd/Mandrake/share/advertising/01-gnu.png /home/david/master_cd/cd/Mandrake/share/advertising/02-internet.png /home/david/master_cd/cd/Mandrake/share/advertising/03-graphic.png /home/david/master_cd/cd/Mandrake/share/advertising/04-develop.png /home/david/master_cd/cd/Mandrake/share/advertising/05-contcenter.png /home/david/master_cd/cd/Mandrake/share/advertising/06-user.png /home/david/master_cd/cd/Mandrake/share/advertising/07-server.png /home/david/master_cd/cd/Mandrake/share/advertising/08-games.png /home/david/master_cd/cd/Mandrake/share/advertising/09-MDKcampus.png /home/david/master_cd/cd/Mandrake/share/advertising/10-MDKexpert.png /home/david/master_cd/cd/Mandrake/share/advertising/11-consul.png /home/david/master_cd/cd/Mandrake/share/advertising/12-MDKstore.png /home/david/master_cd/cd/Mandrake/share/advertising/13-Nvert.png

installation -o 50,3,0.1 --synthesis -l fr,it,en,de,es -t i586

-i /home/david/master_cd/cd/ -d 1/rpms 2/rpms 3/rpms 3/rpms2

boot --isolinux isolinux -b isolinux/isolinux.bin --first /home/david/master_cd/cd/isolinux

-f /home/david/master_cd/cd/images


DISC 2 734000000 MY-DLE-90EN02 DISC 2 Download Edition Second Installation CD (x86)

dir rpms Mandrake/RPMS2

generic --synthesis rpms 1


DISC 3 734000000 MY-DLE-90EN03 DISC 3 Download Edition Contributions CD (x86)

dir rpms Mandrake/RPMS3

##dir rpms2 Mandrake/RPMS4

generic --synthesis rpms 1

##generic -l 0.6 --synthesis rpms2 2

NOTE: the text beginning with advertising through 13-Nvert.png are all on ONE line. The same with the text beginning with installation through 3/rpms2. Also, the lines beginning with ## need to be removed if the final 9.0 ships with CD 3 containing both the RPMS3 and RPMS4 directories or, you add packages of your own.

5. Remove files that are re-generated when creating the ISO images.

rm -f myRPMS/*.cz

rm -f myRPMS4/*.cz

rm -f cd/isolinux/boot.cat

rm -f cd/pkg*.idx

rm -f cd/Mandrake/base/compss

rm -f cd/Mandrake/base/depslist.ordered

rm -f cd/Mandrake/base/hdlist*.cz

rm -f cd/Mandrake/base/provides

rm -f cd/Mandrake/base/synth*

rm -f cd/.rr_moved

6. Update the 'rpmsrate' file

This is optional, but if you added a new package and you want it to be installed using the alternate package selection methods then you have to update the file for your changes. Simply edit the file Mandrake/base/rpmsrate, locate the appropriate Group tag, sub-group tag and add your package to the desired rate. If the rate you want to use is missing, then add it along with your package name. If you have to, add the necessary sub-group tag. Be smart and do not create a new tag.

At this point your 'master_cd' directory should have the directories 'myRPMS', 'myRPMS4' and 'cd' and the file 'myCD.conf'.

Updating the Master File Set

Now the fun part. Locate your favorite ftp mirror site and get the 'updates/9.0/RPMS' directory contents and place them in the master_cd directory in a directory called updates.

When you are done, the updates directory should only contain '*.rpm' files

Now the tricky part. You have to delete the older rpms from your myRPMS and myRPMS4 directories and replace them with the new ones from the updates directory into the appropriate myRPMS or myRPMS4 directory.

I have found that if you run Midnight Commander (mc) from the console or an xterm, you can point it at both your myRPMS/myRPMS4 and updates directories at the same time. This makes it a little easier to see what has to be removed and copied.

WARNING: Be careful and delete only the older files that correspond to the new update ones. See the Advanced section below.

Creating New ISO Images

1. Clean up from any previous ISO creation sessions

cd master_cd

rm -rf tmp

rm -rf build

rm -rf iso

rm -f myCD.script

2. Build the new ISO images

mkcd -s myCD.conf --verbose -p myCD.script -m 1,2,3

When the build is done, you should have three ISO images in the iso/9.0 directory called:

1-9.0.iso, 2-9.0.iso and 3-9.0.iso.

You can now use your favorite CD writing program to create new CDs.

A few things you should watch out for:

1. If you seem to be missing some RPMS on your new CD set, it is probably because there were missing dependencies and as a result they were dropped by mkcd. If you saw REJECTED appear on the display, then you definitely are missing some packages. You will have to look at the dependencies for the rejected packages and make suitable adjustments.

2. If only CD 1 is too large, you can try reducing the 734000000 for it to try and force mkcd to move some packages from CD 1 to the remaining 2 CDs.

If you make any changes then repeat all the steps in Creating New ISO Images.

Advanced and Less Error Prone Approaches

Alternate for Creating the Initial Image

ISO via Loopback device

If you obtained your Mandrake Linux installation CD by downloading the ISO files from a ftp site and have kept them around just in case, then a more reliable way of creating the Mastering File Set is to mount the ISO images via a loop back device and simply copy their contents. The following is a simple set of steps to make an ISO image accessible as though it was just another disk.

The following replaces Step 2, assuming that you are following the steps for Creating a Master Files Set and that you have completed Step 1. You need a temporary mount point and /mnt/disk is usually available so, as root:

mount <where your isos are>/MandrakeLinux-9.0-CD1.i586.iso /mnt/disk \

-t iso9660 -o loop

cp -a /mnt/disk/* cd

umount /mnt/disk

chmod -R u+w cd


mount <where your isos are>/MandrakeLinux-9.0-CD2.i586.iso /mnt/disk \

-t iso9660 -o loop

cp -a /mnt/disk/* cd

umount /mnt/disk

chmod -R u+w cd


mount <where your isos are>/MandrakeLinux-9.0-CD3.i586.iso /mnt/disk \

-t iso9660 -o loop

cp -a /mnt/disk/* cd

umount /mnt/disk

chmod -R u+w cd

finally you have to change ownership from root to a regular user,

chown -R <user>.<group> cd

Now you can resume with Step 3 of Creating a Master Files Set.

A Script Based Updater

The single most frustrating part of maintaining an Updated Installation CD Set, is deleting the correct 'old' RPMS and replacing them with the new 'Updates' RPMS. It is also the one most likely to result in an error; deleting the wrong file or not copying over the new update. So I created the following script to help me. It is not pretty and I am sure that an enterprising individual could come up with a better/safer one, but it works for me.

#!/bin/bash

#

# usage: check2updates <Master RPMS directory> <Master RPMS4 directory> <updates directory>

#

# Examines each update file to see if it is newer than one in the master set.

# If it is, then the older one is removed and the update copied to the master

# set.

#

# If an update package is found that is not in the master set, its name is

# placed in the file "new_rpms.list" for you to manually deal with.

#


# first some Constants

MASTER_FILES="masterfiles.list"

UPDATE_FILES="updatefiles.list"

SELECT_FILES="selections.list"

NEW_RPMS="new_rpms.list"


# and variables

masterfile=""

mastername=""

masterversion=""

masterrelease=""


updatefile=""

updatename=""

updateversion=""

updaterelease=""


master=""

master4=""

updates=""


# then some functions


decide_action ()

{

missing=0


for masterfile in `cat $SELECT_FILES`

do

If [ "`basename $masterfile`" = "$updatefile" ]; then

return 2

fi


get_master_info "$masterfile"


if [ "$mastername" = "$updatename" ]; then

missing=1


# this is the right one

if [ `expr $masterversion \< $updateversion` = "1" ]; then

return 0


elif [ "$masterversion" = "$updateversion" ]; then

if [ `expr $masterrelease \< $updaterelease` = "1" ]; then

return 0

fi

fi

fi

done


if [ $missing -eq 0 ]; then

# update has no match in master list

return 1

fi


# no need to update this one

return 2

}


get_update_info ()

{

# $1 is name of package to query


updatename=`rpm -qp --queryformat %{NAME} $1`

updateversion=`rpm -qp --queryformat %{VERSION} $1`

updaterelease=`rpm -qp --queryformat %{RELEASE} $1 | sed s/mdk//`

}



get_master_info ()

{

# $1 is name of package to query


mastername=`rpm -qp --queryformat %{NAME} $1`

masterversion=`rpm -qp --queryformat %{VERSION} $1`

masterrelease=`rpm -qp --queryformat %{RELEASE} $1 | sed s/mdk//`

}


#

#

# finally the main entry point

#


if [ $# -ne 3 ]; then

echo "usage: <Master RPMS> <Master RPMS4> <Update RPMS>"

exit 1

fi


if [ ! -d "$1" ]; then

echo "Need directory name for Master RPMS."

exit 1

fi

master="$1"


if [ ! -d "$2" ]; then

echo "Need directory name for Master RPMS4."

exit 1

fi

master4="$2"


if [ ! -d "$3" ]; then

echo "Need directory name for Update RPMS."

exit 1

fi

updates="$3"


#clean up old files from previous runs

rm -f $NEW_RPMS


# create list of Update RPMS

ls $updates/* | sed 's|'$updates'/||' > $UPDATE_FILES


# and for the master RPMS

ls $master/* > $MASTER_FILES

ls $master4/* >> $MASTER_FILES


# lets do it

for updatefile in `cat $UPDATE_FILES`

do

# get update package info

echo "Check status of update package: $updatefile."

get_update_info "$updates/$updatefile"


grep "$updatename" $MASTER_FILES > $SELECT_FILES

if [ $? -eq 0 ]; then


decide_action

result=$?


case $result

in

0) # replace, new update

echo " Replacing `basename $masterfile` with $updatefile"

rm -f $masterfile

cp $updates/$updatefile "`dirname $masterfile`/"

;;


1) # missing from master list

echo " Update does not exist in the Master File Set: $updatefile"

echo "$updatefile" >> $NEW_RPMS

;;


*) # skip, update already in Master, but make sure it really is..

If [ ! "`basename $masterfile`" = "$updatefile" ]; then

echo " ERROR Skipping Master file: $masterfile"

fi

;;

esac


else


# the update is a new package, report and add to new list

echo " Update does not exist in the Master File Set: $updatefile"

echo "$updatefile" >> $NEW_RPMS

fi

done


# clean up junk files

rm -f $MASTER_FILES

rm -f $UPDATE_FILES

rm -f $SELECT_FILES


exit 0

Alternate for Creating an Updated CD Set

1. Create a Mastering File set as described in steps 1 through 6 of the section Creating a Mastering File Set (Step 2 could be replaced by the procedure described in section Alternate for Creating the Initial Image).

2. Run the script check2updates, (described in the section A Script Based Updater).

3. Then use the following script to create the ISO images. The first time the script is run, or after you have run the check2updates script, then use the following:

#!/bin/bash

#

# This is a simple script to complete the generation of a

# set of CD's containing the current updates.

#

# It assumes that the ./check2updates script has been run, and that

# the master RPM files contain all the latest stuff.

#

# usage: ./makecd

#


MY_DIR=`pwd`


# couple quick integrity checks

if [ ! -e $MY_DIR/myRPMS ]; then

echo "Could not find the \"myRPMS\" directory."

exit 1

fi


if [ ! -e $MY_DIR/myRPMS4 ]; then

echo "Could not find the \"myRPMS4\" directory."

exit 1

fi


if [ ! -e $MY_DIR/myCD.conf ]; then

echo "Could not find the CD Configuration file."

exit 1

fi


if [ ! -e $MY_DIR/cd ]; then

echo "Could not find the \"cd\" directory."

exit 1

fi


# first, get rid of the old stuff

echo "Removing old stuff..."


rm -f $MY_DIR/myRPMS/*.cz

rm -f $MY_DIR/myRPMS4/*.cz

rm -f $MY_DIR/cd/isolinux/boot.cat

rm -f $MY_DIR/cd/pkg*.idx

rm -f $MY_DIR/cd/Mandrake/base/compss

rm -f $MY_DIR/cd/Mandrake/base/depslist.ordered

rm -f $MY_DIR/cd/Mandrake/base/hdlist*.cz

rm -f $MY_DIR/cd/Mandrake/base/provides

rm -f $MY_DIR/cd/Mandrake/base/synth*

rm -f $MY_DIR/cd/.rr_moved

rm -rf $MY_DIR/tmp

rm -rf $MY_DIR/build

rm -rf $MY_DIR/iso

rm -f $MY_DIR/myCD.script

rm -f $MY_DIR/progress.log


echo "Now making ISO images."

mkcd -s $MY_DIR/myCD.conf -–verbose -p myCD.script -m 1,2,3 &> $MY_DIR/progress.log


echo "Done, the ISOs are located at $MY_DIR/iso/9.0."

echo "and, the verbose diagnostic information is in the file $MY_DIR/progress.log"

exit 0







PrevHome Next
Scratch Built Auto Install Diskette   Setting up a Simple NFS Server