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
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.
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]
24 # Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
25 # Use is subject to license terms.
33 PKGURL1
=${PKGURL1-/usr/nightly/packages/i386/nightly/repo.redist}
34 PKGURL2
=${PKGURL2-/ws/oi-userland/amd64/repo}
38 set -- `getopt cd:o:p: $*`
42 -c) CLEANUP
=1; shift ;;
43 -d) ZROOT
=$2; shift 2;;
45 -p) PROFILE
=$2; shift 2;;
46 -P) PUBLISHER_OVERRIDE
=1; shift ;;
52 if [[ -z "$name" ]]; then
53 echo "$0 [-cP] [-d zfsparent] [-p profile] [-o outputfile] <release_name>"
57 MPR
=`zfs get -H mountpoint $ZROOT | awk '{print $3}'`
58 if [[ -z "$OUT" ]]; then
59 OUT
=$MPR/kayak_
$name.zfs
62 if zfs list
$ZROOT/$name@entire
> /dev
/null
2>&1; then
63 zfs rollback
-r $ZROOT/$name@entire
64 MP
=`zfs get -H mountpoint $ZROOT/$name | awk '{print $3}'`
66 zfs create
-o compress=lz4
$ZROOT/$name || fail
"zfs create"
67 MP
=`zfs get -H mountpoint $ZROOT/$name | awk '{print $3}'`
68 pkg image-create
-F -p $PUBLISHER=$PKGURL1 $MP || fail
"image-create"
69 pkg
-R $MP change-variant arch
=i386
# FIXME hack
70 pkg
-R $MP set-publisher
--non-sticky -p $PKGURL2
71 pkg
-R $MP install 'pkg://unleashed/*' 'pkg://userland/*' || fail
'install'
72 zfs snapshot
$ZROOT/$name@entire
75 zfs snapshot
$ZROOT/$name@kayak || fail
"snap"
76 snapsize
=`zfs get -Hp -o value referenced $ZROOT/$name@kayak`
77 zfs send
-Lc $ZROOT/$name@kayak | pv
-s $snapsize > $OUT || fail
"send"
78 if [[ "$CLEANUP" -eq "1" ]]; then
79 zfs destroy
$ZROOT/$name@kayak || fail
"could not remove snapshot"
80 zfs destroy
$ZROOT/$name || fail
"could not remove zfs filesystem"