+#
+# Create top-level directories if they don't exist
+#
+foreach my $dir ( (
+ "$Conf{TopDir}",
+ "$Conf{TopDir}/pool",
+ "$Conf{TopDir}/cpool",
+ "$Conf{TopDir}/pc",
+ "$Conf{TopDir}/trash",
+ ) ) {
+ next if ( -d $dir );
+ mkpath($dir, 0, 0750);
+ if ( !-d $dir ) {
+ print("Failed to create $dir\n");
+ printf(LOG "%sFailed to create directory %s\n", $bpc->timeStamp, $dir);
+ print("link $clientURI\n") if ( $needLink );
+ exit(1);
+ } else {
+ printf(LOG "%sCreated directory %s\n", $bpc->timeStamp, $dir);
+ }
+}
+
+if ( !$bpc->HardlinkTest($Dir, "$TopDir/cpool") ) {
+ print(LOG $bpc->timeStamp, "Can't create a test hardlink between a file"
+ . " in $Dir and $TopDir/cpool. Either these are different"
+ . " file systems, or this file system doesn't support hardlinks,"
+ . " or these directories don't exist, or there is a permissions"
+ . " problem, or the file system is out of inodes or full. Use"
+ . " df, df -i, and ls -ld to check each of these possibilities."
+ . " Quitting...\n");
+ print("test hardlink between $Dir and $TopDir/cpool failed\n");
+ print("link $clientURI\n") if ( $needLink );
+ exit(1);
+}
+
+if ( !$opts{d} ) {
+ #
+ # In the non-DHCP case, make sure the host can be looked up
+ # via NS, or otherwise find the IP address via NetBios.
+ #
+ if ( $Conf{ClientNameAlias} ne "" ) {
+ $host = $Conf{ClientNameAlias};
+ } else {
+ $host = $client;
+ }
+ if ( !defined(gethostbyname($host)) ) {
+ #
+ # Ok, NS doesn't know about it. Maybe it is a NetBios name
+ # instead.
+ #
+ print(STDERR "Name server doesn't know about $host; trying NetBios\n")
+ if ( $opts{v} );
+ if ( !defined($hostIP = $bpc->NetBiosHostIPFind($host)) ) {
+ print(LOG $bpc->timeStamp, "Can't find host $host via netbios\n");
+ print("host not found\n");
+ exit(1);
+ }
+ } else {
+ $hostIP = $host;
+ }
+}
+