autoinstallate (981B)
1 #!/bin/sh 2 #modifies a bsd.rd to contain an auto{install,conf} file 3 #requires an updated cvs src to build rdsetroot 4 #the binary is placed under /tmp as well as the ramdisk 5 #Warning: if the file is not named auto_upgrade.conf or auto_install.conf 6 #the installer won't be able to find it! 7 8 RDROOTDIR=/usr/src/distrib/common 9 TMPBIN=/tmp/rdsetroot 10 TMPRD=/tmp/ramdisk.img 11 12 if [ $# -lt 2 ]; then 13 echo "Usage: $(basename $0) <bsr.rd> <autofile>" 14 exit 1 15 fi 16 17 if [ ! -d $RDROOTDIR ]; then 18 echo "please checkout sources via CVS" 19 exit 1 20 fi 21 22 #build binary 23 cc -o $TMPBIN $RDROOTDIR/elf32.c $RDROOTDIR/elf64.c $RDROOTDIR/elfrdsetroot.c 24 if [ ! -e $TMPBIN ]; then 25 echo "failed to build rdsetroot under /tmp" 26 exit 1 27 fi 28 29 #extract ramdisk 30 $TMPBIN -x $1 $TMPRD 31 32 #mount it 33 vnconfig vnd0 $TMPRD 34 mount /dev/vnd0a /mnt 35 36 #copy the autofile 37 cp $2 /mnt/ 38 39 # umount ramdisk 40 umount /dev/vnd0a 41 vnconfig -u vnd0 42 43 # put modified ramdisk in bsd.rd 44 $TMPBIN $1 $TMPRD 45 46 # cleanup 47 rm $TMPBIN $TMPRD