#!/bin/sh
# This prepatch script is used to update the package database that
# may not be up to date because of changes made to some of the package bits.
# This is necessary so the package won't fail pkgchk during patch installation.

commit=0
if [ -f $ROOTDIR/etc/opt/licenses/lic_srvr_start ]; then
  installf -R $ROOTDIR SUNWlicsw /etc/opt/licenses/lic_srvr_start f 744 ? sys
  chmod 744 $ROOTDIR/etc/opt/licenses/lic_srvr_start
  chgrp sys $ROOTDIR/etc/opt/licenses/lic_srvr_start 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/lic.SUNW ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/lic.SUNW f 700 ? sys
  chmod 700 $ROOTDIR/opt/SUNWste/license_tools/lic.SUNW
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/lic.SUNW 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/lmdown ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/lmdown f 700 ? sys
  chmod 700 $ROOTDIR/opt/SUNWste/license_tools/lmdown
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/lmdown 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/lmgrd.ste ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/lmgrd.ste f 700 ? sys
  chmod 700 $ROOTDIR/opt/SUNWste/license_tools/lmgrd.ste
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/lmgrd.ste 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/lmremove ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/lmremove f 700 ? sys
  chmod 700 $ROOTDIR/opt/SUNWste/license_tools/lmremove
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/lmremove 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/lmreread ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/lmreread f 700 ? sys
  chmod 700 $ROOTDIR/opt/SUNWste/license_tools/lmreread
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/lmreread 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/lmver ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/lmver f 755 ? sys
  chmod 755 $ROOTDIR/opt/SUNWste/license_tools/lmver
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/lmver 
  commit=1
fi

if [ -f $ROOTDIR/opt/SUNWste/license_tools/suntechd ]; then
  installf -R $ROOTDIR SUNWlicsw /opt/SUNWste/license_tools/suntechd f 700 ? sys
  chmod 700 $ROOTDIR/opt/SUNWste/license_tools/suntechd
  chgrp sys $ROOTDIR/opt/SUNWste/license_tools/suntechd 
  commit=1
fi

if [ -f $ROOTDIR/etc/init.d/lic_mgr ]; then
  installf -R $ROOTDIR SUNWlicsw /etc/init.d/lic_mgr f 0744 ? ?
  commit=1
fi

if [ ${commit} -eq 1 ]; then
  installf -R $ROOTDIR -f SUNWlicsw
fi
exit 0
