#!/bin/sh
#
#  delAllUsers - performs the actions needed to reset to factory defaults.

# Clear out the snmp trap file and inventory file.
# Note: The trap file is the one created by TCM, not the one in the profile.
# Note: The files are sym linked to the persistent storage.  Using the rm
# command would remove the sym link, not the actual file.

echo "" > /var/snmp/snmpd.conf         	 # snmp TCM trap config
echo "" > /var/snmp/snmpd.local.conf     # snmp inventory config

# Note: On 2x00, the genesis nvram bit is used to reset NVRAM.
# This includes the snmp community names.
# The genesis bit is set either by snmpd (from TCM) or by Setup Utility.

# On N70 the genesis bit is not used, so call the reset "nvram" script.
# This includes clearing the community names.
if [ "$MODEL_TYPE" = "N70" -o "$MODEL_TYPE" = "N50" -o "$MODEL_TYPE" = "BIOS" ]; then
        /IBM/bin/reset_NVRam.sh
fi

# check if /nstation is mounted to flash... if so just blow away the directory
cat /proc/mounts > /etc/mtab
__dir="/nstation/profiles"
__nstation_mount=`df $__dir | sed "/^Filesystem/d" | cut -d' ' -f1`
if [ "$MODEL_TYPE" = "2200" -o "$MODEL_TYPE" = "2800" ]; then
        if [ "$__nstation_mount" = "/dev/hda2" ]; then
                rm -rf /nstation/machines/*
                rm -rf /nstation/profiles/*         
        fi
else
        if [ "$__nstation_mount" = "/dev/hdd2" ]; then
                rm -rf /nstation/machines/*
                rm -rf /nstation/profiles/* 
        fi
fi
