#!/bin/bash
# Some checking here

if [ -f /bin/hmcbash ]; then
  grep -q "/bin/hmcbash" /etc/shells
  if [ $? -ne 0 ]; then
     echo "/bin/hmcbash" >> /etc/shells
  fi
fi 
cd /home
for i in *
do
#  echo "Processing user "$i
  case $i in
    ccfw | invscout | root | svcagent )
         ;;
    *)
	 gn=`/usr/bin/id -gn $i`
	 if [ "$gn" == "hmc" ]; then
#           echo "Performing migration to hmcbash for "$i
	   /usr/bin/chsh /bin/hmcbash $i >/dev/null 2>&1
           rm -f /home/$i/.ssh/rc
	   rm -f /home/$i/.mysshrc
	   
	   cp /opt/hsc/data/ssh/bashrc /home/$i/.bashrc
	   chmod 555 /home/$i/.bashrc
	   chown root.root /home/$i/.bashrc
	   cp /opt/hsc/data/ssh/hmcprofile /home/$i/.bash_profile
	   chmod 555 /home/$i/.bash_profile
	   chown root.root /home/$i/.bash_profile
	 fi
	 ;;
  esac
done
cd /
rm -f /etc/ssh/sshrc
exit 0
