#!/bin/sh

DIR="/flash"
TESTFILE="$DIR/$$-testfile"

touch "$TESTFILE" 2> /dev/null

if [ $? -eq 1 ]; then
    mount -o remount,rw "$DIR"
    echo "directory '$DIR' is writable"
else
    rm -f "$TESTFILE"
    mount -o remount,ro "$DIR"
    echo "directory '$DIR' is read-only again"
fi

exit 0
