installvars.pm.in 14.2 KB
Newer Older
1 2
#!/usr/bin/perl -w
#
3
# Copyright (c) 2003-2017 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
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
#
#
# A big set of variables that are common to the installation scripts.
#
package installvars;
use strict;
# Avoid having to predefine everything.
no strict "vars";
use Exporter;
use vars qw(@ISA $SYMLIST);
@ISA    = qw(Exporter);
@EXPORT = qw();

# These are set in the driver script from command line args.
$domakes     = 0;
$packagedir  = "";
$password    = undef;

# Version of FreeBSD.
$FBSD_MAJOR = 4;
$FBSD_MINOR = 10;
if (`uname -r` =~ /^(\d+)\.(\d+)/) {
    $FBSD_MAJOR = $1;
    $FBSD_MINOR = $2;
}
else {
    die("Could not determine what version of FreeBSD you are running!\n");
}
51 52 53 54 55 56 57
$FBSD_ARCH = "i386";
if (`uname -m` =~ /^(\S+)$/) {
    $FBSD_ARCH = $1;
}
else {
    die("Could not determine what architecutre FreeBSD is running on!\n");
}
58 59 60 61 62 63 64 65 66

#
# The meta-ports (name and version) that drag in all the dependancies for
# a boss node. These are OS dependent as we upgrade.
#
$BOSS_PORT = "emulab-boss-1.8";
$OPS_PORT  = "emulab-ops-1.4"; 
$FS_PORT   = "emulab-fs-1.4";
if ($FBSD_MAJOR > 4) {
67 68 69 70 71
    if ($FBSD_MAJOR > 10 || ($FBSD_MAJOR == 10 && $FBSD_MINOR > 1)) {
	$BOSS_PORT = "emulab-boss-6.2";
	$OPS_PORT = "emulab-ops-6.2";
	$FS_PORT = "emulab-fs-6.2";
    } elsif ($FBSD_MAJOR == 10 && $FBSD_MINOR > 0) {
72 73 74 75
	$BOSS_PORT = "emulab-boss-6.1";
	$OPS_PORT = "emulab-ops-6.1";
	$FS_PORT = "emulab-fs-6.1";
    } elsif ($FBSD_MAJOR > 9) {
76 77 78 79
	$BOSS_PORT = "emulab-boss-6.0";
	$OPS_PORT = "emulab-ops-6.0";
	$FS_PORT = "emulab-fs-6.0";
    } elsif ($FBSD_MAJOR == 9 && $FBSD_MINOR > 1) {
80 81 82 83
	$BOSS_PORT = "emulab-boss-5.1";
	$OPS_PORT = "emulab-ops-5.1";
	$FS_PORT = "emulab-fs-5.1";
    } elsif ($FBSD_MAJOR > 8 || ($FBSD_MAJOR == 8 && $FBSD_MINOR > 2)) {
84 85 86 87
	$BOSS_PORT = "emulab-boss-5.0";
	$OPS_PORT = "emulab-ops-5.0";
	$FS_PORT = "emulab-fs-5.0";
    } elsif ($FBSD_MAJOR > 7) {
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
	$BOSS_PORT = "emulab-boss-4.0";
	$OPS_PORT = "emulab-ops-4.0";
	$FS_PORT = "emulab-fs-4.0";
    } elsif ($FBSD_MAJOR == 7 && $FBSD_MINOR > 2) {
	$BOSS_PORT = "emulab-boss-3.1";
	$OPS_PORT = "emulab-ops-3.1";
	$FS_PORT = "emulab-fs-3.1";
    } elsif ($FBSD_MAJOR == 7) {
	$BOSS_PORT = "emulab-boss-3.0";
	$OPS_PORT = "emulab-ops-3.0";
	$FS_PORT = "emulab-fs-3.0";
    } elsif ($FBSD_MAJOR == 6 && $FBSD_MINOR > 2) {
	$BOSS_PORT = "emulab-boss-2.1";
	$OPS_PORT = "emulab-ops-2.1";
	$FS_PORT = "emulab-fs-2.1";
    } else {
	$BOSS_PORT = "emulab-boss-2.0";
	$OPS_PORT = "emulab-ops-2.0";
	$FS_PORT = "emulab-fs-2.0";
    }
}

# PHP5 is the only alternative at the moment and only for newer OSes
$PHP_VERSION = 4;
$PHP_PORT = "php4-extensions-1.0";
if ($FBSD_MAJOR > 7 || ($FBSD_MAJOR == 7 && $FBSD_MINOR > 2)) {
    $PHP_VERSION = 5;
115
    # there is no longer an explict extensions package
116 117
    if ($FBSD_MAJOR == 10 && $FBSD_MINOR > 0) {
	$PHP_PORT = "php56";
118
    } elsif ($FBSD_MAJOR > 9 || ($FBSD_MAJOR == 9 && $FBSD_MINOR > 1)) {
119 120
	$PHP_PORT = "php5-extensions-1.7";
    } elsif ($FBSD_MAJOR > 8 || ($FBSD_MAJOR == 8 && $FBSD_MINOR > 2)) {
121 122
	$PHP_PORT = "php5-extensions-1.6";
    } elsif ($FBSD_MAJOR > 7) {
123
	$PHP_PORT = "php5-extensions-1.4";
124
    } else {
125 126 127 128 129 130
	$PHP_PORT = "php5-extensions-1.3";
    }
}

# XXX temporary for tftp
$TFTPD_PKG	  = "emulab-tftp-hpa-0.48";
Mike Hibler's avatar
Mike Hibler committed
131 132 133
if ($FBSD_MAJOR > 10 || ($FBSD_MAJOR == 10 && $FBSD_MINOR > 0)) {
    $TFTPD_PKG = "emulab-tftp-hpa-5.2";
}
134

135
# XXX temporary for perl DBD mysql access (only needed for FBSD7 and below)
136 137 138 139 140 141 142 143 144 145 146 147 148 149
$P5DBD_PKG	  = "p5-DBD-mysql50-3.0002";

# Lots of patches
$STL_PATCH		= "$main::TOP_SRCDIR/patches/g++.patch";
$M2CRYPTO_PATCH		= "$main::TOP_SRCDIR/patches/m2crypto.patch";
$MYSQL_PM_PATCH		= "$main::TOP_SRCDIR/patches/Mysql.pm.patch";
$PHP4_PATCH		= "$main::TOP_SRCDIR/patches/php4-Makefile.patch";
$SELFLOAD_PATCH		= "$main::TOP_SRCDIR/patches/SelfLoader.patch";

#
# Version dependent python-fu 
#
$PYM2_PKG = "py25-m2crypto-0.19.1";
$PY_VER   = "python2.5";
150 151 152 153
if ($FBSD_MAJOR > 10 || ($FBSD_MAJOR == 10 && $FBSD_MINOR > 0)) {
    $PYM2_PKG = "py27-m2crypto-0.22.3";
    $PY_VER = "python2.7";
} elsif ($FBSD_MAJOR > 9) {
154 155 156
    $PYM2_PKG = "py27-m2crypto-0.21.1_1";
    $PY_VER = "python2.7";
} elsif ($FBSD_MAJOR > 8 || ($FBSD_MAJOR == 8 && $FBSD_MINOR > 2)) {
157 158 159
    $PYM2_PKG = "py27-m2crypto-0.21.1";
    $PY_VER = "python2.7";
} elsif ($FBSD_MAJOR > 7 || ($FBSD_MAJOR == 7 && $FBSD_MINOR > 2)) {
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
    $PYM2_PKG = "py26-m2crypto-0.20";
    $PY_VER = "python2.6";
}
# XXX temporary until someone extracts their head from the dark regions
$EASYINSTALL		= "/usr/local/bin/easy_install";

# These names are for the scripts.
$BOSS_SERVERNAME	= "boss";
$OPS_SERVERNAME 	= "ops";
$FS_SERVERNAME		= "fs";

# Should be configure variable
$TBADMINGID		= 101;

$TBROOT			= "@prefix@";
$PREFIX			= $TBROOT;

$MAINSITE		= @TBMAINSITE@;
$PGENISUPPORT		= @PROTOGENI_SUPPORT@;
Leigh Stoller's avatar
Leigh Stoller committed
179
$PROTOGENI_GENIRACK     = @PROTOGENI_GENIRACK@;
180
$PORTAL_ENABLE          = @PORTAL_ENABLE@;
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
$ELABINELAB		= @ELABINELAB@;
$DBNAME			= "@TBDBNAME@";
$ERRORLOG_DBNAME	= "@TBERRORLOGDBNAME@";
$FRISADDR		= '@FRISEBEEMCASTADDR@';

$HAVE_XERCES		= "@HAVE_XERCES@";
$MAILMANSUPPORT		= @MAILMANSUPPORT@;
$WINSUPPORT		= @WINSUPPORT@;

$OURDOMAIN		= '@OURDOMAIN@';
$USERNODE		= '@USERNODE@';
$FSNODE			= '@FSNODE@';
$BOSSNODE		= '@BOSSNODE@';
$BOSSNODE_IP		= '@BOSSNODE_IP@';
$USERNODE_IP		= '@USERNODE_IP@';
$FSNODE_IP		= '@FSNODE_IP@';
$CONTROL_NETWORK	= "@CONTROL_NETWORK@";
$CONTROL_NETMASK	= "@CONTROL_NETMASK@";
$PUBLIC_NETMASK		= "@PUBLIC_NETMASK@";
200
$NTPSERVER		= "@NTPSERVER@";
201 202
$LOGFACIL		= '@TBLOGFACIL@';
$QUOTA_FSLIST		= '@FS_WITH_QUOTAS@';
Leigh Stoller's avatar
Leigh Stoller committed
203
$OURTIMEZONE	        = "@OURTIMEZONE@";
204
$NODECONSOLE		= "@NODECONSOLE@";
Leigh Stoller's avatar
Leigh Stoller committed
205
$MFSVERSION		= "@MFSVERSION@";
206 207 208 209 210

$LOGDIR			= "$TBROOT/log";
$ETCDIR			= "$PREFIX/etc";
$LIBDIR			= "$PREFIX/lib";
$WAP			= "$TBROOT/sbin/withadminprivs";
Leigh Stoller's avatar
Leigh Stoller committed
211
$TESTBED_CONTROL	= "$TBROOT/sbin/testbed-control";
212 213 214 215 216 217 218 219 220

$ELVIN_COMPAT		= @ELVIN_COMPAT@;
$MAILMANSUPPORT		= @MAILMANSUPPORT@;
$CVSSUPPORT		= @CVSSUPPORT@;
$BUGDBSUPPORT		= @BUGDBSUPPORT@;
$WIKISUPPORT		= @WIKISUPPORT@;
$NOSHAREDFS		= @NOSHAREDFS@;
# Are we a VM on boss?
$OPSVM_ENABLE		= @OPSVM_ENABLE@;
221 222
# mrouted no longer needed; replaced by IGMP querier in mfrisbeed
$NEEDMROUTED		= 0;
223
$ARCHSUPPORT		= @ARCHIVESUPPORT@;
224
$BROWSER_CONSOLE_ENABLE = @BROWSER_CONSOLE_ENABLE@;
225 226
$WITHZFS		= @WITHZFS@;
$WITHAMD		= @WITHAMD@;
227

228 229 230 231 232 233 234 235 236 237 238 239 240
#
# Python/Perl paths
#
# EMULAB* are the paths we expect and use in '#!'
# PORT* are the paths that the ports install and should always exist
#
# We make sure the former is symlinked to the latter.
#
$EMULAB_PERL_PATH	= "/usr/bin/perl";
$EMULAB_PYTHON_PATH	= "/usr/local/bin/python";
$PORT_PERL_PATH		= "/usr/local/bin/perl5";
$PORT_PYTHON_PATH	= "/usr/local/bin/python2";

241 242 243 244 245
#
# Some programs we use
#
$CHGRP			= "/usr/bin/chgrp";
$CHMOD			= "/bin/chmod";
Leigh Stoller's avatar
Leigh Stoller committed
246
$MKDIR			= "/bin/mkdir";
247 248 249 250
$TOUCH			= "/usr/bin/touch";
$CHOWN			= "/usr/sbin/chown";
$PW			= "/usr/sbin/pw";
$PATCH			= "/usr/bin/patch";
Mike Hibler's avatar
Mike Hibler committed
251 252 253
if ($FBSD_MAJOR >= 10) {
    $PATCH		.= " --posix";
}
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
$CAT			= "/bin/cat";
$NEWALIASES		= "/usr/bin/newaliases";
$SH			= "/bin/sh";
$PWD			= "/bin/pwd";
$CP			= "/bin/cp";
$MV			= "/bin/mv";
$ENV			= "/usr/bin/env";
$MOUNT			= "/sbin/mount";
$TAR			= "/usr/bin/tar";
$MD5			= "/sbin/md5";
$SSH_KEYGEN		= "/usr/bin/ssh-keygen";
$SUDO			= "/usr/local/bin/sudo";
$GMAKE			= "/usr/local/bin/gmake";
$MYSQL			= "/usr/local/bin/mysql";
$QUOTAON		= "/usr/sbin/quotaon";
269 270
$SSH_INIT		= "/usr/bin/ssh -2";
$SCP_INIT		= "/usr/bin/scp -2";
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
$SSH			= "/usr/bin/ssh -2";
$SCP			= "/usr/bin/scp -2";
#
# XXX keep 4.x ElabInElab install limping along...
#
if ($FBSD_MAJOR == 4) {
    $SCP_INIT = "/usr/bin/scp -oProtocol=1";
    $SCP =      "/usr/bin/scp -oProtocol=2";
}

$PORTSDIR		= "/usr/ports";
$PORTSMISCDIR		= "$PORTSDIR/misc";
$LIST_DIR		= "/etc/mail/lists";
$ALIASES_FILE           = "/etc/mail/aliases";
$VARRUN			= "/var/run";
$RCDIR			= "/usr/local/etc/rc.d";
$NAMED_DIR		= "/etc/namedb";
288
$RESOLVECONF		= "/etc/resolv.conf";
289 290 291 292 293 294 295 296 297 298 299 300 301 302
$FSTAB			= "/etc/fstab";
$RCCONF			= "/etc/rc.conf";
$HOSTS			= "/etc/hosts";
$LOCAL_HOSTNAMES	= "/etc/mail/local-host-names";
$EXPORTS_FILE		= "/etc/exports";
$EXPORTS_HEAD		= "$EXPORTS_FILE.head";
$SYSLOG_CONF		= "/etc/syslog.conf";
$NEWSYSLOG_CONF		= "/etc/newsyslog.conf";
$SUDOERS		= "/usr/local/etc/sudoers";
$SSHD_CONFIG		= "/etc/ssh/sshd_config";
$CRONTAB		= "/etc/crontab";
$TIPLOG_DIR		= "/var/log/tiplogs";
$OPSWWWDIR		= "/usr/local/www/data";
$WWWDIR			= "$PREFIX/www";
303 304
$TBBASE			= "@TBBASE@";
$THISHOMEBASE           = "@THISHOMEBASE@";
305 306 307 308
$AUTHKEYS		= "/root/.ssh/authorized_keys";
$RCCAPTURE		= "$PREFIX/etc/rc.capture";
$RCLOCAL		= "/etc/rc.local";
$PHP_INI		= "/usr/local/etc/php.ini";
309
$PHP_CONF		= "/usr/local/etc/php.conf";
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
$SENDMAIL_CF		= "/etc/mail/sendmail.cf";
$INETD_CONF		= "/etc/inetd.conf";
$ETCSSH			= "/etc/ssh";
$SSH_CONFIG	        = "$ETCSSH/ssh_config";
$LOADER_CONF		= "/boot/loader.conf";
$SYSCTL_CONF		= "/etc/sysctl.conf";

$GROUPROOT		= "@GROUPSROOT_DIR@";
$USERROOT		= "@USERSROOT_DIR@";
$SCRATCHROOT		= "@SCRATCHROOT_DIR@";
$SHAREROOT		= "@SHAREROOT_DIR@";
$PROJROOT		= "@PROJROOT_DIR@";

$TBOPSEMAIL		= "@TBOPSEMAIL@";
$TBTESTSUITEEMAIL	= "@TBTESTSUITEEMAIL@";

# For installing mysqld
327
$MYSQLD			= "/usr/local/libexec/mysqld";
328 329 330 331 332 333
$MYSQLADMIN		= "/usr/local/bin/mysqladmin";
$MYSQLSHOW		= "/usr/local/bin/mysqlshow";
$MYSQLDUMP		= "/usr/local/bin/mysqldump";
$MYSQLINSTALL		= "/usr/local/bin/mysql_install_db";
$MYSQLDBDIR		= "/var/db/mysql";
$MYSQL_LOGDIR		= "$LOGDIR/mysql";
334
$MYSQL_CNF		= "/usr/local/etc/mysql/my.cnf";
335 336 337 338 339 340 341 342 343

$PROTOUSER		= "elabman";
$CHECKUPUSER		= "elabckup";

$INSTALL_APACHE_CONFIG	= "@INSTALL_APACHE_CONFIG@";
$APACHE_VERSION		= "@APACHE_VERSION@";
$APACHE_START_COMMAND	= "@APACHE_START_COMMAND@";
$APACHE_ETCDIR		= "$INSTALL_APACHE_CONFIG";
$HTTPD_CONF		= "$APACHE_ETCDIR/httpd.conf";
344
$HTTPD_GENI_CONF	= "$APACHE_ETCDIR/httpd-geni.conf";
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
$APACHE_CERTPEM		= "apache.pem";
$APACHE_KEYPEM		= "apache.key";
$APACHE_CERTFILE	= "$APACHE_ETCDIR/ssl.crt/www.${OURDOMAIN}.crt";
$APACHE_KEYFILE		= "$APACHE_ETCDIR/ssl.key/www.${OURDOMAIN}.key";
$APACHE_CERTPEM_OPS	= "apache-ops.pem";
$APACHE_KEYPEM_OPS	= "apache-ops.key";
$APACHE_CERTFILE_OPS	= "$APACHE_ETCDIR/ssl.crt/${USERNODE}.crt";
$APACHE_KEYFILE_OPS	= "$APACHE_ETCDIR/ssl.key/${USERNODE}.key";

$PROTOGENI_RPCNAME	= "@PROTOGENI_RPCNAME@";
$PROTOGENI_RPCPORT	= "@PROTOGENI_RPCPORT@";
$PROTOGENI_EMAIL        = "@PROTOGENI_EMAIL@";

$DHCPD_CONF		= "/usr/local/etc/dhcpd.conf";
$DHCPD_TEMPLATE		= "/usr/local/etc/dhcpd.conf.template";
$DHCPD_LEASES		= "/var/db/dhcpd.leases";
$DHCPD_MAKECONF		= "$TBROOT/sbin/dhcpd_makeconf";
$NAMED_SETUP		= "$TBROOT/sbin/named_setup";

$BATCHEXP		= "$PREFIX/bin/batchexp";
$ADDPUBKEY		= "$PREFIX/sbin/addpubkey";
$TBACCT			= "$PREFIX/sbin/tbacct";
$GENTOPOFILE		= "$PREFIX/libexec/gentopofile";
368
$UPDATESITEVARS		= "$PREFIX/sbin/update_sitevars";
369
$IMAGEIMPORT            = "$PREFIX/sbin/image_import";
370 371 372 373 374

$PROTOUSER_KEY		= "$main::TOP_SRCDIR/install/elabman_dsa.pub";
$ROOT_PRIVKEY		= "/root/.ssh/id_rsa";
$ROOT_PUBKEY		= "$ROOT_PRIVKEY.pub";
$ROOT_AUTHKEY		= "/root/.ssh/authorized_keys";
375 376
$ROOT_DSA_PRIVKEY	= "/root/.ssh/id_dsa";
$ROOT_DSA_PUBKEY	= "$ROOT_DSA_PRIVKEY.pub";
377

378 379
$INIT_PRIVKEY		= "$main::TOP_SRCDIR/install/id_rsa";
$INIT_PUBKEY		= "$main::TOP_SRCDIR/install/id_rsa.pub";
380 381 382 383 384 385 386 387 388 389 390
$CACERT			= "$TBROOT/etc/emulab.pem";
$EMULAB_PEM		= "emulab.pem";
$CLIENT_PEM		= "client.pem";
$CTRLNODE_PEM		= "ctrlnode.pem";
$ETC_EMULAB_DIR		= "/etc/emulab";

$SMBCONF_FILE		= "/usr/local/etc/smb.conf";
$SMBCONF_HEAD		= "$SMBCONF_FILE.head";

$TFTP_DIR	        = "$PREFIX/tftpboot";
$TFTP_PROJ_DIR		= "$TFTP_DIR/proj";
Leigh Stoller's avatar
Leigh Stoller committed
391
$IMAGEKEYS_DIR	        = "$ETCDIR/image_hostkeys";
392

Leigh Stoller's avatar
Leigh Stoller committed
393
$DEFAULTIMAGESITEVAR    = "general/default_imagename";
394
$IMAGEPASSWORDSITEVAR   = "images/root_password";
Leigh Stoller's avatar
Leigh Stoller committed
395

396 397 398
$MAILMANDIR		= "/usr/local/mailman";
$MAILMANCFG		= "$MAILMANDIR/Mailman/mm_cfg.py";

399
$SHAREDIR		= "@FSDIR_SHARE@";
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
$SCRATCHDIR		= "@FSDIR_SCRATCH@";

$OUTERBOSS_XMLRPCPORT   = "@OUTERBOSS_XMLRPCPORT@";

@OPS_NAMES		= ($USERNODE, "users", "ops");
@MAILING_LISTS		= ("@TBOPSEMAIL@","@TBLOGSEMAIL@","@TBWWWEMAIL@",
			   "@TBAPPROVALEMAIL@","@TBAUDITEMAIL@",
			   "@TBSTATEDEMAIL@", "@TBTESTSUITEEMAIL@",
			   "@TBERRORSEMAIL@", "@TBAUTOMAILEMAIL@");
@LOCAL_MAILING_LISTS    = grep(/$OURDOMAIN$/, @MAILING_LISTS);

$USERSVAR_MOUNTPOINT	= "$PREFIX/usersvar";
$OPSDIR_MOUNTPOINT	= "$PREFIX/opsdir";
$OPSVM_MOUNTPOINT	= "@OPSVM_MOUNTPOINT@";

@MOUNTPOINTS		= ($USERROOT, $PROJROOT, $GROUPROOT);
if ($SHAREDIR) {
    push(@MOUNTPOINTS, $SHAREROOT);
}
if ($SCRATCHDIR) {
    push(@MOUNTPOINTS, $SCRATCHROOT);
}

# ElabinElab.
$OUTER_BOSS		 = '@OUTERBOSS_NODENAME@';
if ($OUTER_BOSS eq '') {
    $OUTER_BOSS = "www.emulab.net";
}

429 430 431 432 433 434
# Firewall stuff
$FIREWALL_BOSS		= @FIREWALL_BOSS@;
$FIREWALL_OPS		= @FIREWALL_OPS@;
$FIREWALL_BOSS_RULES    = "/etc/boss.ipfw";
$FIREWALL_OPS_RULES     = "/etc/ops.ipfw";

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
sub ISBOSSNODE($)	{ return ($_[0] eq $BOSS_SERVERNAME) ? 1 : 0; }
sub ISOPSNODE($)	{ return ($_[0] eq $OPS_SERVERNAME) ? 1 : 0; }
sub ISFSNODE($)		{ return ($_[0] eq $FS_SERVERNAME) ? 1 : 0; }

#
# Is the given server the FS
#
sub ISFS($)
{
    my ($server) = @_;

    if ($server eq $BOSS_SERVERNAME) {
	return ($BOSSNODE_IP eq $FSNODE_IP) ? 1 : 0;
    }
    elsif ($server eq $OPS_SERVERNAME) {
	return ($USERNODE_IP eq $FSNODE_IP) ? 1 : 0;
    }
    elsif ($server eq $FS_SERVERNAME) {
	return 1;
    }
    return 0;
}

#
# The point of this code is to export every single symbol in this
# file to the caller, without having to list them all.
#
sub importup($)
{
    my ($caller) = @_;

    no strict 'refs';

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';    # don't export BEGIN blocks
        next if      $name eq 'import';   # don't export this sub

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}

sub import {
    return importup(caller());
}

1;