#! /bin/sh
# ignore USER_DB interrupt
trap '' 56
if [ -f /tmp/target.tar ] ; then
	# untar all contents of zip file
	unzip -p /tmp/target.tar target.tar | tar x -C /
	unzip -p /tmp/target.tar custom.tar | tar x -C /

	# perform extract script ?
	if [ -f /tmp/extract.sh ] ; then
		sh /tmp/extract.sh
		rm -rf /tmp/extract.sh
	fi

	# reboot regardless of what happened
	sync
	reboot -d 0
fi

