| 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 |
|
| 41 |
$opt_n=50; |
| 42 |
$opt_l=3; |
| 43 |
$opt_basedn="dc=farmnet,dc=nikhef,dc=nl"; |
| 44 |
$opt_nfs="hooimijt:/export/cache/edgdevtb/poolaccounts"; |
| 45 |
|
| 46 |
@optdef=qw( v vo=s n:i basedn l:i b|uidbase:i g|gid=i ); |
| 47 |
|
| 48 |
use Getopt::Long; |
| 49 |
$Getopt::Long::ignorecase=0; |
| 50 |
&GetOptions(@optdef); |
| 51 |
|
| 52 |
$opt_vo or die "No VO specified\n"; |
| 53 |
length($opt_vo)>5 and die "VO name too long\n"; |
| 54 |
$opt_g or die "No GroupID specified\n"; |
| 55 |
$opt_b or die "No start of UID numbering specified\n"; |
| 56 |
|
| 57 |
$opt_v and print "Generating VO $opt_vo with $opt_n accounts\n"; |
| 58 |
$opt_v and print "in DIT position $opt_basedn\n"; |
| 59 |
|
| 60 |
$fmtstring='%s%0'.$opt_l.'d'; |
| 61 |
|
| 62 |
for($i=1;$i<=$opt_n;$i++) { |
| 63 |
$uid=sprintf($fmtstring,$opt_vo,$i); |
| 64 |
$n=$i+$opt_b; |
| 65 |
|
| 66 |
print "dn: uid=$uid, ou=PoolAccounts, $opt_basedn\n"; |
| 67 |
print "objectclass: top\n"; |
| 68 |
print "objectclass: posixAccount\n"; |
| 69 |
print "cn: VO $opt_vo member no $i\n"; |
| 70 |
print "uid: $uid\n"; |
| 71 |
print "uidNumber: $n\n"; |
| 72 |
print "gidNumber: $opt_g\n"; |
| 73 |
print "homeDirectory: /home/$uid\n"; |
| 74 |
print "loginShell: /bin/sh\n"; |
| 75 |
print "description: $opt_nfs/$uid\n"; |
| 76 |
print "\n"; |
| 77 |
|
| 78 |
print "dn: cn=$uid,ou=pool,ou=auto.home,ou=automount,$opt_basedn\n"; |
| 79 |
print "objectclass: top\n"; |
| 80 |
print "objectclass: automount\n"; |
| 81 |
print "cn: $uid\n"; |
| 82 |
print "automountInformation: $opt_nfs/$uid\n"; |
| 83 |
print "description: EDG dev testbed pool account $uid\n"; |
| 84 |
print "\n"; |
| 85 |
} |
| 86 |
|