#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/lib/ksh93/aix/KLIB_AIX_add_vg_by_disk.sh 1.4 # # 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 # @(#)75 1.4 src/43haes/lib/ksh93/aix/KLIB_AIX_add_vg_by_disk.sh, hacmp, 61haes_r714 11/28/11 14:54:59 # #=head1 NAME # # KLIB_AIX_add_vg_by_disk - Add a volume group to a list given the raw # disk device /dev/rd* # #=head1 SYNOPSIS # # KLIB_AIX_add_vg_by_disk listvar /dev/rdevtbsp1 "vg1 vg2 vg3" # #=head1 DESCRIPTION # # This function adds the volume group attached to device (2nd arg) # to an array of volume groups if that vg does not already exist # in the thirds argument to this function. # #=head1 ARGUMENTS # # 1: [by ref] list to add volume group to # 2: [scalar] device name to obtain volume group name for # 3+ [scalar] list of volume groups to not duplicate in the arg1 list # #=head1 RETURN # # 0: the device was found, and the list was updated # 1: the device 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_disk { . /usr/es/lib/ksh93/func_include typeset -n setlist=$1 disk_device=$2 shift shift existing_vgs=$* VG=$(KLIB_AIX_get_vg_by_disk $disk_device) 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 }