Print this page
Forgot logerr for get_resource
| Split |
Close |
| Expand all |
| Collapse all |
--- old/build/caiman/build.sh
+++ new/build/caiman/build.sh
1 1 #!/usr/bin/bash
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License, Version 1.0 only
7 7 # (the "License"). You may not use this file except in compliance
8 8 # with the License.
9 9 #
10 10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 11 # or http://www.opensolaris.org/os/licensing.
12 12 # See the License for the specific language governing permissions
13 13 # and limitations under the License.
14 14 #
15 15 # When distributing Covered Code, include this CDDL HEADER in each
16 16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 17 # If applicable, add the following below this CDDL HEADER, with the
18 18 # fields enclosed by brackets "[]" replaced with your own identifying
19 19 # information: Portions Copyright [yyyy] [name of copyright owner]
20 20 #
21 21 # CDDL HEADER END
22 22 #
23 23 #
24 24 # Copyright 2011-2012 OmniTI Computer Consulting, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27
28 28 SHELL=/usr/bin/bash
29 29 export SHELL
30 30 SKIP_ROOT_CHECK=1
31 31 if [[ -n "$SUDO_USER" ]]; then
32 32 echo "Don't run under sudo, just build as you"
33 33 exit
34 34 fi
35 35
36 36 # Load support functions
37 37 . ../../lib/functions.sh
38 38
39 39 PROG=caiman
40 40 VER=$RELVER
41 41 PKG=caiman
42 42 SUMMARY="$PROG"
43 43 DESC="$SUMMARY"
44 44
45 45 #all of the ips depends should be available from OmniTI repos
46 46
47 47 BUILD_DEPENDS_IPS="developer/sunstudio12.1 system/boot/wanboot system/boot/wanboot/internal developer/build/onbld system/library developer/versioning/git developer/swig"
48 48
49 49 GIT=git
50 50
51 51 PKGSERVER=$PKGSRVR
52 52 PKGPREFIX=""
53 53 PREFIX=""
54 54 BUILDDIR=$PROG-$VER
55 55 CODEMGR_WS=$TMPDIR/$BUILDDIR/caiman
56 56 ON_CLOSED_BINS="$CODEMGR_WS/closed"
57 57 export ON_CLOSED_BINS
58 58
59 59 CAIMAN_CODEMGR_SEDSTRING="s/CODEMGR_WS=.*/CODEMGR_WS=`echo $CODEMGR_WS | sed 's/\//\\\\\//g'`/g"
60 60 CAIMAN_PKG_REDIST="PKGPUBLISHER_REDIST=omnios; export PKGPUBLISHER_REDIST;"
61 61 CAIMAN_PKG_BRANCH="PKGVERS_BRANCH=$PVER; export PKGVERS_BRANCH;"
62 62
63 63 sunstudio_location() {
64 64 logmsg "Ensuring that Sun Studio is where Caiman thinks it is..."
65 65 if [[ -d /opt/SUNWspro ]]; then
66 66 logmsg "--- fake SUNWspro directory exists, good"
67 67 else
68 68 logmsg "--- making fake SUNWspro directory"
69 69 logcmd mkdir -p /opt/SUNWspro || \
70 70 logerr "--- Error: failed to make directory"
71 71 fi
72 72 if [[ -L /opt/SUNWspro/sunstudio12.1 ]]; then
73 73 logmsg "--- sunstudio12.1 link exists, good"
74 74 else
75 75 logmsg "--- soft-linking to /opt/sunstudio12.1"
76 76 logcmd ln -s /opt/sunstudio12.1 /opt/SUNWspro/sunstudio12.1 || \
77 77 logerr "--- Failed: ln -s /opt/sunstudio12.1/ /opt/SUNWspro"
78 78 fi
79 79 }
80 80
81 81 #In order for the clone to work while running as root, you must have ssh'ed into the box with agent forwarding turned on. Also the sudo'er file must either have the default, group, or user set to allow SSL_AUTH_SOCK.
82 82
83 83 clone_source(){
84 84 logmsg "Creating build dir $TMPDIR/$BUILDDIR"
85 85 logcmd mkdir -p $TMPDIR/$BUILDDIR || logerr "Failed to create build directory"
86 86 logmsg "Entering $TMPDIR/$BUILDDIR"
87 87 pushd $TMPDIR/$BUILDDIR > /dev/null
88 88 if [[ -d caiman ]]; then
89 89 logmsg "Removing existing cloned repo"
90 90 logcmd rm -rf caiman
91 91 fi
92 92 logmsg "Cloning OMNI caiman Source..."
93 93 logcmd $GIT clone anon@src.omniti.com:~omnios/core/caiman || \
94 94 logerr "Failed to $GIT clone repo"
95 95 logmsg "Leaving $TMPDIR/$BUILDDIR"
96 96 popd > /dev/null
97 97 }
98 98
99 99 modify_build_script() {
100 100 logmsg "Entering $CODEMGR_WS"
101 101 pushd $CODEMGR_WS > /dev/null
102 102 logmsg "Changing omnios.sh variables to what we want them to be..."
103 103 logcmd cp usr/src/tools/env/omnios.sh . || \
104 104 logerr "Could not copy build environment"
105 105 logcmd /usr/bin/sed -I -e $CAIMAN_CODEMGR_SEDSTRING omnios.sh || \
106 106 logerr "/usr/bin/sed failed"
107 107 logcmd `echo $CAIMAN_PKG_REDIST >> omnios.sh`
108 108 logcmd `echo $CAIMAN_PKG_BRANCH >> omnios.sh`
109 109 logmsg "Leaving $CODEMGR_WS"
|
↓ open down ↓ |
109 lines elided |
↑ open up ↑ |
110 110 popd > /dev/null
111 111
112 112 }
113 113
114 114 closed_bins() {
115 115 logmsg "Entering $CODEMGR_WS"
116 116 pushd $CODEMGR_WS > /dev/null
117 117 logmsg "Getting Closed Source Bins..."
118 118 for bin in on-closed-bins.i386.tar.bz2 on-closed-bins-nd.i386.tar.bz2 ; do
119 119 if [[ ! -f $bin ]]; then
120 - get_resource illumos-gate/$bin
120 + get_resource illumos-gate/$bin || logerr "Unable to get $bin"
121 121 fi
122 122 logcmd tar xpf $bin
123 123 done
124 124 logmsg "Leaving $CODEMGR_WS"
125 125 popd > /dev/null
126 126 }
127 127
128 128 build_pkgs() {
129 129 logmsg "Entering $CODEMGR_WS"
130 130 pushd $CODEMGR_WS > /dev/null
131 131 logmsg "Building caiman pkgs..."
132 132 logcmd /opt/onbld/bin/nightly omnios.sh || logerr "Nightly failed"
133 133 logmsg "Leaving $CODEMGR_WS"
134 134 popd > /dev/null
135 135 }
136 136
137 137 push_pkgs() {
138 138 logmsg "Entering $CODEMGR_WS"
139 139 pushd $CODEMGR_WS > /dev/null
140 140 logmsg "Pushing caiman pkgs to $PKGSERVER..."
141 141 logcmd pkgrecv -s packages/i386/nightly-nd/repo.redist/ -d $PKGSERVER 'pkg:/*'
142 142 logmsg "Leaving $CODEMGR_WS"
143 143 popd > /dev/null
144 144 }
145 145
146 146 init
147 147 prep_build
148 148 sunstudio_location
149 149 clone_source
150 150 modify_build_script
151 151 closed_bins
152 152 build_pkgs
153 153 push_pkgs
154 154 clean_up
|
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX