#!/bin/csh -f
set ResourceDir = "$1"
set KeyDir = "$2"
set LicenseType = "$3"
set Id = "$4"
set Key = "$5"
set Feature = "$6"

if ($LicenseType == 0) then
  echo "# Key for user `whoami` on host `hostname` id $Id at `date`" >> $ResourceDir/passwrds
  echo "$Key" >> $ResourceDir/passwrds
else
  (echo 1 ; echo "$Key") | $ResourceDir/elmadmin -n -c -e "$KeyDir" | grep success
endif
exit 0
