xref: /delphix/build_setup.sh (revision 91089243)
1#!/bin/bash
2
3#
4# CDDL HEADER START
5#
6# This file and its contents are supplied under the terms of the
7# Common Development and Distribution License ("CDDL"), version 1.0.
8# You may only use this file in accordance with the terms of version
9# 1.0 of the CDDL.
10#
11# A full copy of the text of the CDDL should have accompanied this
12# source.  A copy of the CDDL is also available via the Internet at
13# http://www.illumos.org/license/CDDL.
14#
15# CDDL HEADER END
16#
17
18#
19# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
20#
21
22PATH=/usr/ccs/bin:/usr/local/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin
23export PATH
24
25function die
26{
27	echo $*
28	exit 1
29}
30
31function usage
32{
33	echo "$(basename $0)"
34	exit 2
35}
36
37[[ $# != 0 ]] && usage
38
39if [[ ! -f illumos.sh ]]; then
40	echo "Updating environment file ... \c"
41	cp usr/src/tools/env/illumos.sh illumos.sh || \
42	    die "failed to copy environment file"
43	echo "done."
44fi
45
46if [[ ! -f bldenv ]]; then
47	echo "Setting up initial build environment ... \c"
48	ksh93 usr/src/tools/scripts/bldenv.sh -d illumos.sh \
49	    -c "cd usr/src && dmake setup" || die "dmake failed"
50	ln -s usr/src/tools/scripts/bldenv || die "link bldenv failed"
51	ln -s usr/src/tools/scripts/nightly || die "link nightly failed"
52	echo "done."
53fi
54
55exit 0
56