[BACK]Return to common.attr CVS log [TXT][DIR] Up to [Development] / xfs-cmds / xfstests

File: [Development] / xfs-cmds / xfstests / common.attr (download)

Revision 1.1, Mon Apr 2 00:41:31 2001 UTC (16 years, 6 months ago) by ajag
Branch: MAIN

No Message Supplied

##/bin/sh

#
# Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
# 
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# 
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
# 
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
# Mountain View, CA  94043, or:
# 
# http://www.sgi.com 
# 
# For further information regarding this notice, see: 
# 
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#

# common extended attribute and ACL support

# pick three unused user/group ids, store them as $acl[1-3]
#
_acl_setup_ids()
{
    eval `cat /etc/passwd /etc/group | gawk -F: '
      { ids[$3]=1 }
      END {
        j=1
        for(i=1; i<1000000 && j<=3;i++){
          if (! (i in ids)) {
	     printf "acl%d=%d;", j, i;		 
	     j++
          }
        }	
      }'`
}

# filter for the acl ids selected above
#
_acl_filter_id()
{
    sed \
       -e "s/u:$acl1/u:id1/" \
       -e "s/u:$acl2/u:id2/" \
       -e "s/u:$acl3/u:id3/" \
       -e "s/g:$acl1/g:id1/" \
       -e "s/g:$acl2/g:id2/" \
       -e "s/g:$acl3/g:id3/" \
       -e "s/ $acl1 / id1 /" \
       -e "s/ $acl2 / id2 /" \
       -e "s/ $acl3 / id3 /"
}

# filtered ls
#
_acl_ls()
{
    ls -ln $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
} 

# make sure this script returns success
/bin/true