#!/bin/sh

. /env/config

image=/env/bin/magic.bin
part=$ageing

if [ \! -e "$part" ]; then
	echo "Partition $part does not exist"
	exit 1
fi

unprotect $part

echo
echo "Erasing partition $part"
erase $part

echo
echo "Creating magic"
cp $image $part

echo
echo "Testing partition"
. /env/bin/_alternate

protect $part
