File: lcmaps_gen_poolgroup_ldif

package info (click to toggle)
lcmaps 1.6.6-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,016 kB
  • ctags: 1,428
  • sloc: sh: 11,191; ansic: 9,519; makefile: 530; lex: 184; perl: 92; yacc: 60
file content (72 lines) | stat: -rw-r--r-- 2,202 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /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 <okoeroo@nikhef.nl>
#     Mischa Sall\'e <msalle@nikhef.nl>
#     David Groep <davidg@nikhef.nl>
#     NIKHEF Amsterdam, the Netherlands
#     <grid-mw-security@nikhef.nl> 
# 
#  2007-2009
#     Oscar Koeroo <okoeroo@nikhef.nl>
#     David Groep <davidg@nikhef.nl>
#     NIKHEF Amsterdam, the Netherlands
# 
#  2003-2007
#     Martijn Steenbakkers <martijn@nikhef.nl>
#     Gerben Venekamp <venekamp@nikhef.nl>
#     Oscar Koeroo <okoeroo@nikhef.nl>
#     David Groep <davidg@nikhef.nl>
#     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";
}