view profiles/xSMALL_/files/etc/save_etc @ 209:b7812d60bbcd

More small than SMALL_ profile :)
author ray@terran.dlink.ua
date Sat, 15 Oct 2011 02:31:07 +0300
parents
children 67a155d37199
line wrap: on
line source
#!/bin/sh

DEVCONFIG=/dev/map/config
BLOCK_SIZE=64
GEOM_PART=`echo ${DEVCONFIG} | sed 's/\/dev\///; s!\/!\\\/!' `

i=0
for s in `sysctl kern.geom.conftxt | grep "${GEOM_PART}"` ; do
	i=$(( ${i} + 1 )) ;
	if [ ${i} == 4 ] ; then
    		DEVCONFIGSIZE=${s} ;
	fi ;
done

DEVCONFIGBLKS=$((${DEVCONFIGSIZE} / ${BLOCK_SIZE} / 1024))

#echo f1 > /dev/led/status
cd /tmp
echo "Dumping etc to etc.tar.gz"
/usr/bin/tar cv --exclude '*pwd.db' -zf /tmp/etc.tar.gz etc/* -C /tmp

lsline=`ls -l /tmp/etc.tar.gz`
script="arg5() echo \$5; arg5 ${lsline}"
size=`sh -c "${script}"`
if [ ${size} -gt ${DEVCONFIGSIZE} ]; then
	echo "etc.tar.gz too big ${size}, must be less than ${DEVCONFIGSIZE}"
	echo "Please remove big files from /etc"
	exit 1
fi 

echo "Saving /etc"
sysctl hw.cfi.rdonly=0
/bin/dd if=/tmp/etc.tar.gz of=/dev/map/config bs=${BLOCK_SIZE}k count=${DEVCONFIGBLKS} conv=sync
echo '.'

#echo f9 > /dev/led/status