#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/lib/ksh93/aix/KLIB_AIX_add_vg_by_path.sh 1.6 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2005,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 # @(#)69 1.6 src/43haes/lib/ksh93/aix/KLIB_AIX_add_vg_by_path.sh, hacmp, 61haes_r714 11/28/11 15:23:49 # #=head1 NAME # # KLIB_AIX_add_vg_by_path - Add a volume group to a list given a # filesystem path # #=head1 SYNOPSIS # # KLIB_AIX_add_vg_by_path listvar /dev/rdevtbsp1 vg1 vg2 vg3 # #=head1 DESCRIPTION # # This function adds the volume group containing path (2nd arg) # to an array of volume groups if that vg does not already exist # in the third and following arguments to this function. # #=head1 ARGUMENTS # # 1: [by ref] list to add volume group to # 2: [scalar] filesystem path to find volume group for # 3+ [scalar] list of volume groups to not duplicate in the arg1 list # #=head1 RETURN # # 0: the filesystem path was found, and the list was updated # 1: the filesystem volume group was already present in the # provided list of volume groups # #=head1 COPYRIGHT # #(C) COPYRIGHT International Business Machines Corp. 2005 #All Rights Reserved # #=cut # function KLIB_AIX_add_vg_by_path { . /usr/es/lib/ksh93/func_include typeset -n setlist=$1 typeset filesyspath=$2 shift shift existing_vgs=$* [[ -z $filesyspath ]] && return 1 typeset VG=$(KLIB_AIX_get_vg_by_path $filesyspath) if [[ -z $VG ]]; then return 1 fi for evg in $existing_vgs; do if [[ "$VG" == "$evg" ]]; then return 1 fi done setlist="$setlist $VG" return 0 }