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.
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.
13 # Copyright 2012, Andrzej Szeszo
17 #SRCREPO=http://pkg.openindiana.org/legacy
18 #PKGLIST=pkg:/cde/$PREFIX@0.5.11,5.11-0.134:20100302T005909Z
27 [ -f $ARCHIVE ] && exit 0
29 if [ ! -d $PREFIX.pkgrecv
]; then
31 pkgrecv
-s $SRCREPO -d $PREFIX.pkgrecv
--raw $PKGLIST
36 while [ ! x
$1 = x
]; do
40 path
=`echo $parm|sed s/^path=//`
43 variant
=`echo $parm|sed s/^variant.arch=//`
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
64 while [ ! x
$1 = x
]; do
68 path
=`echo $parm|sed s/^path=//`
71 mode
=`echo $parm|sed s/^mode=//`
74 variant
=`echo $parm|sed s/^variant.arch=//`
81 if [ -z $variant ]; then
82 [ -f $PREFIX/i386
/$path ] && rm -f $PREFIX/i386
/$path
83 mkdir
-p `dirname $PREFIX/i386/$path`
84 cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386
/$path
85 chmod $mode $PREFIX/i386
/$path
86 [ -f $PREFIX/sparc
/$path ] && rm -f $PREFIX/sparc
/$path
87 mkdir
-p `dirname $PREFIX/sparc/$path`
88 cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc
/$path
89 chmod $mode $PREFIX/sparc
/$path
90 elif [ $variant = i386
]; then
91 [ -f $PREFIX/i386
/$path ] && rm -f $PREFIX/i386
/$path
92 mkdir
-p `dirname $PREFIX/i386/$path`
93 cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386
/$path
94 chmod $mode $PREFIX/i386
/$path
95 elif [ $variant = sparc
]; then
96 [ -f $PREFIX/sparc
/$path ] && rm -f $PREFIX/sparc
/$path
97 mkdir
-p `dirname $PREFIX/sparc/$path`
98 cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc
/$path
99 chmod $mode $PREFIX/sparc
/$path
106 while [ ! x
$1 = x
]; do
110 path
=`echo $parm|sed s/^path=//`
113 target
=`echo $parm|sed s/^target=//`
116 variant
=`echo $parm|sed s/^variant.arch=//`
123 if [ -z $variant ]; then
124 [ -f $PREFIX/i386
/$path ] && rm -f $PREFIX/i386
/$path
125 mkdir
-p `dirname $PREFIX/i386/$path`
126 ln `dirname $PREFIX/i386/$path`/$target $PREFIX/i386
/$path
127 [ -f $PREFIX/sparc
/$path ] && rm -f $PREFIX/sparc
/$path
128 mkdir
-p `dirname $PREFIX/sparc/$path`
129 ln `dirname $PREFIX/sparc/$path`/$target $PREFIX/sparc
/$path
130 elif [ $variant = i386
]; then
131 [ -f $PREFIX/i386
/$path ] && rm -f $PREFIX/i386
/$path
132 mkdir
-p `dirname $PREFIX/i386/$path`
133 ln `dirname $PREFIX/i386/$path`/$target $PREFIX/i386
/$path
134 elif [ $variant = sparc
]; then
135 [ -f $PREFIX/sparc
/$path ] && rm -f $PREFIX/sparc
/$path
136 mkdir
-p `dirname $PREFIX/sparc/$path`
137 ln `dirname $PREFIX/sparc/$path`/$target $PREFIX/sparc
/$path
144 while [ ! x
$1 = x
]; do
148 path
=`echo $parm|sed s/^path=//`
151 target
=`echo $parm|sed s/^target=//`
154 variant
=`echo $parm|sed s/^variant.arch=//`
161 if [ -z $variant ]; then
162 [ -h $PREFIX/i386
/$path ] && rm -f $PREFIX/i386
/$path
163 mkdir
-p `dirname $PREFIX/i386/$path`
164 ln -s $target $PREFIX/i386
/$path
165 [ -h $PREFIX/sparc
/$path ] && rm -f $PREFIX/sparc
/$path
166 mkdir
-p `dirname $PREFIX/sparc/$path`
167 ln -s $target $PREFIX/sparc
/$path
168 elif [ $variant = i386
]; then
169 [ -h $PREFIX/i386
/$path ] && rm -f $PREFIX/i386
/$path
170 mkdir
-p `dirname $PREFIX/i386/$path`
171 ln -s $target $PREFIX/i386
/$path
172 elif [ $variant = sparc
]; then
173 [ -h $PREFIX/sparc
/$path ] && rm -f $PREFIX/sparc
/$path
174 mkdir
-p `dirname $PREFIX/sparc/$path`
175 ln -s $target $PREFIX/sparc
/$path
183 while [ ! x
"$1" = x
]; do
186 license
=`echo $parm|sed s/^license=//`
192 cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/i386
/"$license"
193 cp `ls $PREFIX.pkgrecv/*/*/$hash|head -1` $PREFIX/sparc
/"$license"
198 for i
in $PREFIX.pkgrecv
/*/*/manifest.dir
; do
199 [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && .
$i-edited
202 for i
in $PREFIX.pkgrecv
/*/*/manifest.
file; do
203 [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && .
$i-edited
206 for i
in $PREFIX.pkgrecv
/*/*/manifest.hardlink
; do
207 [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && .
$i-edited
210 for i
in $PREFIX.pkgrecv
/*/*/manifest.link
; do
211 [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && .
$i-edited
214 for i
in $PREFIX.pkgrecv
/*/*/manifest.license
; do
215 [ -f $i ] && sed -e 's/\([^ ]*\)/"\1"/g' < $i > $i-edited && .
$i-edited
218 tar cf
- $PREFIX |
gzip -9 >$ARCHIVE
220 rm -rf $PREFIX.pkgrecv
$PREFIX