#!/bin/sh -x # script to make my bootable CD # By Jeremy C. Reed # Last updated on April 25, 2003 # path of the directory tree to be copied into the iso9660 filesystem. DIRTREE=/backups/netbsd/destdir ## can be original built by "make build" if [ -e /usr/src/sys/arch/i386/compile/LIVECD/netbsd ] ; then KERNEL=/usr/src/sys/arch/i386/compile/LIVECD/netbsd else echo "kernel missing" exit 1 KERNEL=/backups/netbsd/netbsd fi CUSTOM_DIRTREE=/backups/netbsd/mybsd ## customized or new files MOUNT=mnt # just a mount point mkdir -p $MOUNT # clean out dev/ # init will mount it via MFS and run MAKEDEV find $DIRTREE/dev/* ! -name "MAKEDEV*" -exec rm -rf -- "{}" \; # clean out var/run since etc/rc.d/mountcritlocal does same rm -rf -- $DIRTREE/var/run/* # empty lastlog and wtmp cp /dev/null $DIRTREE/var/log/lastlog cp /dev/null $DIRTREE/var/log/wtmp # clean up TMP directories rm -rf -- $DIRTREE/tmp/* rm -rf $DIRTREE/tmp/.* find $DIRTREE/var/tmp/* ! -name "vi.recover" -exec rm -rf -- "{}" \; #rm -rf $DIRTREE/var/tmp/vi.recover/* # clean out /home/ homes #rm -rf -- $DIRTREE/home/reed rm $DIRTREE/home/reed # just a symlink cp /dev/null $DIRTREE/home/user/.bash_history # need a kernel at /netbsd or fstat and other tools won't work right cp -p $KERNEL $DIRTREE chown root $DIRTREE/netbsd # custom README text version lynx -dump $CUSTOM_DIRTREE/root/README.html > $CUSTOM_DIRTREE/root/README cp $CUSTOM_DIRTREE/root/README.html $DIRTREE/home/user/ cp $CUSTOM_DIRTREE/root/README $DIRTREE/home/user/ chown 1000 $DIRTREE/home/user/README* # copy new files (cd $CUSTOM_DIRTREE ; find . | cpio -vupdm $DIRTREE ) # Build boot image # echo Building boot image ... dd if=/dev/zero of=myboot.fs count=5760 vnconfig -t floppy288 -v -c /dev/vnd0d myboot.fs || exit disklabel -rw /dev/vnd0d floppy288 || echo disklabel problem $? newfs -B le -m 0 -o space -i 204800 -c 80 /dev/rvnd0a floppy288 $DIRTREE/usr/mdec/installboot -v -f $DIRTREE/usr/mdec/biosboot.sym /dev/rvnd0a mount /dev/vnd0a $MOUNT gzip -v -c -9 $KERNEL > $MOUNT/netbsd || echo problem with gzip $? chmod a+x $MOUNT/netbsd df -k $MOUNT ls -la $MOUNT umount $MOUNT vnconfig -u vnd0d # build ISO9660 # according to mkhybrid it must be relative to the specified source path # or it will say: Uh oh, I cant find the boot image! cp myboot.fs $DIRTREE # -R instead of -r so attributes are correct # use -D to get rid of "rr_moved" and allow more ISO9660 6 directory limitation mkhybrid -o output.iso -b myboot.fs -c boot.catalog -a -l -D -J -R -L $DIRTREE