#!/bin/ksh
################################################################################
# Name: /IBM/bin/cfInfo
# Purpose:
#   Retrieve information about the flash card and put into files for SNMP to use
################################################################################

# Check if flash card is mounted
flashMounted=`mount | grep hda`
if [ ! "$flashMounted" ]; then
	exit 1
fi

# Get the total size (in 1K blocks, not 512) of the flash card
TOTAL_SIZE=`/sbin/sfdisk -s /dev/hda`/2
echo $TOTAL_SIZE > /tmp/snmp/44

# Get the available size of the flash card
AVAIL_SIZE=`df /dev/hda | grep -E "/dev/hda" | grep -v "No such" | tr -s " " | cut -f4 -d" "`
echo $AVAIL_SIZE > /tmp/snmp/45

# Get the formatted size of the flash card
FORMAT_SIZE=`df /dev/hda | grep -E "/dev/hda" | grep -v "No such" | tr -s " " | cut -f2 -d" "`
echo $FORMAT_SIZE > /tmp/snmp/46
