Commit 0dd58571 authored by Mike Hibler's avatar Mike Hibler
Browse files

Support for FreeBSD 9.3.

Really this is more for FreeNAS 9.
parent 0acf3f5e
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -22,7 +22,7 @@
#
#
# XXX ONLY RUN THIS INSTALL ON A FREEBSD 6 TESTBED NODE!
# XXX ONLY RUN THIS INSTALL ON A FREEBSD 9.x TESTBED NODE!
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
......@@ -50,7 +50,8 @@ JAILDIR = $(SYSETCDIR)/jail
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(DESTDIR)/usr/local/etc/rc.d
LETCDIR = $(DESTDIR)/usr/local/etc
RCDIR = $(LETCDIR)/rc.d
ISMFS = $(ETCDIR)/ismfs
INSTALL = /usr/bin/install -c
......@@ -72,11 +73,19 @@ subboss-install: bincheck basefbsd-subboss-install subboss-etc-install \
simple-install: script-install bin-install
#
# XXX make sure the isc-dhcpd port is installed,
# XXX as of June 2015, the FreeBSD port no longer maintains the
# /usr/bin/perl symlink which we rely on, so it may be wrong or missing.
#
bincheck:
@if [ ! -x /usr/local/sbin/dhclient ]; then \
echo "Need to install net/isc-dhcp3-client port"; \
false; \
fi
@if [ ! -x /usr/bin/perl ]; then \
ln -sf /usr/local/bin/perl5 /usr/bin/perl; \
fi
dir-install:
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/boot
......@@ -85,6 +94,7 @@ dir-install:
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.conf.d
$(INSTALL) -m 755 -o root -g wheel -d $(ETCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(BINDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(LETCDIR)/sudoers.d
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/db
......@@ -95,22 +105,24 @@ dir-install:
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/lock
-rm -rf $(DESTDIR)/etc/testbed
ln -s emulab $(DESTDIR)/etc/testbed
-rm -rf $(DESTDIR)/usr/local/etc/testbed
ln -s emulab $(DESTDIR)/usr/local/etc/testbed
-rm -rf $(LETCDIR)/testbed
ln -s emulab $(LETCDIR)/testbed
basefbsd-install: dir-install
(cd ../freebsd5; $(MAKE) all install)
rm -rf $(SYSETCDIR)/rc.conf.d
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
rm -f $(LETCDIR)/dhclient*
ln -s /etc/dhclient-enter-hooks $(LETCDIR)/
ln -s /etc/dhclient-exit-hooks $(LETCDIR)/
$(INSTALL) -m 644 $(SRCDIR)/sudoers.emulab $(LETCDIR)/sudoers.d/emulab
basefbsd-subboss-install: dir-install
(cd ../freebsd5; $(MAKE) all subboss-install)
rm -rf $(SYSETCDIR)/rc.conf.d
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
rm -f $(LETCDIR)/dhclient*
ln -s /etc/dhclient-enter-hooks $(LETCDIR)/
ln -s /etc/dhclient-exit-hooks $(LETCDIR)/
$(INSTALL) -m 644 $(SRCDIR)/sudoers.emulab $(LETCDIR)/sudoers.d/emulab
tweak-syslog:
@if [ -f $(SYSETCDIR)/newsyslog.conf ]; then \
......@@ -140,6 +152,8 @@ sysetc-install: dir-install netif-emulab tweak-syslog
$(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab
rm -f $(SYSETCDIR)/rc.early
$(INSTALL) -m 644 $(SRCDIR)/loader.conf $(DESTDIR)/boot/loader.conf
$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
$(SYSETCDIR)/dhclient-exit-hooks
script-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/rc.freebsd $(BINDIR)/rc
......@@ -151,10 +165,10 @@ frisbee-mfs-install: destdircheck
(cd ../freebsd5; $(MAKE) all frisbee-mfs-install)
rm -rf $(SYSETCDIR)/rc.conf.d
rm -f $(SYSETCDIR)/testbed/dhclient
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
rmdir $(DESTDIR)/usr/local/etc/emulab
rm -f $(LETCDIR)/dhclient*
ln -s /etc/dhclient-enter-hooks $(LETCDIR)/
ln -s /etc/dhclient-exit-hooks $(LETCDIR)/
rmdir $(LETCDIR)/emulab
$(INSTALL) -m 644 $(SRCDIR)/mfs-frisbee-rc.conf $(SYSETCDIR)/rc.conf
$(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab
@if [ -r $(SRCDIR)/master.passwd ]; then \
......@@ -171,9 +185,9 @@ mfs-install: destdircheck
rm -rf $(SYSETCDIR)/rc.conf.d
rm -rf $(DESTDIR)/root/.cvsup
rm -f $(SYSETCDIR)/testbed/dhclient
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
rm -f $(LETCDIR)/dhclient*
ln -s /etc/dhclient-enter-hooks $(LETCDIR)/
ln -s /etc/dhclient-exit-hooks $(LETCDIR)/
$(INSTALL) -m 644 $(SRCDIR)/mfs-rc.conf $(SYSETCDIR)/rc.conf
$(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab
@if [ -r $(SRCDIR)/master.passwd ]; then \
......
#!/bin/sh
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{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/>.
#
# }}}
#
. /etc/emulab/paths.sh
echo "`date`: ${interface}: ${reason}" >>$LOGDIR/dhclient-exit.log 2>&1
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
exit 0
fi
date >$LOGDIR/dhclient.log 2>&1
#
# ElabinElab support (inner boss and ops)
#
if [ -e "$ETCDIR/outer_bossnode" ]; then
#
# Inner boss or ops. The outer network has now been configured.
# Call rc.inelab to get the inner control network configured (we
# have to ask outer boss in the usual manner).
#
$BINDIR/rc/rc.inelab >>$LOGDIR/dhclient.log 2>&1
# Then kill as we normally do.
killall dhclient >>$LOGDIR/dhclient.log 2>&1
exit 0
fi
#
# ElabinElab support
#
# The enter-hooks script should weed out outer boss calls, so there
# should be nothing to do here. However, just in case we smack em down
# again here.
#
if [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
exit_status=1
exit 1
fi
#
# Remember our server IP, real hostname, router IP, etc.
#
echo $new_dhcp_server_identifier > $BOOTDIR/bossip
echo $new_host_name > $BOOTDIR/realname
echo $new_routers > $BOOTDIR/routerip
echo $new_ip_address > $BOOTDIR/myip
echo $new_subnet_mask > $BOOTDIR/mynetmask
echo $new_domain_name > $BOOTDIR/mydomain
if [ -n "$interface" ]; then
echo $interface > $BOOTDIR/controlif
fi
# All new for 2015, handle larger MTU on control net!
if [ -n "$new_interface_mtu" ]; then
echo $new_interface_mtu > $BOOTDIR/controlmtu
else
echo 1500 > $BOOTDIR/controlmtu
fi
#
# For Xen-based vnodes we record the vnode name where the scripts expect it.
# XXX this works because only Xen-based vnodes DHCP.
#
case "$new_host_name" in
pcvm*)
echo $new_host_name > $BOOTDIR/vmname
;;
esac
#
# If this is a newnode boot, boss (inner or outer) will have returned with
# no hostname. We don't need to record anything in this case, so skip it.
#
if [ x"$new_host_name" = x ]; then
exit 0
fi
#
# Since we have our IP address, let's kill off all dhclient instances
# so they don't interfere and shutdown all the other interfaces dhclient
# was working on.
#
# I'd love to use the dhclient.pid file, but it helpfully has not been
# created at this point
#
killall dhclient >>$LOGDIR/dhclient.log 2>&1
for _if in `ifconfig -lu`
do
if [ $_if != "lo0" -a x$_if != x$interface ]
then
echo "taking $_if down"
ifconfig $_if down remove
fi >>$LOGDIR/dhclient.log 2>&1
done
#
# XXX compenstate for a stupid long time bug in the dhclient-script
#
curhname=`hostname`
if [ $reason = BOUND -a -z "$curhname" -a -n "$new_host_name" ]; then
echo "`date`: hostname is $new_host_name" >>$LOGDIR/dhclient-exit.log 2>&1
hostname $new_host_name
fi
#
# XXX hmm...in FreeBSD 10, the first interface we probe will cause the
# default route to get set to that interface. This will cause any subsequent
# attempt to set the default route to fail and we may wind up without a
# valid default route at this point. So we double check here to make sure
# the default route is correct.
#
if [ -n "$new_routers" ]; then
gw=`route -n get -inet default | grep gateway`
gw=${gw##*: }
if [ -z "$gw" -o "$gw" != "$new_routers" ]; then
if [ -n "$gw" ]; then
echo "reset default route from \"$gw\" to \"$new_routers\""
route delete default
else
echo "setting default route to \"$new_routers\""
fi
route add default $new_routers
fi >>$LOGDIR/dhclient-exit.log 2>&1
fi
#
# See if the Testbed configuration software wants to change the hostname.
# Installed into /etc. Note: frisbee MFS doesn't have perl and hence
# doesn't have this script.
#
if [ -x $BINDIR/sethostname ]
then
$BINDIR/sethostname $new_domain_name >>$LOGDIR/dhclient.log 2>&1
fi
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1
exit 0
......@@ -18,6 +18,7 @@ smmsp:*:25:
mailnull:*:26:
guest:*:31:
bind:*:53:
unbound:*:59:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
......@@ -33,3 +34,5 @@ nobody:*:65534:
messagebus:*:556:
polkit:*:562:
haldaemon:*:560:
_tss:*:601:
git_daemon:*:964:
......@@ -14,6 +14,7 @@ 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
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
......@@ -23,7 +24,8 @@ auditdistd:*:78:77::0:0:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologi
www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin
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
_tss:*:601:601:daemon:0:0:TrouSerS user:/var/empty:/usr/sbin/nologin
git_daemon:*:964:964::0:0:git daemon:/nonexistent:/usr/sbin/nologin
#!/bin/sh
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -28,10 +29,10 @@
#
# PROVIDE: netif-emulab
# REQUIRE: atm1 ipfilter mountcritlocal serial sppp sysctl
# REQUIRE: adjkerntz hostname ipfs ipnat kldxref random
# REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
# REQUIRE: ipfilter ipfs netoptions
# BEFORE: netif
# KEYWORD: nojail
# KEYWORD: nojailvnet
. /etc/rc.subr
. /etc/network.subr
......@@ -115,6 +116,21 @@ cnet_dhcp()
if [ -x /usr/local/sbin/dhclient ]; then
echo "`date`: Using dhclient port..."
dhclient_program="/usr/local/sbin/dhclient"
# newer dhcp ports also don't have -i timeout option
_vers=`/usr/local/sbin/dhclient --version 2>&1`
if [ $? -eq 0 ]; then
case "$_vers" in
isc-dhclient-V3*)
;;
*)
dhclient_flags=`echo $dhclient_flags | sed -e 's/-i [0-9][0-9]*//'`
dhclient_flags="$dhclient_flags -d"
;;
esac
echo "`date`: port version \"$_vers\", flags: $dhclient_flags"
fi
${dhclient_program} ${dhclient_flags} $*
echo "`date`: $dhclient_program returned $?"
else
......@@ -218,6 +234,13 @@ cnet_start()
WA_BOOTMETHOD="dhcp"
fi
#
# Let's always bring up lo0 first.
# Needed for the static configuration case (else clause).
# Also needed for newer dhclients which need some interface to bind to.
#
ifconfig lo0 inet 127.0.0.1 up
if [ "$WA_BOOTMETHOD" = "dhcp" ]; then
#
# use good ol' Emulab dhcp!
......@@ -254,10 +277,6 @@ cnet_start()
ifconfig "$cnetif" inet "$WA_IP_ADDR" netmask "$WA_IP_NETMASK" up
route add default "$WA_IP_GATEWAY"
# bring up lo0 too, since we neuter netif
ifconfig lo0 inet 127.0.0.1 up
route add 127.0.0.1 -interface lo0
# setup resolv.conf
echo "search $WA_DOMAIN" > /etc/resolv.conf
echo "nameserver $WA_IP_DNS1" >> /etc/resolv.conf
......
# Put this file in /usr/local/etc/sudoers.d
Defaults env_keep += "PKG_PATH PKG_DBDIR PKG_TMPDIR TMPDIR PACKAGEROOT PACKAGESITE PKGDIR FTP_PASSIVE_MODE"
Defaults env_keep += "PORTSDIR PORTS_INDEX PORTS_DBDIR PACKAGES PKGTOOLS_CONF"
Defaults env_keep += "EDITOR VISUAL"
%wheel ALL=(ALL) NOPASSWD: ALL
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment