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/DVD provides you with a some benefits, Nice new shiny up to date date CDs/DVD 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/DVD. I expect that you will adapt it to suit your environment and personal preferences. It assumes that you have purchased a set of CDs from MandrakeSoft (always a goo thing) or downloaded the 'ISO' images and burned a set of CDs.
|
The images that you create are for the newer 700MB CD or 4.7G DVD disks. If you still want to use the 650MB size, then you will have modify the configuration file and add additional disk definitions. |
The first step is to install the package mkcd-3.8.0-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. Skip and steps (operations) that are not applicable for the media that you are using. 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 additional CD that you have.
3. Create the new Master RPMS sets using the following:
mkdir myRPMS |
mv -f cd/Mandrake/RPMS/* myRPMS |
mv -f cd/Mandrake/RPMS2/* myRPMS |
mv -f cd/Mandrake/RPMS3/* myRPMS |
rm -rf cd/Mandrake/RPMS |
rm -rf cd/Mandrake/RPMS2 |
rm -rf cd/Mandrake/RPMS3 |
mkdir myRPMSextra |
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 10.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:
# |
|
10.0 |
|
list -k ./cd/RPM-GPG-KEYS 1 ./cd/misc/doc/download ./cd/misc/doc/main |
rpmlist -b ./myRPMSextra |
rpmlist -b ./myRPMS |
|
# download |
|
disc 1 695m 10DOWNLOAD1 "Installation CD 1 (x86)" "MandrakeLinux10.0-Download-1" -p Mandrakesoft |
dir rpms Mandrake/RPMS |
generic --synthesis rpms 1 |
advertising ./cd/Mandrake/share/advertising/01-thanks.png |
./cd/Mandrake/share/advertising/02-community.png |
./cd/Mandrake/share/advertising/03-software.png |
./cd/Mandrake/share/advertising/04-configuration.png |
./cd/Mandrake/share/advertising/05-desktop.png |
./cd/Mandrake/share/advertising/06-development.png |
./cd/Mandrake/share/advertising/07-server.png |
./cd/Mandrake/share/advertising/08-store.png |
./cd/Mandrake/share/advertising/09-mdksecure.png |
./cd/Mandrake/share/advertising/10-security.png |
./cd/Mandrake/share/advertising/11-mnf.png |
./cd/Mandrake/share/advertising/12-mdkexpert.png |
./cd/Mandrake/share/advertising/13-mdkexpert_corporate.png |
installation -o 50,3,0.1 --synthesis -l fr,it,en,de,es -t My-Download-i586 -i ./cd/ |
-d 1/rpms 2/rpms 3/rpms |
boot --isolinux isolinux -b isolinux/isolinux.bin --first ./cd/isolinux -f ./cd/images |
|
disc 2 695m 10DOWNLOAD2 "Installation CD 2 (x86)" "MandrakeLinux10.0-Download-2" -p Mandrakesoft |
dir rpms Mandrake/RPMS2 |
generic --synthesis rpms 1 |
boot -b Boot/cdrom-changedisk.img -- -d -f Boot/ ./cd/images/cdrom-changedisk.img |
disc 3 695m 10DOWNLOAD3 "International CD (x86)" "MandrakeLinux10.0-Download-3" -p Mandrakesoft |
dir rpms Mandrake/RPMS3 |
generic --synthesis rpms 1 |
|
disc 11 4.36g 10DOWNLOAD "Installation DVD (x86)" "MandrakeLinux10.0-Download" -p Mandrakesoft |
dir rpms Mandrake/RPMS |
generic --synthesis rpms 1 |
advertising ./cd/Mandrake/share/advertising/01-thanks.png |
./cd/Mandrake/share/advertising/02-community.png |
./cd/Mandrake/share/advertising/03-software.png |
./cd/Mandrake/share/advertising/04-configuration.png |
./cd/Mandrake/share/advertising/05-desktop.png |
./cd/Mandrake/share/advertising/06-development.png |
./cd/Mandrake/share/advertising/07-server.png |
./cd/Mandrake/share/advertising/08-store.png |
./cd/Mandrake/share/advertising/09-mdksecure.png |
./cd/Mandrake/share/advertising/10-security.png |
./cd/Mandrake/share/advertising/11-mnf.png |
./cd/Mandrake/share/advertising/12-mdkexpert.png |
./cd/Mandrake/share/advertising/13-mdkexpert_corporate.png |
installation -o 50,3,0.1 --synthesis -l fr,it,en,de,es -t My-Download-i586 -i ./cd/ |
-d 11/rpms |
boot --isolinux isolinux -b isolinux/isolinux.bin --first ./cd/isolinux -f ./cd/images |
|
The text beginning with advertising through 13-mdkexpert_corporate.png and installation through 3/rpms and installation through 11/rpms, are all on ONE line. |
The filenames contained in the directory Mandrake/share/advertising/ change from release to release so you need to adjust them to match what you have (see the file list). If you do not, then the GUI based install will FAIL as it goes to install packages. |
5. Remove files that are re-generated when creating the ISO images.
rm -rf ./iso |
rm -rf ./build |
rm -f ./myCD.script |
rm -f ./progress.log |
|
rm -rf ./cd/Boot |
rm -f ./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 |
|
rm -f ./myRPMS/*.cz |
rm -f ./myRPMSextra/*.cz |
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'.
One final note, MandrakeSoft has a series of Twiki pages at http://qa.mandrakesoft.com/twiki/bin/view/Main that describes a substantial number of features of the distribution. For more specific details regarding the configuration file used by mkcd, then look at http://qa.mandrakesoft.com/twiki/bin/view/Main/MakeCD.
Now the fun part. Locate your favorite ftp mirror site and get the 'updates/10.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 myRPMSextra directories and replace them with the new ones from the updates directory into the appropriate myRPMS or myRPMSextra 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 / myRPMSextra and updates directories at the same time. This makes it a little easier to see what has to be removed and copied.
|
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 /home/<your home>/tmp/10.0 |
rm -rf /home/<your home>/tmp/build |
rm -rf /home/<your home>/tmp/.mkcd* |
rm -rf /home/<your home>/tmp/.build_hdlist* |
rm -rf ./build |
rm -rf ./iso |
rm -f ./myCD.script |
rm -f progress.log |
2. Build the new ISO images
For CDs use:
mkcd -s myCD.conf --verbose -p myCD.script -m 1,2,3 &> ./progress.log
For a DVD use:
mkcd -s myCD.conf --verbose -p myCD.script -m 11 &> ./progress.log
When the build is done, you should have three ISO images in the iso/9.0 directory called:
1.iso, 2.iso and 3.iso or 11.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 695m for it to try and force mkcd to move some packages from CD 1 to the remaining 2 CDs. |
3. |
If you have more RPMS than will fit in the disks defined, then add an additional disc definition. See the progression of disc 2 to disc 3 for a hint about what to do. |
4. |
If the ISO build fails when you are building the small (695m) disks and you see a message like: |
|
FATAL mark_and_check_list: a previous revert to put needed packages failed, cannot order packages correctly fo rep 1 on disc 1 It means that mkcd was unable to create the first disk because the were too many REQUIRED packages needed for the first disk. You can try and remove various packages, but I found that removing any OLDer kernels did the trick for me. Alternately, you can build the DVD image. |
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.
Assuming that you are following the steps for Creating a Mastering File Set, then the following replaces Step 2.
You need a temporary mount point and /mnt/disk is usually available so, as root:
mount <where your isos are>/Mandrake10-cd1-inst.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>/Mandrake10-cd2-ext.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>/Mandrake10-cd3-i18n.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 Mastering File 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: 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 |
return 2 |
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 --nosignature --queryformat %{NAME} $1` |
updateversion=`rpm -qp --nosignature --queryformat %{VERSION} $1` |
updaterelease=`rpm -qp --nosignature --queryformat %{RELEASE} $1 | sed s/mdk//` |
} |
|
|
get_master_info () |
{ |
# $1 is name of package to query |
|
mastername=`rpm -qp --nosignature --queryformat %{NAME} $1` |
masterversion=`rpm -qp --nosignature --queryformat %{VERSION} $1` |
masterrelease=`rpm -qp --nosignature --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 ".*/$new_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 |
|
# |
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 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 [clean] |
# |
|
MY_DIR=`pwd` |
TMP_DIR="$HOME/tmp" |
|
# couple quick integrity checks |
if [ ! -e $MY_DIR/myRPMS ]; then |
echo "Could not find the \"myRPMS\" directory." |
exit 1 |
fi |
|
if [ ! -e $MY_DIR/myRPMSextra ]; then |
echo "Could not find the \"myRPMSextra\" 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..." |
|
if [ "XXX$1" != "XXX" ]; then |
# clean up cache area files |
echo "Removing cache filesfrom $TMP_DIR." |
rm -rf $TMP_DIR/10.0 |
rm -rf $TMP_DIR/build |
rm -rf $TMP_DIR/.mkcd* |
rm -rf $TMP_DIR/.build_hdlist* |
rm -rf $MY_DIR/build |
fi |
|
# clean up from the last run |
rm -rf $MY_DIR/iso |
rm -f $MY_DIR/myCD.script |
rm -f $MY_DIR/progress.log |
|
# make sure CD base image is clean |
rm -rf $MY_DIR/cd/Boot |
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 |
|
# remove any disk content files |
rm -f $MY_DIR/myRPMS/*.cz |
rm -f $MY_DIR/myRPMSextra/*.cz |
|
echo "Now making ISO images." |
mkcd -s $MY_DIR/myCD.conf --verbose 1 -p myCD.script -m 11 &> $MY_DIR/progress.log |
|
echo "Done, the ISOs are located at $MY_DIR/iso/10.0." |
echo "and, the verbose diagnostic information is in the file $MY_DIR/progress.log" |
exit 0 |
Prev | Home | Next |
Scratch Built Auto Install Diskette | Setting up a Simple NFS Server |