#!/bin/sh
#
#  delAllUsers - parses /etc/passwd and removes all userids and their home directories

# check if we're booted to flash... if so just blow away /root/KIOSK
ROOTMOUNT=`grep dev\/root /proc/mounts | grep -v root\.old | cut -d" " -f3`
if [ $ROOTMOUNT = "ext2" ]; then
  rm -Rf /root/KIOSK
  rm -f /root/IBM/*
  cd /root
  tar -xzvf /root/KIOSK.tar.gz
  chown -R KIOSK /root/KIOSK
  rm -f /etc/printcap
  rm -Rf /root/lpd
  mkdir /root/lpd
  chown daemon:daemon /root/lpd
  rm -f /usr/local/lib/snmp/snmpd.local.conf    # snmp trap config
  rm /usr/local/share/snmp/snmpd.local.conf	# snmp comm names

else
# get all users from /etc/passwd
userlist=`awk -F: '/\/home\//{print $6}' /etc/passwd | grep -E -v "\/gdm$|\/ftp$|\/Wnn$" | sed -n 's/\/home\///p'` 

# process userlist and remove id's
for user in $userlist
do
  userdel -r $user
done

fi
