#! /usr/bin/perl # # Copyright (c) Members of the EGEE Collaboration. 2004-2010. # See http://www.eu-egee.org/partners/ for details on the copyright # holders. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # Authors: # 2009- # Oscar Koeroo # Mischa Sall\'e # David Groep # NIKHEF Amsterdam, the Netherlands # # # 2007-2009 # Oscar Koeroo # David Groep # NIKHEF Amsterdam, the Netherlands # # 2003-2007 # Martijn Steenbakkers # Gerben Venekamp # Oscar Koeroo # David Groep # NIKHEF Amsterdam, the Netherlands $opt_n=50; $opt_l=3; $opt_basedn="dc=farmnet,dc=nikhef,dc=nl"; #$opt_nfs="hooimijt:/export/cache/edgdevtb/poolaccounts"; @optdef=qw( v pgb|poolgroupbase=s n:i basedn l:i b|gidbase:i ); use Getopt::Long; $Getopt::Long::ignorecase=0; &GetOptions(@optdef); $opt_pgb or die "No poolgroup basename specified\n"; length($opt_pgb)>5 and die "poolgroup basename too long\n"; $opt_b or die "No start of GID numbering specified\n"; $opt_v and print "Generating $opt_n poolgroups of basename $opt_pgb\n"; $opt_v and print "in DIT position $opt_basedn\n"; $fmtstring='%s%0'.$opt_l.'d'; for($i=1;$i<=$opt_n;$i++) { $gname=sprintf($fmtstring,$opt_pgb,$i); $n=$i+$opt_b; print "dn: cn=$gname, ou=PoolGroups, $opt_basedn\n"; print "objectclass: top\n"; print "objectclass: posixGroup\n"; print "cn: $gname\n"; print "gidNumber: $n\n"; print "description: poolgroup $n of $opt_pgb\n"; print "\n"; }