#!/usr/bin/sh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/bin/cdat/smit/cdat_is_init.sh 1.2 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2010,2011 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)36 1.2 src/bos/usr/bin/cdat/smit/cdat_is_init.sh, cdat, bos720 7/15/11 04:33:12 # This command checks if cdat init has already been performed # # If the initialization has been done, the command displays the first parameter # or "Yes" by default. # If cdat is not initialized, the command displays the second parameter or # "No" by default. # Usage: cdat-is-init [ []] PATH=/bin:/sbin:/usr/bin:/usr/sbin case "$#" in 0) YES="Yes" NO="No" ;; 1) YES="$1" NO="No" ;; 2) YES="$1" NO="$2" ;; 3) if [ "$3" = "" ] # smit adds '' as third parameter then YES="$1" NO="$2" else echo "Usage: $0 [ []]" && exit 1 fi ;; *) echo "Usage: $0 [ []]" && exit 1 ;; esac ODMDIR=/etc/objrepos /usr/bin/odmget -qattribute=cdat_user SWservAt | \ awk -v no="$NO" ' $1=="value" && $3!="\"\"" { init="yes" } END { if ( init == "yes" ) { exit 0 } else { print no exit 1 } }' [ $? -ne 0 ] && exit 0 /usr/bin/odmget -qattribute=cdat_directory SWservAt | \ awk -v yes="$YES" -v no="$NO" ' $1=="value" && $3!="\"\"" { init="yes" } END { if ( init == "yes" ) { print yes } else { print no } }' exit 0