#!/bin/bash
################################################################################
# Name: /IBM/bin/getUser
# Purpose: generates /tmp/snmp/70 which contains the name of the user
#          currently logged into the console (i.e. :0)
################################################################################
# if we're in kiosk mode return kiosk user since /var/run/utmp doesn't exist
ROOTMOUNT=`grep dev\/root /proc/mounts | grep -v root\.old | cut -d" " -f3`
if [ $ROOTMOUNT = "ext2" ]; then
   CURUSER=KIOSK
else
   CURUSER=`who | grep -E "ttyp0" | cut -f1 -d" " | head -1` 
fi
if [ ! $CURUSER ]; then
   CURUSER="none"
fi
echo $CURUSER > /tmp/snmp/70
