# # Makefile to help build a customized RedHat Installation CD # # More information from http://256stuff.com/gray/docs/redhat_boot/ # # # This assumes that the Redhat CDs have been unloaded into the 'cdrom' # directory in the current directory. It also assumes you have a # 'mnt' directory in the current directory with sub directories: # 'floppy' and 'redhat' # KS = ks.cfg INITRD = initrd.ext2 # files from the Redhat CDs CDROM = cdrom MOUNTS = mnt FLOPPY = $(MOUNTS)/floppy REDHAT = $(MOUNTS)/redhat IMAGE_BOOT = dosutils/autoboot/cdboot.img CDBOOT = $(CDROM)/$(IMAGE_BOOT) HDLIST = $(CDROM)/RedHat/base/hdlist RPMS = $(CDROM)/RedHat/RPMS all : @ echo 'Enter "make cdr" to burn a cd-r' @ echo 'Enter "make cdrw" to burn a cd-rw' @ echo 'Enter "make cd_image" to make the CD image' @ echo 'Enter "make eject" to eject the cdrom' @ echo '' @ echo 'Enter "make ks" to install the ks.cfg into the cdboot.img' @ echo 'Enter "make editflop" to edit the floppy configs' @ echo 'Enter "make hdlist" to remake the cdrom hdlist files' @ echo 'Enter "make depend" to test the RPMs for any dependencies' clean : rm -f $(KS) cdr : $(KS) $(CDBOOT) $(HDLIST) @ test -w /boot/vmlinuz || ( echo "Must be root" ; false ) mkisofs -b $(IMAGE_BOOT) -l -J -R -r -T -v -V 'RH Install' \ $(CDROM) | \ cdrecord -v $(BLANK) speed=8 dev=0,0,0 - cd_image : $(KS) $(CDBOOT) $(HDLIST) rm -f $@ $@.t mkisofs -b $(IMAGE_BOOT) -l -J -R -r -T -v -V 'RH Install' \ -o ../$@.t $(CDROM) mv $@.t $@ cdrw : make BLANK=blank=fast cdr eject : @ test -w /boot/vmlinuz || ( echo "Must be root" ; false ) cdrecord dev=0,0,0 -eject $(CDBOOT) : $(KS) @ test -w /boot/vmlinuz || ( echo "Must be root" ; false ) -mkdir $(MOUNTS) $(FLOPPY) $(REDHAT) rm -f $(INITRD) $(INITRD).gz mount -o loop -t msdos $@ $(FLOPPY) gzip -dc $(FLOPPY)/initrd.img > $(INITRD) mount -o loop -t ext2 $(INITRD) $(REDHAT) install -c -m 644 $(KS) $(REDHAT)/tmp umount -f $(REDHAT) gzip -9 $(INITRD) mv $(INITRD).gz $(FLOPPY)/initrd.img umount -f $(FLOPPY) touch $@ ks : $(CDBOOT) editflop : @ test -w /boot/vmlinuz || ( echo "Must be root" ; false ) mount -o loop -t msdos $(CDBOOT) $(FLOPPY) $(EDITOR) $(FLOPPY) cd $(FLOPPY) ; rm -f *~ \#* umount -f $(FLOPPY) # NOTE: you cannot use $@.t here because genhdlist creates hdlist and hdlist2 $(HDLIST) : $(RPMS) genhdlist --withnumbers --hdlist $@ $(PWD)/$(CDROM) hdlist : $(HDLIST) # the mkdir testdb is designed to fail because I don't want to rm -rf # it but it needs to be clean before we start. depend : $(RPMS) @echo "Look for any 'is needed by' lines. If you get none and you see" @echo "the 'Preparing' message, then you should be good. I'm not sure" @echo "if there is a better way to test for success here." @echo "" @echo "Also, the testdb directory should be clear so if it exists, you" @echo "will have to 'rm -rf testdb' yourself." @echo "" @echo "Press return/enter to continue." read yn mkdir testdb rpm --initdb --dbpath $(PWD)/testdb -x=$(PWD) ;\ cd $(RPMS) ;\ rpm --test --dbpath $$x/testdb -Uvh *.rpm rm -rf testdb