summaryrefslogtreecommitdiffstats
path: root/ldap/admin/src/CreateInstall.pl
blob: 517146839cfce57e1086e4b7ee364148d2c570b0 (plain)
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
#!perl
#
# BEGIN COPYRIGHT BLOCK
# Copyright 2001 Sun Microsystems, Inc.
# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# figure out what the server root assuming the path to this script is
# server root/bin/slapd/admin/bin

($serverRoot = $0) =~ s@[\\/]?bin[\\/]slapd[\\/]admin[\\/]bin.*$@@g;

# run the post install program
$isNT = -d '\\';
$quote = $isNT ? "\"" : "";
# make sure the arguments are correctly quoted on NT
@fixargs = map { /^[\"].*[\"]$/ ? $_ : $quote . $_ . $quote } @ARGV;
if (! $serverRoot) {
  $serverRoot = ".";
}
chdir "$serverRoot/bin/slapd/admin/bin";

# note: exec on NT doesn't work the same way as exec on Unix. On Unix, exec replaces the calling
# process with the called process.  The parent, if waiting for the calling process, will happily
# wait for it's replacement.  On NT however, the parent thinks the calling process has gone, and
# it doesn't know about the called process, so it stops waiting.  So, we have to do a system()
# on NT to force the calling process to wait for the called process.  On Unix, we can do the
# faster and more memory efficient exec() call.
if ($isNT) {
  system {'./ds_create'} './ds_create', @fixargs;
} else {
  exec {'./ds_create'} './ds_create', @fixargs;
}