Sun, 05 Aug 2012 13:18:44 +0200
Import package vendor original specs for necessary manipulations.
1 ##
2 ## openpkg.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
4 ##
5 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
6 ## All rights reserved. Licenses which grant limited permission to use,
7 ## copy, modify and distribute this software are available from the
8 ## OpenPKG GmbH.
9 ##
10 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # NOTICE: This OpenPKG RPM specification is _very_ special, because
25 # it is used both for bootstrapping OpenPKG with its OpenPKG RPM and
26 # for regular builds of OpenPKG RPM in order to upgrade an existing
27 # installation. For this it has to interact correctly with the
28 # "openpkg.boot" script. See the documentation in the file "README"
29 # and the source of the companion script "openpkg.boot" for details,
30 # but do not touch anything here until you are 100% sure about what
31 # you are doing. In short: This script is allowed to use only a very
32 # restricted subset of the OpenPKG RPM functionality!
34 # BUILD REQUIREMENTS:
35 # o any sh(1)
36 # o any tar(1)
37 # o any make(1)
38 # o any cc(1)
40 # the used software versions
41 %define V_rpm_major 5.1
42 %define V_rpm_minor 9
43 %define V_popt 1.16
44 %define V_lua 5.1.4
45 %define V_sqlite 3.6.17
46 %define V_zlib 1.2.7
47 %define V_bzip2 1.0.6
48 %define V_beecrypt 4.2.1
49 %define V_curl 7.26.0
50 %define V_pcre 8.31
51 %define V_make 3.82
52 %define V_gzip 1.5
53 %define V_patch 2.6.1
54 %define V_tar 1.26
55 %define V_bash 4.2
56 %define V_bash_pl 29
57 %define V_uuid 1.6.2
58 %define V_config 20120627
59 %define V_perl 5.16.0
60 %define V_openssl 1.0.1c
61 %define V_xz 5.0.4
62 %define V_shtool 2.0.8
63 %define V_libarchive 3.0.3
64 %define V_diffutils 3.2
65 %define V_svs 1.1.0
67 # package information
68 Name: openpkg
69 Summary: OpenPKG Framework
70 URL: http://openpkg.org/
71 Vendor: OpenPKG GmbH
72 Packager: OpenPKG GmbH
73 Distribution: OpenPKG
74 Class: BOOT
75 Group: Bootstrapping
76 License: Proprietary, Open Source
77 Version: 4.6.7
78 Release: 20120800
80 # list of pristine upstream sources
81 Source0: ftp://ftp.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
82 Source1: ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz
83 Source2: ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
84 Source3: ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
85 Source4: http://download.openpkg.org/components/versioned/config/config-%{V_config}.tar.gz
86 Source5: http://download.openpkg.org/components/derived/gzip/gzip-%{V_gzip}.tar
87 Source6: http://download.openpkg.org/components/derived/perl/perl-%{V_perl}-mini.tar.gz
88 Source7: http://rpm5.org/files/rpm/rpm-%{V_rpm_major}/rpm-%{V_rpm_major}.%{V_rpm_minor}.tar.gz
89 Source8: ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
90 Source9: ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
91 Source10: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
92 Source11: http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
93 Source12: http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
94 Source13: http://www.zlib.net/zlib-%{V_zlib}.tar.gz
95 Source14: http://rpm5.org/files/popt/popt-%{V_popt}.tar.gz
96 Source15: http://www.sqlite.org/sqlite-%{V_sqlite}.tar.gz
97 Source16: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-%{V_pcre}.tar.gz
98 Source17: http://libarchive.googlecode.com/files/libarchive-%{V_libarchive}.tar.gz
99 Source18: ftp://ftp.gnu.org/gnu/diffutils/diffutils-%{V_diffutils}.tar.gz
100 Source19: ftp://ftp.ossp.org/pkg/tool/svs/svs-%{V_svs}.tar.gz
101 Source20: http://tukaani.org/xz/xz-%{V_xz}.tar.gz
103 # list of local patches against pristine upstream sources
104 Source100: bash.patch
105 Source101: bash.patch.vendor
106 Source102: beecrypt.patch
107 Source103: make.patch
108 Source104: openssl.patch
109 Source105: perl.patch
110 Source106: tar.patch
111 Source107: rpm.patch
112 Source108: popt.patch
113 Source109: sqlite.patch
114 Source110: curl.patch
115 Source111: pcre.patch
116 Source112: diffutils.patch
117 Source113: libarchive.patch
118 Source114: patch.strnlen.c
119 Source115: patch.Makefile.in
120 Source116: xz.patch
121 Source117: zlib.patch
123 # list of local sources
124 Source200: README
125 Source201: etc.prereq.sh
126 Source202: etc.usrgrp.sh
127 Source203: etc.wrapbin.sh
128 Source204: etc.wrapsrc.sh
129 Source205: dot.bash_login
130 Source206: dot.bashrc
131 Source207: dot.lsyncrc
132 Source208: local.README
133 Source209: lsync
134 Source210: lsync.8
135 Source211: lsync.pod
136 Source212: man.sh
137 Source213: openpkg.1
138 Source214: openpkg.boot
139 Source215: openpkg.com.pgp
140 Source216: openpkg.net.pgp
141 Source217: openpkg.org.pgp
142 Source218: openpkg.pod
143 Source219: openpkg.sh
144 Source220: rc
145 Source221: rc.8
146 Source222: rc.conf
147 Source223: rc.func
148 Source224: rc.openpkg
149 Source225: rc.pod
150 Source226: release.8
151 Source227: release.pod
152 Source228: release.sh
153 Source229: root.README
154 Source230: rpm-config.8
155 Source231: rpm-config.pod
156 Source232: rpm-config.sh
157 Source233: rpmdb
158 Source234: rpmtool
159 Source235: rpmtool.8
160 Source236: rpmtool.pod
161 Source237: shtool
162 Source238: shtool.sh
163 Source239: uuid.8
164 Source240: uuid.pod
165 Source241: uuid.sh
166 Source242: rpmmacros
167 Source243: rpmpopt
168 Source244: curl.sh
169 Source245: index.pl
170 Source246: index.8
171 Source247: index.pod
172 Source248: build.pl
173 Source249: build.8
174 Source250: build.pod
175 Source251: makeproxy.pl
176 Source252: makeproxy.8
177 Source253: lint-fsl.pl
178 Source254: lint-rc.pl
179 Source255: lint-rpm.pl
180 Source256: lint-spec.pl
181 Source257: dev.pl
182 Source258: dev.8
183 Source259: dev.pod
184 Source260: openpkg.mk
185 Source261: openpkg.c
186 Source262: Makefile
187 Source263: mutex.c
188 Source264: mutex.mk
189 Source265: register.sh
190 Source266: register.pod
191 Source267: register.8
192 Source268: rpm.sh
193 Source269: license.lua
194 Source270: license-BOOT.txt
195 Source271: license-COMMUNITY.txt
196 Source272: license-EVAL.txt
197 Source273: license-EXAMPLE.txt
198 Source274: license-PROMO.txt
199 Source275: license-RECOVERY.txt
200 Source276: license.sh
201 Source277: license.pod
202 Source278: license.8
203 Source279: rpmlua
204 Source280: sea.sh
205 Source281: sea.pod
206 Source282: sea.8
207 Source283: stack.sh
208 Source284: stack.pod
209 Source285: stack.8
210 Source286: search.pl
211 Source287: search.pod
212 Source288: search.8
213 Source289: mirror.pl
214 Source290: mirror.pod
215 Source291: mirror.8
217 # build information
218 BuildRoot: %{l_buildroot}
219 AutoReq: no
220 AutoReqProv: no
221 Provides: %{l_prefix}
222 Provides: OpenPKG
223 Provides: openpkg = %{release}-%{release}
225 %description
226 This is the OpenPKG Framework, the so called "bootstrap" package
227 of OpenPKG. OpenPKG is a cross platform, self contained, RPM based
228 software packaging solution, targeting the flexible building of
229 software stacks on Unix platforms. The RPM Package Manager (RPM)
230 is the underlying, sophisticated and portable package management
231 tool which drives the automated building, installation, management
232 and deinstallation of all Unix software components in an OpenPKG
233 software stack.
235 This OpenPKG package contains the following individual
236 software components (individual licenses listed in brackets):
237 OpenPKG Framework %(echo "%{version}" | awk '{ printf("%%-7s", $1); }') [Proprietary]
238 rpm5.org RPM %(echo "%{V_rpm_major}.%{V_rpm_minor}" | awk '{ printf("%%-7s", $1); }') [LGPL]
239 rpm5.org POPT %(echo "%{V_popt}" | awk '{ printf("%%-7s", $1); }') [LGPL]
240 BeeCrypt %(echo "%{V_beecrypt}" | awk '{ printf("%%-7s", $1); }') [LGPL]
241 Lua %(echo "%{V_lua}" | awk '{ printf("%%-7s", $1); }') [MIT]
242 SQLite %(echo "%{V_sqlite}" | awk '{ printf("%%-7s", $1); }') [Public Domain]
243 PCRE %(echo "%{V_pcre}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
244 ZLib %(echo "%{V_zlib}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
245 XZ %(echo "%{V_xz}" | awk '{ printf("%%-7s", $1); }') [PD/LGPL/GPL]
246 GNU Bzip2 %(echo "%{V_bzip2}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
247 GNU Gzip %(echo "%{V_gzip}" | awk '{ printf("%%-7s", $1); }') [GPL]
248 GNU Tar %(echo "%{V_tar}" | awk '{ printf("%%-7s", $1); }') [GPL]
249 GNU Patch %(echo "%{V_patch}" | awk '{ printf("%%-7s", $1); }') [GPL]
250 GNU Shtool %(echo "%{V_shtool}" | awk '{ printf("%%-7s", $1); }') [GPL]
251 GNU Make %(echo "%{V_make}" | awk '{ printf("%%-7s", $1); }') [GPL]
252 GNU Bash %(echo "%{V_bash}.%{V_bash_pl}" | awk '{ printf("%%-7s", $1); }') [GPL]
253 GNU DiffUtils %(echo "%{V_diffutils}" | awk '{ printf("%%-7s", $1); }') [GPL]
254 BSD libarchive %(echo "%{V_libarchive}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
255 OSSP uuid %(echo "%{V_uuid}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
256 OSSP svs %(echo "%{V_svs}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
257 cURL %(echo "%{V_curl}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT]
258 OpenSSL %(echo "%{V_openssl}" | awk '{ printf("%%-7s", $1); }') [BSD]
259 Perl %(echo "%{V_perl}" | awk '{ printf("%%-7s", $1); }') [Artistic]
261 %track
262 prog openpkg:bash = {
263 version = %{V_bash}
264 url = ftp://ftp.cwru.edu/pub/bash/
265 regex = bash-(__VER__)\.tar\.gz
266 }
267 prog openpkg:bzip2 = {
268 version = %{V_bzip2}
269 url = http://www.bzip.org/downloads.html
270 regex = bzip2-(__VER__)\.tar\.gz
271 }
272 prog openpkg:curl = {
273 version = %{V_curl}
274 url = http://curl.haxx.se/download/
275 regex = curl-(__VER__)\.tar\.gz
276 }
277 prog openpkg:pcre = {
278 version = %{V_pcre}
279 url = ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
280 regex = pcre-(__VER__)\.tar\.gz
281 }
282 prog openpkg:gzip = {
283 version = %{V_gzip}
284 url = ftp://ftp.gnu.org/gnu/gzip/
285 regex = gzip-(__VER__)\.tar(\.gz)?
286 }
287 prog openpkg:make = {
288 version = %{V_make}
289 url = ftp://ftp.gnu.org/gnu/make/
290 regex = make-(__VER__)\.tar\.gz
291 }
292 prog openpkg:patch = {
293 version = %{V_patch}
294 url = ftp://ftp.gnu.org/gnu/patch/
295 regex = patch-(__VER__)\.tar\.gz
296 }
297 prog openpkg:popt = {
298 version = %{V_popt}
299 url = http://rpm5.org/files/popt/
300 regex = popt-(\d+\.\d+)\.tar\.gz
301 }
302 prog openpkg:rpm = {
303 version = %{V_rpm_major}.%{V_rpm_minor}
304 url = http://rpm5.org/files/rpm/rpm-%{V_rpm_major}/
305 regex = rpm-(\d+\.\d+[.ab]\d+)\.tar\.gz
306 }
307 prog openpkg:tar = {
308 version = %{V_tar}
309 url = ftp://ftp.gnu.org/gnu/tar/
310 regex = tar-(__VER__)\.tar\.gz
311 }
312 prog openpkg:zlib = {
313 version = %{V_zlib}
314 url = http://www.zlib.net/
315 regex = zlib-(__VER__)\.tar\.gz
316 }
317 prog openpkg:diffutils = {
318 version = %{V_diffutils}
319 url = ftp://alpha.gnu.org/gnu/diffutils/
320 regex = diffutils-(__VER__)\.tar\.gz
321 }
322 prog openpkg:libarchive = {
323 version = %{V_libarchive}
324 url = http://code.google.com/p/libarchive/downloads/list
325 regex = libarchive-(__VER__)\.tar\.gz
326 }
327 prog openpkg:uuid = {
328 version = %{V_uuid}
329 url = ftp://ftp.ossp.org/pkg/lib/uuid/
330 regex = uuid-(__VER__)\.tar\.gz
331 }
332 prog openpkg:svs = {
333 version = %{V_svs}
334 url = ftp://ftp.ossp.org/pkg/tool/svs/
335 regex = svs-(__VER__)\.tar\.gz
336 }
337 prog openpkg:config = {
338 version = %{V_config}
339 url = http://download.openpkg.org/components/versioned/config/
340 regex = config-(__VER__)\.tar\.gz
341 }
342 prog openpkg:beecrypt = {
343 version = %{V_beecrypt}
344 url = http://sourceforge.net/project/showfiles.php?group_id=8924&package_id=9007
345 regex = beecrypt-(__VER__)\.tar\.gz
346 }
347 prog openpkg:perl = {
348 version = %{V_perl}
349 url = http://download.openpkg.org/components/derived/perl/
350 regex = perl-(__VER__)-mini\.tar\.gz
351 }
352 prog openpkg:openssl = {
353 version = %{V_openssl}
354 url = ftp://ftp.openssl.org/source/
355 regex = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
356 }
357 prog openpkg:lua = {
358 version = %{V_lua}
359 url = http://www.lua.org/download.html
360 regex = lua-(\d+\.\d+\.\d+)\.tar\.gz
361 }
362 prog openpkg:sqlite = {
363 version = %{V_sqlite}
364 url = http://www.sqlite.org/download.html
365 regex = sqlite-(\d+\.\d+\.\d+(?:\.\d+)?)\.tar\.gz
366 }
367 prog openpkg:xz = {
368 version = %{V_xz}
369 url = http://tukaani.org/xz/
370 regex = xz-(\d+\.\d+\.\d+)\.tar\.gz
371 }
373 %prep
374 # skip in bootstrap phase 2 (see openpkg.boot)
375 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
377 # switch into a temporary build area
378 rm -rf openpkg-%{version}
379 mkdir openpkg-%{version}
380 cd openpkg-%{version}
381 rm -f .buildenv
382 touch .buildenv
384 # provide a bootstrap alternative to %{SOURCE xxx} because else
385 # it is not possible to upgrade a newer OpenPKG RPM with an older
386 # OpenPKG RPM.
387 echo >>.buildenv 'SOURCE () {'
388 echo >>.buildenv ' if [ -f "%{_specdir}/$1" ]; then'
389 echo >>.buildenv ' echo "%{_specdir}/$1"'
390 echo >>.buildenv ' else'
391 echo >>.buildenv ' echo "%{_sourcedir}/$1"'
392 echo >>.buildenv ' fi'
393 echo >>.buildenv '}'
394 echo >>.buildenv 'VERBOSE () {'
395 echo >>.buildenv ' if [ -f "%{_specdir}/rpmtool" ]; then'
396 echo >>.buildenv ' echo "$*" | sh %{_specdir}/rpmtool msg'
397 echo >>.buildenv ' else'
398 echo >>.buildenv ' echo "$*" | sh %{_sourcedir}/rpmtool msg'
399 echo >>.buildenv ' fi'
400 echo >>.buildenv '}'
401 . ./.buildenv
403 # display verbosity header
404 set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"; set -x
406 # determine path to shtool
407 shtool=`SOURCE shtool`
408 echo "shtool=$shtool" >>./.buildenv
410 # determine development tools
411 # - bootstrapping: %{l_xxx} is set via sed(1)
412 # - upgrading new: %{l_xxx} is set via rpmmacros
413 # - upgrading old: %{l_xxx} is not set at all
415 # manually make sure tar(1) is available
416 l_tar=""; export l_tar
417 [ ".%{?l_tar:set}" = .set ] && l_tar="%{l_tar}"
418 [ ".%{?use_tar:set}" = .set ] && l_tar="%{use_tar}"
419 if [ ".$l_tar" = . ]; then
420 l_tar=`sh $shtool path gtar tar`
421 if [ ".$l_tar" = . ]; then
422 echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
423 exit 1
424 fi
425 fi
426 echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
428 # manually make sure make(1) is available
429 l_make=""; export l_make
430 [ ".%{?l_make:set}" = .set ] && l_make="%{l_make}"
431 [ ".%{?use_make:set}" = .set ] && l_make="%{use_make}"
432 if [ ".$l_make" = . ]; then
433 l_make=`sh $shtool path gmake make`
434 if [ ".$l_make" = . ]; then
435 echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
436 exit 1
437 fi
438 fi
439 echo "l_make=\"$l_make\"; export l_make" >>.buildenv
441 # manually make sure cc(1) is available
442 l_cc=""; export l_cc
443 [ ".%{?l_cc:set}" = .set ] && l_cc="%{l_cc}"
444 [ ".%{?use_cc:set}" = .set ] && l_cc="%{use_cc}"
445 if [ ".$l_cc" = . ]; then
446 l_cc=`sh $shtool path gcc cc`
447 if [ ".$l_cc" = . ]; then
448 echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
449 exit 1
450 fi
451 fi
452 echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
454 # manually make sure ar(1) is available
455 l_ar=""; export l_ar
456 [ ".%{?l_ar:set}" = .set ] && l_ar="%{l_ar}"
457 [ ".%{?use_ar:set}" = .set ] && l_ar="%{use_ar}"
458 if [ ".$l_ar" = . ]; then
459 l_ar=`sh $shtool path ar`
460 if [ ".$l_ar" = . ]; then
461 echo "openpkg: prerequisite tool \`ar' not found"
462 exit 1
463 fi
464 fi
465 echo "l_ar=\"$l_ar\"; export l_ar" >>.buildenv
467 # manually make sure ld(1) is available
468 l_ld=""; export l_ld
469 [ ".%{?l_ld:set}" = .set ] && l_ld="%{l_ld}"
470 [ ".%{?use_ld:set}" = .set ] && l_ld="%{use_ld}"
471 if [ ".$l_ld" = . ]; then
472 l_ld=`sh $shtool path ld`
473 if [ ".$l_ld" = . ]; then
474 echo "openpkg: prerequisite tool \`ld' not found"
475 exit 1
476 fi
477 fi
478 echo "l_ld=\"$l_ld\"; export l_ld" >>.buildenv
480 # manually make sure as(1) is available
481 l_as=""; export l_as
482 [ ".%{?l_as:set}" = .set ] && l_as="%{l_as}"
483 [ ".%{?use_as:set}" = .set ] && l_as="%{use_as}"
484 if [ ".$l_as" = . ]; then
485 l_as=`sh $shtool path as`
486 if [ ".$l_as" = . ]; then
487 echo "openpkg: prerequisite tool \`as' not found"
488 exit 1
489 fi
490 fi
491 echo "l_as=\"$l_as\"; export l_as" >>.buildenv
493 # manually make sure strip(1) is available or use a null replacement
494 l_strip=""; export l_strip
495 [ ".%{?l_strip:set}" = .set ] && l_strip="%{l_strip}"
496 [ ".%{?use_strip:set}" = .set ] && l_strip="%{use_strip}"
497 if [ ".$l_strip" = . ]; then
498 l_strip=`sh $shtool path strip ls`
499 if [ ".$l_strip" = . ]; then
500 echo "openpkg: prerequisite tool \`strip' not found"
501 exit 1
502 fi
503 fi
504 echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv
506 # determine path to etc.usrgrp.sh script
507 usrgrp=`SOURCE etc.usrgrp.sh`
508 echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv
510 # display verbosity header
511 set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"; set -x
513 # determine user/group name/id pairs
514 # - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
515 # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
516 # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
517 susr=""; [ ".%{?l_susr:set}" = .set ] && susr="%{l_susr}"
518 sgrp=""; [ ".%{?l_sgrp:set}" = .set ] && sgrp="%{l_sgrp}"
519 musr=""; [ ".%{?l_musr:set}" = .set ] && musr="%{l_musr}"
520 mgrp=""; [ ".%{?l_mgrp:set}" = .set ] && mgrp="%{l_mgrp}"
521 rusr=""; [ ".%{?l_rusr:set}" = .set ] && rusr="%{l_rusr}"
522 rgrp=""; [ ".%{?l_rgrp:set}" = .set ] && rgrp="%{l_rgrp}"
523 nusr=""; [ ".%{?l_nusr:set}" = .set ] && nusr="%{l_nusr}"
524 ngrp=""; [ ".%{?l_ngrp:set}" = .set ] && ngrp="%{l_ngrp}"
525 # corresponding ids
526 suid=""; [ ".%{?l_suid:set}" = .set ] && suid="%{l_suid}"
527 sgid=""; [ ".%{?l_sgid:set}" = .set ] && sgid="%{l_sgid}"
528 muid=""; [ ".%{?l_muid:set}" = .set ] && muid="%{l_muid}"
529 mgid=""; [ ".%{?l_mgid:set}" = .set ] && mgid="%{l_mgid}"
530 ruid=""; [ ".%{?l_ruid:set}" = .set ] && ruid="%{l_ruid}"
531 rgid=""; [ ".%{?l_rgid:set}" = .set ] && rgid="%{l_rgid}"
532 nuid=""; [ ".%{?l_nuid:set}" = .set ] && nuid="%{l_nuid}"
533 ngid=""; [ ".%{?l_ngid:set}" = .set ] && ngid="%{l_ngid}"
534 # compat:
535 usr=""; [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
536 grp=""; [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
537 eval `sh $usrgrp \
538 --usr="$usr" --grp="$grp" \
539 --susr="$susr" --sgrp="$sgrp" \
540 --musr="$musr" --mgrp="$mgrp" \
541 --rusr="$rusr" --rgrp="$rgrp" \
542 --nusr="$nusr" --ngrp="$ngrp" \
543 --suid="$suid" --sgid="$sgid" \
544 --muid="$muid" --mgid="$mgid" \
545 --ruid="$ruid" --rgid="$rgid" \
546 --nuid="$nuid" --ngid="$ngid"`
547 echo "susr=\"$susr\"; export susr" >>.buildenv
548 echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
549 echo "musr=\"$musr\"; export musr" >>.buildenv
550 echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
551 echo "rusr=\"$rusr\"; export rusr" >>.buildenv
552 echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
553 echo "nusr=\"$nusr\"; export nusr" >>.buildenv
554 echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
555 echo "suid=\"$suid\"; export suid" >>.buildenv
556 echo "sgid=\"$sgid\"; export sgid" >>.buildenv
557 echo "muid=\"$muid\"; export muid" >>.buildenv
558 echo "mgid=\"$mgid\"; export mgid" >>.buildenv
559 echo "ruid=\"$ruid\"; export ruid" >>.buildenv
560 echo "rgid=\"$rgid\"; export rgid" >>.buildenv
561 echo "nuid=\"$nuid\"; export nuid" >>.buildenv
562 echo "ngid=\"$ngid\"; export ngid" >>.buildenv
564 # display verbosity header
565 set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"; set -x
567 # determine installation location id
568 if [ ".%{?l_tag_fmt:set}" = .set ]; then
569 tag="%{l_tag_fmt}"
570 else
571 tag="<compat>"
572 fi
573 echo "tag=\"$tag\"; export tag" >>.buildenv
575 # determine platform id
576 s=`(uname -s) 2>/dev/null` || s='Unknown'
577 r=`(uname -r) 2>/dev/null` || r='0.0'
578 plid="${s}/${r}"
579 echo "plid=\"$plid\"; export plid" >>.buildenv
581 # determine platform specific build environment
582 case $plid in
583 FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
584 NetBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
585 Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
586 SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
587 UnixWare/*) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
588 AIX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
589 Darwin/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
590 OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
591 HP-UX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
592 IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
593 CYGWIN*/* ) l_build_path="/bin:/usr/bin:/usr/sbin" ;;
594 * ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
595 esac
596 case $plid in
597 FreeBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
598 NetBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
599 Linux/* ) l_build_ldlp="/lib:/usr/lib" ;;
600 SunOS/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
601 UnixWare/*) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
602 AIX/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
603 Darwin/* ) l_build_ldlp="/usr/lib" ;;
604 OSF1/V5.* ) l_build_ldlp="/usr/lib" ;;
605 HP-UX/* ) l_build_ldlp="/usr/lib" ;;
606 IRIX*/6.* ) l_build_ldlp="/usr/lib" ;;
607 CYGWIN*/* ) l_build_ldlp="/lib:/usr/lib" ;;
608 * ) l_build_ldlp="/usr/lib" ;;
609 esac
610 case $plid in
611 * ) l_build_ulim=":" ;;
612 esac
613 echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
614 echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
615 echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
617 # ACTIVATE AGAIN AFTER ALL 4.2.5 VERSIONS WERE UPGRADED TO AT LEAST 4.2.7
618 # determine status of unprivileged operation
619 if [ ".%{?l_unprivileged:set}" = .set ]; then
620 l_unprivileged="%{l_unprivileged}"
621 else
622 l_unprivileged="no"
623 fi
624 echo "l_unprivileged=\"$l_unprivileged\"; export l_unprivileged" >>.buildenv
626 # display verbosity header
627 set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x
629 # bootstrap GNU zip tool
630 ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
631 ( cd gzip-%{V_gzip}
632 ( echo "ac_cv_prog_cc_g=no"
633 echo "ac_cv_header_getopt_h=no"
634 ) >config.cache
635 case $plid in
636 Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;;
637 esac
638 CC="${l_cc}" \
639 GREP="grep" \
640 ./configure \
641 --cache-file=./config.cache
642 ${l_make} || exit $?
643 ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $?
644 ) || exit $?
645 l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
646 echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
648 # display verbosity header
649 set +x; VERBOSE "PREPARATION: Unpack GNU configuration guessing utilities"; set -x
651 # unpack GNU config.guess
652 ${l_gzip} -dc `SOURCE config-%{V_config}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
654 # display verbosity header
655 set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"; set -x
657 # bootstrap GNU patch tool
658 ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
659 ( cd patch-%{V_patch}
660 chmod a+x install-sh
661 echo '#!' >update-version.sh
662 cp `SOURCE patch.Makefile.in` Makefile.in
663 cp `SOURCE patch.strnlen.c` gl/lib/strnlen.c
664 ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
665 echo 'ac_cv_prog_cc_g=no'
666 false=`sh $shtool path false`
667 echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
668 ) >config.cache
669 CC="${l_cc}" \
670 ./configure \
671 --cache-file=./config.cache \
672 --enable-merge \
673 --disable-largefile
674 ${l_make} || exit $?
675 ( mv src/patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
676 ) || exit $?
677 l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
678 case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
679 *-cygwin* )
680 # Cygwin under Windows Vista dislikes executables with
681 # "patch" in the same and would require a "*.manifest"
682 # file applied with the "mt.exe" from the "Windows
683 # Software Development Kit (SDK)" in order to escape from
684 # UAC. An easy alternative is to just rename the file to a
685 # different name.
686 mv patch-%{V_patch}/patch patch-%{V_patch}/pitch
687 l_patch="`pwd`/patch-%{V_patch}/pitch"
688 ;;
689 esac
690 echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
692 # display verbosity header
693 set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"; set -x
695 # build GNU tar tool
696 ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
697 ( cd tar-%{V_tar}
698 ${l_patch} -p0 <`SOURCE tar.patch`
699 ( echo 'am_cv_func_iconv=no'
700 echo 'am_cv_lib_iconv=no'
701 echo 'ac_cv_lib_iconv_iconv=no'
702 echo 'ac_cv_header_iconv_h=no'
703 echo 'ac_cv_type_iconv_t=no'
704 ) >config.cache
705 CC="${l_cc}" \
706 MAKEINFO="true" \
707 GREP="grep" \
708 FORCE_UNSAFE_CONFIGURE=1 \
709 ./configure \
710 --cache-file=./config.cache \
711 --prefix=%{l_prefix} \
712 --with-gzip=%{l_prefix}/lib/openpkg/gzip \
713 --with-bzip2=%{l_prefix}/lib/openpkg/bzip2 \
714 --disable-nls
715 ${l_make} || exit $?
716 ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $?
717 ) || exit $?
718 l_tar="`pwd`/tar-%{V_tar}/tar"; export l_tar
719 echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
721 # display verbosity header
722 set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x
724 # unpack distribution tarballs
725 ${l_gzip} -dc `SOURCE rpm-%{V_rpm_major}.%{V_rpm_minor}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
726 ${l_gzip} -dc `SOURCE popt-%{V_popt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
727 ${l_gzip} -dc `SOURCE sqlite-%{V_sqlite}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
728 ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
729 ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
730 ${l_gzip} -dc `SOURCE xz-%{V_xz}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
731 ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
732 ${l_gzip} -dc `SOURCE pcre-%{V_pcre}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
733 ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
734 ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
735 ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
736 ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
737 ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz` | ${l_tar} xf - 2>/dev/null || true
738 ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
739 ${l_gzip} -dc `SOURCE libarchive-%{V_libarchive}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
740 ${l_gzip} -dc `SOURCE diffutils-%{V_diffutils}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
741 ${l_gzip} -dc `SOURCE svs-%{V_svs}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
743 # update config.guess/config.sub
744 for dir in curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
745 chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
746 cp config/config.guess $dir/
747 cp config/config.sub $dir/
748 done
750 # display verbosity header
751 set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x
753 # apply OpenPKG patches to distribution trees
754 ( cd rpm-%{V_rpm_major}.%{V_rpm_minor}
755 sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch` | ${l_patch} -p0
756 ) || exit $?
757 ( cd make-%{V_make}
758 ${l_patch} -p0 <`SOURCE make.patch`
759 ) || exit $?
760 ( cd bash-%{V_bash}
761 ${l_patch} -p0 <`SOURCE bash.patch`
762 ${l_patch} -p0 <`SOURCE bash.patch.vendor`
763 sleep 1
764 touch y.tab.[ch]
765 touch configure config.h.in
766 ) || exit $?
767 ( cd beecrypt-%{V_beecrypt}
768 ${l_patch} -p0 <`SOURCE beecrypt.patch`
769 ) || exit $?
770 ( cd perl-%{V_perl}
771 ${l_patch} -p0 <`SOURCE perl.patch`
772 ) || exit $?
773 ( cd openssl-%{V_openssl}
774 ${l_patch} -p0 <`SOURCE openssl.patch`
775 ) || exit $?
776 ( cd popt-%{V_popt}
777 ${l_patch} -p0 <`SOURCE popt.patch`
778 ) || exit $?
779 ( cd sqlite-%{V_sqlite}
780 ${l_patch} -p0 <`SOURCE sqlite.patch`
781 ) || exit $?
782 ( cd curl-%{V_curl}
783 ${l_patch} -p0 <`SOURCE curl.patch`
784 ) || exit $?
785 ( cd pcre-%{V_pcre}
786 ${l_patch} -p0 <`SOURCE pcre.patch`
787 ) || exit $?
788 ( cd diffutils-%{V_diffutils}
789 ${l_patch} -p0 <`SOURCE diffutils.patch`
790 ) || exit $?
791 ( cd libarchive-%{V_libarchive}
792 ${l_patch} -p0 <`SOURCE libarchive.patch`
793 ) || exit $?
794 ( cd zlib-%{V_zlib}
795 ${l_patch} -p0 <`SOURCE zlib.patch`
796 ) || exit $?
797 ( cd xz-%{V_xz}
798 ${l_patch} -p0 <`SOURCE xz.patch`
799 ) || exit $?
801 # display verbosity header
802 set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x
804 # bootstrap GNU make tool
805 ( cd make-%{V_make}
806 CC="${l_cc}" \
807 ./configure \
808 --without-libiconv-prefix \
809 --without-libintl-prefix \
810 --disable-nls \
811 --disable-largefile
812 ${l_make}
813 ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
814 ) || exit $?
815 l_make="`pwd`/make-%{V_make}/make"; export l_make
816 echo "l_make=\"$l_make\"; export l_make" >>.buildenv
818 %build
819 # skip in bootstrap phase 2 (see openpkg.boot)
820 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
822 # switch into a temporary build area
823 cd openpkg-%{version}
824 . ./.buildenv
826 # display verbosity header
827 set +x; VERBOSE "BUILD: Build GNU bash (Bourne-again Shell)"; set -x
829 # build GNU bash tool
830 ( cd bash-%{V_bash}
831 sh $shtool subst \
832 -e 's;@l_openpkg_release@;OpenPKG;' \
833 version.c
834 ( # force disabled wide character support
835 echo "ac_cv_header_wchar_h=no"
836 echo "ac_cv_header_wctype_h=no"
837 echo "ac_cv_func_mbsrtowcs=no"
838 # force disabled internationalization support
839 echo "ac_cv_header_libintl_h=no"
840 echo "ac_cv_func_gettext=no"
841 echo "ac_cv_func_textdomain=no"
842 echo "ac_cv_func_bindtextdomain=no"
843 echo "ac_cv_lib_intl_bindtextdomain=no"
844 # disable building with debug symbols
845 echo "ac_cv_prog_cc_g=no"
846 ) >config.cache
847 AUTOCONF="true"
848 export AUTOCONF
849 CC="${l_cc}"
850 export CC
851 case "$plid" in
852 Darwin/* ) LDFLAGS="-Wl,-search_paths_first" ;;
853 esac
854 ./configure \
855 --cache-file=./config.cache \
856 --prefix=%{l_prefix} \
857 --without-curses \
858 --without-gnu-malloc \
859 --disable-nls
860 ${l_make} || exit $?
861 ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
862 ) || exit $?
864 # display verbosity header
865 set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"; set -x
867 # build BZIP2 library
868 ( cd bzip2-%{V_bzip2}
869 ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
870 ( echo "# libbz2.la - a libtool library file"
871 echo "# Generated by ltmain.sh - GNU libtool x.x.x"
872 echo "dlname=''"
873 echo "library_names=''"
874 echo "old_library='libbz2.a'"
875 echo "dependency_libs=''"
876 echo "current=0"
877 echo "age=0"
878 echo "revision=0"
879 echo "installed=no"
880 echo "dlopen=''"
881 echo "dlpreopen=''"
882 echo "libdir='%{l_prefix}'"
883 ) >libbz2.la
884 ln -s . .libs
885 ) || exit $?
887 # display verbosity header
888 set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"; set -x
890 # build ZLIB library
891 ( cd zlib-%{V_zlib}
892 CC="${l_cc}" CFLAGS="-O" ./configure
893 ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here
894 ) || exit $?
896 # display verbosity header
897 set +x; VERBOSE "BUILD: Build XZ (Compression Library)"; set -x
899 # build XZ library
900 ( cd xz-%{V_xz}
901 opts=""
902 case "$plid" in
903 Darwin/* ) opts="--disable-assembler" ;;
904 esac
905 CC="${l_cc}" \
906 CFLAGS="-O" \
907 ./configure \
908 --prefix=%{l_prefix} \
909 --libdir="%{l_prefix}/lib" \
910 --mandir=%{l_prefix}/man \
911 --without-libiconv-prefix \
912 --without-libintl-prefix \
913 --disable-nls \
914 --disable-shared \
915 $opts
916 ${l_make} || exit $?
917 ) || exit $?
919 # display verbosity header
920 set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x
922 # build OSSP uuid tool
923 ( cd uuid-%{V_uuid}
924 CC="${l_cc}" \
925 CFLAGS="-O" \
926 GREP="grep" \
927 ./configure \
928 --prefix=%{l_prefix} \
929 --disable-shared
930 ${l_make} || exit $?
931 ) || exit $?
933 # display verbosity header
934 set +x; VERBOSE "BUILD: Build Perl (Programming Language)"; set -x
936 # build Perl tool
937 ( cd perl-%{V_perl}
938 chmod -R u+w .
939 sh $shtool subst \
940 -e 's;\(.*for thislib in $libswanted.*\);libswanted=`echo " $libswanted " | sed -e "s/ bind / /g" -e "s/ db / /g" -e "s/ gdbm / /g" -e "s/ iconv / /g"`\; \1;' \
941 -e 's;package=perl5;package=perl;' \
942 Configure
943 sh $shtool subst \
944 -e 's; */usr/local/lib;;' \
945 hints/freebsd.sh hints/netbsd.sh
946 libdirs=""
947 for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
948 [ -d $dir ] && libdirs="$libdirs $dir"
949 done
950 ./Configure \
951 -d -e -s \
952 -Dprefix=%{l_prefix} \
953 -Dvendorprefix=%{l_prefix} \
954 -Dinstallprefix=%{l_prefix} \
955 -Dinstallstyle="lib/perl5" \
956 -Dman1dir=%{l_prefix}/man/man1 \
957 -Dman3dir=%{l_prefix}/man/man3 \
958 -Dcc="${l_cc}" -Uoptimize \
959 -Dlocincpth="%{l_prefix}/include" \
960 -Dloclibpth="%{l_prefix}/lib" \
961 -Dldflags="-L""%{l_prefix}/lib" \
962 -Dlibpth="$libdirs" \
963 -Dglibpth="$libdirs" \
964 -Dscriptdir="%{l_prefix}/bin" \
965 -Uinstallusrbinperl \
966 -Adefine:useshrplib='false' \
967 -Ui_malloc -Ui_iconv -Ui_db
968 case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
969 *-cygwin* ) miniperl="miniperl.exe" ;;
970 * ) miniperl="miniperl" ;;
971 esac
972 ${l_make} $miniperl || exit $?
973 rm -f *.o >/dev/null 2>&1 || true
974 ) || exit $?
975 l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl
976 echo "l_perl=\"$l_perl\"; export l_perl" >>.buildenv
978 # display verbosity header
979 set +x; VERBOSE "BUILD: Build OpenSSL (Crypography and SSL/TLS Toolkit)"; set -x
981 # build OpenSSL toolkit
982 ( cd openssl-%{V_openssl}
983 sh $shtool subst \
984 -e 's;-m64 *;;g' \
985 -e 's;-xarch=amd64 *;;g' \
986 -e 's;-m486;-march=i486;g' \
987 -e 's;BN_LLONG *;;' \
988 Configure
989 sh $shtool subst \
990 -e 's;test "$OSTYPE" = msdosdjgpp;true;' \
991 util/point.sh
992 sh $shtool subst \
993 -e "1s;^.*\$;#!$l_perl;" \
994 Configure `find . -name "*.pl" -print`
995 opts=""
996 case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
997 *-solaris* ) opts="-lnsl -lsocket" ;;
998 esac
999 case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
1000 amd64-* ) opts="$opts -fPIC" ;;
1001 ia64-* ) opts="$opts -fPIC" ;;
1002 sparc64-freebsd* ) opts="$opts -fPIC" ;;
1003 esac
1004 CC="${l_cc}" \
1005 PERL="${l_perl}" \
1006 ./config \
1007 --prefix=%{l_prefix} \
1008 no-asm no-shared no-dso \
1009 no-zlib no-idea no-threads no-krb5 no-hw \
1010 $opts
1011 ${l_make} CC="${l_cc}" build_libs build_apps || exit $?
1012 ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $?
1013 ) || exit $?
1015 # build BSD libarchive
1016 ( cd libarchive-%{V_libarchive}
1017 sh $shtool subst \
1018 -e 's;\(AM_CFLAGS =\) -Wall;\1;' \
1019 Makefile.in
1020 CC="${l_cc}" \
1021 CFLAGS="-O -D_POSIX_PTHREAD_SEMANTICS" \
1022 CPPFLAGS="-I`pwd`/../zlib-%{V_zlib} -I`pwd`/../bzip2-%{V_bzip2} -I`pwd`/../xz-%{V_xz}/src/liblzma/api -I`pwd`/../openssl-%{V_openssl}/include" \
1023 LDFLAGS="-L`pwd`/../zlib-%{V_zlib} -L`pwd`/../bzip2-%{V_bzip2} -L`pwd`/../xz-%{V_xz}/src/liblzma/.libs -L`pwd`/../openssl-%{V_openssl}" \
1024 GREP="grep" \
1025 ./configure \
1026 --prefix=%{l_prefix} \
1027 --libdir="%{l_prefix}/lib" \
1028 --enable-bsdtar \
1029 --enable-bsdcpio \
1030 --with-zlib \
1031 --with-bz2lib \
1032 --with-lzma \
1033 --without-lzmadec \
1034 --with-openssl \
1035 --without-xml2 \
1036 --without-expat \
1037 --without-iconv \
1038 --disable-shared
1039 ${l_make} || exit $?
1040 ( mv bsdcpio bsdtar ..; ${l_make} clean || true; mv ../bsdcpio ../bsdtar . ) || exit $?
1041 ) || exit $?
1043 # build GNU diffutils
1044 ( cd diffutils-%{V_diffutils}
1045 CC="${l_cc}" \
1046 CFLAGS="-O" \
1047 ./configure \
1048 --prefix=%{l_prefix} \
1049 --disable-nls
1050 touch man/diff.1 man/diff3.1 && ${l_make} || exit $?
1051 ( mv src/diff src/diff3 src/sdiff src/cmp ..
1052 ${l_make} clean || true
1053 mv ../diff ../diff3 ../sdiff ../cmp .
1054 ) || exit $?
1055 ) || exit $?
1057 # display verbosity header
1058 set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x
1060 # build cURL tool
1061 ( cd curl-%{V_curl}
1062 ( echo 'ac_cv_header_openssl_engine_h=no'
1063 echo 'lt_cv_prog_compiler_c_o_F77=no'
1064 echo 'lt_cv_sys_max_cmd_len=100'
1065 ) >config.cache
1066 CC="${l_cc}" \
1067 CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
1068 CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
1069 LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
1070 GREP="grep" \
1071 ./configure \
1072 --cache-file=./config.cache \
1073 --libdir="%{l_prefix}/lib" \
1074 --without-libidn \
1075 --disable-shared \
1076 --disable-thread \
1077 --disable-ipv6 \
1078 --disable-ldap \
1079 --with-zlib=`pwd`/../zlib-%{V_zlib} \
1080 --with-ssl=`pwd`/../openssl-%{V_openssl} \
1081 --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509
1082 ${l_make} || exit $?
1083 mv src/curl ..; ${l_make} clean || true; mv ../curl .
1084 ) || exit $?
1086 # build PCRE library
1087 ( cd pcre-%{V_pcre}
1088 CC="${l_cc}" \
1089 CFLAGS="-O" \
1090 GREP="grep" \
1091 ./configure \
1092 --disable-cpp \
1093 --disable-utf8 \
1094 --disable-shared
1095 ${l_make} || exit $?
1096 ) || exit $?
1098 # display verbosity header
1099 set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"; set -x
1101 # build BeeCrypt library
1102 ( cd beecrypt-%{V_beecrypt}
1103 sh $shtool subst \
1104 -e 's;^[ ][ ]*#;#;' \
1105 aes.c base64.c blockmode.c blowfish.c entropy.c fips186.c md4.c md5.c \
1106 mp.c mtprng.c ripemd128.c ripemd160.c ripemd256.c ripemd320.c rsa.c \
1107 sha1.c sha224.c sha256.c sha2k64.c sha384.c sha512.c timestamp.c
1108 sh $shtool subst \
1109 -e 's;cppglue\.lo;;g' \
1110 -e 's;cppglue\.cxx;;g' \
1111 -e '/^CXX = /s;@CXX@;@CC@;g' \
1112 Makefile.in
1113 ( echo 'ac_cv_have_dev_dsp=no'
1114 echo 'ac_cv_have_dev_audio=no'
1115 echo 'ac_cv_func_gettimeofday=yes'
1116 echo 'bc_cv_as_noexecstack=no'
1117 ) >config.cache
1118 CC="${l_cc}" \
1119 CFLAGS="-O" \
1120 ./configure \
1121 --cache-file=./config.cache \
1122 --prefix=%{l_prefix} \
1123 --libdir="%{l_prefix}/lib" \
1124 --with-cpu=none \
1125 --with-arch=none \
1126 --without-cplusplus \
1127 --without-java \
1128 --without-python \
1129 --disable-expert-mode \
1130 --disable-aio \
1131 --disable-openmp \
1132 --disable-threads \
1133 --disable-shared
1134 ${l_make} || exit $?
1135 cp .libs/libbeecrypt.a .
1136 ) || exit $?
1138 # display verbosity header
1139 set +x; VERBOSE "BUILD: Build POPT (Option Parsing Library)"; set -x
1141 # build POPT library
1142 ( cd popt-%{V_popt}
1143 CC="${l_cc}" \
1144 CFLAGS="-O" \
1145 CPPFLAGS="-DOPENPKG -DPOPT_fprintf=fprintf" \
1146 GREP="grep" \
1147 ./configure \
1148 --prefix=%{l_prefix} \
1149 --libdir="%{l_prefix}/lib" \
1150 --disable-shared \
1151 --with-included-gettext \
1152 --without-libintl-prefix \
1153 --without-libiconv-prefix \
1154 --disable-nls
1155 ${l_make}
1156 ) || exit $?
1158 # display verbosity header
1159 set +x; VERBOSE "BUILD: Build SQLite (RDBMS Library)"; set -x
1161 # build SQLite library
1162 ( cd sqlite-%{V_sqlite}
1163 CC="${l_cc}" \
1164 CFLAGS="-O" \
1165 LIBS="-lm" \
1166 GREP="grep" \
1167 ./configure \
1168 --prefix=%{l_prefix} \
1169 --libdir="%{l_prefix}/lib" \
1170 --disable-threadsafe \
1171 --disable-readline \
1172 --disable-debug \
1173 --disable-amalgamation \
1174 --disable-tcl \
1175 --disable-shared
1176 ${l_make}
1177 ) || exit $?
1179 # display verbosity header
1180 set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x
1182 # build RPM
1183 ( br=`pwd`
1184 cd rpm-%{V_rpm_major}.%{V_rpm_minor}
1186 # remove unused and undefined methods
1187 sh $shtool subst \
1188 -e 's;^\(#include *<[^>][^>]*>\);/*\1*/;g' \
1189 rpmconstant/rpmconstant.h
1191 # Avoid bugs causing 'fatal problems'
1192 sh $shtool subst \
1193 -e 's;\(rc = INTEGRITY\)_ERROR;\1_OK;g' \
1194 -e 's;integrity_check_message("%s\\n", result);((void)0);g' \
1195 rpmqv.c
1197 # provide nonstandard constructs
1198 cat > nonstandard.h <<EOF
1199 /* MSvB: define missing nonstandard GCC builtin extensions */
1200 #ifndef __GNUC__
1201 #define __builtin_expect(e,n) (e)
1202 #endif /* ifndef __GNUC__ */
1203 EOF
1205 # cheat GNU Autoconf
1206 ( echo 'ac_cv_path_MSGFMT=:'
1207 echo 'ac_cv_path_GMSGFMT=:'
1208 echo 'ac_cv_path_XGETTEXT=:'
1209 echo 'ac_cv_path_MSGMERGE=:'
1210 echo "ac_cv_header_getopt_h=no"
1211 echo "ac_cv_lib_gz_gzread=no"
1212 ) >config.cache
1214 # use miniperl
1215 PERL="${l_perl}"
1216 export PERL
1218 # set build tool flags
1219 CC="${l_cc}"
1220 CFLAGS=""
1221 CPPFLAGS="-DRPM_VENDOR_OPENPKG"
1222 LDFLAGS=""
1223 LIBS=""
1224 LIBS="$LIBS -lm"
1225 export CC
1226 export CFLAGS
1227 export CPPFLAGS
1228 export LDFLAGS
1229 export LIBS
1231 # special platform workarounds
1232 GREP="grep"
1233 export GREP
1235 # determine POPT option, RPM macros and Lua script file paths
1236 RPMPOPT="%{l_prefix}/lib/openpkg/rpmpopt"
1237 RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt"
1238 RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt.d/*"
1239 RPMPOPT="$RPMPOPT:~/.openpkg/rpmpopt"
1240 RPMPOPT="$RPMPOPT:@../../.openpkg/rpmpopt"
1241 RPMPOPT="$RPMPOPT:@../.openpkg/rpmpopt"
1242 RPMPOPT="$RPMPOPT:@./.openpkg/rpmpopt"
1243 RPMMACROS="%{l_prefix}/lib/openpkg/rpmmacros"
1244 RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros"
1245 RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros.d/*"
1246 RPMMACROS="$RPMMACROS:~/.openpkg/rpmmacros"
1247 RPMMACROS="$RPMMACROS:@../../.openpkg/rpmmacros"
1248 RPMMACROS="$RPMMACROS:@../.openpkg/rpmmacros"
1249 RPMMACROS="$RPMMACROS:@./.openpkg/rpmmacros"
1250 RPMLUA="%{l_prefix}/lib/openpkg/rpmlua"
1251 RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua"
1252 RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua.d/*"
1253 RPMLUA="$RPMLUA:~/.openpkg/rpmlua"
1254 RPMLUA="$RPMLUA:@../../.openpkg/rpmlua"
1255 RPMLUA="$RPMLUA:@../.openpkg/rpmlua"
1256 RPMLUA="$RPMLUA:@./.openpkg/rpmlua"
1258 # parametrize integrity checking framework
1259 sh $shtool subst \
1260 -e "s;0000000000000000000000000000000000000000;7D121A8FC05DC18A4329E9EF67042EC961B7AE34;" \
1261 -e "s;0\\.0\\.0;0.9.0;" \
1262 rpmqv.c
1264 # disable building of any tests
1265 # (mainly because those would fail because of integrity checking anyway)
1266 sh $shtool subst \
1267 -e 's;tools scripts tests doc;tools scripts doc;' \
1268 Makefile.in
1270 # configure program
1271 ./configure \
1272 --cache-file=./config.cache \
1273 --prefix=%{l_prefix} \
1274 --libdir="%{l_prefix}/lib" \
1275 --mandir="%{l_prefix}/man" \
1276 --includedir="%{l_prefix}/include/openpkg" \
1277 --with-name="OpenPKG RPM" \
1278 --with-path-cfg="%{l_prefix}/etc/openpkg" \
1279 --with-path-rpmpopt="$RPMPOPT" \
1280 --with-path-macros="$RPMMACROS" \
1281 --with-path-rpmlua="$RPMLUA" \
1282 --with-path-lib="%{l_prefix}/lib/openpkg" \
1283 --with-path-locale="%{l_prefix}/share/openpkg/locale" \
1284 --with-path-database="%{l_prefix}/RPM/DB" \
1285 --with-path-sources="%{l_prefix}/RPM" \
1286 --with-bugreport="openpkg-users@openpkg.org" \
1287 --with-beecrypt="$br/beecrypt-%{V_beecrypt}" \
1288 --with-openssl="$br/openssl-%{V_openssl}" \
1289 --with-zlib="$br/zlib-%{V_zlib}" \
1290 --with-bzip2="$br/bzip2-%{V_bzip2}" \
1291 --with-popt="$br/popt-%{V_popt}" \
1292 --with-sqlite="$br/sqlite-%{V_sqlite}" \
1293 --with-pcre="$br/pcre-%{V_pcre}" \
1294 --with-uuid="$br/uuid-%{V_uuid}" \
1295 --with-lua="internal" \
1296 --with-db="internal" \
1297 --without-db-rpc \
1298 --without-db-largefile \
1299 --with-db-tools-integrated \
1300 --with-db-mutex="UNIX/fcntl" \
1301 --without-file \
1302 --without-neon \
1303 --without-pthreads \
1304 --without-libelf \
1305 --without-selinux \
1306 --without-perl \
1307 --without-python \
1308 --without-apidocs \
1309 --disable-build-warnings \
1310 --disable-build-extlibdep \
1311 --disable-build-intlibdep \
1312 --disable-build-lafiles \
1313 --disable-shared \
1314 --disable-rpath \
1315 --disable-nls
1317 # build program
1318 ${l_make}
1319 ) || exit $?
1321 # display verbosity header
1322 set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Setuid Wrapper)"; set -x
1324 # build "openpkg" executable
1325 ${l_make} -f `SOURCE openpkg.mk` \
1326 CC="${l_cc}" \
1327 OPENPKG_PREFIX="%{l_prefix}" \
1328 OPENPKG_SUSR="%{l_susr}" \
1329 OPENPKG_MUSR="%{l_musr}" \
1330 OPENPKG_DOT_C="`SOURCE openpkg.c`"
1332 # display verbosity header
1333 set +x; VERBOSE "BUILD: Build OpenPKG Mutual Exclusion (MutEx) Utility"; set -x
1335 # build "mutex" executable
1336 ${l_make} -f `SOURCE mutex.mk` \
1337 CC="${l_cc}" \
1338 CPPFLAGS="-Ipopt-%{V_popt}" \
1339 LDFLAGS="-Lpopt-%{V_popt} -Lpopt-%{V_popt}/.libs" \
1340 MUTEX_DOT_C="`SOURCE mutex.c`"
1342 %install
1343 # skip in bootstrap phase 2 (see openpkg.boot)
1344 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
1346 # switch into a temporary build area
1347 cd openpkg-%{version}
1348 . ./.buildenv
1350 # display verbosity header
1351 set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
1353 # create installation hierarchy
1354 rm -rf $RPM_BUILD_ROOT
1355 sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
1356 for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
1357 test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
1358 mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
1359 done
1360 for i in 1 2 3 4 5 6 7 8 9; do
1361 test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
1362 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
1363 test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
1364 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
1365 done
1366 for dir in PKG bin etc include info lib man sbin; do
1367 test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
1368 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
1369 done
1370 for i in 1 2 3 4 5 6 7 8 9; do
1371 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
1372 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
1373 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
1374 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
1375 done
1376 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
1377 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
1378 for dir in SRC PKG DB TR TMP; do
1379 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
1380 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
1381 done
1382 mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
1384 # display verbosity header
1385 set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
1387 # install RPM into installation hierarchy
1388 ( cd rpm-%{V_rpm_major}.%{V_rpm_minor}
1389 ${l_make} install DESTDIR="$RPM_BUILD_ROOT"
1390 cp lua/rpmlua $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
1391 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
1392 ) || exit $?
1394 # postadjust RPM installation
1395 mv $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/macros \
1396 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmmacros
1398 # display verbosity header
1399 set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
1401 # add additional development files
1402 cp rpm-%{V_rpm_major}.%{V_rpm_minor}/rpmio/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1403 cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1404 cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1405 cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
1406 cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1407 cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
1408 cp beecrypt-%{V_beecrypt}/include/beecrypt/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1409 cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
1410 cp popt-%{V_popt}/popt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1411 cp popt-%{V_popt}/.libs/libpopt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
1412 cp sqlite-%{V_sqlite}/sqlite3.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1413 cp sqlite-%{V_sqlite}/.libs/libsqlite3.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmsqlite3.a
1415 # display verbosity header
1416 set +x; VERBOSE "INSTALL: Postadjust Installation"; set -x
1418 # move C API into custom locations
1419 mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
1420 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1421 mv $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/rpm.pc \
1422 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1423 # FIXME: does the rpm.pc really work this way?
1425 # move rpm tool to custom location
1426 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
1427 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1428 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
1429 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
1430 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm >/dev/null 2>&1 || true
1432 # move rpm2cpio tool to custom location
1433 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
1434 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
1435 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
1436 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
1437 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio >/dev/null 2>&1 || true
1439 # move rpmconstant tool to custom location
1440 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmconstant \
1441 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant
1442 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmconstant.8 \
1443 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant.8
1444 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant >/dev/null 2>&1 || true
1446 # move rpmcache tool to custom location
1447 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmcache \
1448 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache
1449 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmcache.8 \
1450 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache.8
1451 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache >/dev/null 2>&1 || true
1453 # move rpmgrep tool to custom location
1454 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmgrep \
1455 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep
1456 mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/rpmgrep.1 \
1457 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep.1
1458 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep >/dev/null 2>&1 || true
1460 # move manual pages to custom location
1461 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmdeps.8 \
1462 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmdeps.8
1463 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmgraph.8 \
1464 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgraph.8
1465 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
1466 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
1468 # display verbosity header
1469 set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
1471 # strip RPM installation
1472 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
1473 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
1474 for file in rpmbuild gendiff; do
1475 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
1476 done
1477 for dir in RPMS SRPMS SPEC SOURCES BUILD; do
1478 rm -rf $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir >/dev/null 2>&1 || true
1479 done
1480 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
1481 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
1482 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
1483 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig >/dev/null 2>&1 || true
1484 for file in \
1485 brp-compress brp-python-bytecompile brp-java-gcjcompile brp-strip brp-strip-comment-note \
1486 brp-nobuildrootpath brp-strip-shared brp-strip-static-archive brp-sparc64-linux check-files \
1487 cross-build executabledeps.sh find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
1488 find-provides.perl find-requires.perl getpo.sh http.req javadeps.sh libtooldeps.sh mono-find-provides \
1489 mono-find-requires osgideps.pl pkgconfigdeps.sh perldeps.pl perl.prov perl.req pythondeps.sh \
1490 php.prov php.req rpmdb_loadcvt rpm.daily rpm.log rpm.xinetd symclash.py symclash.sh tgpg u_pkg.sh \
1491 vpkg-provides.sh vpkg-provides2.sh install-sh mkinstalldirs; do
1492 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
1493 done
1494 for file in \
1495 db_archive db_checkpoint db_deadlock db_dump db_hotbackup db_load \
1496 db_printlog db_recover db_stat db_upgrade db_verify; do
1497 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
1498 done
1500 # display verbosity header
1501 set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
1503 # install lsync tool
1504 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1505 <`SOURCE lsync` \
1506 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1507 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1508 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1509 <`SOURCE dot.lsyncrc` \
1510 >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
1511 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1512 <`SOURCE lsync.8` \
1513 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
1515 # install rpm-config tool
1516 ( l_prefix="%{l_prefix}"
1517 l_cc="%{l_cc}"
1518 l_cflags=""
1519 l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
1520 l_ldflags="-L${l_prefix}/lib/openpkg"
1521 l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmmisc -lrpmsqlite3 -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
1522 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1523 -e "s:@l_cc@:$l_cc:g" \
1524 -e "s:@l_cflags@:$l_cflags:g" \
1525 -e "s:@l_cppflags@:$l_cppflags:g" \
1526 -e "s:@l_ldflags@:$l_ldflags:g" \
1527 -e "s:@l_libs@:$l_libs:g" \
1528 -e "s:@l_version@:%{V_rpm_major}.%{V_rpm_minor}:g" \
1529 <`SOURCE rpm-config.sh` \
1530 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1531 ) || exit $?
1532 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1533 sed -e "s:RPM_VERSION:%{V_rpm_major}.%{V_rpm_minor}:g" \
1534 <`SOURCE rpm-config.8` \
1535 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
1537 # install OpenPKG registry commands
1538 mv $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
1539 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
1540 sed -e "s;@l_prefix@;%{l_prefix};g" \
1541 `SOURCE rpm.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1542 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1543 sed -e "s;@l_prefix@;%{l_prefix};g" \
1544 `SOURCE register.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1545 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1546 cp `SOURCE register.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
1548 # allow GNU shtool to be called as "openpkg shtool" from external, too.
1549 sed -e "s;@l_prefix@;%{l_prefix};g" \
1550 `SOURCE shtool.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
1551 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
1553 # install OpenPKG tool chain command subset
1554 cp `SOURCE curl.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
1555 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
1556 cp `SOURCE build.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1557 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1558 cp `SOURCE build.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
1559 cp `SOURCE index.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
1560 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
1561 cp `SOURCE index.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.8
1562 cp `SOURCE search.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
1563 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
1564 cp `SOURCE search.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.8
1565 cp `SOURCE mirror.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
1566 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
1567 cp `SOURCE mirror.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.8
1568 cp `SOURCE makeproxy.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
1569 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
1570 cp `SOURCE makeproxy.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.8
1571 cp `SOURCE lint-fsl.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
1572 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
1573 cp `SOURCE lint-rc.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
1574 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
1575 cp `SOURCE lint-rpm.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
1576 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
1577 cp `SOURCE lint-spec.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
1578 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
1579 cp `SOURCE dev.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
1580 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
1581 cp `SOURCE dev.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.8
1582 cp `SOURCE sea.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
1583 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
1584 cp `SOURCE sea.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.8
1585 cp `SOURCE stack.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
1586 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
1587 cp `SOURCE stack.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.8
1589 # install RPM extension
1590 ( cd perl-%{V_perl}
1591 cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1592 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1593 ) || exit $?
1594 ( cd openssl-%{V_openssl}
1595 cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1596 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1597 ) || exit $?
1598 ( cd curl-%{V_curl}
1599 cp curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1600 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1601 ) || exit $?
1602 ( cd bzip2-%{V_bzip2}
1603 cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1604 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1605 ) || exit $?
1606 ( cd gzip-%{V_gzip}
1607 cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1608 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1609 ) || exit $?
1610 ( cd xz-%{V_xz}
1611 cp src/xz/xz $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
1612 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
1613 ) || exit $?
1614 ( cd patch-%{V_patch}
1615 cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1616 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1617 ) || exit $?
1618 ( cd tar-%{V_tar}
1619 cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1620 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1621 ) || exit $?
1622 ( cd bash-%{V_bash}
1623 cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1624 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1625 ) || exit $?
1626 ( cd uuid-%{V_uuid}
1627 cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1628 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1629 ) || exit $?
1630 ( cd sqlite-%{V_sqlite}
1631 cp sqlite3 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
1632 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
1633 ) || exit $?
1634 ( cd libarchive-%{V_libarchive}
1635 cp bsdcpio $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
1636 cp bsdtar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
1637 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
1638 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
1639 ) || exit $?
1640 ( cd diffutils-%{V_diffutils}
1641 ${l_strip} diff diff3 sdiff cmp
1642 cp diff diff3 sdiff cmp $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1643 ) || exit $?
1644 ( cd svs-%{V_svs}
1645 sed -e "s;/bin/sh;%{l_prefix}/lib/openpkg/bash;" \
1646 -e "s;^\( *\)\(diff \);\1%{l_prefix}/lib/openpkg/\2;" \
1647 <svs.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
1648 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
1649 cp svs.1 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs.1
1650 ) || exit $?
1651 sed -e "s;@l_prefix@;%{l_prefix};g" \
1652 -e "s;@l_musr@;%{l_musr};g" \
1653 -e "s;@l_mgrp@;%{l_mgrp};g" \
1654 <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1655 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1656 sed -e "s;@l_prefix@;%{l_prefix};g" \
1657 <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
1658 sed -e "s;@l_prefix@;%{l_prefix};g" \
1659 <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1660 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1661 sed -e "s;@l_prefix@;%{l_prefix};g" \
1662 <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
1663 sed -e "s;@l_prefix@;%{l_prefix};g" \
1664 -e "s;@l_musr@;%{l_musr};g" \
1665 -e "s;@l_mgrp@;%{l_mgrp};g" \
1666 <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1667 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1668 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1669 <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1670 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1671 sed -e "s;@l_prefix@;%{l_prefix};g" \
1672 -e "s;@l_musr@;%{l_musr};g" \
1673 -e "s;@l_mgrp@;%{l_mgrp};g" \
1674 <`SOURCE license.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
1675 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
1676 sed -e "s;@l_prefix@;%{l_prefix};g" \
1677 <`SOURCE license.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license.8
1679 # install OpenPKG tool chain execution frontend and execution wrapper
1680 cp openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1681 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1682 chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1683 sed -e "s;@l_prefix@;%{l_prefix};g" \
1684 <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1685 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1686 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1687 <`SOURCE openpkg.1` \
1688 >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
1690 # install more OpenPKG tool chain commands
1691 sed -e "s;@l_prefix@;%{l_prefix};g" \
1692 <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1693 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1695 # install OpenPKG mutex utility
1696 cp mutex $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/mutex
1698 # install an own copy of shtool
1699 cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1700 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1702 # display verbosity header
1703 set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
1705 # install a few README files
1706 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1707 <`SOURCE root.README` \
1708 >$RPM_BUILD_ROOT%{l_prefix}/README
1709 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1710 <`SOURCE local.README` \
1711 >$RPM_BUILD_ROOT%{l_prefix}/local/README
1713 # install Bash environment
1714 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1715 <`SOURCE dot.bashrc` \
1716 >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
1717 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1718 <`SOURCE dot.bash_login` \
1719 >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
1721 # install Runcommand files
1722 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1723 -e "s:@l_susr@:%{l_susr}:g" \
1724 -e "s:@l_musr@:%{l_musr}:g" \
1725 <`SOURCE rc` \
1726 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
1727 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
1728 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1729 <`SOURCE rc.conf` \
1730 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1731 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1732 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1733 <`SOURCE rc.func` \
1734 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1735 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1736 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
1737 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1738 -e "s:@l_musr@:%{l_musr}:g" \
1739 <`SOURCE rc.openpkg` \
1740 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1741 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1742 ( echo "#!/bin/sh"
1743 echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
1744 ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1745 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1746 ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
1747 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
1748 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1749 <`SOURCE rc.8` \
1750 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
1752 # create configuration directory
1753 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
1754 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
1756 # install platform identification file
1757 sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
1758 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1759 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1761 # install UUID configuration file (ghost)
1762 touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1763 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1765 # install registry configuration files (ghost)
1766 touch \
1767 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
1768 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
1769 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
1770 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
1771 chmod 644 \
1772 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
1773 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
1774 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
1775 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
1777 # install default managers configuration file
1778 ( echo "##"
1779 echo "## managers -- OpenPKG Instance Managers"
1780 echo "##"
1781 echo ""
1782 echo "%{l_susr}"
1783 echo "%{l_musr}"
1784 echo ""
1785 ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
1787 # install default release information file
1788 release_tag=""
1789 release_url=""
1790 l_stack=""; [ ".%{?l_stack:set}" = .set ] && l_stack="%{l_stack}"
1791 case "$l_stack" in
1792 http: | https: | ftp: | file: )
1793 release_url="$l_stack"
1794 ;;
1795 [a-zA-Z]* )
1796 release_tag="$l_stack"
1797 ;;
1798 esac
1799 ( echo "##"
1800 echo "## release -- OpenPKG Release Information"
1801 echo "##"
1802 echo ""
1803 echo "TAG=$release_tag"
1804 echo "URL=$release_url"
1805 echo ""
1806 ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/release
1808 # install overriding RPM configuration files
1809 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1810 <`SOURCE rpmpopt` \
1811 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt
1812 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1813 -e "s:@l_prefix_static@:%{l_prefix}:g" \
1814 -e "s;@l_build_path@;$l_build_path;g" \
1815 -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
1816 -e "s;@l_build_ulim@;$l_build_ulim;g" \
1817 -e "s;@l_unprivileged@;$l_unprivileged;g" \
1818 -e "s:@TAG@:$tag:g" \
1819 -e "s:@SUSR@:$susr:g" \
1820 -e "s:@SGRP@:$sgrp:g" \
1821 -e "s:@MUSR@:$musr:g" \
1822 -e "s:@MGRP@:$mgrp:g" \
1823 -e "s:@RUSR@:$rusr:g" \
1824 -e "s:@RGRP@:$rgrp:g" \
1825 -e "s:@NUSR@:$nusr:g" \
1826 -e "s:@NGRP@:$ngrp:g" \
1827 <`SOURCE rpmmacros` \
1828 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
1829 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1830 <`SOURCE rpmlua` \
1831 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua
1832 cp `SOURCE openpkg.org.pgp` \
1833 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
1834 cp `SOURCE openpkg.com.pgp` \
1835 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
1836 cp `SOURCE openpkg.net.pgp` \
1837 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
1839 # install license data
1840 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d || \
1841 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d
1842 cp `SOURCE license-BOOT.txt` \
1843 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/BOOT
1844 cp `SOURCE license-COMMUNITY.txt` \
1845 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/COMMUNITY
1846 cp `SOURCE license-EVAL.txt` \
1847 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EVAL
1848 cp `SOURCE license-EXAMPLE.txt` \
1849 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EXAMPLE
1850 cp `SOURCE license-PROMO.txt` \
1851 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/PROMO
1852 cp `SOURCE license-RECOVERY.txt` \
1853 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/RECOVERY
1854 cp `SOURCE license.lua` \
1855 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/license.lua
1856 touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license
1858 # provide directories for easy overriding of RPM configuration files
1859 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d || \
1860 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d
1861 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d || \
1862 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d
1863 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d || \
1864 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d
1866 # display verbosity header
1867 set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
1869 %files
1870 %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
1871 %{l_prefix}/README
1872 %config(noreplace) %{l_prefix}/.bashrc
1873 %config(noreplace) %{l_prefix}/.bash_login
1874 %dir %{l_prefix}/RPM
1875 %dir %{l_prefix}/RPM/SRC
1876 %dir %{l_prefix}/RPM/PKG
1877 %dir %{l_prefix}/RPM/TR
1878 %dir %{l_prefix}/RPM/DB
1879 %dir %{l_prefix}/RPM/TMP
1880 %dir %{l_prefix}/cgi
1881 %dir %{l_prefix}/bin
1882 %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
1883 %dir %{l_prefix}/etc
1884 %{l_prefix}/etc/rc
1885 %config(noreplace) %{l_prefix}/etc/rc.conf
1886 %{l_prefix}/etc/rc.func
1887 %dir %{l_prefix}/etc/rc.d
1888 %{l_prefix}/etc/rc.d/rc.openpkg
1889 %dir %{l_prefix}/etc/openpkg
1890 %ghost %{l_prefix}/etc/openpkg/license
1891 %dir %{l_prefix}/etc/openpkg/license.d
1892 %{l_prefix}/etc/openpkg/license.d/BOOT
1893 %{l_prefix}/etc/openpkg/license.d/COMMUNITY
1894 %{l_prefix}/etc/openpkg/license.d/EVAL
1895 %{l_prefix}/etc/openpkg/license.d/EXAMPLE
1896 %{l_prefix}/etc/openpkg/license.d/PROMO
1897 %{l_prefix}/etc/openpkg/license.d/RECOVERY
1898 %ghost %{l_prefix}/etc/openpkg/uuid
1899 %config %{l_prefix}/etc/openpkg/release
1900 %config %{l_prefix}/etc/openpkg/platform
1901 %config %{l_prefix}/etc/openpkg/rpmmacros
1902 %config %{l_prefix}/etc/openpkg/rpmpopt
1903 %config %{l_prefix}/etc/openpkg/rpmlua
1904 %dir %{l_prefix}/etc/openpkg/rpmmacros.d
1905 %dir %{l_prefix}/etc/openpkg/rpmpopt.d
1906 %dir %{l_prefix}/etc/openpkg/rpmlua.d
1907 %ghost %{l_prefix}/etc/openpkg/register.conf
1908 %ghost %{l_prefix}/etc/openpkg/register.prep
1909 %ghost %{l_prefix}/etc/openpkg/register.tran
1910 %ghost %{l_prefix}/etc/openpkg/register.util
1911 %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
1912 %{l_prefix}/etc/openpkg/openpkg.org.pgp
1913 %{l_prefix}/etc/openpkg/openpkg.com.pgp
1914 %{l_prefix}/etc/openpkg/openpkg.net.pgp
1915 %dir %{l_prefix}/include
1916 %dir %{l_prefix}/include/openpkg
1917 %dir %{l_prefix}/include/openpkg/rpm
1918 %{l_prefix}/include/openpkg/rpm/argv.h
1919 %{l_prefix}/include/openpkg/rpm/beecrypt.h
1920 %{l_prefix}/include/openpkg/rpm/bzlib.h
1921 %{l_prefix}/include/openpkg/rpm/db.h
1922 %{l_prefix}/include/openpkg/rpm/envvar.h
1923 %{l_prefix}/include/openpkg/rpm/fs.h
1924 %{l_prefix}/include/openpkg/rpm/fts.h
1925 %{l_prefix}/include/openpkg/rpm/glob.h
1926 %{l_prefix}/include/openpkg/rpm/mire.h
1927 %{l_prefix}/include/openpkg/rpm/misc.h
1928 %{l_prefix}/include/openpkg/rpm/pkgio.h
1929 %{l_prefix}/include/openpkg/rpm/popt.h
1930 %{l_prefix}/include/openpkg/rpm/rpm4compat.h
1931 %{l_prefix}/include/openpkg/rpm/rpmal.h
1932 %{l_prefix}/include/openpkg/rpm/rpmbc.h
1933 %{l_prefix}/include/openpkg/rpm/rpmbuild.h
1934 %{l_prefix}/include/openpkg/rpm/rpmcb.h
1935 %{l_prefix}/include/openpkg/rpm/rpmcli.h
1936 %{l_prefix}/include/openpkg/rpm/rpmconstant.h
1937 %{l_prefix}/include/openpkg/rpm/rpmdav.h
1938 %{l_prefix}/include/openpkg/rpm/rpmdb.h
1939 %{l_prefix}/include/openpkg/rpm/rpmds.h
1940 %{l_prefix}/include/openpkg/rpm/rpmevr.h
1941 %{l_prefix}/include/openpkg/rpm/rpmfc.h
1942 %{l_prefix}/include/openpkg/rpm/rpmfi.h
1943 %{l_prefix}/include/openpkg/rpm/rpmgc.h
1944 %{l_prefix}/include/openpkg/rpm/rpmgi.h
1945 %{l_prefix}/include/openpkg/rpm/rpmhash.h
1946 %{l_prefix}/include/openpkg/rpm/rpmio-stub.h
1947 %{l_prefix}/include/openpkg/rpm/rpmio.h
1948 %{l_prefix}/include/openpkg/rpm/rpmiotypes.h
1949 %{l_prefix}/include/openpkg/rpm/rpmku.h
1950 %{l_prefix}/include/openpkg/rpm/rpmlib.h
1951 %{l_prefix}/include/openpkg/rpm/rpmlog.h
1952 %{l_prefix}/include/openpkg/rpm/rpmmacro.h
1953 %{l_prefix}/include/openpkg/rpm/rpmmg.h
1954 %{l_prefix}/include/openpkg/rpm/rpmns.h
1955 %{l_prefix}/include/openpkg/rpm/rpmnss.h
1956 %{l_prefix}/include/openpkg/rpm/rpmpgp.h
1957 %{l_prefix}/include/openpkg/rpm/rpmps.h
1958 %{l_prefix}/include/openpkg/rpm/rpmspec.h
1959 %{l_prefix}/include/openpkg/rpm/rpmsq.h
1960 %{l_prefix}/include/openpkg/rpm/rpmssl.h
1961 %{l_prefix}/include/openpkg/rpm/rpmsw.h
1962 %{l_prefix}/include/openpkg/rpm/rpmsx.h
1963 %{l_prefix}/include/openpkg/rpm/rpmtag.h
1964 %{l_prefix}/include/openpkg/rpm/rpmte.h
1965 %{l_prefix}/include/openpkg/rpm/rpmts.h
1966 %{l_prefix}/include/openpkg/rpm/rpmurl.h
1967 %{l_prefix}/include/openpkg/rpm/rpmuuid.h
1968 %{l_prefix}/include/openpkg/rpm/rpmversion.h
1969 %{l_prefix}/include/openpkg/rpm/rpmwf.h
1970 %{l_prefix}/include/openpkg/rpm/rpmxar.h
1971 %{l_prefix}/include/openpkg/rpm/rpmzlog.h
1972 %{l_prefix}/include/openpkg/rpm/signature.h
1973 %{l_prefix}/include/openpkg/rpm/sqlite3.h
1974 %{l_prefix}/include/openpkg/rpm/ugid.h
1975 %{l_prefix}/include/openpkg/rpm/yarn.h
1976 %{l_prefix}/include/openpkg/rpm/zconf.h
1977 %{l_prefix}/include/openpkg/rpm/zlib.h
1978 %dir %{l_prefix}/info
1979 %dir %{l_prefix}/lib
1980 %dir %{l_prefix}/lib/openpkg
1981 %{l_prefix}/lib/openpkg/bash
1982 %{l_prefix}/lib/openpkg/bsdcpio
1983 %{l_prefix}/lib/openpkg/bsdtar
1984 %{l_prefix}/lib/openpkg/bzip2
1985 %{l_prefix}/lib/openpkg/curl
1986 %{l_prefix}/lib/openpkg/db_tool
1987 %{l_prefix}/lib/openpkg/cmp
1988 %{l_prefix}/lib/openpkg/diff
1989 %{l_prefix}/lib/openpkg/diff3
1990 %{l_prefix}/lib/openpkg/sdiff
1991 %{l_prefix}/lib/openpkg/gzip
1992 %{l_prefix}/lib/openpkg/librpm.a
1993 %{l_prefix}/lib/openpkg/librpmbeecrypt.a
1994 %{l_prefix}/lib/openpkg/librpmbuild.a
1995 %{l_prefix}/lib/openpkg/librpmbz2.a
1996 %{l_prefix}/lib/openpkg/librpmdb.a
1997 %{l_prefix}/lib/openpkg/librpmio.a
1998 %{l_prefix}/lib/openpkg/librpmmisc.a
1999 %{l_prefix}/lib/openpkg/librpmpopt.a
2000 %{l_prefix}/lib/openpkg/librpmsqlite3.a
2001 %{l_prefix}/lib/openpkg/librpmz.a
2002 %{l_prefix}/lib/openpkg/license.lua
2003 %{l_prefix}/lib/openpkg/miniperl
2004 %{l_prefix}/lib/openpkg/mutex
2005 %{l_prefix}/lib/openpkg/openpkg
2006 %{l_prefix}/lib/openpkg/openssl
2007 %{l_prefix}/lib/openpkg/patch
2008 %{l_prefix}/lib/openpkg/rc
2009 %{l_prefix}/lib/openpkg/rpm
2010 %{l_prefix}/lib/openpkg/rpm.pc
2011 %{l_prefix}/lib/openpkg/rpmdb
2012 %{l_prefix}/lib/openpkg/rpmdeps
2013 %{l_prefix}/lib/openpkg/lua
2014 %{l_prefix}/lib/openpkg/rpmmacros
2015 %{l_prefix}/lib/openpkg/rpmpopt
2016 %{l_prefix}/lib/openpkg/rpmtool
2017 %{l_prefix}/lib/openpkg/shtool
2018 %{l_prefix}/lib/openpkg/sqlite3
2019 %{l_prefix}/lib/openpkg/tar
2020 %{l_prefix}/lib/openpkg/uuid
2021 %{l_prefix}/lib/openpkg/xz
2022 %dir %{l_prefix}/libexec
2023 %dir %{l_prefix}/libexec/openpkg
2024 %{l_prefix}/libexec/openpkg/build.8
2025 %{l_prefix}/libexec/openpkg/build.pl
2026 %{l_prefix}/libexec/openpkg/curl.sh
2027 %{l_prefix}/libexec/openpkg/dev.8
2028 %{l_prefix}/libexec/openpkg/dev.pl
2029 %{l_prefix}/libexec/openpkg/index.8
2030 %{l_prefix}/libexec/openpkg/index.pl
2031 %{l_prefix}/libexec/openpkg/license
2032 %{l_prefix}/libexec/openpkg/license.8
2033 %{l_prefix}/libexec/openpkg/lsync
2034 %{l_prefix}/libexec/openpkg/lsync.8
2035 %{l_prefix}/libexec/openpkg/lint-fsl.pl
2036 %{l_prefix}/libexec/openpkg/lint-rc.pl
2037 %{l_prefix}/libexec/openpkg/lint-rpm.pl
2038 %{l_prefix}/libexec/openpkg/lint-spec.pl
2039 %{l_prefix}/libexec/openpkg/makeproxy.8
2040 %{l_prefix}/libexec/openpkg/makeproxy.pl
2041 %{l_prefix}/libexec/openpkg/man
2042 %{l_prefix}/libexec/openpkg/mirror.8
2043 %{l_prefix}/libexec/openpkg/mirror.pl
2044 %{l_prefix}/libexec/openpkg/rc
2045 %{l_prefix}/libexec/openpkg/rc.8
2046 %{l_prefix}/libexec/openpkg/register
2047 %{l_prefix}/libexec/openpkg/register.8
2048 %{l_prefix}/libexec/openpkg/release
2049 %{l_prefix}/libexec/openpkg/release.8
2050 %{l_prefix}/libexec/openpkg/rpm
2051 %{l_prefix}/libexec/openpkg/rpm-config
2052 %{l_prefix}/libexec/openpkg/rpm-config.8
2053 %{l_prefix}/libexec/openpkg/rpm.8
2054 %{l_prefix}/libexec/openpkg/rpmconstant
2055 %{l_prefix}/libexec/openpkg/rpmconstant.8
2056 %{l_prefix}/libexec/openpkg/rpm2cpio
2057 %{l_prefix}/libexec/openpkg/rpm2cpio.8
2058 %{l_prefix}/libexec/openpkg/rpmbuild.8
2059 %{l_prefix}/libexec/openpkg/rpmcache
2060 %{l_prefix}/libexec/openpkg/rpmcache.8
2061 %{l_prefix}/libexec/openpkg/rpmdeps.8
2062 %{l_prefix}/libexec/openpkg/rpmgraph.8
2063 %{l_prefix}/libexec/openpkg/rpmgrep
2064 %{l_prefix}/libexec/openpkg/rpmgrep.1
2065 %{l_prefix}/libexec/openpkg/sea.8
2066 %{l_prefix}/libexec/openpkg/sea.sh
2067 %{l_prefix}/libexec/openpkg/search.8
2068 %{l_prefix}/libexec/openpkg/search.pl
2069 %{l_prefix}/libexec/openpkg/stack.8
2070 %{l_prefix}/libexec/openpkg/stack.sh
2071 %{l_prefix}/libexec/openpkg/shtool.sh
2072 %{l_prefix}/libexec/openpkg/svs
2073 %{l_prefix}/libexec/openpkg/svs.1
2074 %{l_prefix}/libexec/openpkg/uuid
2075 %{l_prefix}/libexec/openpkg/uuid.8
2076 %dir %{l_prefix}/man
2077 %dir %{l_prefix}/man/man1
2078 %dir %{l_prefix}/man/man2
2079 %dir %{l_prefix}/man/man3
2080 %dir %{l_prefix}/man/man4
2081 %dir %{l_prefix}/man/man5
2082 %dir %{l_prefix}/man/man6
2083 %dir %{l_prefix}/man/man7
2084 %dir %{l_prefix}/man/man8
2085 %dir %{l_prefix}/man/man9
2086 %dir %{l_prefix}/man/cat1
2087 %dir %{l_prefix}/man/cat2
2088 %dir %{l_prefix}/man/cat3
2089 %dir %{l_prefix}/man/cat4
2090 %dir %{l_prefix}/man/cat5
2091 %dir %{l_prefix}/man/cat6
2092 %dir %{l_prefix}/man/cat7
2093 %dir %{l_prefix}/man/cat8
2094 %dir %{l_prefix}/man/cat9
2095 %{l_prefix}/man/man1/openpkg.1
2096 %dir %{l_prefix}/sbin
2097 %dir %{l_prefix}/pub
2098 %dir %{l_prefix}/share
2099 %dir %{l_prefix}/var
2100 %dir %{l_prefix}/local
2101 %{l_prefix}/local/README
2102 %{l_prefix}/local/.lsyncrc
2103 %dir %{l_prefix}/local/PKG
2104 %dir %{l_prefix}/local/bin
2105 %dir %{l_prefix}/local/etc
2106 %dir %{l_prefix}/local/include
2107 %dir %{l_prefix}/local/info
2108 %dir %{l_prefix}/local/lib
2109 %dir %{l_prefix}/local/man
2110 %dir %{l_prefix}/local/man/man1
2111 %dir %{l_prefix}/local/man/man2
2112 %dir %{l_prefix}/local/man/man3
2113 %dir %{l_prefix}/local/man/man4
2114 %dir %{l_prefix}/local/man/man5
2115 %dir %{l_prefix}/local/man/man6
2116 %dir %{l_prefix}/local/man/man7
2117 %dir %{l_prefix}/local/man/man8
2118 %dir %{l_prefix}/local/man/man9
2119 %dir %{l_prefix}/local/man/cat1
2120 %dir %{l_prefix}/local/man/cat2
2121 %dir %{l_prefix}/local/man/cat3
2122 %dir %{l_prefix}/local/man/cat4
2123 %dir %{l_prefix}/local/man/cat5
2124 %dir %{l_prefix}/local/man/cat6
2125 %dir %{l_prefix}/local/man/cat7
2126 %dir %{l_prefix}/local/man/cat8
2127 %dir %{l_prefix}/local/man/cat9
2128 %dir %{l_prefix}/local/sbin
2130 %clean
2131 # skip in bootstrap phase 2 (see openpkg.boot)
2132 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
2134 # cleanup build area
2135 rm -rf openpkg-%{version} >/dev/null 2>&1 || true
2137 # cleanup installation area
2138 rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
2140 %pre
2141 # always performed for upgrades and because it doesn't harm!
2142 # [ ".$1" != .1 ] && exit 0
2144 # this procedure is only usable with root privileges
2145 # (for nonroot installations it is not required at all)
2146 cusr=`(id -un) 2>/dev/null ||\
2147 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
2148 (whoami) 2>/dev/null ||\
2149 (who am i | cut "-d " -f1) 2>/dev/null ||\
2150 echo $LOGNAME`
2152 # determine runtime details (for both inside and outside RPM!!)
2153 # - bootstrapping: $xxx is set from etc.wrapbin.sh
2154 # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
2155 # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
2156 [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
2157 [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
2158 [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
2159 [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
2160 [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
2161 [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
2162 [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
2163 [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
2164 [ ".$suid" = . ] && suid="%{?l_suid}"
2165 [ ".$sgid" = . ] && sgid="%{?l_sgid}"
2166 [ ".$muid" = . ] && muid="%{?l_muid}"
2167 [ ".$mgid" = . ] && mgid="%{?l_mgid}"
2168 [ ".$ruid" = . ] && ruid="%{?l_ruid}"
2169 [ ".$rgid" = . ] && rgid="%{?l_rgid}"
2170 [ ".$nuid" = . ] && nuid="%{?l_nuid}"
2171 [ ".$ngid" = . ] && ngid="%{?l_ngid}"
2173 # if any of these optional params are not used we won't have a
2174 # corresponding macro either, so make use of one conditionally
2175 [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
2176 [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
2177 [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
2178 [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
2179 [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
2180 [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
2181 [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
2182 [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
2184 # determine prefix
2185 [ ".$prefix" = . ] && prefix="%{l_prefix}"
2186 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
2188 # Preflight check before update to make sure that the currently
2189 # activated license is still valid. This is done just be friendly
2190 # to people and to not too easily shoot theirself into the foot
2191 # by blindly upgrading and then having to recognize that the new
2192 # OpenPKG Framework is no longer covered by the old license.
2193 if [ ".$1" = .2 ]; then
2194 ( OPENPKG_FRAMEWORK_RELEASE="%{release}"
2195 export OPENPKG_FRAMEWORK_RELEASE
2196 # LATER:
2197 # $prefix/bin/openpkg rpm -q openpkg >/dev/null 2>&1 || exit $?
2198 # if [ $? -ne 0 ]; then
2199 # NOW:
2200 output="`$prefix/bin/openpkg rpm -q openpkg 2>&1 | grep 'ENVIRONMENT ANOMALY'`"
2201 if [ ".$output" != . ]; then
2202 id="`($prefix/bin/openpkg license active) 2>/dev/null`"
2203 [ ".$id" = . ] && id="UNKNOWN"
2204 ( echo "Attention, your currently active license \"$id\" does"
2205 echo "not allow you to use this newer version of the OpenPKG Framework!"
2206 echo "We cancel this update to prevent you from a runtime failure."
2207 echo "Please first upgrade to a newer license with the command:"
2208 echo " \$ $prefix/bin/openpkg license update $id <file>"
2209 ) | $prefix/lib/openpkg/rpmtool msg -b -t error
2210 exit 42
2211 fi
2212 ) || exit $?
2213 fi
2215 # register instance in presence file
2216 presence="/etc/openpkg"
2217 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
2218 if [ ".$exists" = . ]; then
2219 ( umask 022
2220 echo "${prefix}" >>$presence
2221 ) 2>/dev/null || true
2222 fi
2224 # determine user/group ids
2225 for class in s m r n; do
2226 eval "xusr=\"\$${class}usr\""
2227 eval "xgrp=\"\$${class}grp\""
2228 eval "xuid=\"\$${class}uid\""
2229 eval "xgid=\"\$${class}gid\""
2230 if [ ".$xuid" = . ]; then
2231 case "$plid" in
2232 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2233 xuid=`dscl . -read "/users/${xusr}" UniqueID 2>/dev/null | awk '{ print $2; }'`
2234 ;;
2235 * )
2236 xuid=`(getent passwd "${xusr}"; \
2237 grep "^${xusr}:" /etc/passwd; \
2238 ypmatch "${xusr}" passwd; \
2239 nismatch "${xusr}" passwd; \
2240 nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
2241 sed -e 'q' | awk -F: '{ print $3; }'`
2242 ;;
2243 esac
2244 if [ ".$xuid" = . ]; then
2245 # seek for a reasonably uid/gid pair
2246 xuid=1000
2247 ok=0
2248 while [ ".$ok" = .0 ]; do
2249 eval "u_exists=\$u_exists_$xuid"
2250 if [ ".$u_exists" = . ]; then
2251 case "$plid" in
2252 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2253 u_exists=`dscl . -search /users UniqueID "$xuid" 2>/dev/null`
2254 ;;
2255 * )
2256 u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
2257 grep "^[^:]*:[^:]*:$xuid:"`
2258 ;;
2259 esac
2260 fi
2261 eval "g_exists=\$g_exists_$xuid"
2262 if [ ".$g_exists" = . ]; then
2263 case "$plid" in
2264 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2265 g_exists=`dscl . -search /groups PrimaryGroupID "$xuid" 2>/dev/null`
2266 ;;
2267 * )
2268 g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
2269 grep "^[^:]*:[^:]*:$xuid:"`
2270 esac
2271 fi
2272 if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
2273 ok=1
2274 break
2275 fi
2276 xuid=`expr $xuid + 1`
2277 done
2278 eval "u_exists_$xuid=yes"
2279 eval "g_exists_$xuid=yes"
2280 fi
2281 fi
2282 if [ ".$xgid" = . ]; then
2283 xgid=`(getent group "${xgrp}"; \
2284 grep "^${xgrp}:" /etc/group; \
2285 ypmatch "${xgrp}" group; \
2286 nismatch "${xgrp}" group; \
2287 nidump group . | grep "^${xgrp}:"; \
2288 dscl . -read "/groups/${xgrp}" | grep RecordName) 2>/dev/null | \
2289 sed -e 'q' | awk -F: '{ print $3; }'`
2290 if [ ".$xgid" = . ]; then
2291 xgid="$xuid"
2292 fi
2293 fi
2294 eval "${class}uid=\"$xuid\""
2295 eval "${class}gid=\"$xgid\""
2296 done
2298 # determine platform id
2299 s=`(uname -s) 2>/dev/null` || s='Unknown'
2300 r=`(uname -r) 2>/dev/null` || r='0.0'
2301 plid="${s}/${r}"
2303 # add entry to /etc/shells
2304 shell="${prefix}/lib/openpkg/bash"
2305 if [ -f /etc/shells ]; then
2306 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
2307 if [ ".$exists" = . ]; then
2308 if [ ".$cusr" != ".root" ]; then
2309 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
2310 echo "openpkg:WARNING: (would require root privileges)" 1>&2
2311 else
2312 echo "${shell}" >>/etc/shells
2313 fi
2314 fi
2315 fi
2317 # clear pending deferred actions
2318 rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
2320 # create the hierarchy user/group
2321 for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
2322 "management:${musr}:${muid}:${mgrp}:${mgid}" \
2323 "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
2324 "nonprivileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
2325 # split request into class/usr/uid/grp/gid
2326 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
2327 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
2329 # check whether user already exists
2330 exists=`(getent passwd "$usr"; \
2331 grep "^$usr:" /etc/passwd; \
2332 ypmatch "$usr" passwd; \
2333 nismatch "$usr" passwd; \
2334 nidump passwd . | grep "^$usr:"; \
2335 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
2336 sed -e 'q'`
2337 if [ ".$exists" = . ]; then
2338 if [ ".$cusr" != ".root" ]; then
2339 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
2340 echo "openpkg:WARNING: (would require root privileges)" 1>&2
2341 else
2342 # add entry to passwd database
2343 realname="${prefix} OpenPKG ($class)"
2344 case "$plid" in
2345 FreeBSD/* | NetBSD/* )
2346 file=/etc/master.passwd
2347 entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
2348 update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
2349 ;;
2350 Linux/* )
2351 file=/etc/passwd
2352 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2353 update="(PATH=\$PATH:/usr/sbin; pwconv)"
2354 ;;
2355 SunOS/5.* | UnixWare/* )
2356 file=/etc/passwd
2357 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2358 update="(PATH=\$PATH:/usr/sbin; pwconv)"
2359 ;;
2360 AIX/* )
2361 # intentionally do nothing here
2362 :
2363 ;;
2364 OSF1/V5.* )
2365 file=/etc/passwd
2366 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2367 update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
2368 ;;
2369 HP-UX/* )
2370 file=/etc/passwd
2371 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2372 update=":"
2373 ;;
2374 Darwin/* )
2375 # intentionally do nothing here
2376 :
2377 ;;
2378 IRIX*/6.* )
2379 file=/etc/passwd
2380 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2381 if [ -f /etc/shadow ]
2382 then update="(PATH=\$PATH:/sbin; pwconv)"
2383 else update=":"
2384 fi
2385 ;;
2386 CYGWIN*/* )
2387 file=/etc/passwd
2388 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2389 update=":"
2390 ;;
2391 esac
2392 case "$plid" in
2393 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2394 dscl . -create "/users/${usr}"
2395 dscl . -create "/users/${usr}" Password "*"
2396 dscl . -create "/users/${usr}" UniqueID "${uid}"
2397 dscl . -create "/users/${usr}" PrimaryGroupID "${gid}"
2398 dscl . -create "/users/${usr}" RealName "${realname}"
2399 dscl . -create "/users/${usr}" NFSHomeDirectory "${prefix}"
2400 dscl . -create "/users/${usr}" UserShell "${shell}"
2401 ;;
2402 Darwin/* )
2403 niutil -create . "/users/${usr}"
2404 niutil -createprop . "/users/${usr}" passwd "*"
2405 niutil -createprop . "/users/${usr}" uid "${uid}"
2406 niutil -createprop . "/users/${usr}" gid "${gid}"
2407 niutil -createprop . "/users/${usr}" realname "${realname}"
2408 niutil -createprop . "/users/${usr}" home "${prefix}"
2409 niutil -createprop . "/users/${usr}" shell "${shell}"
2410 ;;
2411 AIX/* )
2412 mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
2413 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
2414 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
2415 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
2416 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
2417 # defer both the setting of the primary group and the shell,
2418 # as they do not exist at this stage of processing.
2419 echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
2420 echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
2421 ;;
2422 * )
2423 cp $file $file.bak && \
2424 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
2425 rm -f $file.bak >/dev/null 2>&1
2426 eval $update
2427 [ $? -ne 0 ] && exit $?
2428 ;;
2429 esac
2430 fi
2431 fi
2433 # check whether group already exists
2434 exists=`(getent group "$grp"; \
2435 grep "^$grp:" /etc/group; \
2436 ypmatch "$grp" group; \
2437 nismatch "$grp" group; \
2438 nidump group . | grep "^$grp:"; \
2439 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
2440 sed -e 'q'`
2441 if [ ".$exists" = . ]; then
2442 if [ ".$cusr" != ".root" ]; then
2443 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
2444 echo "openpkg:WARNING: (would require root privileges)" 1>&2
2445 else
2446 case "$plid" in
2447 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2448 dscl . -create "/groups/${grp}"
2449 dscl . -create "/groups/${grp}" Password "*"
2450 dscl . -create "/groups/${grp}" PrimaryGroupID "${gid}"
2451 dscl . -create "/groups/${grp}" GroupMembership "${usr}"
2452 ;;
2453 Darwin/* )
2454 niutil -create . "/groups/${grp}"
2455 niutil -createprop . "/groups/${grp}" gid "${gid}"
2456 niutil -createprop . "/groups/${grp}" users "${usr}"
2457 ;;
2458 AIX/* )
2459 mkgroup id="${gid}" users="${usr}" "${grp}"
2460 ;;
2461 * )
2462 # add entry to group database
2463 file=/etc/group
2464 entry="${grp}:*:${gid}:${usr}"
2465 cp $file $file.bak && \
2466 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
2467 rm -f $file.bak >/dev/null 2>&1
2468 ;;
2469 esac
2470 fi
2471 fi
2472 done
2474 # optional group processing (deferred adjustment of primary group)
2475 if [ -f %{l_prefix}.pre-group-process.sh ]; then
2476 sh %{l_prefix}.pre-group-process.sh
2477 rm -f %{l_prefix}.pre-group-process.sh
2478 fi
2480 # invalidate passwd and group tables from Name Service Cache Daemon to
2481 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
2482 if [ -x /usr/sbin/nscd ]; then
2483 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
2484 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
2485 fi
2487 # create the startup/shutdown transfer script
2488 name_old="`echo "$prefix" | sed -e 's;/;;g'`"
2489 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
2490 if [ ".$cusr" != ".root" ]; then
2491 echo "openpkg:WARNING: skipping creation of system runcommand hooks" 1>&2
2492 echo "openpkg:WARNING: (would require root privileges)" 1>&2
2493 else
2494 case "$plid" in
2495 FreeBSD/* )
2496 if [ -f /etc/rc.d/${name_old} ]; then
2497 rm -f /etc/rc.d/${name_old}
2498 fi
2499 if [ ! -f /etc/rc.d/${name} ]; then
2500 # install transfer script
2501 rm -f /etc/rc.d/${name} >/dev/null 2>&1
2502 ( echo "#!/bin/sh"
2503 echo "##"
2504 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2505 echo "##"
2506 echo ""
2507 echo "# PROVIDE: ${name}"
2508 echo "# REQUIRE: LOGIN"
2509 echo "# KEYWORD: shutdown"
2510 echo ""
2511 echo ". /etc/rc.subr"
2512 echo ""
2513 echo "name=\"openpkg_${name}\""
2514 echo "start_cmd=\"openpkg_rc_all start\""
2515 echo "stop_cmd=\"openpkg_rc_all stop\""
2516 echo "restart_cmd=\"openpkg_rc_all stop start\""
2517 echo ""
2518 echo "openpkg_rc_all () {"
2519 echo " if [ -f ${prefix}/bin/openpkg ]; then"
2520 echo " ${prefix}/bin/openpkg rc all \"\$@\""
2521 echo " fi"
2522 echo "}"
2523 echo ""
2524 echo "load_rc_config \$name"
2525 echo "run_rc_command \"\$1\""
2526 echo ""
2527 ) >/etc/rc.d/${name}
2528 chmod 755 /etc/rc.d/${name}
2529 fi
2530 ;;
2531 NetBSD/* )
2532 if [ -f /etc/rc.d/${name_old} ]; then
2533 rm -f /etc/rc.d/${name_old}
2534 fi
2535 if [ ! -f /etc/rc.d/${name} ]; then
2536 ( echo "#!/bin/sh"
2537 echo "##"
2538 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2539 echo "##"
2540 echo "## PROVIDE: ${name}"
2541 echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS"
2542 echo "##"
2543 echo ""
2544 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2545 echo "case \$1 in"
2546 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2547 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2548 echo " restart ) exec ${prefix}/bin/openpkg rc all stop start ;;"
2549 echo " status ) ;;"
2550 echo "esac"
2551 ) >/etc/rc.d/${name}
2552 chmod 755 /etc/rc.d/${name}
2553 fi
2554 ;;
2555 Linux/* )
2556 if [ -f /etc/gentoo-release ]; then
2557 if [ -f /etc/init.d/${name_old} ]; then
2558 rm -f /etc/init.d/${name_old}
2559 fi
2560 if [ ! -f /etc/init.d/${name} ]; then
2561 # install transfer script
2562 ( echo "#!/sbin/runscript"
2563 echo "##"
2564 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2565 echo "##"
2566 echo ""
2567 echo "depend() {"
2568 echo " after *"
2569 echo "}"
2570 echo ""
2571 echo "checkconfig() {"
2572 echo " [ -f ${prefix}/bin/openpkg ] || return 1"
2573 echo " case $1 in"
2574 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2575 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2576 echo " esac"
2577 echo "}"
2578 echo ""
2579 echo "start() {"
2580 echo " checkconfig || return 1"
2581 echo " ebegin "Starting OpenPKG ${prefix} hierarchy""
2582 echo " exec ${prefix}/bin/openpkg rc all start"
2583 echo " eend 0"
2584 echo "}"
2585 echo ""
2586 echo "stop() {"
2587 echo " checkconfig || return 1"
2588 echo " ebegin "Stopping OpenPKG ${prefix} hierarchy""
2589 echo " exec ${prefix}/bin/openpkg rc all stop"
2590 echo " eend 0"
2591 echo "}"
2592 ) >/etc/init.d/${name}
2593 chmod 755 /etc/init.d/${name}
2594 /sbin/rc-update add ${name} default
2595 fi
2596 elif [ -f /etc/redhat-release ]; then
2597 sroot=/etc/rc.d/init.d
2598 if [ ! -f $sroot/${name} ]; then
2599 # install transfer script
2600 ( echo "#!/bin/sh"
2601 echo "##"
2602 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2603 echo "##"
2604 echo ""
2605 echo "# chkconfig: 2345 99 00"
2606 echo "# description: OpenPKG ${prefix}"
2607 echo ""
2608 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2609 echo "case \$1 in"
2610 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2611 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2612 echo "esac"
2613 ) >$sroot/${name}
2614 chmod 755 $sroot/${name}
2615 # activate script
2616 /sbin/chkconfig --add ${name}
2617 /sbin/chkconfig ${name} on
2618 fi
2619 else
2620 # sroot: script root directory
2621 # lroot: link root directory
2622 if [ -f /etc/debian_version ]; then
2623 sroot=/etc/init.d
2624 lroot=/etc/rc%%d.d
2625 elif [ -f /etc/mandrake-release ]; then
2626 sroot=/etc/rc.d/init.d
2627 lroot=/etc/rc.d/rc%%d.d
2628 elif [ -f /etc/SuSE-release ]; then
2629 sroot=/etc/init.d
2630 lroot=/etc/init.d/rc%%d.d
2631 elif [ -f /etc/slackware-version ]; then
2632 sroot=/etc/rc.d
2633 lroot=/etc/rc.d/rc%%d.d
2634 name="rc.${name}"
2635 for i in 0 1 2 3 4 5 6; do
2636 l=`echo $lroot | sed -e "s;%%d;$i;"`
2637 if [ ! -d $l ]; then
2638 mkdir $l 2>&1 || true
2639 fi
2640 done
2641 else
2642 echo "WARNING: you are not running one of the supported standard" 1>&2
2643 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
2644 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
2645 sroot=""
2646 lroot=""
2647 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
2648 if [ -d $sr ]; then
2649 sroot="$sr"
2650 break
2651 fi
2652 done
2653 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
2654 if [ -d $lr ]; then
2655 lroot="`echo $lr | sed -e 's;2;%%d;'`"
2656 break
2657 fi
2658 done
2659 if [ ".$sroot" = . -o ".$lroot" = . ]; then
2660 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
2661 exit 1
2662 fi
2663 fi
2664 if [ -f $sroot/${name_old} ]; then
2665 rm -f $sroot/${name_old}
2666 fi
2667 if [ ! -f $sroot/${name} ]; then
2668 # install transfer script
2669 ( echo "#!/bin/sh"
2670 echo "##"
2671 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2672 echo "##"
2673 echo ""
2674 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2675 echo "case \$1 in"
2676 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2677 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2678 echo "esac"
2679 ) >$sroot/${name}
2680 chmod 755 $sroot/${name}
2681 # create corresponding symbolic links
2682 for i in 2 3 4 5; do
2683 ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/S99${name}
2684 done
2685 for i in 0 1 6; do
2686 ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/K00${name}
2687 done
2688 fi
2689 fi
2690 ;;
2691 SunOS/5.1* )
2692 suname="`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
2693 svcdir=/`[ -d /lib/svc/manifest ] && echo lib || echo var`
2694 if [ ! -d /${svcdir}/svc/manifest/openpkg ]; then
2695 mkdir /${svcdir}/svc/manifest/openpkg
2696 fi
2697 if [ ! -f /${svcdir}/svc/manifest/openpkg/${suname}.xml ]; then
2698 # install SMF manifest
2699 ( echo "<?xml version=\"1.0\"?>"
2700 echo "<!DOCTYPE service_bundle SYSTEM \"/usr/share/lib/xml/dtd/service_bundle.dtd.1\">"
2701 echo "<service_bundle type='manifest' name='OpenPKG:${suname}'>"
2702 echo " <service"
2703 echo " name='openpkg/${suname}'"
2704 echo " type='service'"
2705 echo " version='1'>"
2706 echo " <create_default_instance enabled='false' />"
2707 echo " <single_instance />"
2708 echo " <dependency"
2709 echo " name='filesystem'"
2710 echo " type='service'"
2711 echo " grouping='require_all'"
2712 echo " restart_on='none'>"
2713 echo " <service_fmri value='svc:/system/filesystem/local' />"
2714 echo " </dependency>"
2715 echo " <dependency"
2716 echo " name='name-services'"
2717 echo " type='service'"
2718 echo " grouping='require_all'"
2719 echo " restart_on='none'>"
2720 echo " <service_fmri value='svc:/milestone/name-services' />"
2721 echo " </dependency>"
2722 echo " <dependency"
2723 echo " name='multi-user-server'"
2724 echo " type='service'"
2725 echo " grouping='require_all'"
2726 echo " restart_on='none'>"
2727 echo " <service_fmri value='svc:/milestone/multi-user-server' />"
2728 echo " </dependency>"
2729 echo " <dependency"
2730 echo " name='network'"
2731 echo " type='service'"
2732 echo " grouping='require_all'"
2733 echo " restart_on='none'>"
2734 echo " <service_fmri value='svc:/milestone/network' />"
2735 echo " </dependency>"
2736 echo " <exec_method"
2737 echo " type='method'"
2738 echo " name='start'"
2739 echo " exec='${prefix}/etc/rc all start'"
2740 echo " timeout_seconds='180'>"
2741 echo " <method_context>"
2742 echo " <method_credential user='root' group='root' />"
2743 echo " </method_context>"
2744 echo " </exec_method>"
2745 echo " <exec_method"
2746 echo " type='method'"
2747 echo " name='refresh'"
2748 echo " exec='${prefix}/etc/rc all restart'"
2749 echo " timeout_seconds='270'>"
2750 echo " <method_context>"
2751 echo " <method_credential user='root' group='root' />"
2752 echo " </method_context>"
2753 echo " </exec_method>"
2754 echo " <exec_method"
2755 echo " type='method'"
2756 echo " name='stop'"
2757 echo " exec='${prefix}/etc/rc all stop'"
2758 echo " timeout_seconds='180'>"
2759 echo " </exec_method>"
2760 echo " <property_group name='startd' type='framework'>"
2761 echo " <propval"
2762 echo " name='ignore_error'"
2763 echo " type='astring'"
2764 echo " value='core,signal' />"
2765 echo " </property_group>"
2766 echo " <property_group name='startd' type='framework'>"
2767 echo " <propval"
2768 echo " name='duration'"
2769 echo " type='astring'"
2770 echo " value='transient' />"
2771 echo " </property_group>"
2772 echo " <property_group name='general' type='framework'>"
2773 echo " <propval"
2774 echo " name='action_authorization'"
2775 echo " type='astring'"
2776 echo " value='solaris.smf.manage.openpkg.${suname}' />"
2777 echo " </property_group>"
2778 echo " <stability value='Unstable' />"
2779 echo " <template>"
2780 echo " <common_name>"
2781 echo " <loctext xml:lang='C'>OpenPKG Instance ${prefix}</loctext>"
2782 echo " </common_name>"
2783 echo " </template>"
2784 echo " </service>"
2785 echo "</service_bundle>"
2786 ) >/${svcdir}/svc/manifest/openpkg/${suname}.xml
2787 /usr/sbin/svcadm restart svc:/system/manifest-import
2788 ( echo "/usr/sbin/svcadm enable svc:/openpkg/${suname}:default"
2789 ) >%{l_prefix}.pre-post-process.sh
2790 fi
2791 ;;
2792 SunOS/5.* )
2793 if [ -f /etc/init.d/${name_old} ]; then
2794 rm -f /etc/init.d/${name_old}
2795 fi
2796 if [ ! -f /etc/init.d/${name} ]; then
2797 # install transfer script
2798 ( echo "#!/bin/sh"
2799 echo "##"
2800 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2801 echo "##"
2802 echo ""
2803 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2804 echo "case \$1 in"
2805 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2806 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2807 echo "esac"
2808 ) >/etc/init.d/${name}
2809 chmod 755 /etc/init.d/${name}
2810 # create corresponding symbolic links
2811 ( cd /etc
2812 ln init.d/${name} rc3.d/S99${name}
2813 ln init.d/${name} rc0.d/K00${name}
2814 ln init.d/${name} rc1.d/K00${name}
2815 ) || exit $?
2816 fi
2817 ;;
2818 UnixWare/* )
2819 if [ -f /etc/init.d/${name_old} ]; then
2820 rm -f /etc/init.d/${name_old}
2821 fi
2822 if [ ! -f /etc/init.d/${name} ]; then
2823 # install transfer script
2824 ( echo "#!/bin/sh"
2825 echo "##"
2826 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2827 echo "##"
2828 echo ""
2829 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2830 echo "case \$1 in"
2831 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2832 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2833 echo "esac"
2834 ) >/etc/init.d/${name}
2835 chmod 755 /etc/init.d/${name}
2836 # create corresponding symbolic links
2837 ( cd /etc
2838 ln init.d/${name} rc2.d/S99${name}
2839 ln init.d/${name} rc0.d/K00${name}
2840 ln init.d/${name} rc1.d/K00${name}
2841 ) || exit $?
2842 fi
2843 ;;
2844 AIX/* )
2845 if [ -f /etc/rc.d/init.d/${name_old} ]; then
2846 rm -f /etc/rc.d/init.d/${name_old}
2847 fi
2848 if [ ! -f /etc/rc.d/init.d/${name} ]; then
2849 # install transfer script
2850 ( echo "#!/bin/sh"
2851 echo "##"
2852 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2853 echo "##"
2854 echo ""
2855 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2856 echo "case \$1 in"
2857 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2858 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2859 echo "esac"
2860 ) >/etc/rc.d/init.d/${name}
2861 chmod 755 /etc/rc.d/init.d/${name}
2862 # create corresponding symbolic links
2863 ( cd /etc/rc.d
2864 ln -s ../init.d/${name} rc2.d/S99${name}
2865 ) || exit $?
2866 fi
2867 ;;
2868 OSF1/V5.* )
2869 if [ -f /sbin/init.d/${name_old} ]; then
2870 rm -f /sbin/init.d/${name_old}
2871 fi
2872 if [ ! -f /sbin/init.d/${name} ]; then
2873 # install transfer script
2874 ( echo "#!/bin/sh"
2875 echo "##"
2876 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2877 echo "##"
2878 echo ""
2879 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2880 echo "case \$1 in"
2881 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2882 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2883 echo "esac"
2884 ) >/sbin/init.d/${name}
2885 chmod 755 /sbin/init.d/${name}
2886 # create corresponding symbolic links
2887 ( cd /sbin
2888 ln -s ../init.d/${name} rc3.d/S99${name}
2889 ln -s ../init.d/${name} rc0.d/K00${name}
2890 ) || exit $?
2891 fi
2892 ;;
2893 HP-UX/* )
2894 if [ -f /sbin/init.d/${name_old} ]; then
2895 rm -f /sbin/init.d/${name_old}
2896 fi
2897 if [ ! -f /sbin/init.d/${name} ]; then
2898 # install transfer script
2899 ( echo "#!/bin/sh"
2900 echo "##"
2901 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2902 echo "##"
2903 echo ""
2904 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2905 echo "case \$1 in"
2906 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2907 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2908 echo "esac"
2909 ) >/sbin/init.d/${name}
2910 chmod 755 /sbin/init.d/${name}
2911 # create corresponding symbolic links
2912 ( cd /sbin
2913 ln -s ../init.d/${name} rc2.d/S900${name}
2914 ln -s ../init.d/${name} rc1.d/K100${name}
2915 ) || exit $?
2916 fi
2917 ;;
2918 Darwin/* )
2919 if [ -d /Library/StartupItems/${name_old} ]; then
2920 rm -rf /Library/StartupItems/${name_old}
2921 fi
2922 darwin_rc_dir="/Library/StartupItems/${name}"
2923 if [ ! -d ${darwin_rc_dir} ]; then
2924 mkdir -p ${darwin_rc_dir}
2925 fi
2927 # make sure hierarchy is activated in /etc/hostconfig
2928 # FIXME: cs: simple and bad code here without any detection of existing entries
2929 darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
2930 echo "${darwin_rc_var}=-YES-" >>/etc/hostconfig
2932 # install transfer script
2933 if [ ! -f ${darwin_rc_dir}/${name} ]; then
2934 rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
2935 ( echo "#!/bin/sh"
2936 echo "##"
2937 echo "## ${darwin_rc_dir}/${name}"
2938 echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy"
2939 echo "##"
2940 echo ""
2941 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2942 echo ""
2943 echo ". /etc/rc.common"
2944 echo ""
2945 echo "if [ \"\${${darwin_rc_var}:=-NO-}\" = \"-YES-\" ]; then"
2946 echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
2947 echo " ${prefix}/bin/openpkg rc all start"
2948 echo "fi"
2949 ) >${darwin_rc_dir}/${name}
2950 chmod 755 ${darwin_rc_dir}/${name}
2951 fi
2953 # install startup parameter list
2954 if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
2955 rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
2956 ( echo "{"
2957 echo " Description = \"OpenPKG ${prefix} hierarchy\";"
2958 echo " Provides = (\"OpenPKG ${prefix}\");"
2959 echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
2960 echo " Uses = (\"Cron\");"
2961 echo " OrderPreference = \"Last\";"
2962 echo " Messages ="
2963 echo " {"
2964 echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
2965 echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
2966 echo " };"
2967 echo "}"
2968 ) >${darwin_rc_dir}/StartupParameters.plist
2969 chmod 644 ${darwin_rc_dir}/StartupParameters.plist
2970 fi
2971 ;;
2972 IRIX*/6.* )
2973 if [ -f /etc/init.d/${name_old} ]; then
2974 rm -f /etc/init.d/${name_old}
2975 fi
2976 if [ ! -f /etc/init.d/${name} ]; then
2977 # install transfer script
2978 ( echo "#!/bin/sh"
2979 echo "##"
2980 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2981 echo "##"
2982 echo ""
2983 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2984 echo "case \$1 in"
2985 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2986 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2987 echo "esac"
2988 ) >/etc/init.d/${name}
2989 chmod 755 /etc/init.d/${name}
2990 # create corresponding links
2991 ( cd /etc
2992 ln -f init.d/${name} rc2.d/S99${name}
2993 ln -f init.d/${name} rc0.d/K00${name}
2994 ) || exit $?
2995 fi
2996 ;;
2997 CYGWIN*/* )
2998 if [ -f /etc/rc.d/init.d/${name_old} ]; then
2999 rm -f /etc/rc.d/init.d/${name_old}
3000 fi
3001 if [ ! -f /etc/rc.d/init.d/${name} ]; then
3002 # install transfer script
3003 ( echo "#!/bin/sh"
3004 echo "##"
3005 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
3006 echo "##"
3007 echo ""
3008 echo "test -f /etc/rc.d/init.d/functions && . /etc/rc.d/init.d/functions"
3009 echo "test -f /etc/sysconfig/network && . /etc/sysconfig/network"
3010 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
3011 echo "case \$1 in"
3012 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
3013 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
3014 echo "esac"
3015 ) >/etc/rc.d/init.d/${name}
3016 chmod 755 /etc/rc.d/init.d/${name}
3017 # create corresponding symbolic links
3018 ( cd /etc/rc.d
3019 ln -s ../init.d/${name} rc2.d/S90${name}
3020 ln -s ../init.d/${name} rc1.d/K10${name}
3021 ) || exit $?
3022 fi
3023 ;;
3024 esac
3025 fi
3027 # create the cron transfer entries
3028 if [ ".$cusr" != ".root" ]; then
3029 echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
3030 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3031 else
3032 case "$plid" in
3033 FreeBSD/* | Linux/* )
3034 if [ -f /etc/slackware-version ]; then
3035 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
3036 if [ ".$exists" = . ]; then
3037 EDITOR=/tmp/vipw.$$
3038 VISUAL="$EDITOR"
3039 export EDITOR
3040 export VISUAL
3041 ( echo "#!/bin/sh"
3042 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
3043 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
3044 echo " echo \"0 0 1 * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
3045 echo " echo \"0 0 * * 0 [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
3046 echo " echo \"0 0 * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
3047 echo " echo \"0 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
3048 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
3049 echo " echo \"# </OpenPKG>\""
3050 echo ") >>\$1"
3051 ) >$EDITOR
3052 chmod a+x $EDITOR
3053 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3054 rm -f $EDITOR
3055 fi
3056 else
3057 exists=`egrep "($prefix/bin/openpkg|$prefix/etc/rc)" /etc/crontab`
3058 if [ ".$exists" = . ]; then
3059 ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
3060 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
3061 echo "0 0 1 * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
3062 echo "0 0 * * 0 root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
3063 echo "0 0 * * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
3064 echo "0 * * * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
3065 echo "*/15 * * * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
3066 echo "# </OpenPKG>"
3067 ) >>/etc/crontab
3068 fi
3069 fi
3070 ;;
3071 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
3072 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
3073 if [ ".$exists" = . ]; then
3074 EDITOR=/tmp/vipw.$$
3075 VISUAL="$EDITOR"
3076 export EDITOR
3077 export VISUAL
3078 ( echo "#!/bin/sh"
3079 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
3080 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
3081 echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc cron monthly\""
3082 echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc cron weekly\""
3083 echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc cron daily\""
3084 echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc cron hourly\""
3085 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc cron quarterly\""
3086 echo " echo \"# </OpenPKG>\""
3087 echo ") >>\$1"
3088 ) >$EDITOR
3089 chmod a+x $EDITOR
3090 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3091 rm -f $EDITOR
3092 fi
3093 ;;
3094 IRIX*/6.* )
3095 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
3096 if [ ".$exists" = . ]; then
3097 ( crontab -l
3098 echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
3099 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
3100 echo "0 0 1 * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
3101 echo "0 0 * * 0 [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
3102 echo "0 0 * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
3103 echo "0 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
3104 echo "0,15,30,45 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
3105 echo "# </OpenPKG>"
3106 ) | /usr/bin/crontab || exit $?
3107 fi
3108 ;;
3109 esac
3110 fi
3112 # remember what OpenPKG RPM version was installed, so we can
3113 # correctly upgrade the RPM database in the %post section (see below).
3114 if [ -d ${prefix}/RPM/DB ]; then
3115 if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
3116 # OpenPKG >= 2.0
3117 rpm="${prefix}/bin/openpkg rpm"
3118 else
3119 # OpenPKG 1.x
3120 rpm="${prefix}/bin/rpm"
3121 fi
3122 rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
3123 $rpm --version 2>/dev/null |\
3124 sed -e 's;^;X;' \
3125 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
3126 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
3127 -e 's;^X.*$;0.0;' \
3128 >${prefix}/RPM/DB/.version
3129 fi
3131 %post
3132 # optional post-processing from "pre" section
3133 if [ -f %{l_prefix}.pre-post-process.sh ]; then
3134 sh %{l_prefix}.pre-post-process.sh
3135 rm -f %{l_prefix}.pre-post-process.sh
3136 fi
3138 # update or initially create OpenPKG UUID configuration
3139 %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
3141 # when upgrading from RPM 4 to RPM 5 there will be no
3142 # initial license at all, so create one
3143 if [ ! -f %{l_prefix}/etc/openpkg/license ]; then
3144 echo "BOOT" >%{l_prefix}/etc/openpkg/license
3145 ( chown %{l_musr}:%{l_mgrp} %{l_prefix}/etc/openpkg/license
3146 chmod 644 %{l_prefix}/etc/openpkg/license
3147 ) >/dev/null 2>&1 || true
3148 fi
3150 # finally switch from a possibly active BOOT license to EVAL license
3151 # (notice: this is really the earliest time we can switch because the
3152 # previous command had to create the <prefix>/etc/openpkg/uuid first!)
3153 if [ ".`cat %{l_prefix}/etc/openpkg/license`" = ".BOOT" ]; then
3154 echo "EVAL" >%{l_prefix}/etc/openpkg/license
3155 fi
3157 # determine new and old OpenPKG RPM version
3158 V_rpm_new="%{V_rpm_major}.%{V_rpm_minor}"
3159 if [ -f %{l_prefix}/RPM/DB/.version ]; then
3160 V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
3161 rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
3162 else
3163 V_rpm_old="0.0"
3164 fi
3166 # make sure all RPM database files are present and that their
3167 # attributes are correct, etc. This is not a database rebuild
3168 # operation, so this is fully harmless and can be done always.
3169 %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate >/dev/null 2>&1 || true
3171 # check RPM database for upgrade requirements
3172 if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
3173 # RPM 4.0/4.1 does not allow concurrent database access, so we
3174 # cannot upgrade the database immediately from here (because
3175 # we are still running within the execution context of the
3176 # old RPM which in turn has the database locked) and instead
3177 # have to just drop a note to the administrator about database
3178 # upgrading. RPM >= 4.2 in general allows concurrent database
3179 # access, but the whole stuff is too risky here, too.
3180 ( echo "You are upgrading the OpenPKG bootstrap from a previous"
3181 echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
3182 echo "version. The RPM database in %{l_prefix}/RPM/DB/ can be"
3183 echo "reused, but you first have to upgrade it as soon as"
3184 echo "possible to the latest format files by executing:"
3185 echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
3186 echo "In case of problems with the RPM database you can always"
3187 echo "execute the command:"
3188 echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
3189 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
3190 fi
3192 # system command overriding support
3193 # ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
3194 # BUILD COMMAND OVERRIDE SOLUTION!
3195 if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
3196 mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
3197 fi
3198 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
3199 case "`cat %{l_prefix}/etc/openpkg/platform`" in
3200 *-*-debian* | *-*-ubuntu* )
3201 # FIXME: Evil hack to workaround build problems under Debian
3202 # (at least 3.1) (and similar platforms) where a Debian
3203 # install-info(8) exists which is both API and functionally
3204 # incompatible to the de-facto standardized install-info(8)
3205 # command from GNU Texinfo.
3206 if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
3207 ( echo "#!/bin/sh"
3208 echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
3209 echo "exit 0"
3210 ) >%{l_prefix}/lib/openpkg/override/install-info
3211 chmod 775 %{l_prefix}/lib/openpkg/override/install-info
3212 fi
3213 ;;
3214 *-*-macosx* | *-*-darwin* )
3215 # FIXME: Evil hack to workaround the fact that Mac OS X'
3216 # linker by default prefers the /usr/lib libraries and does
3217 # not honor the -L options the way one would expect it.
3218 gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
3219 cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
3220 ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
3221 if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
3222 ( echo "#!/bin/sh"
3223 echo "case \" \$* \" in"
3224 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
3225 echo " * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
3226 echo "esac"
3227 ) >%{l_prefix}/lib/openpkg/override/gcc
3228 chmod 775 %{l_prefix}/lib/openpkg/override/gcc
3229 fi
3230 if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
3231 ( echo "#!/bin/sh"
3232 echo "case \" \$* \" in"
3233 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
3234 echo " * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
3235 echo "esac"
3236 ) >%{l_prefix}/lib/openpkg/override/cc
3237 chmod 775 %{l_prefix}/lib/openpkg/override/cc
3238 fi
3239 if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
3240 ( echo "#!/bin/sh"
3241 echo "exec $ld -search_paths_first \"\$@\""
3242 ) >%{l_prefix}/lib/openpkg/override/ld
3243 chmod 775 %{l_prefix}/lib/openpkg/override/ld
3244 fi
3245 ;;
3246 esac
3248 # special support for fully unprivileged environments
3249 # where we cannot switch the user at all with su(1),
3250 # so we provide a dummy su(1) override command.
3251 if [ ".%{l_unprivileged}" = ".yes" ]; then
3252 ( echo "#!/bin/sh"
3253 echo "while [ \$# -gt 0 ]; do"
3254 echo " case \"\$1\" in"
3255 echo " - | -* ) shift ;;"
3256 echo " * ) shift; break ;;"
3257 echo " esac"
3258 echo "done"
3259 echo "exec /bin/sh \${1+\"\$@\"}"
3260 ) >%{l_prefix}/lib/openpkg/override/su
3261 chmod 775 %{l_prefix}/lib/openpkg/override/su
3262 fi
3264 # FIXME: hack to workaround problems in environments with too few
3265 # development tools. ATTENTION: see one paragraph above.
3266 if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
3267 mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
3268 fi
3269 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
3271 # cruel platform hack
3272 case "`cat %{l_prefix}/etc/openpkg/platform`" in
3273 *-*-cygwin* )
3274 # Cygwin under Windows Vista dislikes executables with
3275 # "patch" in the same and would require a "*.manifest"
3276 # file applied with the "mt.exe" from the "Windows
3277 # Software Development Kit (SDK)" in order to escape from
3278 # UAC. An easy alternative is to just rename the file to a
3279 # different name.
3280 cp %{l_prefix}/lib/openpkg/patch \
3281 %{l_prefix}/lib/openpkg/pitch
3282 %{l_prefix}/lib/openpkg/shtool subst \
3283 -e 's;openpkg/patch;openpkg/pitch;g' \
3284 %{l_prefix}/etc/openpkg/rpmmacros
3285 ;;
3286 esac
3288 # print license
3289 ( echo ""
3290 echo "NOTICE: Proprietary components of the OpenPKG Framework are covered"
3291 echo "by the following terms and conditions and require a valid run-time"
3292 echo "license, issued by the OpenPKG GmbH. An initial license, which allows"
3293 echo "30 days of free use for evaluation purposes, is already pre-installed."
3294 echo "Please go to http://openpkg.com/go/framework-license to obtain"
3295 echo "your permanent license."
3296 echo ""
3297 %{l_prefix}/bin/openpkg --license
3298 echo "______________________________________________________________________________"
3299 echo ""
3300 echo "NOTICE: Open Source components of the OpenPKG Framework are covered"
3301 echo "by various standard Open Source distribution licenses, including"
3302 echo "the MIT, BSD, LGPL, GPL, Public-Domain and Artistic licenses."
3303 echo "They all allow you the use of those components free of charge."
3304 echo "See http://www.opensource.org/licenses for more details."
3305 echo ""
3306 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
3308 # register package with central OpenPKG registry
3309 ( nohup %{l_prefix}/bin/openpkg register \
3310 </dev/null >/dev/null 2>&1 &
3311 ) </dev/null >/dev/null 2>&1 || true
3313 %preun
3314 [ ".$1" != .0 ] && exit 0
3316 # remove override files
3317 if [ -d %{l_prefix}/lib/openpkg/override ]; then
3318 rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
3319 fi
3321 # remove fallback files
3322 if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
3323 rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
3324 fi
3326 # remove files which are not RPM controlled
3327 rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
3328 rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
3329 rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
3330 rm -rf %{l_prefix}/RPM/TR/* %{l_prefix}/RPM/TR/.[a-z]* >/dev/null 2>&1 || true
3331 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
3333 # The following code usually would be done in a %postun section.
3334 # But because we already had to remove the database in this %preun
3335 # section (see the 'rm' commands above) in order to make RPM happy
3336 # inside its own removal procedure, RPM would no longer find the
3337 # %postun script (because it's recorded in the database files). So
3338 # we have to perform the procedure already in this %preun script.
3339 # except for the removal of the top-level directory it does not
3340 # matter. But the top-level directory can only be removed after
3341 # the RPM removal procedure took place, so we play a little delay
3342 # trick below.
3344 # determine current user
3345 cusr=`(id -un) 2>/dev/null ||\
3346 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
3347 (whoami) 2>/dev/null ||\
3348 (who am i | cut "-d " -f1) 2>/dev/null ||\
3349 echo $LOGNAME`
3351 # determine runtime details (for both inside and outside RPM!!)
3352 user="%{l_musr}"
3353 group="%{l_mgrp}"
3354 prefix="%{l_prefix}"
3355 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
3357 # determine platform id
3358 s=`(uname -s) 2>/dev/null` || s='Unknown'
3359 r=`(uname -r) 2>/dev/null` || r='0.0'
3360 plid="${s}/${r}"
3362 # unregister instance in presence file
3363 presence="/etc/openpkg"
3364 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
3365 if [ ".$exists" != . ]; then
3366 if [ ".$cusr" != ".root" ]; then
3367 echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
3368 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3369 else
3370 cp $presence $presence.bak && \
3371 egrep -v "^ *${prefix} *\$" $presence.bak >$presence
3372 rm -f $presence.bak >/dev/null 2>&1
3373 if [ ".`cat $presence`" = . ]; then
3374 rm -f $presence >/dev/null 2>&1
3375 fi
3376 fi
3377 fi
3379 # remove entry in /etc/shells
3380 shell="${prefix}/lib/openpkg/bash"
3381 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
3382 if [ ".$exists" != . ]; then
3383 if [ ".$cusr" != ".root" ]; then
3384 echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
3385 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3386 else
3387 cp /etc/shells /etc/shells.bak && \
3388 grep -v "^${shell}" /etc/shells.bak >/etc/shells
3389 rm -f /etc/shells.bak >/dev/null 2>&1
3390 fi
3391 fi
3393 # remove the hierarchy user/group
3394 for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
3395 "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
3396 "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
3397 "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
3398 # split request into class/usr/uid/grp/gid
3399 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
3400 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
3402 # check whether user already exists
3403 exists=`(getent passwd "$usr"; \
3404 grep "^$usr:" /etc/passwd; \
3405 ypmatch "$usr" passwd; \
3406 nismatch "$usr" passwd; \
3407 nidump passwd . | grep "^$usr:"; \
3408 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
3409 sed -e 'q'`
3410 if [ ".$exists" != . ]; then
3411 if [ ".$cusr" != ".root" ]; then
3412 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
3413 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3414 elif [ ".$usr" = ".root" ]; then
3415 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
3416 echo "openpkg:WARNING: (would remove system standard user)" 1>&2
3417 else
3418 case "$plid" in
3419 FreeBSD/* | NetBSD/* )
3420 cp /etc/master.passwd /etc/master.passwd.bak && \
3421 grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
3422 ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
3423 rm -f /etc/master.passwd.bak >/dev/null 2>&1
3424 ;;
3425 Linux/* | SunOS/5.* | UnixWare/* )
3426 cp /etc/passwd /etc/passwd.bak && \
3427 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3428 ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
3429 rm -f /etc/passwd.bak >/dev/null 2>&1
3430 ;;
3431 AIX/* )
3432 rmuser -p "${usr}"
3433 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
3434 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
3435 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
3436 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
3437 ;;
3438 OSF1/V5.* )
3439 cp /etc/passwd /etc/passwd.bak && \
3440 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3441 ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
3442 rm -f /etc/passwd.bak >/dev/null 2>&1
3443 ;;
3444 HP-UX/* )
3445 cp /etc/passwd /etc/passwd.bak && \
3446 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3447 rm -f /etc/passwd.bak >/dev/null 2>&1
3448 ;;
3449 Darwin/10.[1-9]* | Darwin/1[1-9].* )
3450 dscl . -delete "/users/${usr}"
3451 ;;
3452 Darwin/* )
3453 niutil -destroy . "/users/${usr}"
3454 ;;
3455 IRIX*/6.* )
3456 cp /etc/passwd /etc/passwd.bak && \
3457 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3458 if [ -f /etc/shadow ]
3459 then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
3460 fi
3461 rm -f /etc/passwd.bak >/dev/null 2>&1
3462 ;;
3463 CYGWIN*/* )
3464 cp /etc/passwd /etc/passwd.bak && \
3465 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3466 rm -f /etc/passwd.bak >/dev/null 2>&1
3467 ;;
3468 esac
3469 fi
3470 fi
3472 # check whether group already exists
3473 exists=`(getent group "$grp"; \
3474 grep "^$grp:" /etc/group; \
3475 ypmatch "$grp" group; \
3476 nismatch "$grp" group; \
3477 nidump group . | grep "^$grp:"; \
3478 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
3479 sed -e 'q'`
3480 if [ ".$exists" != . ]; then
3481 if [ ".$cusr" != ".root" ]; then
3482 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
3483 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3484 elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
3485 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
3486 echo "openpkg:WARNING: (would remove system standard group)" 1>&2
3487 else
3488 case "$plid" in
3489 Darwin/10.[1-9]* | Darwin/1[1-9].* )
3490 dscl . -delete "/groups/${grp}"
3491 ;;
3492 Darwin/* )
3493 niutil -destroy . "/groups/${grp}"
3494 ;;
3495 AIX/* )
3496 rmgroup "${grp}"
3497 ;;
3498 * )
3499 cp /etc/group /etc/group.bak && \
3500 grep -v "^${grp}:" /etc/group.bak >/etc/group
3501 rm -f /etc/group.bak >/dev/null 2>&1
3502 ;;
3503 esac
3504 fi
3505 fi
3506 done
3508 # invalidate passwd and group tables from Name Service Cache Daemon to
3509 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
3510 if [ -x /usr/sbin/nscd ]; then
3511 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
3512 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
3513 fi
3515 # remove the startup/shutdown transfer scripts
3516 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
3517 if [ ".$cusr" != ".root" ]; then
3518 echo "openpkg:WARNING: skipping deletion of system runcommand hooks" 1>&2
3519 echo "openpkg:WARNING: (would require root privileges)" 1>&2
3520 else
3521 case "$plid" in
3522 FreeBSD/* )
3523 rm -f /etc/rc.d/${name} >/dev/null 2>&1
3524 ;;
3525 NetBSD/* )
3526 rm -f /etc/rc.d/${name} >/dev/null 2>&1
3527 ;;
3528 Linux/* )
3529 if [ -f /etc/gentoo-release ]; then
3530 /sbin/rc-update del ${name} >/dev/null 2>&1
3531 rm -f /etc/init.d/${name} >/dev/null 2>&1
3532 elif [ -f /etc/redhat-release ]; then
3533 /sbin/chkconfig ${name} off >/dev/null 2>&1
3534 /sbin/chkconfig --del ${name} >/dev/null 2>&1
3535 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
3536 else
3537 # sroot: script root directory
3538 # lroot: link root directory
3539 if [ -f /etc/debian_version ]; then
3540 sroot=/etc/init.d
3541 lroot=/etc/rc%%d.d
3542 elif [ -f /etc/mandrake-release ]; then
3543 sroot=/etc/rc.d/init.d
3544 lroot=/etc/rc.d/rc%%d.d
3545 elif [ -f /etc/SuSE-release ]; then
3546 sroot=/etc/init.d
3547 lroot=/etc/init.d/rc%%d.d
3548 elif [ -f /etc/slackware-version ]; then
3549 sroot=/etc/rc.d
3550 lroot=/etc/rc.d/rc%%d.d
3551 name="rc.${name}"
3552 else
3553 echo "WARNING: you are not running one of the supported standard" 1>&2
3554 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
3555 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
3556 sroot=""
3557 lroot=""
3558 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
3559 if [ -d $sr ]; then
3560 sroot="$sr"
3561 break
3562 fi
3563 done
3564 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
3565 if [ -d $lr ]; then
3566 lroot="`echo $lr | sed -e 's;2;%%d;'`"
3567 break
3568 fi
3569 done
3570 if [ ".$sroot" = . -o ".$lroot" = . ]; then
3571 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
3572 exit 1
3573 fi
3574 fi
3575 rm -f ${sroot}/${name} >/dev/null 2>&1
3576 for i in 2 3 4 5; do
3577 rm -f `echo $lroot | sed -e "s;%%d;$i;"`/S99${name} >/dev/null 2>&1
3578 done
3579 for i in 0 1 6; do
3580 rm -f `echo $lroot | sed -e "s;%%d;$i;"`/K00${name} >/dev/null 2>&1
3581 done
3582 if [ -f /etc/slackware-version ]; then
3583 for i in 0 1 2 3 4 5 6; do
3584 l=`echo $lroot | sed -e "s;%%d;$i;"`
3585 if [ -d $l ]; then
3586 rmdir $l >/dev/null 2>&1 || true
3587 fi
3588 done
3589 fi
3590 fi
3591 ;;
3592 SunOS/5.1* )
3593 suname="`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
3594 svcdir=/`[ -d /lib/svc/manifest ] && echo lib || echo var`
3595 /usr/sbin/svcadm disable svc:/openpkg/${suname}:default; sleep 2
3596 rm -f /${svcdir}/svc/manifest/openpkg/${suname}.xml >/dev/null 2>&1
3597 rmdir /${svcdir}/svc/manifest/openpkg >/dev/null 2>&1 || true
3598 /usr/sbin/svcadm restart svc:/system/manifest-import
3599 ;;
3600 SunOS/5.* )
3601 rm -f /etc/init.d/${name} >/dev/null 2>&1
3602 rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
3603 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
3604 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
3605 ;;
3606 UnixWare/* )
3607 rm -f /etc/init.d/${name} >/dev/null 2>&1
3608 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
3609 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
3610 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
3611 ;;
3612 AIX/* )
3613 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
3614 rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
3615 ;;
3616 OSF1/V5.* )
3617 rm -f /sbin/init.d/${name} >/dev/null 2>&1
3618 rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
3619 rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
3620 ;;
3621 HP-UX/* )
3622 rm -f /sbin/init.d/${name} >/dev/null 2>&1
3623 rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
3624 rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
3625 ;;
3626 Darwin/* )
3627 darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
3628 cp /etc/hostconfig /etc/hostconfig.bak && \
3629 grep -v "^${darwin_rc_var}=" /etc/hostconfig.bak >/etc/hostconfig
3630 rm -f /etc/hostconfig.bak >/dev/null 2>&1
3631 rm -rf /Library/StartupItems/${name} >/dev/null 2>&1
3632 ;;
3633 IRIX*/6.* )
3634 rm -f /etc/init.d/${name} >/dev/null 2>&1
3635 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
3636 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
3637 ;;
3638 CYGWIN*/* )
3639 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
3640 rm -f /etc/rc.d/rc2.d/S90${name} >/dev/null 2>&1
3641 rm -f /etc/rc.d/rc1.d/K10${name} >/dev/null 2>&1
3642 ;;
3643 esac
3644 fi
3646 # remove the cron transfer entries
3647 if [ ".$cusr" != ".root" ]; then
3648 echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
3649 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3650 else
3651 case "$plid" in
3652 FreeBSD/* | Linux/* )
3653 if [ -f /etc/slackware-version ]; then
3654 EDITOR=/tmp/vipw.$$
3655 VISUAL="$EDITOR"
3656 export EDITOR
3657 export VISUAL
3658 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
3659 ( echo "cp \$1 \$1.bak"
3660 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
3661 echo "rm -f \$1.bak"
3662 ) >$EDITOR
3663 chmod a+x $EDITOR
3664 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3665 rm -f $EDITOR
3666 else
3667 exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
3668 if [ ".$exists" != . ]; then
3669 p=`echo $prefix | sed -e 's;/;\\\\/;g'`
3670 cp /etc/crontab /etc/crontab.bak
3671 cat /etc/crontab.bak |\
3672 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
3673 >/etc/crontab
3674 rm -f /etc/crontab.bak >/dev/null 2>&1
3675 fi
3676 fi
3677 ;;
3678 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
3679 EDITOR=/tmp/vipw.$$
3680 VISUAL="$EDITOR"
3681 export EDITOR
3682 export VISUAL
3683 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
3684 ( echo "cp \$1 \$1.bak"
3685 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
3686 echo "rm -f \$1.bak"
3687 ) >$EDITOR
3688 chmod a+x $EDITOR
3689 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3690 rm -f $EDITOR
3691 ;;
3692 IRIX*/6.* )
3693 p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
3694 ( crontab -l |
3695 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
3696 ) | /usr/bin/crontab || exit $?
3697 ;;
3698 esac
3699 fi
3701 # delayed removal of top-level directory.
3702 ( sleep 2
3703 rm -rf %{l_prefix}/RPM/PKG/* >/dev/null 2>&1 || true
3704 rm -rf %{l_prefix}/RPM/SRC/* >/dev/null 2>&1 || true
3705 rm -rf %{l_prefix}/RPM/CACHE/* >/dev/null 2>&1 || true
3706 rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
3707 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
3708 rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
3709 rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
3710 rmdir %{l_prefix} >/dev/null 2>&1 || true
3711 ) </dev/null >/dev/null 2>/dev/null &