Commit e81136ad authored by Mike Hibler's avatar Mike Hibler

Support for FreeBSD 10.x boss/ops.

The biggest changes were related to 10.0's replacing gcc with clang
and the switch to a new package system. The former required various
fixes to Makefiles that hardwired "gcc" and also missing prototypes
in source files that clang is particularly obnoxious about.

There was also accomodating the normal evolution of the ports tree.
New variables were needed in many of the Makefiles for this. Hopefully,
all the changes I made are backward compatible, but I don't actually
care that much since I hope to never, ever have to remake those older
packages! A new emulab version of the m2crypto port was needed to
reflect that m2crypto is no longer installed as an .egg file.

Casualties:

  * Emulab assign. As of this commit, assign does not build with
    clang. It will build, but immediately core dumps if built with
    a gcc port (gcc46 below). THIS NEEDS TO BE FIXED!

  * Emulab nsverify. This requires building a pure ns-2.34, which
    is old and does not compile with clang. You will need to set
    NSVERIFY=0 in your defs file. I did this in defs-elabinelab
    (iff FBSD==10) but no where else right now.

  * Bind in the base distro. Bind is no longer part of FreeBSD
    (it has been replaced with something called "unbound"). So we
    install bind99 from a port and we make the /etc/namedb symlink
    to /usr/local/etc/namedb which is where it now lives.

  * Perl 5.12. It has been totally removed from the ports tree.
    We now install 5.14, the next-most obsolete version of Perl!

  * pkg_{add,delete,info}. As mentioned, the packages tools have
    changed. For the most part "pkg <cmd>" is the same as "pkg_<cmd>"
    but not always. This required considerable violence in the
    install/phases code. But it is actually cleaner now.

  * GCC in the base distro. I added installation of the gcc46 port
    to the boss and ops meta packages, just for old-times sake
    (we might wind up needing it, if still more stuff doesn't work
    with clang).
parent 454d9991
......@@ -278,7 +278,7 @@ diff -c -r1.1.1.1 -r1.4
/*
! * wait_for_xmit(): Wait for certain period of time in busy-loop
*/
__inline__ void wait_for_xmit(struct timeval *target, struct timeval *now)
! __inline__ void wait_for_xmit(struct timeval *target, struct timeval *now)
{
while(1){
- gettimeofday(now,NULL);
......@@ -322,7 +322,7 @@ diff -c -r1.1.1.1 -r1.4
! /*
! * wait_for_xmit(): Wait for certain period of time
*/
__inline__ void wait_for_xmit(struct timeval *target, struct timeval *now)
! static __inline__ void wait_for_xmit(struct timeval *target, struct timeval *now)
{
+ gettimeofday(now,NULL);
+ if (usecpertick) {
......
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -36,7 +36,7 @@ include $(TESTBED_SRCDIR)/GNUmakerules
LIBTBDIR = $(TESTBED_LIBOBJDIR)/libtb
LIBEVENTDIR = $(TESTBED_LIBOBJDIR)/event
CPPC = g++
CPPC = $(CXX)
# Rules to make sure that some libraries we need from other directories get
# built first
......
......@@ -285,7 +285,7 @@ my %emulabconfig = (
# Version of FreeBSD.
my $FBSD_VERSION = 4;
if (`uname -r` =~ /^(\d\.\d*)/) {
if (`uname -r` =~ /^(\d+\.\d*)/) {
$FBSD_VERSION = $1;
}
else {
......@@ -352,6 +352,8 @@ sub RecreateDir($$);
sub CreateOpsJail($);
sub SetupOpsJail();
sub FindExtraFSConfig($);
sub AddPackage($$$);
sub DelPackage($@);
#
# Boot Action.
......@@ -624,7 +626,7 @@ sub doboot()
$emulabconfig{BOSS_PKG} = "emulab-boss-5.0";
$emulabconfig{PACKAGE_TARBALL} = "FreeBSD-9.0-packages.tar.gz";
$emulabconfig{PGENI_PKG} = "emulab-protogeni-3.0";
} elsif ($FBSD_VERSION >= 9.2) {
} elsif ($FBSD_VERSION >= 9.2 && $FBSD_VERSION < 10.0) {
my $suf = ($FBSD_ARCH eq "amd64") ? "-64" : "";
$emulabconfig{FS_PKG_DIR} = "/share/freebsd/9.2/packages${suf}";
$emulabconfig{OPS_PKG_DIR} = $emulabconfig{FS_PKG_DIR};
......@@ -634,20 +636,40 @@ sub doboot()
$emulabconfig{BOSS_PKG} = "emulab-boss-5.1";
$emulabconfig{PACKAGE_TARBALL} = "FreeBSD-9.2-packages${suf}.tar.gz";
$emulabconfig{PGENI_PKG} = "emulab-protogeni-3.1";
} elsif ($FBSD_VERSION >= 10.0) {
my $suf = ($FBSD_ARCH eq "amd64") ? "-64" : "";
$emulabconfig{FS_PKG_DIR} = "/share/freebsd/10.0/packages${suf}";
$emulabconfig{OPS_PKG_DIR} = $emulabconfig{FS_PKG_DIR};
$emulabconfig{BOSS_PKG_DIR} = $emulabconfig{FS_PKG_DIR};
$emulabconfig{FS_PKG} = "emulab-fs-6.0";
$emulabconfig{OPS_PKG} = "emulab-ops-6.0";
$emulabconfig{BOSS_PKG} = "emulab-boss-6.0";
$emulabconfig{PACKAGE_TARBALL} = "FreeBSD-10.0-packages${suf}.tar.gz";
$emulabconfig{PGENI_PKG} = "emulab-protogeni-4.0";
}
#
# If there is a package tarball, prefer that and grab it now.
# XXX note that we do not download into $TBDIR, it gets moved later.
#
if (exists($emulabconfig{"PACKAGE_TARBALL"})) {
$emulabconfig{FS_PKG_DIR} = "$TBDIR/packages";
$emulabconfig{OPS_PKG_DIR} = $emulabconfig{FS_PKG_DIR};
$emulabconfig{BOSS_PKG_DIR} = $emulabconfig{FS_PKG_DIR};
#
# Grab the package tarball now.
# XXX note that we do not download into $TBDIR, it gets moved later.
#
mysystem("fetch -q -o /usr/packages.tar.gz ".
"'http://${bossname}/downloads/" .
$emulabconfig{PACKAGE_TARBALL} . "'");
}
#
# Otherwise, make sure the NFS-mounted package directories exist.
#
else {
if (! -e $emulabconfig{"BOSS_PKG_DIR"} ||
! -e $emulabconfig{"OPS_PKG_DIR"} ||
! -e $emulabconfig{"FS_PKG_DIR"}) {
SetupFatal("Could not locate boss/ops/fs packages");
}
}
#
# XXX Copy in new mkextrafs if necessary
......@@ -685,9 +707,9 @@ sub doboot()
mysystem("echo '$passhash' | /usr/sbin/pw usermod toor -H 0");
mysystem("echo '$passhash' | /usr/sbin/pw usermod root -H 0");
if (!$opsjail) {
if (!exists($emulabconfig{PACKAGE_TARBALL})) {
#
# XXX To avoid NFS errors while copying goo from outer boss.
# XXX To avoid NFS errors while copying goo from outer FS.
#
system("sysctl vfs.nfs.eacces_retry_enable=1 >/dev/null 2>&1");
system("sysctl vfs.nfs.eacces_retry_count=20 >/dev/null 2>&1");
......@@ -976,8 +998,7 @@ sub SetupFsNode()
print "Installing the fs metaport.\n";
RecreateDir("/usr/ports", 1);
$ENV{"PKG_PATH"} = $emulabconfig{FS_PKG_DIR};
mysystem("pkg_add $emulabconfig{FS_PKG} >/tmp/perrs 2>&1");
AddPackage($emulabconfig{FS_PKG}, $emulabconfig{FS_PKG_DIR}, 0);
}
#
......@@ -1487,29 +1508,31 @@ sub SetupOpsNode($)
print "Removing conflicting packages.\n";
$ENV{"PYEASYINSTALL_UNINSTALLARGS"} = "-H None";
system("pkg_delete -r -x mysql-client")
DelPackage(1, "mysql-client")
if (-e "/usr/local/bin/mysql");
if (-e "$pdir/emacs-23") {
system("pkg_delete -f -x emacs");
}
DelPackage(0, "emacs")
if (-e "$pdir/emacs-23");
# XXX 8.x images have rpm-3 installed
if ($FBSD_VERSION == 8.2 || $FBSD_VERSION == 8.3) {
system("pkg_delete -f -x rpm-3");
# XXX 8.2+ images have rpm-3 installed
if ($FBSD_VERSION >= 8.2) {
DelPackage(0, "rpm-3");
}
# XXX 10.x images have py-distribute installed
if ($FBSD_VERSION == 10.0) {
DelPackage(0, "py27-distribute");
}
# XXX 7.3 image is out of sync right now
if ($FBSD_VERSION == 7.3) {
system("pkg_delete -f -x python25 -x py25");
system("pkg_delete -f -x sudo -x png -x tiff");
system("pkg_delete -f -x git -x rpm -x p5-libwww");
DelPackage(0, "python25", "py25",
"sudo", "png", "tiff",
"git", "rpm", "p5-libwww");
}
print "Installing the ops metaport.\n";
RecreateDir("/usr/ports", 1);
$ENV{"PKG_PATH"} = $emulabconfig{OPS_PKG_DIR};
mysystem("pkg_add $emulabconfig{OPS_PKG} >/tmp/perrs 2>&1");
AddPackage($emulabconfig{OPS_PKG}, $emulabconfig{OPS_PKG_DIR}, 0);
if ($isfs) {
# XXX if not set, derive from the OPS info
......@@ -1517,11 +1540,11 @@ sub SetupOpsNode($)
$emulabconfig{FS_PKG_DIR} = $emulabconfig{OPS_PKG_DIR};
($emulabconfig{FS_PKG} = $emulabconfig{OPS_PKG}) =~ s/ops/fs/;
}
print "Installing the fs metaport.\n";
AddPackage($emulabconfig{FS_PKG}, $emulabconfig{FS_PKG_DIR}, 0);
}
if (-e "$pdir/emacs-23") {
$ENV{"PKG_PATH"} = "$pdir/emacs-23";
system("pkg_add $pdir/emacs-23/emacs*");
$ENV{"PKG_PATH"} = "$pdir";
AddPackage("$pdir/emacs-23", "emacs-23.2_4,2", 0);
}
}
......@@ -2167,31 +2190,35 @@ sub SetupBossNode($)
print "Removing conflicting packages.\n";
$ENV{"PYEASYINSTALL_UNINSTALLARGS"} = "-H None";
system("pkg_delete -r -x mysql-client")
DelPackage(1, "mysql-client")
if (-e "/usr/local/bin/mysql");
system("pkg_delete -x net-snmp")
DelPackage(0, "emacs")
if (-e "$pdir/emacs-23");
DelPackage(0, "net-snmp")
if (-e "/usr/local/include/net-snmp");
# XXX 8.x images have rpm-3 installed
if ($FBSD_VERSION == 8.2 || $FBSD_VERSION == 8.3) {
system("pkg_delete -f -x rpm-3");
# XXX 8.2+ images have dhcp3 client installed, but we need dhcp4
# XXX 8.2+ images have rpm-3 installed
if ($FBSD_VERSION >= 8.2) {
DelPackage(0, "isc-dhcp3");
DelPackage(0, "rpm-3");
}
# XXX 10.x images have py-distribute installed
if ($FBSD_VERSION == 10.0) {
DelPackage(0, "py27-distribute");
}
# XXX 7.3 image is out of sync right now
if ($FBSD_VERSION == 7.3) {
system("pkg_delete -f -x python25 -x py25");
system("pkg_delete -f -x sudo -x png -x tiff");
system("pkg_delete -f -x git -x rpm -x p5-libwww");
DelPackage(0, "python25", "py25",
"sudo", "png", "tiff",
"git", "rpm", "p5-libwww");
}
if (-e "$pdir/emacs-23") {
system("pkg_delete -f -x emacs");
}
print "Installing the boss metaport.\n";
RecreateDir("/usr/ports", 1);
$ENV{"PKG_PATH"} = $emulabconfig{BOSS_PKG_DIR};
mysystem("pkg_add -f $emulabconfig{BOSS_PKG} >/tmp/perrs 2>&1");
AddPackage($emulabconfig{BOSS_PKG}, $emulabconfig{BOSS_PKG_DIR}, 1);
if ($isfs) {
# XXX if not set, derive from the OPS info
......@@ -2199,18 +2226,17 @@ sub SetupBossNode($)
$emulabconfig{FS_PKG_DIR} = $emulabconfig{OPS_PKG_DIR};
($emulabconfig{FS_PKG} = $emulabconfig{OPS_PKG}) =~ s/ops/fs/;
}
print "Installing the fs metaport.\n";
AddPackage($emulabconfig{FS_PKG}, $emulabconfig{FS_PKG_DIR}, 0);
}
if ($emulabconfig{"LOAD_PROTOGENI"}) {
print "Installing the protogeni metaport.\n";
# XXX lives in the boss package dir
$ENV{"PKG_PATH"} = $emulabconfig{BOSS_PKG_DIR};
mysystem("pkg_add -f $emulabconfig{PGENI_PKG} >>/tmp/perrs 2>&1");
AddPackage($emulabconfig{PGENI_PKG}, $emulabconfig{BOSS_PKG_DIR}, 1);
}
if (-e "$pdir/emacs-23") {
$ENV{"PKG_PATH"} = "$pdir/emacs-23";
system("pkg_add $pdir/emacs-23/emacs*");
$ENV{"PKG_PATH"} = "$pdir";
AddPackage("$pdir/emacs-23", "emacs-23.2_4,2", 0);
}
}
......@@ -2827,26 +2853,30 @@ sub SetupOpsJail()
}
print "Removing conflicting packages.\n";
$ENV{"PYEASYINSTALL_UNINSTALLARGS"} = "-H None";
system("pkg_delete -r -x mysql-client")
DelPackage(1, "mysql-client")
if (-e "/usr/local/bin/mysql");
# XXX 8.x images have rpm-3 installed
if ($FBSD_VERSION == 8.2 || $FBSD_VERSION == 8.3) {
system("pkg_delete -f -x rpm-3");
# XXX 8.2+ images have rpm-3 installed
if ($FBSD_VERSION >= 8.2) {
DelPackage(0, "rpm-3");
}
# XXX 10.x images have py-distribute installed
if ($FBSD_VERSION == 10.0) {
DelPackage(0, "py27-distribute");
}
# XXX 7.3 image is out of sync right now
if ($FBSD_VERSION == 7.3) {
system("pkg_delete -f -x python25 -x py25");
system("pkg_delete -f -x sudo -x png -x tiff");
system("pkg_delete -f -x git -x rpm -x p5-libwww");
DelPackage(0, "python25", "py25",
"sudo", "png", "tiff",
"git", "rpm", "p5-libwww");
}
print "Installing the ops metaport.\n";
RecreateDir("/usr/ports", 1);
# Mounted from outside the jail.
$ENV{"PKG_PATH"} = "/packages";
mysystem("pkg_add $emulabconfig{OPS_PKG} >/tmp/perrs 2>&1");
AddPackage($emulabconfig{OPS_PKG}, "/packages", 0);
}
#
......@@ -3270,7 +3300,12 @@ sub CreateDefsFile($)
last SWITCH;
};
/^NSVERIFY$/ && do {
print OUTDEFS "NSVERIFY=1\n";
if ($FBSD_VERSION >= 10.0) {
# XXX ns-2.34 does not build with clang or gcc46
print OUTDEFS "NSVERIFY=0\n";
} else {
print OUTDEFS "NSVERIFY=1\n";
}
last SWITCH;
};
/^NOSHAREDFS$/ && do {
......@@ -3608,3 +3643,45 @@ sub RecreateDir($$)
mysystem("mkdir -p $dir");
}
}
#
# Hide differences in the package tools
#
sub AddPackage($$$)
{
my ($pkg, $pkgdir, $force) = @_;
my $args = $force ? "-f" : "";
if ($FBSD_VERSION >= 10.0) {
my $path = defined($pkgdir) ? "$pkgdir/$pkg.txz" : "$pkg.txz";
if (! -e $path) {
SetupFatal("No package file '$path'!");
}
mysystem("pkg add $args $path >>/tmp/perrs 2>&1");
} else {
$ENV{"PKG_PATH"} = $pkgdir;
mysystem("pkg_add $args $pkg >>/tmp/perrs 2>&1");
}
}
sub DelPackage($@)
{
my ($recursive,@pkgs) = @_;
my ($cmd, $args, $list);
$args = "-f";
if ($FBSD_VERSION >= 10.0) {
$cmd = "pkg delete";
$args .= " -y";
$args .= " -R"
if ($recursive);
} else {
$cmd = "pkg_delete";
$args .= " -r"
if ($recursive);
}
$list = "-x " . join(" -x ", @pkgs);
# note: non-fatal
system("$cmd $args $list");
}
# $FreeBSD: head/etc/group 241823 2012-10-22 01:18:41Z marcel $
# $FreeBSD: releng/10.0/etc/group 256366 2013-10-12 06:08:18Z rpaulo $
#
wheel:*:0:root,toor
daemon:*:1:
kmem:*:2:root,toor
sys:*:3:root,toor
tty:*:4:root,toor
operator:*:5:root,toor
kmem:*:2:root
sys:*:3:root
tty:*:4:root
operator:*:5:root
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:root,toor
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
_atf:*:27:
guest:*:31:root,toor
guest:*:31:
bind:*:53:
unbound:*:59:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
......@@ -35,3 +35,4 @@ sfs:*:171:
messagebus:*:556:
polkit:*:562:
haldaemon:*:560:
git_daemon:*:964:
# $FreeBSD: src/etc/hosts,v 1.16 2003/01/28 21:29:23 dbaker Exp $
# $FreeBSD: releng/10.0/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
......@@ -11,5 +11,5 @@
#
#
#::1 localhost localhost.my.domain
127.0.0.1 localhost loghost
127.0.0.1 localhost loghost
# $FreeBSD: head/etc/master.passwd 243752 2012-12-01 15:11:46Z rwatson $
# $FreeBSD: releng/10.0/etc/master.passwd 256366 2013-10-12 06:08:18Z rpaulo $
#
root:$1$0DKicYf8$PsfF3uhmTrtuaJKH/rxtQ/:0:0::0:0:Charlie &:/root:/bin/csh
toor:$1$0DKicYf8$PsfF3uhmTrtuaJKH/rxtQ/:0:0::0:0:Chaplin &:/root:/bin/csh
......@@ -13,9 +13,8 @@ man:*:9:9::0:0:Mister Man Pages:/usr/share/man:/usr/sbin/nologin
sshd:*:22:22::0:0:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
smmsp:*:25:25::0:0:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin
mailnull:*:26:26::0:0:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin
# Emulab: _atf changed to 28, 27 is mike and he ain't budgin'
_atf:*:28:27::0:0:& pseudo-user:/nonexistent:/usr/sbin/nologin
bind:*:53:53::0:0:Bind Sandbox:/:/usr/sbin/nologin
unbound:*:59:59::0:0:Unbound DNS Resolver:/var/unbound:/usr/sbin/nologin
proxy:*:62:62::0:0:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin
_pflogd:*:64:64::0:0:pflogd privsep user:/var/empty:/usr/sbin/nologin
_dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin
......@@ -29,3 +28,4 @@ sfs:*:171:171::0:0:SFS pseudo-user:/:/usr/sbin/nologin
messagebus:*:556:556::0:0:D-BUS Daemon User:/nonexistent:/usr/sbin/nologin
polkit:*:562:562::0:0:PolicyKit Daemon User:/nonexistent:/usr/sbin/nologin
haldaemon:*:560:560::0:0:HAL Daemon User:/nonexistent:/usr/sbin/nologin
git_daemon:*:964:964::0:0:git daemon:/nonexistent:/usr/sbin/nologin
named_enable="NO"
sendmail_enable="NO"
sshd_enable="YES"
nfs_client_enable="YES"
......
/*
* Copyright (c) 2004, 2005 University of Utah and the Flux Group.
* Copyright (c) 2004-2014 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -23,6 +23,7 @@
#include "config.h"
#include <unistd.h>
#include <sys/param.h>
#include <math.h>
......
/*
* Copyright (c) 2004-2011 University of Utah and the Flux Group.
* Copyright (c) 2004-2014 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -30,6 +30,7 @@
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
......
#!/usr/bin/perl -w
#
# Copyright (c) 2009 University of Utah and the Flux Group.
# Copyright (c) 2009-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -48,9 +48,6 @@ my $PWD = "/bin/pwd";
my $PW = "/usr/sbin/pw";
my $PATCH = "/usr/bin/patch";
my $SSH_KEYGEN = "/usr/bin/ssh-keygen";
my $PKG_INFO = "/usr/sbin/pkg_info";
my $PKG_ADD = "/usr/sbin/pkg_add";
my $PKG_DEL = "/usr/sbin/pkg_delete";
my $TOUCH = "/usr/bin/touch";
my $SSH_INIT = "/usr/bin/ssh -1";
my $SCP_INIT = "/usr/bin/scp -1";
......@@ -287,9 +284,7 @@ Phase "dirs", "Setting directory permissions", sub {
};
Phase "ports", "Installing ports", sub {
if (!ExecQuiet("$PKG_INFO -e $PORTNAME")) {
PhaseSkip("Package already installed");
}
DoneIfPackageInstalled($PORTNAME);
Phase "pcopy", "Copying ports into place", sub {
DoneIfExists("$PORTSMISCDIR/emulab-clrhouse");
ExecQuietFatal("$SH $SRCDIR/ports/ports-install");
......@@ -302,20 +297,16 @@ Phase "ports", "Installing ports", sub {
Phase "portfixup", "Fixing up packages", sub {
Phase "rsync", "Looking for rsync", sub {
if (!ExecQuiet("$PKG_INFO -x rsync")) {
PhaseSkip("rsync already installed");
}
DoneIfPackageInstalled("rsync");
my $pname = GetPackage("rsync", $packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $pname");
AddPackage($pname, $packagedir);
};
if ($FBSD_MAJOR == 6) {
# Temporary for template stuff
Phase "Simple", "Looking for Simple XML Parser", sub {
if (!ExecQuiet("$PKG_INFO -x p5-XML-Simple")) {
PhaseSkip("p5-XML-Simple already installed");
}
DoneIfPackageInstalled("p5-XML-Simple");
my $pname = GetPackage("p5-XML-Simple", $packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $pname");
AddPackage($pname, $packagedir);
};
}
};
......@@ -324,10 +315,11 @@ Phase "patches", "Applying patches", sub {
Phase "m2cryptopatch", "Patching m2crypto", sub {
my $patchfile = $M2CRYPTO_PATCH;
if (ExecQuiet("$PKG_INFO -I -x m2crypto | fgrep -q -s '0.17'") == 0) {
my $pkg = InstalledPackage("m2crypto", 0);
if ($pkg && $pkg =~ /0\.17/) {
$patchfile = "${patchfile}-0.17";
}
elsif (ExecQuiet("$PKG_INFO -I -x m2crypto | fgrep -q -s '0.13'") == 0) {
elsif ($pkg && $pkg =~ /0\.13/) {
$patchfile = "${patchfile}-0.13";
}
if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $patchfile")) {
......
......@@ -64,7 +64,11 @@ $BOSS_PORT = "emulab-boss-1.8";
$OPS_PORT = "emulab-ops-1.4";
$FS_PORT = "emulab-fs-1.4";
if ($FBSD_MAJOR > 4) {
if ($FBSD_MAJOR > 9 || ($FBSD_MAJOR == 9 && $FBSD_MINOR > 1)) {
if ($FBSD_MAJOR > 9) {
$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) {
$BOSS_PORT = "emulab-boss-5.1";
$OPS_PORT = "emulab-ops-5.1";
$FS_PORT = "emulab-fs-5.1";
......@@ -129,7 +133,10 @@ $SELFLOAD_PATCH = "$main::TOP_SRCDIR/patches/SelfLoader.patch";
#
$PYM2_PKG = "py25-m2crypto-0.19.1";
$PY_VER = "python2.5";
if ($FBSD_MAJOR > 8 || ($FBSD_MAJOR == 8 && $FBSD_MINOR > 2)) {
if ($FBSD_MAJOR > 9) {
$PYM2_PKG = "py27-m2crypto-0.21.1_1";
$PY_VER = "python2.7";
} elsif ($FBSD_MAJOR > 8 || ($FBSD_MAJOR == 8 && $FBSD_MINOR > 2)) {
$PYM2_PKG = "py27-m2crypto-0.21.1";
$PY_VER = "python2.7";
} elsif ($FBSD_MAJOR > 7 || ($FBSD_MAJOR == 7 && $FBSD_MINOR > 2)) {
......@@ -211,9 +218,6 @@ $PATCH = "/usr/bin/patch";
$CAT = "/bin/cat";
$NEWALIASES = "/usr/bin/newaliases";
$SH = "/bin/sh";
$PKG_ADD = "/usr/sbin/pkg_add";
$PKG_DEL = "/usr/sbin/pkg_delete";
$PKG_INFO = "/usr/sbin/pkg_info";
$PWD = "/bin/pwd";
$CP = "/bin/cp";
$MV = "/bin/mv";
......@@ -266,7 +270,6 @@ $RCLOCAL = "/etc/rc.local";
$PHP_INI = "/usr/local/etc/php.ini";
$SENDMAIL_CF = "/etc/mail/sendmail.cf";
$INETD_CONF = "/etc/inetd.conf";
$NAMED_PIDFILE = "$VARRUN/named.pid";
$ETCSSH = "/etc/ssh";
$SSH_CONFIG = "$ETCSSH/ssh_config";
$LOADER_CONF = "/boot/loader.conf";
......
#!/usr/bin/perl -w
#
# Copyright (c) 2003-2012 University of Utah and the Flux Group.
# Copyright (c) 2003-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -436,10 +436,12 @@ sub DoneIfIdentical($$) {
#
# Done if package installed.
#
sub DoneIfPackageInstalled($) {
my ($pname) = @_;
my $foo = `$PKG_INFO -x $pname 2>&1`;
if (! $?) {
sub DoneIfPackageInstalled($;$) {
my ($pname,$exact) = @_;
$exact = 0
if (!defined($exact));
if (InstalledPackage($pname, $exact)) {
PhaseSkip("already installed");
}
}
......@@ -781,7 +783,7 @@ sub FetchFileFatal($$) {
# Locate the proper version of a package to install by looking
# at the available package tarballs.
#
# Must be called "in phase" since we will PhashFail on errors.
# Must be called "in phase" since we will PhaseFail on errors.
#
sub GetPackage($$) {
my ($prefix, $packagedir) = @_;
......@@ -789,17 +791,89 @@ sub GetPackage($$) {
PhaseFail("Must provide -p (packagedir) argument!")
if (!$packagedir);
my $pname = `ls $packagedir/$prefix-*.tbz 2>/dev/null`;
my $pname = `ls $packagedir/$prefix-*.txz 2>/dev/null`;
if ($?) {
$pname = `ls $packagedir/$prefix-*.tgz 2>/dev/null`;
PhaseFail("Cannot find $prefix package in $packagedir!")
if ($?);
$pname = `ls $packagedir/$prefix-*.tbz 2>/dev/null`;
if ($?) {
$pname = `ls $packagedir/$prefix-*.tgz 2>/dev/null`;
PhaseFail("Cannot find $prefix package in $packagedir!")
if ($?);
}
}
chomp($pname);
return $pname;
}
#
# Return the name of any installed package matching the given regex or exact
# name (if $exact != 0). If there are multiple matches, we warn and return
# the first. Return undef if no match.
#
sub InstalledPackage($$) {
my ($pname, $exact) = @_;
my (@foo, $args);
if (-x "/usr/sbin/pkg_info") {
# note: use extended REs to match new pkg tool
$args = $exact ? "-I" : "-I -X";
@foo = `pkg_info $args $pname 2>/dev/null`;
} elsif (-x "/usr/sbin/pkg") {
$args = $exact ? "" : "-x";
@foo = `pkg info $args $pname 2>/dev/null`;
} else {
PhaseFail("No package tools found!?");
}
if ($? == 0 && @foo > 0) {
if (@foo > 1) {
print STDERR "WARNING: '$pname' matches multiple packages, returning first\n";
}
if ($foo[0] =~ /^(\S+)/) {
return $1;
}
}
return undef;
}
sub AddPackage($$) {
my ($pname, $packagedir) = @_;
if (-x "/usr/sbin/pkg_add") {
ExecQuietFatal("env PKG_PATH=$packagedir pkg_add $pname");
} elsif (-x "/usr/sbin/pkg") {
ExecQuietFatal("pkg add $packagedir/$pname.txz");
} else {
PhaseFail("No package tools found!?");
}
}
sub DelPackage($$$) {
my ($pname, $recursive, $fatal) = @_;
my ($cmd, $args);
$args = "-f";
if (-x "/usr/sbin/pkg_delete") {
$cmd = "pkg_delete";
$args .= " -r"
if ($recursive);
} elsif (-x "/usr/sbin/pkg") {
$cmd = "pkg delete";
$args .= " -y";
$args .= " -R"
if ($recursive);
} else {
PhaseFail("No package tools found!?");
}
$args .= "-x $pname";
if ($fatal) {
ExecQuietFatal("$cmd $args");
} else {
ExecQuiet("$cmd $args");
}
}
#
# Print out the phase stack that got us here
#
......
......@@ -31,8 +31,16 @@ sub Install($$$)
if (!$isupdate) {
# Starting at 6.0 we use the default version of bind, not the port.