GNUmakefile.in 6.1 KB
Newer Older
Mike Hibler's avatar
Mike Hibler committed
1
#
2
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 
# {{{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/>.
# 
# }}}
Mike Hibler's avatar
Mike Hibler committed
22
23
24
#

#
25
# XXX ONLY RUN THIS INSTALL ON A FREEBSD 10.x TESTBED NODE!
Mike Hibler's avatar
Mike Hibler committed
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
51
52
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
#
#
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= @top_builddir@
SUBDIR		= $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))

include $(OBJDIR)/Makeconf

SCRIPTS		= 

#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
all:	netif-emulab $(SCRIPTS)

include $(TESTBED_SRCDIR)/GNUmakerules

SYSETCDIR	= $(DESTDIR)/etc
JAILDIR		= $(SYSETCDIR)/jail
ETCDIR		= $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR		= $(DESTDIR)$(CLIENT_BINDIR)
VARDIR		= $(DESTDIR)$(CLIENT_VARDIR)
53
54
LETCDIR		= $(DESTDIR)/usr/local/etc
RCDIR		= $(LETCDIR)/rc.d
Mike Hibler's avatar
Mike Hibler committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ISMFS		= $(ETCDIR)/ismfs
INSTALL		= /usr/bin/install -c

destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
	fi

install client-install:	bincheck basefbsd-install etc-install \
			sup-install script-install bin-install

subboss-install:	bincheck basefbsd-subboss-install etc-install \
			sup-install script-install bin-install

simple-install:	script-install bin-install

76
77
78
79
80
#
# 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.
#
Mike Hibler's avatar
Mike Hibler committed
81
82
83
84
85
bincheck:
	@if [ ! -x /usr/local/sbin/dhclient ]; then \
		echo "Need to install net/isc-dhcp3-client port"; \
		false; \
	fi
86
87
88
	@if [ ! -x /usr/bin/perl ]; then \
		ln -sf /usr/local/bin/perl5 /usr/bin/perl; \
	fi
Mike Hibler's avatar
Mike Hibler committed
89
90
91
92
93
94
95
96

dir-install:
	$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/boot
	$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)
	$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.d
	$(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)
97
	$(INSTALL) -m 755 -o root -g wheel -d $(LETCDIR)/sudoers.d
Mike Hibler's avatar
Mike Hibler committed
98
99
100
101
102
103
104
105
106
107
	$(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
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/jails
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/logs
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/sup
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/boot
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/lock
	-rm -rf $(DESTDIR)/etc/testbed
	ln -s emulab $(DESTDIR)/etc/testbed
108
109
	-rm -rf $(LETCDIR)/testbed
	ln -s emulab $(LETCDIR)/testbed
Mike Hibler's avatar
Mike Hibler committed
110
111
112
113

basefbsd-install: dir-install
	(cd ../freebsd5; $(MAKE) all install)
	rm -rf $(SYSETCDIR)/rc.conf.d
114
115
116
117
	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
Mike Hibler's avatar
Mike Hibler committed
118
119
120
121

basefbsd-subboss-install: dir-install
	(cd ../freebsd5; $(MAKE) all subboss-install)
	rm -rf $(SYSETCDIR)/rc.conf.d
122
123
124
125
	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
Mike Hibler's avatar
Mike Hibler committed
126

127
128
129
130
131
132
133
134
tweak-syslog:
	@if [ -f $(SYSETCDIR)/newsyslog.conf ]; then \
	    if `grep -q 'Added by Emulab' $(SYSETCDIR)/newsyslog.conf`; then \
		sed -i .preemulab -e '/Added by Emulab/,$$d' $(SYSETCDIR)/newsyslog.conf; \
	    fi; \
	    cat $(SRCDIR)/newsyslog.conf.tail >> $(SYSETCDIR)/newsyslog.conf; \
	fi

Mike Hibler's avatar
Mike Hibler committed
135
136
137
138
139
140
141
142
143
144
145
# Do not even pretend to do cvsup anymore
sup-install:	dir-install
	rm -f $(ETCDIR)/supfile

bin-install:	dir-install

etc-install:	dir-install sysetc-install
	$(INSTALL) -m 644 $(SRCDIR)/group $(ETCDIR)/group
	$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(ETCDIR)/master.passwd
	$(INSTALL) -m 444 $(SRCDIR)/hosts $(ETCDIR)/hosts

146
sysetc-install:	dir-install netif-emulab tweak-syslog
Mike Hibler's avatar
Mike Hibler committed
147
148
149
150
151
	$(INSTALL) -m 444 $(SRCDIR)/rc.conf $(SYSETCDIR)/rc.conf
	$(INSTALL) -m 444 $(SRCDIR)/sysctl.conf $(SYSETCDIR)/sysctl.conf
	$(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
Mike Hibler's avatar
Mike Hibler committed
152
153
	$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
			$(SYSETCDIR)/dhclient-exit-hooks
Mike Hibler's avatar
Mike Hibler committed
154
155
156
157
158
159
160
161
162
163

script-install:	dir-install
	$(INSTALL) -m 755 $(SRCDIR)/rc.freebsd $(BINDIR)/rc

#
# XXX we still do this like freebsd5!
#
frisbee-mfs-install: destdircheck
	(cd ../freebsd5; $(MAKE) all frisbee-mfs-install)
	rm -f $(SYSETCDIR)/testbed/dhclient
164
165
166
	rm -f $(LETCDIR)/dhclient*
	ln -s /etc/dhclient-enter-hooks $(LETCDIR)/
	ln -s /etc/dhclient-exit-hooks $(LETCDIR)/
Mike Hibler's avatar
Mike Hibler committed
167
168
169
170
171
172
173
174
175
176
177
	@if [ -r $(SRCDIR)/master.passwd ]; then \
	    $(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
	    pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
	fi
	@if [ -r $(SRCDIR)/group ]; then \
	    $(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
	fi

mfs-install:
	(cd ../freebsd5; $(MAKE) all mfs-install)
	rm -f $(SYSETCDIR)/testbed/dhclient
178
179
180
	rm -f $(LETCDIR)/dhclient*
	ln -s /etc/dhclient-enter-hooks $(LETCDIR)/
	ln -s /etc/dhclient-exit-hooks $(LETCDIR)/
Mike Hibler's avatar
Mike Hibler committed
181
182
183
184
185
186
187
	@if [ -r $(SRCDIR)/master.passwd ]; then \
	    $(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
	    pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
	fi
	@if [ -r $(SRCDIR)/group ]; then \
	    $(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
	fi