#!/bin/sh

prefix=/usr

echo "Creating /newroot"
mkdir -p /newroot

echo "Mounting /newroot to tempfs"
mount -t tmpfs tmpfs /newroot

if [ -e /tmp/backup_flash.tar.gz ]; then
	echo "Moving /tmp/backup_flash.tar.gz to /newroot"
	mv /tmp/backup_flash.tar.gz /newroot/
fi

echo "Copying ofgwrite_bin to /newroot"
cp -p $prefix/bin/ofgwrite_bin /newroot/

echo "Calling /newroot/ofgwrite_bin $@"
/newroot/ofgwrite_bin "$@"
