#!/bin/bash
#
# Helper script to initialize the array configuration.
# Works only if webGui is running and listening on port 80.

echo "This will rename super.dat to super.bak, effectively clearing array configuration."
echo "The array must be in the Stopped state and it is up to you to confirm this."
echo -n "Are you sure you want to proceed? (type Yes if you do):"
read answer
if [ "$answer" != "Yes" ]; then
  exit 0;
fi

# Access a blank page in case this is first request since startup.
/usr/bin/wget -q -O - localhost/update.htm >/dev/null

# Have emhttp do all the work.
/usr/bin/wget -q -O - localhost/update.htm?cmdInit=apply >/dev/null

echo "Completed"
