Auto Install for Mandrake Linux | ||
---|---|---|
Prev | Next |
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 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 them to suit your environment and personal preferences.
The first step is to create a mirror image of the installation CDs in a working directory and make a couple adjustments. As a regular user:
1. Create Working directories
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. Remove files that are re-generated when creating the ISO images or in later steps.
rm -f cd/isolinux/boot.cat |
rm -f cd/pkg*.idx |
rm -f cd/.rr_moved |
4. 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. 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.
5. Create a new Master RPMS set
mkdir RPMS |
mv cd/Mandrake/RPMS/* RPMS |
mv cd/Mandrake/RPMS2/* RPMS |
mv cd/Mandrake/RPMS3/* RPMS |
rm -rf cd/Mandrake/RPMS |
rm -rf cd/Mandrake/RPMS2 |
rm -rf cd/Mandrake/RPMS3 |
At this point your 'master_cd' directory should have the directories 'RPMS' and 'cd'.
Now the fun part. Locate your favorite ftp mirror site and get the 'updates/8.2/RPMS' directory contents and place them in the master_cd 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 master_cd/RPMS directory and then copy the new ones from the master_cd/updates directory into the master_cd/RPMS directory.
I have found that if you run Midnight Commander (mc) from the console or an xterm, you can point it at both your RPMS 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.
1. Clean up from any previous ISO creation sessions
cd master_cd |
rm -rf /tmp/.mkcd_build_hdlist |
rm -rf /tmp/build |
rm -rf /tmp/Cooker |
rm -rf cd/Mandrake/RPMS |
2. Copy master files and directory contents back
cp -a RPMS cd/Mandrake |
3. Build the new ISO images
cd cd/misc |
./MakeCD -t $HOME/tmp -a $HOME/master_cd/cd |
When the build is done, you should have three ISO images in the $HOME/tmp/iso/Cooker directory called:
1-Cooker-i586.iso, 2-Cooker-i586.iso and 3-Cooker-i586.iso.
You can now use your favorite CD writing program to create new CDs.
Couple 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 dependancies and as a result they were dropped by the MakeCD script.
2. If you end up with 4 CDs because you added some extras or the ones that were updated were larger, then you can always add the option –discsize 731000000 to have your CDs created for the newer 700MB CDs.
If you make any changes then repeat all the steps in Creating New ISO Images.
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 follow 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-8.2-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-8.2-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-8.2-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.
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: checkupdates <Master RPMS 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="" |
updates="" |
|
# then some functions |
|
decide_action () |
{ |
missing=0 |
|
for masterfile in `cat $SELECT_FILES` |
do |
if [ "$masterfile" = "$updatefile" ]; then |
return 2 |
fi |
|
get_master_info "$master/$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 2 ]; then |
echo "usage: <Master RPMS> <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 Update RPMS." |
exit 1 |
fi |
updates="$2" |
|
#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/* | sed 's|'$master'/||' > $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 $masterfile with $updatefile" |
rm -f $master/$masterfile |
cp $updates/$updatefile $master/ |
;; |
|
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 [ ! "$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 |
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 checkupdates, (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 checkupdates 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 ./checkupdates script has been run, and that |
# the master RPM files contain all the latest stuff. |
# |
# usage: ./makecd [700] |
# |
# if 700 is present, then build the ISOs for a 700MB CD |
# instead of the default 650MB |
|
# set desired CD size |
SIZE=”681000000” |
if [ “XXX$1” = “XXX700” ]; then |
SIZE=”731000000” |
fi |
|
# set where things are |
MY_DIR=`pwd` |
TOP=”$HOME/tmp” |
|
# couple quick integrity checks |
if [ ! -e $MY_DIR/RPMS ]; then |
echo “Could not find the \”RPMS\” directory.” |
exit |
fi |
if [ ! -e $MY_DIR/cd ]; then |
echo “Could not find the \”cd\” directory.” |
exit |
fi |
if [ ! -e $TOP ]; then |
echo “Could not find where you wanted stuff placed.” |
exit |
fi |
|
# first, get rid of the old stuff |
echo "Removing old stuff..." |
rm -f $TOP/progress.log |
rm -f $TOP/diag.log |
rm -rf $TOP/iso |
|
rm -rf $MY_DIR/cd/.rr_moved |
rm -f $MY_DIR/cd/isolinux/boot.cat |
rm -rf $MY_DIR/cd/Mandrake/RPMS* |
|
rm -rf /tmp/.mkcd_build_hdlist |
rm -rf /tmp/build |
rm -rf /tmp/Cooker |
|
echo "Adding the RPMS back too." |
cp -a $MY_DIR/RPMS $MY_DIR/cd/Mandrake/RPMS |
|
echo "Now making ISO images." |
$MY_DIR/cd/misc/MakeCD -t $TOP -c $TOP/diag.log –-discsize $SIZE -a $MY_DIR/cd &> $TOP/progress.log |
|
echo “Done, the ISOs are located at $TOP/iso/cooker.” |
exit 0 |
|
Prev | Home | Next |
Scratch Built Auto Install Diskette | Setting up a Simple NFS Server |