1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright 2017 Gordon W. Ross
  15 #
  16 
  17 errs=
  18 DEFS=$ROOT/opt/util-tests/bin/oamu_defs
  19 if [ -n "$ROOT" ] ; then
  20   export LD_LIBRARY_PATH=$ROOT/usr/lib
  21 fi
  22 
  23 #
  24 # Make test data files
  25 #
  26 
  27 # role.def (same as compiled-in defaults)
  28 echo '
  29 defrid=99
  30 defgroup=1
  31 defgname=other
  32 defparent=/home
  33 defskel=/etc/skel
  34 defshell=/bin/pfsh
  35 definact=0
  36 defexpire=
  37 defauthorization=
  38 defprofile=All
  39 defproj=3
  40 defprojname=default
  41 deflimitpriv=
  42 defdefaultpriv=
  43 deflock_after_retries=' > role.def
  44 
  45 # role.tst (different from defaults)
  46 echo '
  47 defrid=101
  48 defgroup=10
  49 defgname=testrole
  50 defparent=/home/testrole
  51 defskel=/etc/skel.testrole
  52 defshell=/bin/pfsh.testrole
  53 definact=0
  54 defexpire=
  55 defauthorization=
  56 defprofile=All,TestRole
  57 defproj=4
  58 defprojname=default
  59 deflimitpriv=
  60 defdefaultpriv=
  61 deflock_after_retries=' > role.tst
  62 
  63 #
  64 # Run some tests
  65 #
  66 
  67 # Override compiled-in role defaults
  68 $DEFS -r role.def |tail +2 > role1.out
  69 if cmp -s role.def role1.out ; then
  70     echo "PASS: role1.out"
  71 else
  72     echo "FAIL: role1.out is wrong"
  73     errs="$errs role1.out"
  74 fi
  75 
  76 # Override role.def values
  77 $DEFS -r role.def role.tst |tail +2 > role2.out
  78 if cmp -s role.tst role2.out ; then
  79     echo "PASS: role2.out"
  80 else
  81     echo "FAIL: role2.out is wrong"
  82     errs="$errs role2.out"
  83 fi
  84 
  85 rm -f role.def role.tst role1.out role2.out