Print this page
Modernize CDDL license text and copyrights for OmniTI-original code.
Add pxeboot/BSD Loader as an option for PXE Kayak boots.
Fix PXE regressions.
Add web/curl explicitly, because removing svm broke a long
dependency string that included web/curl.
Remove pcser and pcata, which no longer exist
Kayak for ISO checkpoint 1
| Split |
Close |
| Expand all |
| Collapse all |
--- old/build_image.sh
+++ new/build_image.sh
1 1 #!/bin/bash
2 +
2 3 #
3 -# CDDL HEADER START
4 +# This file and its contents are supplied under the terms of the
5 +# Common Development and Distribution License ("CDDL"), version 1.0.
6 +# You may only use this file in accordance with the terms of version
7 +# 1.0 of the CDDL.
4 8 #
5 -# The contents of this file are subject to the terms of the
6 -# Common Development and Distribution License, Version 1.0 only
7 -# (the "License"). You may not use this file except in compliance
8 -# with the License.
9 +# A full copy of the text of the CDDL should have accompanied this
10 +# source. A copy of the CDDL is also available via the Internet at
11 +# http://www.illumos.org/license/CDDL.
9 12 #
10 -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 -# or http://www.opensolaris.org/os/licensing.
12 -# See the License for the specific language governing permissions
13 -# and limitations under the License.
13 +
14 14 #
15 -# When distributing Covered Code, include this CDDL HEADER in each
16 -# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 -# If applicable, add the following below this CDDL HEADER, with the
18 -# fields enclosed by brackets "[]" replaced with your own identifying
19 -# information: Portions Copyright [yyyy] [name of copyright owner]
15 +# Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
20 16 #
21 -# CDDL HEADER END
22 -#
23 -#
24 -# Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
25 -# Use is subject to license terms.
26 -#
17 +
27 18 fail() {
28 19 echo "ERROR: $*"
29 20 exit 1
30 21 }
31 22
32 23 # NOTE --> The URL needs to be updated with every release.
33 24 # Change "bloody" to whatever release the current branch is.
34 25 PUBLISHER=omnios
35 26 : ${PKGURL:=http://pkg.omniti.com/omnios/bloody}
36 27 : ${GZIP_CMD:=gzip}
37 28 SRCDIR=$(dirname $0)
38 29 DIDWORK=0
39 30 BUILDNUM=${VERSION//r/}
40 31 if [[ ${SRCDIR:0:1} != "/" ]]; then
41 32 SRCDIR=`pwd`/$SRCDIR
42 33 fi
43 34 if [[ -z "${1}" ]]; then
44 35 echo "$0 <zfs pool> [checkpoint]"
45 36 exit 1
46 37 else
47 38 BASE=${1}
48 39 shift
|
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
49 40 BASEDIR=`zfs get -o value -H mountpoint $BASE`
50 41 fi
51 42 MKFILEDIR=/tmp
52 43 WORKDIR=$BASEDIR
53 44 ROOTDIR=$WORKDIR/root
54 45 if [[ ! -d $ROOTDIR ]]; then
55 46 zfs create -o compression=off $BASE/root || fail "zfs create failed"
56 47 fi
57 48 SVCCFG_DTD=${ROOTDIR}/usr/share/lib/xml/dtd/service_bundle.dtd.1
58 49 SVCCFG_REPOSITORY=${ROOTDIR}/etc/svc/repository.db
59 -#SVCCFG=/usr/sbin/svccfg
60 50 if [[ -f ${PREBUILT_ILLUMOS}/usr/src/cmd/svc/svccfg/svccfg-native ]]; then
61 51 SVCCFG=${PREBUILT_ILLUMOS}/usr/src/cmd/svc/svccfg/svccfg-native
62 52 else
63 53 echo "WARNING -- Not using 'native' svccfg, may hang on build."
64 54 echo " We recommend a pre-built illumos's svccfg-native."
65 55 echo " Set PREBUILT_ILLUMOS in your environment to point"
66 56 echo " to a built illumos-omnios repository."
67 57 SVCCFG=/usr/sbin/svccfg
68 58 fi
69 59 export WORKDIR ROOTDIR SVCCFG_DTD SVCCFG_REPOSITORY SVCCFG
70 60
71 61 # This was uber-helpful
72 62 # http://alexeremin.blogspot.com/2008/12/preparing-small-miniroot-with-zfs-and.html
73 63
74 64 PKG=/bin/pkg
75 65
76 66 UNNEEDED_MANIFESTS="application/management/net-snmp.xml
77 67 application/pkg/pkg-server.xml application/pkg/pkg-mdns.xml
78 68 system/rmtmpfiles.xml system/mdmonitor.xml
79 69 system/fm/notify-params.xml system/device/allocate.xml
80 70 system/device/devices-audio.xml system/auditd.xml
81 71 system/metasync.xml system/pkgserv.xml system/fcoe_initiator.xml
82 72 system/metainit.xml system/zonestat.xml
83 73 system/cron.xml system/rbac.xml system/sac.xml
84 74 system/auditset.xml system/hotplug.xml
85 75 system/wusb.xml system/zones.xml
86 76 system/intrd.xml system/coreadm.xml
87 77 system/extended-accounting.xml
88 78 system/scheduler.xml
89 79 system/logadm-upgrade.xml system/resource-mgmt.xml
90 80 system/idmap.xml
91 81 network/ldap/client.xml network/shares/reparsed.xml
92 82 network/shares/group.xml network/inetd-upgrade.xml
93 83 network/smb/client.xml network/smb/server.xml
94 84 network/network-iptun.xml network/ipsec/policy.xml
95 85 network/ipsec/ipsecalgs.xml network/ipsec/ike.xml
96 86 network/ipsec/manual-key.xml network/forwarding.xml
97 87 network/inetd.xml network/npiv_config.xml
98 88 network/ssl/kssl-proxy.xml network/rpc/metamed.xml
99 89 network/rpc/mdcomm.xml network/rpc/gss.xml
100 90 network/rpc/bind.xml network/rpc/keyserv.xml
101 91 network/rpc/meta.xml network/rpc/metamh.xml
102 92 network/socket-filter-kssl.xml network/network-netcfg.xml
103 93 network/nfs/status.xml network/nfs/cbd.xml
104 94 network/nfs/nlockmgr.xml network/nfs/mapid.xml
105 95 network/nfs/client.xml network/network-ipqos.xml
106 96 network/security/ktkt_warn.xml network/security/krb5kdc.xml
107 97 network/security/kadmin.xml network/network-install.xml
108 98 network/bridge.xml network/network-initial.xml
109 99 network/network-ipmgmt.xml network/routing/legacy-routing.xml
110 100 network/network-service.xml network/network-physical.xml
|
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
111 101 network/network-netmask.xml network/dlmgmt.xml
112 102 network/network-location.xml network/ibd-post-upgrade.xml
113 103 network/network-routing-setup.xml network/network-loopback.xml
114 104 network/dns/client.xml network/dns/install.xml
115 105 network/dns/multicast.xml platform/i86pc/acpihpd.xml
116 106 system/hostid.xml system/power.xml system/pfexecd.xml
117 107 system/consadm.xml system/pools.xml system/console-login.xml
118 108 system/stmf.xml system/fmd.xml system/utmp.xml
119 109 system/poold.xml system/dumpadm.xml"
120 110
121 -SYSTEM="system/boot/grub system/boot/real-mode system/boot/wanboot/internal
111 +SYSTEM="system/boot/real-mode system/boot/wanboot/internal
122 112 system/boot/loader system/boot/wanboot system/data/hardware-registry
123 113 system/data/keyboard/keytables system/data/terminfo
124 114 system/data/zoneinfo system/extended-system-utilities
125 115 system/file-system/autofs system/file-system/nfs
126 116 system/file-system/smb system/file-system/udfs
127 117 system/file-system/zfs system/flash/fwflash
128 118 system/fru-id/platform system/fru-id system/ipc
129 119 system/kernel/dynamic-reconfiguration/i86pc
130 120 system/kernel/security/gss system/library/math
131 121 system/library/platform system/library/policykit
132 122 system/library/processor
133 123 system/library/storage/fibre-channel/hbaapi
134 124 system/library/storage/fibre-channel/libsun_fc
135 125 system/library/storage/ima/header-ima
136 126 system/library/storage/ima
137 127 system/library/storage/libmpapi
138 128 system/library/storage/libmpscsi_vhci
139 129 system/library/storage/scsi-plugins
140 130 system/library system/network
141 131 system/prerequisite/gnu system/storage/luxadm
142 132 system/storage/fibre-channel/port-utility"
143 133
144 134 DEBUG_PKGS="developer/debug/mdb system/dtrace developer/dtrace"
145 135
146 136 DRIVERS="driver/audio driver/crypto/dca driver/crypto/tpm driver/firewire
147 137 driver/graphics/agpgart driver/graphics/atiatom driver/graphics/drm
148 138 driver/i86pc/fipe driver/i86pc/ioat driver/i86pc/platform
149 139 driver/misc/virtio
150 140 driver/network/afe driver/network/amd8111s driver/network/atge
151 141 driver/network/bfe driver/network/bge driver/network/bnx
152 142 driver/network/bnxe driver/network/bpf driver/network/chxge
153 143 driver/network/dmfe driver/network/e1000g driver/network/elxl
154 144 driver/network/emlxs driver/network/eoib driver/network/fcip
155 145 driver/network/fcp driver/network/fcsm driver/network/fp
156 146 driver/network/hermon driver/network/hme driver/network/hxge
|
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
157 147 driver/network/ib driver/network/ibdma driver/network/ibp
158 148 driver/network/igb driver/network/iprb driver/network/ixgb
159 149 driver/network/ixgbe driver/network/mxfe driver/network/myri10ge
160 150 driver/network/nge driver/network/ntxn driver/network/nxge
161 151 driver/network/vmxnet3s driver/network/sfxge driver/network/i40e
162 152 driver/network/ofk driver/network/pcn driver/network/platform
163 153 driver/network/qlc driver/network/rds driver/network/rdsv3
164 154 driver/network/rge driver/network/rpcib driver/network/rtls
165 155 driver/network/sdp driver/network/sdpib driver/network/sfe
166 156 driver/network/tavor driver/network/usbecm driver/network/vr
167 - driver/network/xge driver/network/yge driver/pcmcia driver/serial/pcser
157 + driver/network/xge driver/network/yge driver/pcmcia
168 158 driver/serial/usbftdi driver/serial/usbsacm driver/serial/usbser
169 159 driver/serial/usbser_edge driver/serial/usbsksp
170 160 driver/serial/usbsksp/usbs49_fw driver/serial/usbsprl
171 161 driver/storage/aac driver/storage/adpu320 driver/storage/ahci
172 162 driver/storage/amr driver/storage/arcmsr driver/storage/ata
173 163 driver/storage/bcm_sata driver/storage/blkdev driver/storage/cpqary3
174 164 driver/storage/glm driver/storage/lsimega driver/storage/marvell88sx
175 165 driver/storage/mega_sas driver/storage/mpt_sas driver/storage/mr_sas
176 - driver/storage/nv_sata driver/storage/pcata driver/storage/pmcs
166 + driver/storage/nv_sata driver/storage/pmcs
177 167 driver/storage/sbp2 driver/storage/scsa1394 driver/storage/sdcard
178 168 driver/storage/ses driver/storage/si3124 driver/storage/smp
179 169 driver/usb driver/usb/ugen driver/xvm/pv driver/storage/vioblk
180 170 driver/network/vioif driver/storage/nvme driver/storage/pvscsi"
181 171
182 172 PARTS="release/name release/notices service/picl install/beadm SUNWcs SUNWcsd
183 - library/libidn shell/pipe-viewer text/less editor/vim
173 + library/libidn shell/pipe-viewer text/less editor/vim web/curl
184 174 developer/linker file/gnu-coreutils openssh openssh-server
185 175 diagnostic/diskinfo"
186 176
187 177 PKGS="$PARTS $SYSTEM $DRIVERS"
188 178
189 179 if [ -n "$DEBUG" ]; then
190 180 PKGS="$PKGS $DEBUG_PKGS"
191 181 BIGROOT=1
192 182 fi
193 183 CULL="perl python package/pkg snmp"
194 184 RMRF="/var/pkg /usr/share/man /usr/lib/python2.7 /usr/lib/iconv"
195 185
196 186 ID=`id -u`
197 187 if [[ "$ID" != "0" ]]; then
198 188 echo "must run as root"
199 189 exit 1
200 190 fi
201 191
202 192 chkpt() {
203 193 SNAP=`zfs list -H -t snapshot $BASE/root@${1} 2> /dev/null`
204 194 if [[ "$DIDWORK" -ne "0" ]]; then
205 195 if [[ -n "$SNAP" ]]; then
206 196 zfs destroy $BASE/root@${1} || \
207 197 fail "zfs destroy ${1} failed"
208 198 fi
209 199 zfs snapshot $BASE/root@${1} || fail "zfs snapshot failed"
210 200 fi
211 201 if [[ "${1}" != "begin" ]]; then
212 202 echo " === Proceeding to phase $1 (zfs @${1}) ==="
213 203 zfs rollback -r $BASE/root@${1} || fail "zfs rollback failed"
214 204 else
215 205 echo " === Proceeding to phase $1 ==="
216 206 fi
217 207 CHKPT=$1
218 208 DIDWORK=1
219 209 }
220 210
221 211 if [[ -n "$1" ]]; then
222 212 echo "Explicit checkpoint requested: '$1'"
223 213 CHKPT=$1
224 214 chkpt $CHKPT
225 215 fi
226 216 if [[ -z "$CHKPT" ]]; then
227 217 CHKPT="begin"
228 218 fi
229 219
230 220 declare -A keep_list
231 221 load_keep_list() {
232 222 for datafile in $*
233 223 do
234 224 FCNT=0
235 225 while read file
236 226 do
237 227 if [[ -n "$file" ]]; then
238 228 keep_list+=([$file]="x")
239 229 FCNT=$(($FCNT + 1))
240 230 fi
241 231 done < <(cut -f2- -d/ $datafile)
242 232 echo " --- keeping $FCNT files from $datafile"
243 233 done
244 234 }
245 235
246 236 step() {
247 237 CHKPT=""
248 238 case "$1" in
249 239
250 240 "begin")
251 241 zfs destroy -r $BASE/root 2> /dev/null
252 242 zfs create -o compression=off $BASE/root || fail "zfs create failed"
253 243 chkpt pkg
254 244 ;;
255 245
256 246 "pkg")
257 247
258 248 echo "Creating image of $PUBLISHER from $PKGURL"
259 249 $PKG image-create -F -p $PUBLISHER=$PKGURL $ROOTDIR || fail "image-create"
260 250 # If a version was requested, respect it
261 251 if [[ -n $BUILDNUM ]]; then
262 252 $PKG -R $ROOTDIR install illumos-gate@11-0.$BUILDNUM omnios-userland@11-0.$BUILDNUM || fail "version constraint prep"
263 253 fi
264 254 $PKG -R $ROOTDIR install $PKGS || fail "install"
265 255 if [[ -n $BUILDNUM ]]; then
266 256 $PKG -R $ROOTDIR uninstall illumos-gate omnios-userland || fail "version constraint cleanup"
267 257 fi
268 258 chkpt fixup
269 259 ;;
270 260
271 261 "fixup")
272 262
273 263 echo "Fixing up install root"
274 264 (cp $ROOTDIR/etc/vfstab $WORKDIR/vfstab && \
275 265 awk '{if($3!="/"){print;}}' $WORKDIR/vfstab > $ROOTDIR/etc/vfstab && \
276 266 echo "/devices/ramdisk:a - / ufs - no nologging" >> $ROOTDIR/etc/vfstab) || \
277 267 fail "vfstab / updated"
278 268 rm $WORKDIR/vfstab
279 269 cp $ROOTDIR/lib/svc/seed/global.db $ROOTDIR/etc/svc/repository.db
280 270
281 271 sed -i 's,PASSREQ=YES,PASSREQ=NO,' $ROOTDIR/etc/default/login
282 272
283 273 ${SVCCFG} import ${ROOTDIR}/lib/svc/manifest/milestone/sysconfig.xml
284 274 for xml in $UNNEEDED_MANIFESTS; do
285 275 rm -f ${ROOTDIR}/lib/svc/manifest/$xml && echo " --- tossing $xml"
286 276 done
287 277 echo " --- initial manifest import"
288 278 # See if we can transform manifest-import to use the 'native' svccfg.
289 279 sed 's/\/usr\/sbin\/svccfg/\$SVCCFG/g' \
290 280 < ${ROOTDIR}/lib/svc/method/manifest-import \
291 281 > /tmp/manifest-import.$$
292 282 chmod 0755 /tmp/manifest-import.$$
293 283 export SVCCFG
294 284 /tmp/manifest-import.$$ -f ${ROOTDIR}/etc/svc/repository.db \
295 285 -d ${ROOTDIR}/lib/svc/manifest
296 286 /bin/rm -f /tmp/manifest-import.$$
297 287
298 288 ${SVCCFG} -s 'system/boot-archive' setprop 'start/exec=:true'
299 289 ${SVCCFG} -s 'system/manifest-import' setprop 'start/exec=:true'
300 290 ${SVCCFG} -s "system/intrd:default" setprop "general/enabled=false"
301 291 ${SVCCFG} -s "system/initial-boot" setprop "start/timeout_seconds=600"
302 292 echo " --- neutering the manifest import"
303 293 echo "#!/bin/ksh" > ${ROOTDIR}/lib/svc/method/manifest-import
304 294 echo "exit 0" >> ${ROOTDIR}/lib/svc/method/manifest-import
305 295 chmod 555 ${ROOTDIR}/lib/svc/method/manifest-import
306 296 chkpt cull
307 297 ;;
308 298
309 299 "cull")
310 300 if [[ -z "$BIGROOT" ]]; then
311 301 load_keep_list data/*
312 302 while read file
313 303 do
314 304 if [[ -n "$file" && \
315 305 ${keep_list[$file]} == "" && \
316 306 -e "$ROOTDIR/$file" && \
317 307 ! -d $ROOTDIR/$file ]] ; then
318 308 rm -f $ROOTDIR/$file
319 309 fi
320 310 done < <(cd $ROOTDIR && find ./ | cut -c3-)
321 311 for path in $RMRF ; do
322 312 rm -rf ${ROOTDIR}$path && echo " -- tossing $path"
323 313 done
324 314 fi
325 315
326 316 chkpt mkfs
327 317 ;;
328 318
329 319 "mkfs")
330 320 size=`/usr/bin/du -ks ${ROOTDIR}|/usr/bin/nawk '{print $1+10240}'`
331 321 echo " --- making image of size $size"
332 322 /usr/sbin/mkfile ${size}k $MKFILEDIR/miniroot || fail "mkfile"
333 323 lofidev=`/usr/sbin/lofiadm -a $MKFILEDIR/miniroot`
334 324 rlofidev=`echo $lofidev |sed s/lofi/rlofi/`
335 325 yes | /usr/sbin/newfs -m 0 $rlofidev 2> /dev/null > /dev/null || fail "newfs"
336 326 chkpt mount
337 327 ;;
338 328
339 329 "mount")
340 330 mkdir -p $WORKDIR/mnt
341 331 /usr/sbin/mount -o nologging $lofidev $WORKDIR/mnt || fail "mount"
342 332 chkpt copy
|
↓ open down ↓ |
149 lines elided |
↑ open up ↑ |
343 333 ;;
344 334
345 335 "copy")
346 336 pushd $ROOTDIR >/dev/null
347 337 /usr/bin/find . | /usr/bin/cpio -pdum $WORKDIR/mnt 2> /dev/null > /dev/null || fail "populate root"
348 338 /usr/sbin/devfsadm -r $WORKDIR/mnt > /dev/null
349 339 popd >/dev/null
350 340 mkdir $WORKDIR/mnt/kayak
351 341 cp $SRCDIR/*.sh $WORKDIR/mnt/kayak/
352 342 chmod a+x $WORKDIR/mnt/kayak/*.sh
343 +
344 + # So "bootadm update-archive" can work.
345 + cp $SRCDIR/digest $WORKDIR/mnt/usr/bin/digest
346 + chmod 0755 $WORKDIR/mnt/usr/bin/digest
347 +
353 348 make_initial_boot $WORKDIR/mnt/.initialboot
354 349 if [[ -n "$DEBUG" ]]; then
355 350 cp $SRCDIR/anon.system $WORKDIR/mnt/etc/system
356 351 cp $SRCDIR/anon.dtrace.conf $WORKDIR/mnt/kernel/drv/dtrace.conf
357 352 fi
358 353 chkpt umount
359 354 ;;
360 355
361 356 "umount")
362 357 /usr/sbin/umount $WORKDIR/mnt || fail "umount"
363 358 /usr/sbin/lofiadm -d $MKFILEDIR/miniroot || fail "lofiadm delete"
364 359 chkpt compress
365 360 ;;
366 361
367 362 "compress")
368 363 $GZIP_CMD -c -f $MKFILEDIR/miniroot > $WORKDIR/miniroot.gz
369 364 rm -f $MKFILEDIR/miniroot
370 365 chmod 644 $WORKDIR/miniroot.gz
371 366 echo " === Finished ==="
372 367 ls -l $WORKDIR/miniroot.gz
373 368 ;;
374 369
375 370 esac
376 371 }
377 372
378 373 make_initial_boot() {
379 374 FILE=$1
380 375 cat > $FILE <<EOF
381 376 /kayak/install_image.sh
382 377 exit \$?
383 378 EOF
384 379 }
385 380
386 381 while [[ -n "$CHKPT" ]]; do
387 382 step $CHKPT
388 383 done
|
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX