Transfer image from one CF to another
-
here is the link to rc3f
http://www.pfsense.com/~sullrich/pfSense-1.0-RC3f-Full-Embedded.tgz -
@bradenmcg:
Your method didn't work for me, I tried to embed my config but it didn't seem to take. I edited in the appropriate XML stuff first and no worky…
Maybe it's because it couldn't find an RC3f patch to apply? All that is on the mirrors is RC3e, at least as of yesterday night.
RC3f was in the sullrich folder or on my site with the scripts. Although now it doesn't matter as 1.0 is out. Check out the following files they should do what you want.
http://wgnrs.dynalias.com:81/pfsense/sh-replace-config.sh
http://wgnrs.dynalias.com:81/pfsense/sh-add-miniupnpd.sh
http://wgnrs.dynalias.com:81/pfsense/miniupnpd.tar.gz
http://wgnrs.dynalias.com:81/pfsense/cfg-add-miniupnpd.xmlOR
http://wgnrs.dynalias.com:81/pfsense/sh-custom-image.sh
As I rewrote the the above script. It is updated for 1.0-RELEASE, includes error checking, and the ability to specify a config file at the command line. If no config file is specified it will use the default config file with the miniupnpd package section added.
Download file to freebsd machine
chmod +x sh-custom-image.sh
./sh-custom-image.sh
or
./sh-custom-image.sh yourconfig.xmlTry the above and let me know if it doesn't work.
-
and more for the colection: sh-add-files.sh
this file will read the file filelist and add the files listed there to the image
start the file with sh-add-files.sh pfSense.img
use the complete filepath to the file in file filelist
like this: /bin/routed -
added some text to sh-add-miniupnpd.sh
it will now check of the config for miniupnp is in the config.xml
if its not it will download the file cfg-add-miniupnpd.xml
and add it to the correct place in config.xml#!/bin/sh # This script adds the miniupnpd files to image specified. # Make sure the miniupnpd.tar.gz file is in the script directory. # # # The miniupnpd.tar.gz file was made by creating a directory named # miniupnpd. In there should be the following files: # miniupnpd, miniupnpd.sh, miniupnpd.inc, miniupnpd.xml, status_upnp.php # Then you execute the command "tar cfz miniupnpd.tar.gz miniupnpd/" # # Usage {miniupnpd} {imagefile} # Example ./sh-add-miniupnpd.sh miniupnpd.tar.gz pfSense.img TARFILE="$1" IMGFILE="$2" WORKDIR=`pwd` UPNPDIR="$WORKDIR/miniupnpd" MD=`mdconfig -a -t vnode -f $WORKDIR/$IMGFILE` mkdir $WORKDIR/a mount /dev/${MD}a $WORKDIR/a tar zxf $TARFILE cp $UPNPDIR/miniupnpd.inc $WORKDIR/a/usr/local/pkg/miniupnpd.inc chmod 755 $WORKDIR/a/usr/local/pkg/miniupnpd.inc cp $UPNPDIR/miniupnpd.xml $WORKDIR/a/usr/local/pkg/miniupnpd.xml chmod 644 $WORKDIR/a/usr/local/pkg/miniupnpd.xml cp $UPNPDIR/miniupnpd $WORKDIR/a/usr/local/sbin/miniupnpd chmod 755 $WORKDIR/a/usr/local/sbin/miniupnpd cp $UPNPDIR/status_upnp.php $WORKDIR/a/usr/local/www/status_upnp.php chmod 755 $WORKDIR/a/usr/local/www/status_upnp.php cd $UPNPDIR echo -n "looking for miniupnp config in config.xml.." if grep -q miniupnp $WORKDIR/a/conf/config.xml then echo "..miniupnp config found." else echo "..miniupnp config not found." cp $WORKDIR/a/conf/config.xml $UPNPDIR/test.xml echo "downloading miniupnp xml config" fetch -q -o cfg_add_miniupnp.xml http://wgnrs.dynalias.com:81/pfsense/cfg-add-m iniupnpd.xml # the downloaded file has <installedpackages>and</installedpackages> #the test.xml has them to so we remove them from the downloaded file echo "removing not needed text" sed -e '/<installedpackages>/ d' -e '/<\/installedpackages>/ d' cfg_add_miniupn p.xml >upnp.xml # now we add upnp.xml to test.xml afther <installedpackages>echo "adding miniupnp config." sed '/<installedpackages>/ r upnp.xml' test.xml > output.xml mv output.xml $WORKDIR/a/conf/config.xml fi echo “all done” rm -rf miniupnpd umount $WORKDIR/a rm -rf $WORKDIR/a mdconfig -d -u ${MD}</installedpackages></installedpackages></installedpackages>
-
added some text to sh-add-miniupnpd.sh
it will now check of the config for miniupnp is in the config.xml
if its not it will download the file cfg-add-miniupnpd.xml
and add it to the correct place in config.xml#!/bin/sh # This script adds the miniupnpd files to image specified. # Make sure the miniupnpd.tar.gz file is in the script directory. # # # The miniupnpd.tar.gz file was made by creating a directory named # miniupnpd. In there should be the following files: # miniupnpd, miniupnpd.sh, miniupnpd.inc, miniupnpd.xml, status_upnp.php # Then you execute the command "tar cfz miniupnpd.tar.gz miniupnpd/" # # Usage {miniupnpd} {imagefile} # Example ./sh-add-miniupnpd.sh miniupnpd.tar.gz pfSense.img TARFILE="$1" IMGFILE="$2" WORKDIR=`pwd` UPNPDIR="$WORKDIR/miniupnpd" MD=`mdconfig -a -t vnode -f $WORKDIR/$IMGFILE` mkdir $WORKDIR/a mount /dev/${MD}a $WORKDIR/a tar zxf $TARFILE cp $UPNPDIR/miniupnpd.inc $WORKDIR/a/usr/local/pkg/miniupnpd.inc chmod 755 $WORKDIR/a/usr/local/pkg/miniupnpd.inc cp $UPNPDIR/miniupnpd.xml $WORKDIR/a/usr/local/pkg/miniupnpd.xml chmod 644 $WORKDIR/a/usr/local/pkg/miniupnpd.xml cp $UPNPDIR/miniupnpd $WORKDIR/a/usr/local/sbin/miniupnpd chmod 755 $WORKDIR/a/usr/local/sbin/miniupnpd cp $UPNPDIR/status_upnp.php $WORKDIR/a/usr/local/www/status_upnp.php chmod 755 $WORKDIR/a/usr/local/www/status_upnp.php cd $UPNPDIR echo -n "looking for miniupnp config in config.xml.." if grep -q miniupnp $WORKDIR/a/conf/config.xml then echo "..miniupnp config found." else echo "..miniupnp config not found." cp $WORKDIR/a/conf/config.xml $UPNPDIR/test.xml echo "downloading miniupnp xml config" fetch -q -o cfg_add_miniupnp.xml http://wgnrs.dynalias.com:81/pfsense/cfg-add-m iniupnpd.xml # the downloaded file has <installedpackages>and</installedpackages> #the test.xml has them to so we remove them from the downloaded file echo "removing not needed text" sed -e '/<installedpackages>/ d' -e '/<\/installedpackages>/ d' cfg_add_miniupn p.xml >upnp.xml # now we add upnp.xml to test.xml afther <installedpackages>echo "adding miniupnp config." sed '/<installedpackages>/ r upnp.xml' test.xml > output.xml mv output.xml $WORKDIR/a/conf/config.xml fi echo “all done” rm -rf miniupnpd umount $WORKDIR/a rm -rf $WORKDIR/a mdconfig -d -u ${MD}</installedpackages></installedpackages></installedpackages>
Have you tested this script out?? As you need to mount the other partition in the image as thats where the config is stored. Look at my sh-mount-image.sh or sh-replace-config.sh
http://wgnrs.dynalias.com:81/pfsense/sh-mount-image.sh
http://wgnrs.dynalias.com:81/pfsense/sh-replace-config.shRegardless I like the script. Billm had suggested that the script automatically add the required section last night and you beat me to writing it :). I will update mine with the changes. Thanks!
-
hmm i have only tested the part that add's the miniupnp code to config.xml on my soekris
will look at the replace config file
[edit]
oke the config is on party D not on Atook from the replace config file what was needed
#!/bin/sh # This script adds the miniupnpd files to image specified. # Make sure the miniupnpd.tar.gz file is in the script directory. # # # The miniupnpd.tar.gz file was made by creating a directory named # miniupnpd. In there should be the following files: # miniupnpd, miniupnpd.sh, miniupnpd.inc, miniupnpd.xml, status_upnp.php # Then you execute the command "tar cfz miniupnpd.tar.gz miniupnpd/" # # Usage {miniupnpd} {imagefile} # Example ./sh-add-miniupnpd.sh miniupnpd.tar.gz pfSense.img TARFILE="$1" IMGFILE="$2" WORKDIR=`pwd` UPNPDIR="$WORKDIR/miniupnpd" MD=`mdconfig -a -t vnode -f $WORKDIR/$IMGFILE` mkdir $WORKDIR/a mount /dev/${MD}a $WORKDIR/a tar zxf $TARFILE cp $UPNPDIR/miniupnpd.inc $WORKDIR/a/usr/local/pkg/miniupnpd.inc chmod 755 $WORKDIR/a/usr/local/pkg/miniupnpd.inc cp $UPNPDIR/miniupnpd.xml $WORKDIR/a/usr/local/pkg/miniupnpd.xml chmod 644 $WORKDIR/a/usr/local/pkg/miniupnpd.xml cp $UPNPDIR/miniupnpd $WORKDIR/a/usr/local/sbin/miniupnpd chmod 755 $WORKDIR/a/usr/local/sbin/miniupnpd cp $UPNPDIR/status_upnp.php $WORKDIR/a/usr/local/www/status_upnp.php chmod 755 $WORKDIR/a/usr/local/www/status_upnp.php cd $UPNPDIR MD1=`mdconfig -a -t vnode -f $WORKDIR/$IMGFILE` mkdir $WORKDIR/d mount /dev/${MD1}d $WORKDIR/d echo -n "looking for miniupnp config in config.xml.." if grep -q miniupnp $WORKDIR/d/conf/config.xml then echo "..miniupnp config found." else echo "..miniupnp config not found." cp $WORKDIR/d/conf/config.xml $UPNPDIR/test.xml echo "downloading miniupnp xml config" fetch -q -o cfg_add_miniupnp.xml http://wgnrs.dynalias.com:81/pfsense/cfg-add-m iniupnpd.xml # the downloaded file has <installedpackages>and</installedpackages> #the test.xml has them to so we remove them from the downloaded file echo "removing not needed text" sed -e '/<installedpackages>/ d' -e '/<\/installedpackages>/ d' cfg_add_miniupn p.xml >upnp.xml # now we add upnp.xml to test.xml afther <installedpackages>echo "adding miniupnp config." sed '/<installedpackages>/ r upnp.xml' test.xml > output.xml mv output.xml $WORKDIR/d/conf/config.xml chmod 640 $WORKDIR/d/conf/config.xml fi echo “all done” rm -rf miniupnpd umount $WORKDIR/a rm -rf $WORKDIR/a mdconfig -d -u ${MD} umount $WORKDIR/d rm -rf $WORKDIR/d mdconfig -d -u ${MD1}</installedpackages></installedpackages></installedpackages>
-
Since we are downloading the current config section might as well get the current miniupnpd files as well.
#!/bin/sh # This script adds the miniupnpd files to image specified. # # Usage {imagefile} # Example ./sh-add-miniupnpd.sh pfSense.img IMGFILE="$1" WORKDIR=`pwd` MD=`mdconfig -a -t vnode -f $WORKDIR/$IMGFILE` mkdir $WORKDIR/d mount /dev/${MD}d $WORKDIR/d mkdir $WORKDIR/a mount /dev/${MD}a $WORKDIR/a echo "downloading miniupnp files..." fetch -q -o $WORKDIR/a/usr/local/sbin/miniupnpd "http://pfsense.com/packages/config/packages/miniupnpd/sbin/miniupnpd" fetch -q -o $WORKDIR/a/usr/local/pkg/miniupnpd.inc "http://pfsense.com/packages/config/packages/miniupnpd/miniupnpd.inc" fetch -q -o $WORKDIR/a/usr/local/pkg/miniupnpd.xml "http://pfsense.com/packages/config/packages/miniupnpd/miniupnpd.xml" fetch -q -o $WORKDIR/a/usr/local/www/status_upnp.php "http://pfsense.com/packages/config/packages/miniupnpd/status_upnp.php" chmod 755 $WORKDIR/a/usr/local/pkg/miniupnpd.inc chmod 644 $WORKDIR/a/usr/local/pkg/miniupnpd.xml chmod 755 $WORKDIR/a/usr/local/sbin/miniupnpd chmod 755 $WORKDIR/a/usr/local/www/status_upnp.php echo "looking for miniupnp config in config.xml..." if grep -q miniupnp $WORKDIR/d/conf/config.xml then echo " miniupnpd config already exists!" else cp $WORKDIR/d/conf/config.xml $WORKDIR/config.xml echo " downloading miniupnp config..." fetch -q "http://wgnrs.dynalias.com:81/pfsense/cfg-add-miniupnpd.xml" # lets remove <installedpackages>and</installedpackages> sed -e '/<installedpackages>/ d' -e '/<\/installedpackages>/ d' cfg-add-miniupnpd.xml > cfg-miniupnpd.xml echo " adding miniupnp config..." # add miniupnpd section after <installedpackages>sed '/<installedpackages>/ r cfg-miniupnpd.xml' config.xml > $WORKDIR/d/conf/config.xml chmod 640 $WORKDIR/d/conf/config.xml rm -f cfg-add-miniupnpd.xml cfg-miniupnpd.xml config.xml fi echo "miniupnpd successfully added!" umount $WORKDIR/d rm -rf $WORKDIR/d umount $WORKDIR/a rm -rf $WORKDIR/a mdconfig -d -u ${MD}</installedpackages></installedpackages></installedpackages>
-
looking nice
is it me or is the file now less lines ? -
looking nice
is it me or is the file now less lines ?Yes, there is less lines now. Downloading the miniupnpd files saved space. I consolidated some of the file copying back and forth. Also removed the second mdconfig as it was unneeded. I verified the script works and will be using it to build my images once I modify my other script. Thanks.
-
maybe, with a "ghost like program" and with IDE to CF adapter you can create a image of the old and you can reinject it on new CF …
OR, with a soft as "winimage" you can create and image from CF in your usb card reader ...
no ?PS : i use a 1GB CF in a IDE to CF adapter. So, i don't use embedded, but full install from CD Live.
-
Heres a tip
what ever you do DONT use ghost!
I just tried making a ghost image, ghost made a 1 gig image from a 1gig cf card, (install wasnt 1gig) i then rebooted and it no longer boots, it just beeps at me at Default: F1
I then tried to ghost on the image i had made and it wont it says theres not enough space
So yeah pretty much a disaster.
-
I used the windows version of dd to copy my working 128MB CF to an image, using this command:
dd id=f: (replace with yours) of=pfsense128mb.img
Then I inserted the new 1024MB CF into the USB reader and used physdiskwrite.exe to restore the image. Ofcourse, my 1GB CF is now seen as a 128MB one. My Alix2c3's are now booting from the new 1GB CF cards.