#!/bin/sh
#
# Usage: moduninstall {dsmod|all-mods}

if [ "$1" != "dsmod" -a "$1" != "all-mods" ]; then
	echo "Usage: $0 {dsmod|all-mods}" 1>&2
	echo '       dsmod:     deletes dsmod config files' 1>&2
	echo '       all-mods:  deletes dsmod and m*.* config files' 1>&2
	echo '                  (including debug.cfg)' 1>&2
	exit 1
fi

echo -n 'Clearing dsmod...'
echo "clear_id $((0x3c))" > /proc/tffs
echo 'done.'

if [ "$1" = "all-mods" ]; then
	echo -n 'Clearing other mods...'
	echo "clear_id $((0x62))" > /proc/tffs
	echo "clear_id $((0x3b))" > /proc/tffs
	echo "clear_id $((0x90))" > /proc/tffs
	echo "clear_id $((0x91))" > /proc/tffs
	echo 'done.'
fi

echo ''
echo 'The next time you save or reboot /var/flash/ds_mod will be created again.'

exit 0