| 1 |
#! /usr/bin/perl |
| 2 |
# |
| 3 |
# Copyright (c) Members of the EGEE Collaboration. 2004-2010. |
| 4 |
# See http://www.eu-egee.org/partners/ for details on the copyright |
| 5 |
# holders. |
| 6 |
# |
| 7 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 |
# you may not use this file except in compliance with the License. |
| 9 |
# You may obtain a copy of the License at |
| 10 |
# |
| 11 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
# |
| 13 |
# Unless required by applicable law or agreed to in writing, software |
| 14 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 15 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 |
# See the License for the specific language governing permissions and |
| 17 |
# limitations under the License. |
| 18 |
# |
| 19 |
# |
| 20 |
# Authors: |
| 21 |
# 2009- |
| 22 |
# Oscar Koeroo <[email protected]> |
| 23 |
# Mischa Sall\'e <[email protected]> |
| 24 |
# David Groep <[email protected]> |
| 25 |
# NIKHEF Amsterdam, the Netherlands |
| 26 |
# <[email protected]> |
| 27 |
# |
| 28 |
# 2007-2009 |
| 29 |
# Oscar Koeroo <[email protected]> |
| 30 |
# David Groep <[email protected]> |
| 31 |
# NIKHEF Amsterdam, the Netherlands |
| 32 |
# |
| 33 |
# 2003-2007 |
| 34 |
# Martijn Steenbakkers <[email protected]> |
| 35 |
# Gerben Venekamp <[email protected]> |
| 36 |
# Oscar Koeroo <[email protected]> |
| 37 |
# David Groep <[email protected]> |
| 38 |
# NIKHEF Amsterdam, the Netherlands |
| 39 |
|
| 40 |
$opt_n=50; |
| 41 |
$opt_l=3; |
| 42 |
$opt_basedn="dc=farmnet,dc=nikhef,dc=nl"; |
| 43 |
#$opt_nfs="hooimijt:/export/cache/edgdevtb/poolaccounts"; |
| 44 |
|
| 45 |
@optdef=qw( v pgb|poolgroupbase=s n:i basedn l:i b|gidbase:i ); |
| 46 |
|
| 47 |
use Getopt::Long; |
| 48 |
$Getopt::Long::ignorecase=0; |
| 49 |
&GetOptions(@optdef); |
| 50 |
|
| 51 |
$opt_pgb or die "No poolgroup basename specified\n"; |
| 52 |
length($opt_pgb)>5 and die "poolgroup basename too long\n"; |
| 53 |
$opt_b or die "No start of GID numbering specified\n"; |
| 54 |
|
| 55 |
$opt_v and print "Generating $opt_n poolgroups of basename $opt_pgb\n"; |
| 56 |
$opt_v and print "in DIT position $opt_basedn\n"; |
| 57 |
|
| 58 |
$fmtstring='%s%0'.$opt_l.'d'; |
| 59 |
|
| 60 |
for($i=1;$i<=$opt_n;$i++) { |
| 61 |
$gname=sprintf($fmtstring,$opt_pgb,$i); |
| 62 |
$n=$i+$opt_b; |
| 63 |
|
| 64 |
print "dn: cn=$gname, ou=PoolGroups, $opt_basedn\n"; |
| 65 |
print "objectclass: top\n"; |
| 66 |
print "objectclass: posixGroup\n"; |
| 67 |
print "cn: $gname\n"; |
| 68 |
print "gidNumber: $n\n"; |
| 69 |
print "description: poolgroup $n of $opt_pgb\n"; |
| 70 |
print "\n"; |
| 71 |
} |
| 72 |
|