Development/Howto/Remaster ISO
From Mandriva
This page summarizes my own experience in creating Ehad, a single installation disk that is based on (and fully compatible with) Mandriva 2006, and includes support for Hebrew and English out of the box.
Contents |
Setup a build environment
Create separate user account
I use a separate user account to host the build environment.
You can create the new account from the command line or use the 'userdrake' GUI.
Once you have your new account set up, open a terminal window and log into the new account using 'su - accountname'.
Install mkcd
You will need 'mkcd' to remaster the iso, so 'urpmi mkcd' to get it.
Create Working directory
Create and change into the working directory as follows:
mkdir -p master_cd/cd
cd master_cd
Obtain an initial image of the CD-ROM's directory hierarchy and files
The next step will copy the installation CD directory hierarchy and files into the working directory.
The easiest way is to download a Mandriva installation cd, mount it, and copy it's content to the working directory.
The following example uses the Mandriva Mini ISO:
# You can use another mirror if you wish wget ftp://fr2.rpmfind.net/linux/Mandrakelinux/official/iso/2006.0/i586/Mandriva-Linux-Free-Mini-2006-CD.i586.iso # create a mount target, if you don't have one already # switch to root account for this su mkdir /mnt/iso mount -o loop Mandriva-Linux-Free-Mini-2006-CD.i586.iso /mnt/iso exit # return to normal user account # now copy the content cp -a /mnt/iso/* cd chmod -R u+w cd # now unmount the iso, and delete the image if you don't need it anymore. # switch to root account for this su umount /mnt/iso # return to normal user account exit # Delete the image if you don't need it anymore rm Mandriva-Linux-Free-Mini-2006-CD.i586.iso
Create the new Master RPMS sets
mkdir myRPMS mkdir mainRPMS mv -f cd/media/main/* mainRPMS rm -rf cd/media/main mkdir contribRPMS
Create a CD configuration file
Create a CD configuration file called myCD.conf (similar to the following, which I used for Ehad) and place it in the master_cd directory.
# Ehad-2006 list 1 -k cd/media/media_info/pubkey1 rpmlist rpmlist -b ./myRPMS rpmlist -b ./mainRPMS rpmlist -b ./contribRPMS disc 1 702m Ehad-2006 "EhadInstallCD 32bit" "EhadLinux2006" -p Dovix dir rpms media/main generic --synthesis rpms 1 installation --askmedia -o 50,3,0.1 --synthesis -l en,he -t i586 -i cd/ -d 1/rpms boot --isolinux -b isolinux/isolinux.bin -f --first cd/isolinux -f --dest install/images cd/install/images
You will need to change occurances of 'Ehad-2005' and 'EhadLinux2005' with your CD name, as well as change 'Dovix' to your nickname.
Create the build script
Create a build script mkiso.sh (similar to the following, which I used for Ehad) and place it in the master_cd directory.
#!/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: ./mkiso.sh # 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/mainRPMS ]; then echo "Could not find the \"mainRPMS\" directory." exit 1 fi if [ ! -e $MY_DIR/contribRPMS ]; then echo "Could not find the \"contribRPMS\" 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/cd/isolinux/boot.cat rm -f $MY_DIR/cd/pkg*.idx rm -f $MY_DIR/cd/media/media_info/depslist.ordered rm -f $MY_DIR/cd/media/media_info/*hdlist*.cz rm -f $MY_DIR/cd/media/media_info/provides rm -rf $MY_DIR/build rm -rf $MY_DIR/iso mv -f $MY_DIR/progress.log $MY_DIR/progress.log.bak echo "Now making ISO images." mkcd -s $MY_DIR/myCD.conf --verbose 1 -m 1 &> $MY_DIR/progress.log # mkcd -s $MY_DIR/myCD.conf --verbose 1 -p myCD.script -m 1,2,3 &> $MY_DIR/progress.log echo "Done, the ISOs are located at $MY_DIR/iso/[version]." echo "and, the verbose diagnostic information is in the file $MY_DIR/progress.log" exit 0
Change the permission on the build script:
chmod +x mkiso.sh
Other configuration files
~/master_cd/cd/media/media_info/compssUsers.pl
This file configures the package selection screen.
It allows to configure:
- The version name (e.g.: Mini) - there may be more than one occurrence.
- The selection topics available to the user
(you might want to get the file from a regular install ISO, as it will contain more package groups. However, this step is really optional and you can skip it while you build your first ISO).
~/master_cd/rpmlist
This configuration file includes the list of files to include in the cd build.
As an example, this is the beginning of the file I use:
# # Ehad configuration # # Mandriva base system # basesystem force zcip force xorg regexp,force urw-fonts force python force tk force tcl force autologin numlock kernel regexp,force # # Mandrake system tools # drakconf force drakwizard force drakxtools force rpmdrake force urpmi force harddrake regexp,force userdrake force menudrake force
Remember that dependencies are added automatically, so you don't have to add them. The syntax, as you can see, is fairly simple. Use 'regexp' to include multiple files using wildcard, and 'force' for packages you want to force into the ISO.
~/master_cd/cd/media/media_info/rpmsrate
This file includes the priority of package selection (is 5 the higher?).
I usually change priority of files that are not included in the "default install" because their priority is too low.
And finally, build the ISO
./mkiso.sh
Couldn't be simpler, once your environment is set up properly :-)
Personalizing your ISO
Adding more RPM packages
As you've noticed, three directories were created: myRPMS, mainRPMS, contribRPMS. The RPMs from the Mini ISO were copied into the mainRPMS directory. You can copy more packages into these directories, based on your personal file selection.
After you add files, make sure to add them to the ~/master_cd/rpmlist file I mentioned before.
Once you build the ISO, some packages may be 'REJECTED' due to missing dependencies. I fix that in the hard way: I build the iso, then check the ~/master_cd/progress.log and add any missing dependencies manually.
If you can and want to write a script to find and download dependencies automatically, please do so and let everybody enjoy it...
Updating RPMs from update repository
I use the script from the Auto Install link mentioned in the Credits section.
Common questions & answers
Question: I get a message such as "REJECTED master disc EhadLinux2006 (1) 8014 mandi-ifw-0.7.4-1mdk.i586 (not selected)" in the progress.log file. What does it mean?
Answer: It means that the build script did not include an RPM package in the ISO as there was no dependency on this package. You can bypass that an force a package to be added by adding a line in the ~/master_cd/rpmlist file:
- mandi regexp,force
or:
- mandi-ifw force
Note that in the first case you don't need the exact package name as defined by RPM.
You don't need to specify in the configuration file secondary packages that are needed due to dependency on other packages - those will be automatically selected by the install script.
Credits & further references
Auto Install For Mandrake Linux
Auto Install For Mandrake Linux is the best resource I know of, and the basis for most of what I know about remastering Mandriva. Even though it is not up to date, I recommend it as an excellent reference - it also contains much more information than what I included in this short guide.
Other Guides
How To create a set of Remastered Distribution CDs that include updated packages and How to create ISOs are two Wiki resources which might provide some background, but they don't seem to be updated.
Quick receipe to get you going
The following is a list of steps you can make to quickly remaster "Ehad" into a distro of your own choice, for example a single disk for server installation.
- Download an and make a clean install of Ehad from linux.ehad.info
- Export the list of installed packages: rpm -qa > pkg_before
- Define software installation repositories using easyurpmi.zarb.info
- Update your system and create updated packages list:
- su
- urpmi --auto-select --auto
- exit
- rpm -qa > pkg_updated
- diff -y pkg_before pkg_updated > to_update
- Remove using rpmdrake any package you don't need. Once you're done, use the "leaves only" filter to view leftover libraries with no dependents and remove them.
Create a removed packages list:- rpm -qa > pkg_deleted
diff -y pkg_before pkg_deleted > to_delete
- rpm -qa > pkg_deleted
- Install any new packaged you need. Run the new apps to make sure they work well for you, then create the list of packages to install:
- rpm -qa > pkg_installed
diff -y pkg_before pkg_installed > to_install
- rpm -qa > pkg_installed
- Follow this wiki page to create your build environment.
- Update your packages directory according tp the lists you created before (to_update, to_delete, to_install)
- Follow this wiki page to update the configuration files in your build environment.
- Build your iso
It would be nice to automate the above using screpts to make it easier to create derivative isos. Any volunteers?
Help wanted
If you can help and extend/correct this short guide, please do so. Help will be appreciated in: documenting the content and parameters of the various configuration files, writing scripts that will automate the process, and covering extended topics that I didn't cover here. Thanks!