Print this page
Fix kayak to be mindful of publishers
| Split |
Close |
| Expand all |
| Collapse all |
--- old/./build_zfs_send.sh
+++ new/./build_zfs_send.sh
1 1 #!/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
|
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22 #
23 23 #
24 24 # Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27 fail() {
28 28 echo $*
29 29 exit 1
30 30 }
31 31
32 +# NOTE --> The URL needs to be updated with every release.
33 +# Change "bloody" to whatever release the current branch is.
32 34 PUBLISHER=omnios
33 -OMNIOS_URL=http://pkg.omniti.com/omnios/release
34 -: ${PKGURL:=http://pkg.omniti.com/omnios/release}
35 +OMNIOS_URL=http://pkg.omniti.com/omnios/bloody
36 +: ${PKGURL:=http://pkg.omniti.com/omnios/bloody}
35 37 : ${BZIP2:=bzip2}
36 38 ZROOT=rpool
37 39 OUT=
38 40 CLEANUP=0
39 41 set -- `getopt cd:o:p: $*`
40 42 for i in $*
41 43 do
42 44 case $i in
43 45 -c) CLEANUP=1; shift ;;
44 46 -d) ZROOT=$2; shift 2;;
45 47 -o) OUT=$2; shift 2;;
46 48 -p) PROFILE=$2; shift 2;;
47 49 -P) PUBLISHER_OVERRIDE=1; shift ;;
48 50 --) shift; break ;;
49 51 esac
50 52 done
51 53
52 54 name=$1
53 55 if [[ -z "$name" ]]; then
54 56 echo "$0 [-cP] [-d zfsparent] [-p profile] [-o outputfile] <release_name>"
55 57 exit
56 58 fi
57 59
58 60 MPR=`zfs get -H mountpoint $ZROOT | awk '{print $3}'`
59 61 if [[ -z "$OUT" ]]; then
60 62 OUT=$MPR/kayak_$name.zfs.bz2
61 63 fi
62 64
63 65 if zfs list $ZROOT/$name@entire > /dev/null 2>&1; then
64 66 zfs rollback -r $ZROOT/$name@entire
65 67 MP=`zfs get -H mountpoint $ZROOT/$name | awk '{print $3}'`
66 68 else
67 69 zfs create $ZROOT/$name || fail "zfs create"
68 70 MP=`zfs get -H mountpoint $ZROOT/$name | awk '{print $3}'`
69 71 pkg image-create -F -a $PUBLISHER=$PKGURL $MP || fail "image-create"
70 72 # If r151006, use a specific version to avoid missing incorporation
71 73 if [[ "$name" == "r151006" ]]; then
72 74 entire_version="151006:20131210T224515Z"
73 75 else
74 76 entire_version=${name//r/}
75 77 fi
76 78 pkg -R $MP install entire@11-0.$entire_version || fail "install entire"
77 79 zfs snapshot $ZROOT/$name@entire
78 80 fi
79 81
80 82 if [[ -n "$PROFILE" ]]; then
81 83 echo "Applying custom profile: $PROFILE"
82 84 [[ -r "$PROFILE" ]] || fail "Cannot find file: $PROFILE"
83 85 while read line ;
84 86 do
85 87 TMPPUB=`echo $line | cut -f1 -d=`
86 88 TMPURL=`echo $line | cut -f2 -d=`
87 89 if [[ -n "$TMPURL" && "$TMPURL" != "$TMPPUB" ]]; then
88 90 echo "Setting publisher: $TMPPUB / $TMPURL"
89 91 pkg -R $MP set-publisher -g $TMPURL $TMPPUB || fail "set publisher $TMPPUB"
90 92 PUBLISHER=$TMPPUB
91 93 PKGURL=$TMPURL
92 94 else
93 95 echo "Installing additional package: $line"
94 96 pkg -R $MP install -g $PKGURL $line || fail "install $line"
95 97 fi
96 98 done < <(grep . $PROFILE | grep -v '^ *#')
97 99 fi
98 100
99 101 if [[ -n "$PUBLISHER_OVERRIDE" ]]; then
100 102 OMNIOS_URL=$PKGURL
101 103 fi
102 104 echo "Setting omnios publisher to $OMNIOS_URL"
103 105 pkg -R $MP unset-publisher omnios
104 106 pkg -R $MP set-publisher -P --no-refresh -g $OMNIOS_URL omnios
105 107
106 108 zfs snapshot $ZROOT/$name@kayak || fail "snap"
107 109 zfs send $ZROOT/$name@kayak | $BZIP2 -9 > $OUT || fail "send/compress"
108 110 if [[ "$CLEANUP" -eq "1" ]]; then
109 111 zfs destroy $ZROOT/$name@kayak || fail "could not remove snapshot"
110 112 zfs destroy $ZROOT/$name || fail "could not remove zfs filesystem"
111 113 fi
|
↓ open down ↓ |
67 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX