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