commit | author | age
|
617c23
|
1 |
#!/bin/sh |
AS |
2 |
# |
|
3 |
# This file and its contents are supplied under the terms of the |
|
4 |
# Common Development and Distribution License ("CDDL)". You may |
|
5 |
# only use this file in accordance with the terms of the CDDL. |
|
6 |
# |
|
7 |
# A full copy of the text of the CDDL should have accompanied this |
|
8 |
# source. A copy of the CDDL is also available via the Internet at |
|
9 |
# http://www.illumos.org/license/CDDL. |
|
10 |
# |
|
11 |
|
|
12 |
# |
|
13 |
# Copyright 2012, Andrzej Szeszo |
|
14 |
# |
|
15 |
|
|
16 |
#PREFIX=cde-runtime |
|
17 |
#SRCREPO=http://pkg.openindiana.org/legacy |
|
18 |
#PKGLIST=pkg:/cde/$PREFIX@0.5.11,5.11-0.134:20100302T005909Z |
|
19 |
|
|
20 |
set -e |
|
21 |
|
|
22 |
PREFIX=$1; shift |
3d9efa
|
23 |
ARCHIVE=$1; shift |
617c23
|
24 |
SRCREPO=$1; shift |
AS |
25 |
PKGLIST="$@" |
|
26 |
|
3d9efa
|
27 |
[ -f $ARCHIVE ] && exit 0 |
617c23
|
28 |
|
AS |
29 |
if [ ! -d $PREFIX.pkgrecv ]; then |
|
30 |
mkdir $PREFIX.pkgrecv |
|
31 |
pkgrecv -s $SRCREPO -d $PREFIX.pkgrecv --raw $PKGLIST |
|
32 |
fi |
|
33 |
|
|
34 |
dir() { |
|
35 |
parm=$1 |
|
36 |
while [ ! x$1 = x ]; do |
|
37 |
variant= |
|
38 |
case $parm in |
|
39 |
path=*) |
|
40 |
path=`echo $parm|sed s/^path=//` |
|
41 |
;; |
|
42 |
variant.arch=*) |
|
43 |
variant=`echo $parm|sed s/^variant.arch=//` |
|
44 |
;; |
|
45 |
esac |
|
46 |
shift |
|
47 |
parm=$1 |
|
48 |
done |
|
49 |
|
|
50 |
if [ -z $variant ]; then |
|
51 |
mkdir -p $PREFIX/i386/$path |
|
52 |
mkdir -p $PREFIX/sparc/$path |
|
53 |
elif [ $variant = i386 ]; then |
|
54 |
mkdir -p $PREFIX/i386/$path |
|
55 |
elif [ $variant = sparc ]; then |
|
56 |
mkdir -p $PREFIX/sparc/$path |
|
57 |
fi |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
file() { |
|
62 |
hash=$1 |
|
63 |
parm=$1 |
|
64 |
while [ ! x$1 = x ]; do |
|
65 |
variant= |
|
66 |
case $parm in |
|
67 |
path=*) |
|
68 |
path=`echo $parm|sed s/^path=//` |
|
69 |
;; |
|
70 |
mode=*) |
|
71 |
mode=`echo $parm|sed s/^mode=//` |
|
72 |
;; |
|
73 |
variant.arch=*) |
|
74 |
variant=`echo $parm|sed s/^variant.arch=//` |
|
75 |
;; |
|
76 |
esac |
|
77 |
shift |
|
78 |
parm=$1 |
|
79 |
done |
|
80 |
|
|
81 |
if [ -z $variant ]; then |
|
82 |
[ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path |
6a05f5
|
83 |
mkdir -p `dirname $PREFIX/i386/$path` |
617c23
|
84 |
cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386/$path |
AS |
85 |
chmod $mode $PREFIX/i386/$path |
|
86 |
[ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path |
6a05f5
|
87 |
mkdir -p `dirname $PREFIX/sparc/$path` |
617c23
|
88 |
cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc/$path |
AS |
89 |
chmod $mode $PREFIX/sparc/$path |
|
90 |
elif [ $variant = i386 ]; then |
|
91 |
[ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path |
6a05f5
|
92 |
mkdir -p `dirname $PREFIX/i386/$path` |
617c23
|
93 |
cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386/$path |
AS |
94 |
chmod $mode $PREFIX/i386/$path |
|
95 |
elif [ $variant = sparc ]; then |
|
96 |
[ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path |
6a05f5
|
97 |
mkdir -p `dirname $PREFIX/sparc/$path` |
617c23
|
98 |
cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc/$path |
AS |
99 |
chmod $mode $PREFIX/sparc/$path |
|
100 |
fi |
|
101 |
|
|
102 |
} |
|
103 |
|
|
104 |
hardlink() { |
|
105 |
parm=$1 |
|
106 |
while [ ! x$1 = x ]; do |
|
107 |
variant= |
|
108 |
case $parm in |
|
109 |
path=*) |
|
110 |
path=`echo $parm|sed s/^path=//` |
|
111 |
;; |
|
112 |
target=*) |
|
113 |
target=`echo $parm|sed s/^target=//` |
|
114 |
;; |
|
115 |
variant.arch=*) |
|
116 |
variant=`echo $parm|sed s/^variant.arch=//` |
|
117 |
;; |
|
118 |
esac |
|
119 |
shift |
|
120 |
parm=$1 |
|
121 |
done |
|
122 |
|
|
123 |
if [ -z $variant ]; then |
|
124 |
[ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path |
6a05f5
|
125 |
mkdir -p `dirname $PREFIX/i386/$path` |
617c23
|
126 |
ln `dirname $PREFIX/i386/$path`/$target $PREFIX/i386/$path |
AS |
127 |
[ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path |
6a05f5
|
128 |
mkdir -p `dirname $PREFIX/sparc/$path` |
617c23
|
129 |
ln `dirname $PREFIX/sparc/$path`/$target $PREFIX/sparc/$path |
AS |
130 |
elif [ $variant = i386 ]; then |
|
131 |
[ -f $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path |
6a05f5
|
132 |
mkdir -p `dirname $PREFIX/i386/$path` |
617c23
|
133 |
ln `dirname $PREFIX/i386/$path`/$target $PREFIX/i386/$path |
AS |
134 |
elif [ $variant = sparc ]; then |
|
135 |
[ -f $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path |
6a05f5
|
136 |
mkdir -p `dirname $PREFIX/sparc/$path` |
617c23
|
137 |
ln `dirname $PREFIX/sparc/$path`/$target $PREFIX/sparc/$path |
AS |
138 |
fi |
|
139 |
|
|
140 |
} |
|
141 |
|
|
142 |
link() { |
|
143 |
parm=$1 |
|
144 |
while [ ! x$1 = x ]; do |
|
145 |
variant= |
|
146 |
case $parm in |
|
147 |
path=*) |
|
148 |
path=`echo $parm|sed s/^path=//` |
|
149 |
;; |
|
150 |
target=*) |
|
151 |
target=`echo $parm|sed s/^target=//` |
|
152 |
;; |
|
153 |
variant.arch=*) |
|
154 |
variant=`echo $parm|sed s/^variant.arch=//` |
|
155 |
;; |
|
156 |
esac |
|
157 |
shift |
|
158 |
parm=$1 |
|
159 |
done |
|
160 |
|
|
161 |
if [ -z $variant ]; then |
|
162 |
[ -h $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path |
6a05f5
|
163 |
mkdir -p `dirname $PREFIX/i386/$path` |
617c23
|
164 |
ln -s $target $PREFIX/i386/$path |
AS |
165 |
[ -h $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path |
6a05f5
|
166 |
mkdir -p `dirname $PREFIX/sparc/$path` |
617c23
|
167 |
ln -s $target $PREFIX/sparc/$path |
AS |
168 |
elif [ $variant = i386 ]; then |
|
169 |
[ -h $PREFIX/i386/$path ] && rm -f $PREFIX/i386/$path |
6a05f5
|
170 |
mkdir -p `dirname $PREFIX/i386/$path` |
617c23
|
171 |
ln -s $target $PREFIX/i386/$path |
AS |
172 |
elif [ $variant = sparc ]; then |
|
173 |
[ -h $PREFIX/sparc/$path ] && rm -f $PREFIX/sparc/$path |
6a05f5
|
174 |
mkdir -p `dirname $PREFIX/sparc/$path` |
617c23
|
175 |
ln -s $target $PREFIX/sparc/$path |
AS |
176 |
fi |
|
177 |
|
|
178 |
} |
|
179 |
|
|
180 |
license() { |
|
181 |
hash=$1 |
|
182 |
parm=$1 |
|
183 |
while [ ! x"$1" = x ]; do |
|
184 |
case $parm in |
|
185 |
license=*) |
|
186 |
license=`echo $parm|sed s/^license=//` |
|
187 |
;; |
|
188 |
esac |
|
189 |
shift |
|
190 |
parm=$1 |
|
191 |
done |
|
192 |
cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386/"$license" |
|
193 |
cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc/"$license" |
|
194 |
|
|
195 |
} |
|
196 |
|
|
197 |
|
|
198 |
for i in $PREFIX.pkgrecv/*/*/manifest.dir; do |
6a05f5
|
199 |
[ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited |
617c23
|
200 |
done |
AS |
201 |
|
|
202 |
for i in $PREFIX.pkgrecv/*/*/manifest.file; do |
6a05f5
|
203 |
[ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited |
617c23
|
204 |
done |
AS |
205 |
|
|
206 |
for i in $PREFIX.pkgrecv/*/*/manifest.hardlink; do |
6a05f5
|
207 |
[ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited |
617c23
|
208 |
done |
AS |
209 |
|
|
210 |
for i in $PREFIX.pkgrecv/*/*/manifest.link; do |
6a05f5
|
211 |
[ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited |
617c23
|
212 |
done |
AS |
213 |
|
|
214 |
for i in $PREFIX.pkgrecv/*/*/manifest.license; do |
6a05f5
|
215 |
[ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && . $i-edited |
617c23
|
216 |
done |
AS |
217 |
|
3d9efa
|
218 |
tar cf - $PREFIX | gzip -9 >$ARCHIVE |
617c23
|
219 |
|
AS |
220 |
rm -rf $PREFIX.pkgrecv $PREFIX |