|
||||||||||
This one time, at band camp, Frederic Lebel said: > yesterday, i coded a dynamic ipsec between two offices. but this > morning, i reboot my box, and my code dont stay in m0n0wall, is there a > reason ? PXE Boot ? you have rebuild the boot image to include your new code. i created a shell script on my linix box to help me do this, and posted it to the list a while back. http://m0n0.ch/wall/list/?action=show_msg&actionargs[]=62&actionargs[]=54 attached is a slightly modified version that also zeros out unused sectors in mfsroot.gz and in the image. compresses better. jj | ||||||||||
#!/bin/sh - [ -e $1 ] || ! echo ERROR: \ file does not exist or no file specified || ! echo \ \ \ \ \ \ \ \ Must specify an existing regular file || exit shellcmd=/bin/bash tmpdir=/tmp/m0n0_dev mntdir1=$tmpdir/img mntdir2=$tmpdir/mfs zerofn=.zero.zero.bin mkdir --verbose $tmpdir/ mkdir --verbose $mntdir1/ mkdir --verbose $mntdir2/ echo Uncompressing $1 ... gunzip -v < $1 > $tmpdir/$1.bin echo Mounting ad0a ... mount -v -o loop -t ufs -o ufstype=44bsd $tmpdir/$1.bin $mntdir1 echo Uncompressing mfsroot.gz ... gunzip -v < $mntdir1/mfsroot.gz > $tmpdir/mfsroot echo Mounting mfsroot ... mount -v -o loop -t ufs -o ufstype=44bsd $tmpdir/mfsroot $mntdir2 echo echo Dropping into m0n0wall root filesystem, $mntdir2/ echo /dev/ad0a is $mntdir1/ echo Go crazy! Type exit when done, and a new image will be built. pushd $mntdir2 $shellcmd - popd echo Zeroing out unused space in root fs ... dd bs=512 < /dev/zero > $mntdir2/$zerofn rm -v $mntdir2/$zerofn echo Unmounting mfsroot ... umount -v $mntdir2 echo Compressing mfsroot ... gzip -9v $tmpdir/mfsroot echo Replacing mfsroot ... mv -v $tmpdir/mfsroot.gz $mntdir1/ echo Zeroing out unused space in boot fs ... dd bs=512 < /dev/zero > $mntdir1/$zerofn rm -v $mntdir1/$zerofn echo Unmounting ad0a ... umount -v $mntdir1 echo Compressing new image ... gzip -9v < $tmpdir/$1.bin > $1.new echo Cleaning up ... rm -r -f -v $tmpdir/ echo echo Built $1.new |