#!/bin/sh

active_part=`/bin/cat /proc/cisco/activePartition`
keypad=`/bin/cat /proc/cisco/factoryReset`

/bin/mount -t ext4 /dev/cache-$active_part /cache
/system/xbin/grep -qs -e'--wipe_data' /cache/recovery/command
wipe_data=$?
/bin/umount /cache

if [[ $keypad = 1 || $wipe_data = 0 ]]
then
	echo "Device was factory reset" > /tmp/factory_reset.log
	echo "  keypad = $keypad" >> /tmp/factory_reset.log
	echo "  wipe_data = $wipe_data" >> /tmp/factory_reset.log
	/bin/make_ext4fs -w -a /cache -L \"cache\" /dev/cache-$active_part
	/bin/make_ext4fs -w -a /data -L \"data\" /dev/userdata-$active_part
fi

exit 0

