Wed, 01 Aug 2012 23:54:32 +0200
Add smf(5) logic in addition to legacy initialization scripts.
The introduced smf logic causes Solaris platforms supporting the
smf(5) to integrate new OpenPKG manifests and associated configuration.
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 # remove unused and undefined methods
1197 sh $shtool subst \
1198 -e 's;^\(#include *<[^>][^>]*>\);/*\1*/;g' \
1199 rpmconstant/rpmconstant.h
1201 # provide nonstandard constructs
1202 cat > nonstandard.h <<EOF
1203 /* MSvB: define missing nonstandard GCC builtin extensions */
1204 #ifndef __GNUC__
1205 #define __builtin_expect(e,n) (e)
1206 #endif /* ifndef __GNUC__ */
1207 EOF
1209 # cheat GNU Autoconf
1210 ( echo 'ac_cv_path_MSGFMT=:'
1211 echo 'ac_cv_path_GMSGFMT=:'
1212 echo 'ac_cv_path_XGETTEXT=:'
1213 echo 'ac_cv_path_MSGMERGE=:'
1214 echo "ac_cv_header_getopt_h=no"
1215 echo "ac_cv_lib_gz_gzread=no"
1216 ) >config.cache
1218 # use miniperl
1219 PERL="${l_perl}"
1220 export PERL
1222 # set build tool flags
1223 CC="${l_cc}"
1224 CFLAGS="$bitopt"
1225 CPPFLAGS="-DRPM_VENDOR_OPENPKG"
1226 LDFLAGS="$bitopt"
1227 LIBS=""
1228 LIBS="$LIBS -lm"
1229 export CC
1230 export CFLAGS
1231 export CPPFLAGS
1232 export LDFLAGS
1233 export LIBS
1235 # special platform workarounds
1236 GREP="grep"
1237 export GREP
1239 # determine POPT option, RPM macros and Lua script file paths
1240 RPMPOPT="%{l_prefix}/lib/openpkg/rpmpopt"
1241 RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt"
1242 RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt.d/*"
1243 RPMPOPT="$RPMPOPT:~/.openpkg/rpmpopt"
1244 RPMPOPT="$RPMPOPT:@../../.openpkg/rpmpopt"
1245 RPMPOPT="$RPMPOPT:@../.openpkg/rpmpopt"
1246 RPMPOPT="$RPMPOPT:@./.openpkg/rpmpopt"
1247 RPMMACROS="%{l_prefix}/lib/openpkg/rpmmacros"
1248 RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros"
1249 RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros.d/*"
1250 RPMMACROS="$RPMMACROS:~/.openpkg/rpmmacros"
1251 RPMMACROS="$RPMMACROS:@../../.openpkg/rpmmacros"
1252 RPMMACROS="$RPMMACROS:@../.openpkg/rpmmacros"
1253 RPMMACROS="$RPMMACROS:@./.openpkg/rpmmacros"
1254 RPMLUA="%{l_prefix}/lib/openpkg/rpmlua"
1255 RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua"
1256 RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua.d/*"
1257 RPMLUA="$RPMLUA:~/.openpkg/rpmlua"
1258 RPMLUA="$RPMLUA:@../../.openpkg/rpmlua"
1259 RPMLUA="$RPMLUA:@../.openpkg/rpmlua"
1260 RPMLUA="$RPMLUA:@./.openpkg/rpmlua"
1262 # parametrize integrity checking framework
1263 sh $shtool subst \
1264 -e "s;0000000000000000000000000000000000000000;7D121A8FC05DC18A4329E9EF67042EC961B7AE34;" \
1265 -e "s;0\\.0\\.0;0.9.0;" \
1266 rpmqv.c
1268 # disable building of any tests
1269 # (mainly because those would fail because of integrity checking anyway)
1270 sh $shtool subst \
1271 -e 's;tools scripts tests doc;tools scripts doc;' \
1272 Makefile.in
1274 # configure program
1275 ./configure \
1276 --cache-file=./config.cache \
1277 --prefix=%{l_prefix} \
1278 --libdir="%{l_prefix}/lib" \
1279 --mandir="%{l_prefix}/man" \
1280 --includedir="%{l_prefix}/include/openpkg" \
1281 --with-name="OpenPKG RPM" \
1282 --with-path-cfg="%{l_prefix}/etc/openpkg" \
1283 --with-path-rpmpopt="$RPMPOPT" \
1284 --with-path-macros="$RPMMACROS" \
1285 --with-path-rpmlua="$RPMLUA" \
1286 --with-path-lib="%{l_prefix}/lib/openpkg" \
1287 --with-path-locale="%{l_prefix}/share/openpkg/locale" \
1288 --with-path-database="%{l_prefix}/RPM/DB" \
1289 --with-path-sources="%{l_prefix}/RPM" \
1290 --with-bugreport="openpkg-users@openpkg.org" \
1291 --with-beecrypt="$br/beecrypt-%{V_beecrypt}" \
1292 --with-openssl="$br/openssl-%{V_openssl}" \
1293 --with-zlib="$br/zlib-%{V_zlib}" \
1294 --with-bzip2="$br/bzip2-%{V_bzip2}" \
1295 --with-popt="$br/popt-%{V_popt}" \
1296 --with-sqlite="$br/sqlite-%{V_sqlite}" \
1297 --with-pcre="$br/pcre-%{V_pcre}" \
1298 --with-uuid="$br/uuid-%{V_uuid}" \
1299 --with-lua="internal" \
1300 --with-db="internal" \
1301 --without-db-rpc \
1302 --without-db-largefile \
1303 --with-db-tools-integrated \
1304 --with-db-mutex="UNIX/fcntl" \
1305 --without-file \
1306 --without-neon \
1307 --without-pthreads \
1308 --without-libelf \
1309 --without-selinux \
1310 --without-perl \
1311 --without-python \
1312 --without-apidocs \
1313 --disable-build-warnings \
1314 --disable-build-extlibdep \
1315 --disable-build-intlibdep \
1316 --disable-build-lafiles \
1317 --disable-shared \
1318 --disable-rpath \
1319 --disable-nls
1321 # build program
1322 ${l_make}
1323 ) || exit $?
1325 # display verbosity header
1326 set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
1328 # build "openpkg" executable
1329 ${l_make} -f `SOURCE openpkg.mk` \
1330 CC="${l_cc}" \
1331 OPENPKG_PREFIX="%{l_prefix}" \
1332 OPENPKG_SUSR="%{l_susr}" \
1333 OPENPKG_MUSR="%{l_musr}" \
1334 OPENPKG_DOT_C="`SOURCE openpkg.c`"
1336 # display verbosity header
1337 set +x; VERBOSE "BUILD: Build OpenPKG Mutual Exclusion (MutEx) Utility"; set -x
1339 # build "mutex" executable
1340 ${l_make} -f `SOURCE mutex.mk` \
1341 CC="${l_cc}" \
1342 CPPFLAGS="-Ipopt-%{V_popt}" \
1343 LDFLAGS="$bitopt -Lpopt-%{V_popt} -Lpopt-%{V_popt}/.libs" \
1344 MUTEX_DOT_C="`SOURCE mutex.c`"
1346 %install
1347 # skip in bootstrap phase 2 (see openpkg.boot)
1348 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
1350 # switch into a temporary build area
1351 cd openpkg-%{version}
1352 . ./.buildenv
1354 # display verbosity header
1355 set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
1357 # create installation hierarchy
1358 rm -rf $RPM_BUILD_ROOT
1359 sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
1360 for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
1361 test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
1362 mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
1363 done
1364 for i in 1 2 3 4 5 6 7 8 9; do
1365 test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
1366 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
1367 test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
1368 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
1369 done
1370 for dir in PKG bin etc include info lib man sbin; do
1371 test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
1372 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
1373 done
1374 for i in 1 2 3 4 5 6 7 8 9; do
1375 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
1376 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
1377 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
1378 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
1379 done
1380 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
1381 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
1382 for dir in SRC PKG DB TR TMP; do
1383 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
1384 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
1385 done
1386 mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
1388 # display verbosity header
1389 set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
1391 # install RPM into installation hierarchy
1392 ( cd rpm-%{V_rpm_major}.%{V_rpm_minor}
1393 ${l_make} install DESTDIR="$RPM_BUILD_ROOT"
1394 cp lua/rpmlua $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
1395 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
1396 ) || exit $?
1398 # post-adjust RPM installation
1399 mv $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/macros \
1400 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmmacros
1402 # display verbosity header
1403 set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
1405 # add additional development files
1406 cp rpm-%{V_rpm_major}.%{V_rpm_minor}/rpmio/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1407 cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1408 cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1409 cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
1410 cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1411 cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
1412 cp beecrypt-%{V_beecrypt}/include/beecrypt/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1413 cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
1414 cp popt-%{V_popt}/popt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1415 cp popt-%{V_popt}/.libs/libpopt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
1416 cp sqlite-%{V_sqlite}/sqlite3.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
1417 cp sqlite-%{V_sqlite}/.libs/libsqlite3.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmsqlite3.a
1419 # display verbosity header
1420 set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
1422 # move C API into custom locations
1423 mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
1424 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1425 mv $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/rpm.pc \
1426 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1427 # FIXME: does the rpm.pc really work this way?
1429 # move rpm tool to custom location
1430 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
1431 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1432 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
1433 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
1434 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm >/dev/null 2>&1 || true
1436 # move rpm2cpio tool to custom location
1437 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
1438 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
1439 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
1440 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
1441 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio >/dev/null 2>&1 || true
1443 # move rpmconstant tool to custom location
1444 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmconstant \
1445 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant
1446 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmconstant.8 \
1447 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant.8
1448 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant >/dev/null 2>&1 || true
1450 # move rpmcache tool to custom location
1451 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmcache \
1452 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache
1453 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmcache.8 \
1454 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache.8
1455 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache >/dev/null 2>&1 || true
1457 # move rpmgrep tool to custom location
1458 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmgrep \
1459 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep
1460 mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/rpmgrep.1 \
1461 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep.1
1462 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep >/dev/null 2>&1 || true
1464 # move manual pages to custom location
1465 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmdeps.8 \
1466 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmdeps.8
1467 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmgraph.8 \
1468 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgraph.8
1469 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
1470 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
1472 # display verbosity header
1473 set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
1475 # strip RPM installation
1476 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
1477 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
1478 for file in rpmbuild gendiff; do
1479 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
1480 done
1481 for dir in RPMS SRPMS SPEC SOURCES BUILD; do
1482 rm -rf $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir >/dev/null 2>&1 || true
1483 done
1484 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
1485 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
1486 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
1487 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig >/dev/null 2>&1 || true
1488 for file in \
1489 brp-compress brp-python-bytecompile brp-java-gcjcompile brp-strip brp-strip-comment-note \
1490 brp-nobuildrootpath brp-strip-shared brp-strip-static-archive brp-sparc64-linux check-files \
1491 cross-build executabledeps.sh find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
1492 find-provides.perl find-requires.perl getpo.sh http.req javadeps.sh libtooldeps.sh mono-find-provides \
1493 mono-find-requires osgideps.pl pkgconfigdeps.sh perldeps.pl perl.prov perl.req pythondeps.sh \
1494 php.prov php.req rpmdb_loadcvt rpm.daily rpm.log rpm.xinetd symclash.py symclash.sh tgpg u_pkg.sh \
1495 vpkg-provides.sh vpkg-provides2.sh install-sh mkinstalldirs; do
1496 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
1497 done
1498 for file in \
1499 db_archive db_checkpoint db_deadlock db_dump db_hotbackup db_load \
1500 db_printlog db_recover db_stat db_upgrade db_verify; do
1501 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
1502 done
1504 # display verbosity header
1505 set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
1507 # install lsync tool
1508 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1509 <`SOURCE lsync` \
1510 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1511 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1512 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1513 <`SOURCE dot.lsyncrc` \
1514 >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
1515 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1516 <`SOURCE lsync.8` \
1517 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
1519 # install rpm-config tool
1520 ( l_prefix="%{l_prefix}"
1521 l_cc="%{l_cc}"
1522 l_cflags=""
1523 l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
1524 l_ldflags="-L${l_prefix}/lib/openpkg"
1525 l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmmisc -lrpmsqlite3 -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
1526 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1527 -e "s:@l_cc@:$l_cc:g" \
1528 -e "s:@l_cflags@:$l_cflags:g" \
1529 -e "s:@l_cppflags@:$l_cppflags:g" \
1530 -e "s:@l_ldflags@:$l_ldflags:g" \
1531 -e "s:@l_libs@:$l_libs:g" \
1532 -e "s:@l_version@:%{V_rpm_major}.%{V_rpm_minor}:g" \
1533 <`SOURCE rpm-config.sh` \
1534 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1535 ) || exit $?
1536 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1537 sed -e "s:RPM_VERSION:%{V_rpm_major}.%{V_rpm_minor}:g" \
1538 <`SOURCE rpm-config.8` \
1539 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
1541 # install OpenPKG registry commands
1542 mv $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
1543 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
1544 sed -e "s;@l_prefix@;%{l_prefix};g" \
1545 `SOURCE rpm.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1546 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1547 sed -e "s;@l_prefix@;%{l_prefix};g" \
1548 `SOURCE register.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1549 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1550 cp `SOURCE register.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
1552 # allow GNU shtool to be called as "openpkg shtool" from external, too.
1553 sed -e "s;@l_prefix@;%{l_prefix};g" \
1554 `SOURCE shtool.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
1555 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
1557 # install OpenPKG tool chain command subset
1558 cp `SOURCE curl.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
1559 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
1560 cp `SOURCE build.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1561 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1562 cp `SOURCE build.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
1563 cp `SOURCE index.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
1564 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
1565 cp `SOURCE index.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.8
1566 cp `SOURCE search.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
1567 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
1568 cp `SOURCE search.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.8
1569 cp `SOURCE mirror.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
1570 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
1571 cp `SOURCE mirror.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.8
1572 cp `SOURCE makeproxy.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
1573 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
1574 cp `SOURCE makeproxy.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.8
1575 cp `SOURCE lint-fsl.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
1576 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
1577 cp `SOURCE lint-rc.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
1578 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
1579 cp `SOURCE lint-rpm.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
1580 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
1581 cp `SOURCE lint-spec.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
1582 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
1583 cp `SOURCE dev.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
1584 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
1585 cp `SOURCE dev.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.8
1586 cp `SOURCE sea.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
1587 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
1588 cp `SOURCE sea.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.8
1589 cp `SOURCE stack.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
1590 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
1591 cp `SOURCE stack.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.8
1593 # install RPM extension
1594 ( cd perl-%{V_perl}
1595 cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1596 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1597 ) || exit $?
1598 ( cd openssl-%{V_openssl}
1599 cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1600 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1601 ) || exit $?
1602 ( cd curl-%{V_curl}
1603 cp curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1604 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1605 ) || exit $?
1606 ( cd bzip2-%{V_bzip2}
1607 cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1608 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1609 ) || exit $?
1610 ( cd gzip-%{V_gzip}
1611 cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1612 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1613 ) || exit $?
1614 ( cd xz-%{V_xz}
1615 cp src/xz/xz $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
1616 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
1617 ) || exit $?
1618 ( cd patch-%{V_patch}
1619 cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1620 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1621 ) || exit $?
1622 ( cd tar-%{V_tar}
1623 cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1624 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1625 ) || exit $?
1626 ( cd bash-%{V_bash}
1627 cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1628 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1629 ) || exit $?
1630 ( cd uuid-%{V_uuid}
1631 cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1632 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1633 ) || exit $?
1634 ( cd sqlite-%{V_sqlite}
1635 cp sqlite3 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
1636 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
1637 ) || exit $?
1638 ( cd libarchive-%{V_libarchive}
1639 cp bsdcpio $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
1640 cp bsdtar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
1641 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
1642 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
1643 ) || exit $?
1644 ( cd diffutils-%{V_diffutils}
1645 ${l_strip} diff diff3 sdiff cmp
1646 cp diff diff3 sdiff cmp $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1647 ) || exit $?
1648 ( cd svs-%{V_svs}
1649 sed -e "s;/bin/sh;%{l_prefix}/lib/openpkg/bash;" \
1650 -e "s;^\( *\)\(diff \);\1%{l_prefix}/lib/openpkg/\2;" \
1651 <svs.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
1652 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
1653 cp svs.1 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs.1
1654 ) || exit $?
1655 sed -e "s;@l_prefix@;%{l_prefix};g" \
1656 -e "s;@l_musr@;%{l_musr};g" \
1657 -e "s;@l_mgrp@;%{l_mgrp};g" \
1658 <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1659 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1660 sed -e "s;@l_prefix@;%{l_prefix};g" \
1661 <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
1662 sed -e "s;@l_prefix@;%{l_prefix};g" \
1663 <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1664 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1665 sed -e "s;@l_prefix@;%{l_prefix};g" \
1666 <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
1667 sed -e "s;@l_prefix@;%{l_prefix};g" \
1668 -e "s;@l_musr@;%{l_musr};g" \
1669 -e "s;@l_mgrp@;%{l_mgrp};g" \
1670 <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1671 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1672 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1673 <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1674 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1675 sed -e "s;@l_prefix@;%{l_prefix};g" \
1676 -e "s;@l_musr@;%{l_musr};g" \
1677 -e "s;@l_mgrp@;%{l_mgrp};g" \
1678 <`SOURCE license.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
1679 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
1680 sed -e "s;@l_prefix@;%{l_prefix};g" \
1681 <`SOURCE license.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license.8
1683 # install OpenPKG tool chain execution frontend and execution wrapper
1684 cp openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1685 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1686 chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1687 sed -e "s;@l_prefix@;%{l_prefix};g" \
1688 <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1689 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1690 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1691 <`SOURCE openpkg.1` \
1692 >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
1694 # install more OpenPKG tool chain commands
1695 sed -e "s;@l_prefix@;%{l_prefix};g" \
1696 <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1697 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1699 # install OpenPKG mutex utility
1700 cp mutex $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/mutex
1702 # install an own copy of shtool
1703 cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1704 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1706 # display verbosity header
1707 set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
1709 # install a few README files
1710 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1711 <`SOURCE root.README` \
1712 >$RPM_BUILD_ROOT%{l_prefix}/README
1713 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1714 <`SOURCE local.README` \
1715 >$RPM_BUILD_ROOT%{l_prefix}/local/README
1717 # install Bash environment
1718 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1719 <`SOURCE dot.bashrc` \
1720 >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
1721 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1722 <`SOURCE dot.bash_login` \
1723 >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
1725 # install Run-Command files
1726 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1727 -e "s:@l_susr@:%{l_susr}:g" \
1728 -e "s:@l_musr@:%{l_musr}:g" \
1729 <`SOURCE rc` \
1730 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
1731 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
1732 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1733 <`SOURCE rc.conf` \
1734 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1735 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1736 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1737 <`SOURCE rc.func` \
1738 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1739 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1740 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
1741 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1742 -e "s:@l_musr@:%{l_musr}:g" \
1743 <`SOURCE rc.openpkg` \
1744 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1745 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1746 ( echo "#!/bin/sh"
1747 echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
1748 ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1749 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1750 ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
1751 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
1752 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1753 <`SOURCE rc.8` \
1754 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
1756 # create configuration directory
1757 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
1758 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
1760 # install platform identification file
1761 sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
1762 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1763 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1765 # install UUID configuration file (ghost)
1766 touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1767 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1769 # install registry configuration files (ghost)
1770 touch \
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
1775 chmod 644 \
1776 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
1777 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
1778 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
1779 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
1781 # install default managers configuration file
1782 ( echo "##"
1783 echo "## managers -- OpenPKG Instance Managers"
1784 echo "##"
1785 echo ""
1786 echo "%{l_susr}"
1787 echo "%{l_musr}"
1788 echo ""
1789 ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
1791 # install default release information file
1792 release_tag=""
1793 release_url=""
1794 l_stack=""; [ ".%{?l_stack:set}" = .set ] && l_stack="%{l_stack}"
1795 case "$l_stack" in
1796 http: | https: | ftp: | file: )
1797 release_url="$l_stack"
1798 ;;
1799 [a-zA-Z]* )
1800 release_tag="$l_stack"
1801 ;;
1802 esac
1803 ( echo "##"
1804 echo "## release -- OpenPKG Release Information"
1805 echo "##"
1806 echo ""
1807 echo "TAG=$release_tag"
1808 echo "URL=$release_url"
1809 echo ""
1810 ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/release
1812 # install overriding RPM configuration files
1813 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1814 <`SOURCE rpmpopt` \
1815 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt
1816 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1817 -e "s:@l_prefix_static@:%{l_prefix}:g" \
1818 -e "s;@l_build_path@;$l_build_path;g" \
1819 -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
1820 -e "s;@l_build_ulim@;$l_build_ulim;g" \
1821 -e "s;@l_unprivileged@;$l_unprivileged;g" \
1822 -e "s:@TAG@:$tag:g" \
1823 -e "s:@SUSR@:$susr:g" \
1824 -e "s:@SGRP@:$sgrp:g" \
1825 -e "s:@MUSR@:$musr:g" \
1826 -e "s:@MGRP@:$mgrp:g" \
1827 -e "s:@RUSR@:$rusr:g" \
1828 -e "s:@RGRP@:$rgrp:g" \
1829 -e "s:@NUSR@:$nusr:g" \
1830 -e "s:@NGRP@:$ngrp:g" \
1831 <`SOURCE rpmmacros` \
1832 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
1833 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1834 <`SOURCE rpmlua` \
1835 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua
1836 cp `SOURCE openpkg.org.pgp` \
1837 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
1838 cp `SOURCE openpkg.com.pgp` \
1839 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
1840 cp `SOURCE openpkg.net.pgp` \
1841 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
1843 # install license data
1844 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d || \
1845 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d
1846 cp `SOURCE license-BOOT.txt` \
1847 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/BOOT
1848 cp `SOURCE license-COMMUNITY.txt` \
1849 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/COMMUNITY
1850 cp `SOURCE license-EVAL.txt` \
1851 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EVAL
1852 cp `SOURCE license-EXAMPLE.txt` \
1853 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EXAMPLE
1854 cp `SOURCE license-PROMO.txt` \
1855 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/PROMO
1856 cp `SOURCE license-RECOVERY.txt` \
1857 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/RECOVERY
1858 cp `SOURCE license.lua` \
1859 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/license.lua
1860 touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license
1862 # provide directories for easy overriding of RPM configuration files
1863 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d || \
1864 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d
1865 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d || \
1866 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d
1867 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d || \
1868 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d
1870 # display verbosity header
1871 set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
1873 %files
1874 %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
1875 %{l_prefix}/README
1876 %config(noreplace) %{l_prefix}/.bashrc
1877 %config(noreplace) %{l_prefix}/.bash_login
1878 %dir %{l_prefix}/RPM
1879 %dir %{l_prefix}/RPM/SRC
1880 %dir %{l_prefix}/RPM/PKG
1881 %dir %{l_prefix}/RPM/TR
1882 %dir %{l_prefix}/RPM/DB
1883 %dir %{l_prefix}/RPM/TMP
1884 %dir %{l_prefix}/cgi
1885 %dir %{l_prefix}/bin
1886 %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
1887 %dir %{l_prefix}/etc
1888 %{l_prefix}/etc/rc
1889 %config(noreplace) %{l_prefix}/etc/rc.conf
1890 %{l_prefix}/etc/rc.func
1891 %dir %{l_prefix}/etc/rc.d
1892 %{l_prefix}/etc/rc.d/rc.openpkg
1893 %dir %{l_prefix}/etc/openpkg
1894 %ghost %{l_prefix}/etc/openpkg/license
1895 %dir %{l_prefix}/etc/openpkg/license.d
1896 %{l_prefix}/etc/openpkg/license.d/BOOT
1897 %{l_prefix}/etc/openpkg/license.d/COMMUNITY
1898 %{l_prefix}/etc/openpkg/license.d/EVAL
1899 %{l_prefix}/etc/openpkg/license.d/EXAMPLE
1900 %{l_prefix}/etc/openpkg/license.d/PROMO
1901 %{l_prefix}/etc/openpkg/license.d/RECOVERY
1902 %ghost %{l_prefix}/etc/openpkg/uuid
1903 %config %{l_prefix}/etc/openpkg/release
1904 %config %{l_prefix}/etc/openpkg/platform
1905 %config %{l_prefix}/etc/openpkg/rpmmacros
1906 %config %{l_prefix}/etc/openpkg/rpmpopt
1907 %config %{l_prefix}/etc/openpkg/rpmlua
1908 %dir %{l_prefix}/etc/openpkg/rpmmacros.d
1909 %dir %{l_prefix}/etc/openpkg/rpmpopt.d
1910 %dir %{l_prefix}/etc/openpkg/rpmlua.d
1911 %ghost %{l_prefix}/etc/openpkg/register.conf
1912 %ghost %{l_prefix}/etc/openpkg/register.prep
1913 %ghost %{l_prefix}/etc/openpkg/register.tran
1914 %ghost %{l_prefix}/etc/openpkg/register.util
1915 %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
1916 %{l_prefix}/etc/openpkg/openpkg.org.pgp
1917 %{l_prefix}/etc/openpkg/openpkg.com.pgp
1918 %{l_prefix}/etc/openpkg/openpkg.net.pgp
1919 %dir %{l_prefix}/include
1920 %dir %{l_prefix}/include/openpkg
1921 %dir %{l_prefix}/include/openpkg/rpm
1922 %{l_prefix}/include/openpkg/rpm/argv.h
1923 %{l_prefix}/include/openpkg/rpm/beecrypt.h
1924 %{l_prefix}/include/openpkg/rpm/bzlib.h
1925 %{l_prefix}/include/openpkg/rpm/db.h
1926 %{l_prefix}/include/openpkg/rpm/envvar.h
1927 %{l_prefix}/include/openpkg/rpm/fs.h
1928 %{l_prefix}/include/openpkg/rpm/fts.h
1929 %{l_prefix}/include/openpkg/rpm/glob.h
1930 %{l_prefix}/include/openpkg/rpm/mire.h
1931 %{l_prefix}/include/openpkg/rpm/misc.h
1932 %{l_prefix}/include/openpkg/rpm/pkgio.h
1933 %{l_prefix}/include/openpkg/rpm/popt.h
1934 %{l_prefix}/include/openpkg/rpm/rpm4compat.h
1935 %{l_prefix}/include/openpkg/rpm/rpmal.h
1936 %{l_prefix}/include/openpkg/rpm/rpmbc.h
1937 %{l_prefix}/include/openpkg/rpm/rpmbuild.h
1938 %{l_prefix}/include/openpkg/rpm/rpmcb.h
1939 %{l_prefix}/include/openpkg/rpm/rpmcli.h
1940 %{l_prefix}/include/openpkg/rpm/rpmconstant.h
1941 %{l_prefix}/include/openpkg/rpm/rpmdav.h
1942 %{l_prefix}/include/openpkg/rpm/rpmdb.h
1943 %{l_prefix}/include/openpkg/rpm/rpmds.h
1944 %{l_prefix}/include/openpkg/rpm/rpmevr.h
1945 %{l_prefix}/include/openpkg/rpm/rpmfc.h
1946 %{l_prefix}/include/openpkg/rpm/rpmfi.h
1947 %{l_prefix}/include/openpkg/rpm/rpmgc.h
1948 %{l_prefix}/include/openpkg/rpm/rpmgi.h
1949 %{l_prefix}/include/openpkg/rpm/rpmhash.h
1950 %{l_prefix}/include/openpkg/rpm/rpmio-stub.h
1951 %{l_prefix}/include/openpkg/rpm/rpmio.h
1952 %{l_prefix}/include/openpkg/rpm/rpmiotypes.h
1953 %{l_prefix}/include/openpkg/rpm/rpmku.h
1954 %{l_prefix}/include/openpkg/rpm/rpmlib.h
1955 %{l_prefix}/include/openpkg/rpm/rpmlog.h
1956 %{l_prefix}/include/openpkg/rpm/rpmmacro.h
1957 %{l_prefix}/include/openpkg/rpm/rpmmg.h
1958 %{l_prefix}/include/openpkg/rpm/rpmns.h
1959 %{l_prefix}/include/openpkg/rpm/rpmnss.h
1960 %{l_prefix}/include/openpkg/rpm/rpmpgp.h
1961 %{l_prefix}/include/openpkg/rpm/rpmps.h
1962 %{l_prefix}/include/openpkg/rpm/rpmspec.h
1963 %{l_prefix}/include/openpkg/rpm/rpmsq.h
1964 %{l_prefix}/include/openpkg/rpm/rpmssl.h
1965 %{l_prefix}/include/openpkg/rpm/rpmsw.h
1966 %{l_prefix}/include/openpkg/rpm/rpmsx.h
1967 %{l_prefix}/include/openpkg/rpm/rpmtag.h
1968 %{l_prefix}/include/openpkg/rpm/rpmte.h
1969 %{l_prefix}/include/openpkg/rpm/rpmts.h
1970 %{l_prefix}/include/openpkg/rpm/rpmurl.h
1971 %{l_prefix}/include/openpkg/rpm/rpmuuid.h
1972 %{l_prefix}/include/openpkg/rpm/rpmversion.h
1973 %{l_prefix}/include/openpkg/rpm/rpmwf.h
1974 %{l_prefix}/include/openpkg/rpm/rpmxar.h
1975 %{l_prefix}/include/openpkg/rpm/rpmzlog.h
1976 %{l_prefix}/include/openpkg/rpm/signature.h
1977 %{l_prefix}/include/openpkg/rpm/sqlite3.h
1978 %{l_prefix}/include/openpkg/rpm/ugid.h
1979 %{l_prefix}/include/openpkg/rpm/yarn.h
1980 %{l_prefix}/include/openpkg/rpm/zconf.h
1981 %{l_prefix}/include/openpkg/rpm/zlib.h
1982 %dir %{l_prefix}/info
1983 %dir %{l_prefix}/lib
1984 %dir %{l_prefix}/lib/openpkg
1985 %{l_prefix}/lib/openpkg/bash
1986 %{l_prefix}/lib/openpkg/bsdcpio
1987 %{l_prefix}/lib/openpkg/bsdtar
1988 %{l_prefix}/lib/openpkg/bzip2
1989 %{l_prefix}/lib/openpkg/curl
1990 %{l_prefix}/lib/openpkg/db_tool
1991 %{l_prefix}/lib/openpkg/cmp
1992 %{l_prefix}/lib/openpkg/diff
1993 %{l_prefix}/lib/openpkg/diff3
1994 %{l_prefix}/lib/openpkg/sdiff
1995 %{l_prefix}/lib/openpkg/gzip
1996 %{l_prefix}/lib/openpkg/librpm.a
1997 %{l_prefix}/lib/openpkg/librpmbeecrypt.a
1998 %{l_prefix}/lib/openpkg/librpmbuild.a
1999 %{l_prefix}/lib/openpkg/librpmbz2.a
2000 %{l_prefix}/lib/openpkg/librpmdb.a
2001 %{l_prefix}/lib/openpkg/librpmio.a
2002 %{l_prefix}/lib/openpkg/librpmmisc.a
2003 %{l_prefix}/lib/openpkg/librpmpopt.a
2004 %{l_prefix}/lib/openpkg/librpmsqlite3.a
2005 %{l_prefix}/lib/openpkg/librpmz.a
2006 %{l_prefix}/lib/openpkg/license.lua
2007 %{l_prefix}/lib/openpkg/miniperl
2008 %{l_prefix}/lib/openpkg/mutex
2009 %{l_prefix}/lib/openpkg/openpkg
2010 %{l_prefix}/lib/openpkg/openssl
2011 %{l_prefix}/lib/openpkg/patch
2012 %{l_prefix}/lib/openpkg/rc
2013 %{l_prefix}/lib/openpkg/rpm
2014 %{l_prefix}/lib/openpkg/rpm.pc
2015 %{l_prefix}/lib/openpkg/rpmdb
2016 %{l_prefix}/lib/openpkg/rpmdeps
2017 %{l_prefix}/lib/openpkg/lua
2018 %{l_prefix}/lib/openpkg/rpmmacros
2019 %{l_prefix}/lib/openpkg/rpmpopt
2020 %{l_prefix}/lib/openpkg/rpmtool
2021 %{l_prefix}/lib/openpkg/shtool
2022 %{l_prefix}/lib/openpkg/sqlite3
2023 %{l_prefix}/lib/openpkg/tar
2024 %{l_prefix}/lib/openpkg/uuid
2025 %{l_prefix}/lib/openpkg/xz
2026 %dir %{l_prefix}/libexec
2027 %dir %{l_prefix}/libexec/openpkg
2028 %{l_prefix}/libexec/openpkg/build.8
2029 %{l_prefix}/libexec/openpkg/build.pl
2030 %{l_prefix}/libexec/openpkg/curl.sh
2031 %{l_prefix}/libexec/openpkg/dev.8
2032 %{l_prefix}/libexec/openpkg/dev.pl
2033 %{l_prefix}/libexec/openpkg/index.8
2034 %{l_prefix}/libexec/openpkg/index.pl
2035 %{l_prefix}/libexec/openpkg/license
2036 %{l_prefix}/libexec/openpkg/license.8
2037 %{l_prefix}/libexec/openpkg/lsync
2038 %{l_prefix}/libexec/openpkg/lsync.8
2039 %{l_prefix}/libexec/openpkg/lint-fsl.pl
2040 %{l_prefix}/libexec/openpkg/lint-rc.pl
2041 %{l_prefix}/libexec/openpkg/lint-rpm.pl
2042 %{l_prefix}/libexec/openpkg/lint-spec.pl
2043 %{l_prefix}/libexec/openpkg/makeproxy.8
2044 %{l_prefix}/libexec/openpkg/makeproxy.pl
2045 %{l_prefix}/libexec/openpkg/man
2046 %{l_prefix}/libexec/openpkg/mirror.8
2047 %{l_prefix}/libexec/openpkg/mirror.pl
2048 %{l_prefix}/libexec/openpkg/rc
2049 %{l_prefix}/libexec/openpkg/rc.8
2050 %{l_prefix}/libexec/openpkg/register
2051 %{l_prefix}/libexec/openpkg/register.8
2052 %{l_prefix}/libexec/openpkg/release
2053 %{l_prefix}/libexec/openpkg/release.8
2054 %{l_prefix}/libexec/openpkg/rpm
2055 %{l_prefix}/libexec/openpkg/rpm-config
2056 %{l_prefix}/libexec/openpkg/rpm-config.8
2057 %{l_prefix}/libexec/openpkg/rpm.8
2058 %{l_prefix}/libexec/openpkg/rpmconstant
2059 %{l_prefix}/libexec/openpkg/rpmconstant.8
2060 %{l_prefix}/libexec/openpkg/rpm2cpio
2061 %{l_prefix}/libexec/openpkg/rpm2cpio.8
2062 %{l_prefix}/libexec/openpkg/rpmbuild.8
2063 %{l_prefix}/libexec/openpkg/rpmcache
2064 %{l_prefix}/libexec/openpkg/rpmcache.8
2065 %{l_prefix}/libexec/openpkg/rpmdeps.8
2066 %{l_prefix}/libexec/openpkg/rpmgraph.8
2067 %{l_prefix}/libexec/openpkg/rpmgrep
2068 %{l_prefix}/libexec/openpkg/rpmgrep.1
2069 %{l_prefix}/libexec/openpkg/sea.8
2070 %{l_prefix}/libexec/openpkg/sea.sh
2071 %{l_prefix}/libexec/openpkg/search.8
2072 %{l_prefix}/libexec/openpkg/search.pl
2073 %{l_prefix}/libexec/openpkg/stack.8
2074 %{l_prefix}/libexec/openpkg/stack.sh
2075 %{l_prefix}/libexec/openpkg/shtool.sh
2076 %{l_prefix}/libexec/openpkg/svs
2077 %{l_prefix}/libexec/openpkg/svs.1
2078 %{l_prefix}/libexec/openpkg/uuid
2079 %{l_prefix}/libexec/openpkg/uuid.8
2080 %dir %{l_prefix}/man
2081 %dir %{l_prefix}/man/man1
2082 %dir %{l_prefix}/man/man2
2083 %dir %{l_prefix}/man/man3
2084 %dir %{l_prefix}/man/man4
2085 %dir %{l_prefix}/man/man5
2086 %dir %{l_prefix}/man/man6
2087 %dir %{l_prefix}/man/man7
2088 %dir %{l_prefix}/man/man8
2089 %dir %{l_prefix}/man/man9
2090 %dir %{l_prefix}/man/cat1
2091 %dir %{l_prefix}/man/cat2
2092 %dir %{l_prefix}/man/cat3
2093 %dir %{l_prefix}/man/cat4
2094 %dir %{l_prefix}/man/cat5
2095 %dir %{l_prefix}/man/cat6
2096 %dir %{l_prefix}/man/cat7
2097 %dir %{l_prefix}/man/cat8
2098 %dir %{l_prefix}/man/cat9
2099 %{l_prefix}/man/man1/openpkg.1
2100 %dir %{l_prefix}/sbin
2101 %dir %{l_prefix}/pub
2102 %dir %{l_prefix}/share
2103 %dir %{l_prefix}/var
2104 %dir %{l_prefix}/local
2105 %{l_prefix}/local/README
2106 %{l_prefix}/local/.lsyncrc
2107 %dir %{l_prefix}/local/PKG
2108 %dir %{l_prefix}/local/bin
2109 %dir %{l_prefix}/local/etc
2110 %dir %{l_prefix}/local/include
2111 %dir %{l_prefix}/local/info
2112 %dir %{l_prefix}/local/lib
2113 %dir %{l_prefix}/local/man
2114 %dir %{l_prefix}/local/man/man1
2115 %dir %{l_prefix}/local/man/man2
2116 %dir %{l_prefix}/local/man/man3
2117 %dir %{l_prefix}/local/man/man4
2118 %dir %{l_prefix}/local/man/man5
2119 %dir %{l_prefix}/local/man/man6
2120 %dir %{l_prefix}/local/man/man7
2121 %dir %{l_prefix}/local/man/man8
2122 %dir %{l_prefix}/local/man/man9
2123 %dir %{l_prefix}/local/man/cat1
2124 %dir %{l_prefix}/local/man/cat2
2125 %dir %{l_prefix}/local/man/cat3
2126 %dir %{l_prefix}/local/man/cat4
2127 %dir %{l_prefix}/local/man/cat5
2128 %dir %{l_prefix}/local/man/cat6
2129 %dir %{l_prefix}/local/man/cat7
2130 %dir %{l_prefix}/local/man/cat8
2131 %dir %{l_prefix}/local/man/cat9
2132 %dir %{l_prefix}/local/sbin
2134 %clean
2135 # skip in bootstrap phase 2 (see openpkg.boot)
2136 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
2138 # cleanup build area
2139 rm -rf openpkg-%{version} >/dev/null 2>&1 || true
2141 # cleanup installation area
2142 rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
2144 %pre
2145 # always performed for upgrades and because it doesn't harm!
2146 # [ ".$1" != .1 ] && exit 0
2148 # this procedure is only usable with root privileges
2149 # (for non-root installations it is not required at all)
2150 cusr=`(id -un) 2>/dev/null ||\
2151 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
2152 (whoami) 2>/dev/null ||\
2153 (who am i | cut "-d " -f1) 2>/dev/null ||\
2154 echo $LOGNAME`
2156 # determine runtime details (for both inside and outside RPM!!)
2157 # - bootstrapping: $xxx is set from etc.wrapbin.sh
2158 # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
2159 # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
2160 [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
2161 [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
2162 [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
2163 [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
2164 [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
2165 [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
2166 [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
2167 [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
2168 [ ".$suid" = . ] && suid="%{?l_suid}"
2169 [ ".$sgid" = . ] && sgid="%{?l_sgid}"
2170 [ ".$muid" = . ] && muid="%{?l_muid}"
2171 [ ".$mgid" = . ] && mgid="%{?l_mgid}"
2172 [ ".$ruid" = . ] && ruid="%{?l_ruid}"
2173 [ ".$rgid" = . ] && rgid="%{?l_rgid}"
2174 [ ".$nuid" = . ] && nuid="%{?l_nuid}"
2175 [ ".$ngid" = . ] && ngid="%{?l_ngid}"
2177 # if any of these optional params are not used we won't have a
2178 # corresponding macro either, so make use of one conditionally
2179 [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
2180 [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
2181 [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
2182 [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
2183 [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
2184 [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
2185 [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
2186 [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
2188 # determine prefix
2189 [ ".$prefix" = . ] && prefix="%{l_prefix}"
2190 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
2192 # Pre-flight check before update to make sure that the currently
2193 # activated license is still valid. This is done just be friendly
2194 # to people and to not too easily shoot theirself into the foot
2195 # by blindly upgrading and then having to recognize that the new
2196 # OpenPKG Framework is no longer covered by the old license.
2197 if [ ".$1" = .2 ]; then
2198 ( OPENPKG_FRAMEWORK_RELEASE="%{release}"
2199 export OPENPKG_FRAMEWORK_RELEASE
2200 # LATER:
2201 # $prefix/bin/openpkg rpm -q openpkg >/dev/null 2>&1 || exit $?
2202 # if [ $? -ne 0 ]; then
2203 # NOW:
2204 output="`$prefix/bin/openpkg rpm -q openpkg 2>&1 | grep 'ENVIRONMENT ANOMALY'`"
2205 if [ ".$output" != . ]; then
2206 id="`($prefix/bin/openpkg license active) 2>/dev/null`"
2207 [ ".$id" = . ] && id="UNKNOWN"
2208 ( echo "Attention, your currently active license \"$id\" does"
2209 echo "not allow you to use this newer version of the OpenPKG Framework!"
2210 echo "We cancel this update to prevent you from a run-time failure."
2211 echo "Please first upgrade to a newer license with the command:"
2212 echo " \$ $prefix/bin/openpkg license update $id <file>"
2213 ) | $prefix/lib/openpkg/rpmtool msg -b -t error
2214 exit 42
2215 fi
2216 ) || exit $?
2217 fi
2219 # register instance in presence file
2220 presence="/etc/openpkg"
2221 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
2222 if [ ".$exists" = . ]; then
2223 ( umask 022
2224 echo "${prefix}" >>$presence
2225 ) 2>/dev/null || true
2226 fi
2228 # determine user/group ids
2229 for class in s m r n; do
2230 eval "xusr=\"\$${class}usr\""
2231 eval "xgrp=\"\$${class}grp\""
2232 eval "xuid=\"\$${class}uid\""
2233 eval "xgid=\"\$${class}gid\""
2234 if [ ".$xuid" = . ]; then
2235 case "$plid" in
2236 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2237 xuid=`dscl . -read "/users/${xusr}" UniqueID 2>/dev/null | awk '{ print $2; }'`
2238 ;;
2239 * )
2240 xuid=`(getent passwd "${xusr}"; \
2241 grep "^${xusr}:" /etc/passwd; \
2242 ypmatch "${xusr}" passwd; \
2243 nismatch "${xusr}" passwd; \
2244 nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
2245 sed -e 'q' | awk -F: '{ print $3; }'`
2246 ;;
2247 esac
2248 if [ ".$xuid" = . ]; then
2249 # seek for a reasonably uid/gid pair
2250 xuid=1000
2251 ok=0
2252 while [ ".$ok" = .0 ]; do
2253 eval "u_exists=\$u_exists_$xuid"
2254 if [ ".$u_exists" = . ]; then
2255 case "$plid" in
2256 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2257 u_exists=`dscl . -search /users UniqueID "$xuid" 2>/dev/null`
2258 ;;
2259 * )
2260 u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
2261 grep "^[^:]*:[^:]*:$xuid:"`
2262 ;;
2263 esac
2264 fi
2265 eval "g_exists=\$g_exists_$xuid"
2266 if [ ".$g_exists" = . ]; then
2267 case "$plid" in
2268 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2269 g_exists=`dscl . -search /groups PrimaryGroupID "$xuid" 2>/dev/null`
2270 ;;
2271 * )
2272 g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
2273 grep "^[^:]*:[^:]*:$xuid:"`
2274 esac
2275 fi
2276 if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
2277 ok=1
2278 break
2279 fi
2280 xuid=`expr $xuid + 1`
2281 done
2282 eval "u_exists_$xuid=yes"
2283 eval "g_exists_$xuid=yes"
2284 fi
2285 fi
2286 if [ ".$xgid" = . ]; then
2287 xgid=`(getent group "${xgrp}"; \
2288 grep "^${xgrp}:" /etc/group; \
2289 ypmatch "${xgrp}" group; \
2290 nismatch "${xgrp}" group; \
2291 nidump group . | grep "^${xgrp}:"; \
2292 dscl . -read "/groups/${xgrp}" | grep RecordName) 2>/dev/null | \
2293 sed -e 'q' | awk -F: '{ print $3; }'`
2294 if [ ".$xgid" = . ]; then
2295 xgid="$xuid"
2296 fi
2297 fi
2298 eval "${class}uid=\"$xuid\""
2299 eval "${class}gid=\"$xgid\""
2300 done
2302 # determine platform id
2303 s=`(uname -s) 2>/dev/null` || s='Unknown'
2304 r=`(uname -r) 2>/dev/null` || r='0.0'
2305 plid="${s}/${r}"
2307 # add entry to /etc/shells
2308 shell="${prefix}/lib/openpkg/bash"
2309 if [ -f /etc/shells ]; then
2310 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
2311 if [ ".$exists" = . ]; then
2312 if [ ".$cusr" != ".root" ]; then
2313 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
2314 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2315 else
2316 echo "${shell}" >>/etc/shells
2317 fi
2318 fi
2319 fi
2321 # clear pending deferred actions
2322 rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
2324 # create the hierarchy user/group
2325 for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
2326 "management:${musr}:${muid}:${mgrp}:${mgid}" \
2327 "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
2328 "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
2329 # split request into class/usr/uid/grp/gid
2330 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
2331 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
2333 # check whether user already exists
2334 exists=`(getent passwd "$usr"; \
2335 grep "^$usr:" /etc/passwd; \
2336 ypmatch "$usr" passwd; \
2337 nismatch "$usr" passwd; \
2338 nidump passwd . | grep "^$usr:"; \
2339 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
2340 sed -e 'q'`
2341 if [ ".$exists" = . ]; then
2342 if [ ".$cusr" != ".root" ]; then
2343 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
2344 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2345 else
2346 # add entry to passwd database
2347 realname="${prefix} OpenPKG ($class)"
2348 case "$plid" in
2349 FreeBSD/* | NetBSD/* )
2350 file=/etc/master.passwd
2351 entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
2352 update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
2353 ;;
2354 Linux/* )
2355 file=/etc/passwd
2356 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2357 update="(PATH=\$PATH:/usr/sbin; pwconv)"
2358 ;;
2359 SunOS/5.* | UnixWare/* )
2360 file=/etc/passwd
2361 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2362 update="(PATH=\$PATH:/usr/sbin; pwconv)"
2363 ;;
2364 AIX/* )
2365 # intentionally do nothing here
2366 :
2367 ;;
2368 OSF1/V5.* )
2369 file=/etc/passwd
2370 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2371 update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
2372 ;;
2373 HP-UX/* )
2374 file=/etc/passwd
2375 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2376 update=":"
2377 ;;
2378 Darwin/* )
2379 # intentionally do nothing here
2380 :
2381 ;;
2382 IRIX*/6.* )
2383 file=/etc/passwd
2384 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2385 if [ -f /etc/shadow ]
2386 then update="(PATH=\$PATH:/sbin; pwconv)"
2387 else update=":"
2388 fi
2389 ;;
2390 CYGWIN*/* )
2391 file=/etc/passwd
2392 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
2393 update=":"
2394 ;;
2395 esac
2396 case "$plid" in
2397 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2398 dscl . -create "/users/${usr}"
2399 dscl . -create "/users/${usr}" Password "*"
2400 dscl . -create "/users/${usr}" UniqueID "${uid}"
2401 dscl . -create "/users/${usr}" PrimaryGroupID "${gid}"
2402 dscl . -create "/users/${usr}" RealName "${realname}"
2403 dscl . -create "/users/${usr}" NFSHomeDirectory "${prefix}"
2404 dscl . -create "/users/${usr}" UserShell "${shell}"
2405 ;;
2406 Darwin/* )
2407 niutil -create . "/users/${usr}"
2408 niutil -createprop . "/users/${usr}" passwd "*"
2409 niutil -createprop . "/users/${usr}" uid "${uid}"
2410 niutil -createprop . "/users/${usr}" gid "${gid}"
2411 niutil -createprop . "/users/${usr}" realname "${realname}"
2412 niutil -createprop . "/users/${usr}" home "${prefix}"
2413 niutil -createprop . "/users/${usr}" shell "${shell}"
2414 ;;
2415 AIX/* )
2416 mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
2417 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
2418 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
2419 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
2420 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
2421 # defer both the setting of the primary group and the shell,
2422 # as they do not exist at this stage of processing.
2423 echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
2424 echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
2425 ;;
2426 * )
2427 cp $file $file.bak && \
2428 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
2429 rm -f $file.bak >/dev/null 2>&1
2430 eval $update
2431 [ $? -ne 0 ] && exit $?
2432 ;;
2433 esac
2434 fi
2435 fi
2437 # check whether group already exists
2438 exists=`(getent group "$grp"; \
2439 grep "^$grp:" /etc/group; \
2440 ypmatch "$grp" group; \
2441 nismatch "$grp" group; \
2442 nidump group . | grep "^$grp:"; \
2443 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
2444 sed -e 'q'`
2445 if [ ".$exists" = . ]; then
2446 if [ ".$cusr" != ".root" ]; then
2447 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
2448 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2449 else
2450 case "$plid" in
2451 Darwin/10.[1-9]* | Darwin/1[1-9].* )
2452 dscl . -create "/groups/${grp}"
2453 dscl . -create "/groups/${grp}" Password "*"
2454 dscl . -create "/groups/${grp}" PrimaryGroupID "${gid}"
2455 dscl . -create "/groups/${grp}" GroupMembership "${usr}"
2456 ;;
2457 Darwin/* )
2458 niutil -create . "/groups/${grp}"
2459 niutil -createprop . "/groups/${grp}" gid "${gid}"
2460 niutil -createprop . "/groups/${grp}" users "${usr}"
2461 ;;
2462 AIX/* )
2463 mkgroup id="${gid}" users="${usr}" "${grp}"
2464 ;;
2465 * )
2466 # add entry to group database
2467 file=/etc/group
2468 entry="${grp}:*:${gid}:${usr}"
2469 cp $file $file.bak && \
2470 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
2471 rm -f $file.bak >/dev/null 2>&1
2472 ;;
2473 esac
2474 fi
2475 fi
2476 done
2478 # optional group processing (deferred adjustment of primary group)
2479 if [ -f %{l_prefix}.pre-group-process.sh ]; then
2480 sh %{l_prefix}.pre-group-process.sh
2481 rm -f %{l_prefix}.pre-group-process.sh
2482 fi
2484 # invalidate passwd and group tables from Name Service Cache Daemon to
2485 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
2486 if [ -x /usr/sbin/nscd ]; then
2487 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
2488 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
2489 fi
2491 # create the startup/shutdown transfer script
2492 name_old="`echo "$prefix" | sed -e 's;/;;g'`"
2493 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
2494 if [ ".$cusr" != ".root" ]; then
2495 echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
2496 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2497 else
2498 case "$plid" in
2499 FreeBSD/* )
2500 if [ -f /etc/rc.d/${name_old} ]; then
2501 rm -f /etc/rc.d/${name_old}
2502 fi
2503 if [ ! -f /etc/rc.d/${name} ]; then
2504 # install transfer script
2505 rm -f /etc/rc.d/${name} >/dev/null 2>&1
2506 ( echo "#!/bin/sh"
2507 echo "##"
2508 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2509 echo "##"
2510 echo ""
2511 echo "# PROVIDE: ${name}"
2512 echo "# REQUIRE: LOGIN"
2513 echo "# KEYWORD: shutdown"
2514 echo ""
2515 echo ". /etc/rc.subr"
2516 echo ""
2517 echo "name=\"openpkg_${name}\""
2518 echo "start_cmd=\"openpkg_rc_all start\""
2519 echo "stop_cmd=\"openpkg_rc_all stop\""
2520 echo "restart_cmd=\"openpkg_rc_all stop start\""
2521 echo ""
2522 echo "openpkg_rc_all () {"
2523 echo " if [ -f ${prefix}/bin/openpkg ]; then"
2524 echo " ${prefix}/bin/openpkg rc all \"\$@\""
2525 echo " fi"
2526 echo "}"
2527 echo ""
2528 echo "load_rc_config \$name"
2529 echo "run_rc_command \"\$1\""
2530 echo ""
2531 ) >/etc/rc.d/${name}
2532 chmod 755 /etc/rc.d/${name}
2533 fi
2534 ;;
2535 NetBSD/* )
2536 if [ -f /etc/rc.d/${name_old} ]; then
2537 rm -f /etc/rc.d/${name_old}
2538 fi
2539 if [ ! -f /etc/rc.d/${name} ]; then
2540 ( echo "#!/bin/sh"
2541 echo "##"
2542 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2543 echo "##"
2544 echo "## PROVIDE: ${name}"
2545 echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS"
2546 echo "##"
2547 echo ""
2548 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2549 echo "case \$1 in"
2550 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2551 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2552 echo " restart ) exec ${prefix}/bin/openpkg rc all stop start ;;"
2553 echo " status ) ;;"
2554 echo "esac"
2555 ) >/etc/rc.d/${name}
2556 chmod 755 /etc/rc.d/${name}
2557 fi
2558 ;;
2559 Linux/* )
2560 if [ -f /etc/gentoo-release ]; then
2561 if [ -f /etc/init.d/${name_old} ]; then
2562 rm -f /etc/init.d/${name_old}
2563 fi
2564 if [ ! -f /etc/init.d/${name} ]; then
2565 # install transfer script
2566 ( echo "#!/sbin/runscript"
2567 echo "##"
2568 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2569 echo "##"
2570 echo ""
2571 echo "depend() {"
2572 echo " after *"
2573 echo "}"
2574 echo ""
2575 echo "checkconfig() {"
2576 echo " [ -f ${prefix}/bin/openpkg ] || return 1"
2577 echo " case $1 in"
2578 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2579 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2580 echo " esac"
2581 echo "}"
2582 echo ""
2583 echo "start() {"
2584 echo " checkconfig || return 1"
2585 echo " ebegin "Starting OpenPKG ${prefix} hierarchy""
2586 echo " exec ${prefix}/bin/openpkg rc all start"
2587 echo " eend 0"
2588 echo "}"
2589 echo ""
2590 echo "stop() {"
2591 echo " checkconfig || return 1"
2592 echo " ebegin "Stopping OpenPKG ${prefix} hierarchy""
2593 echo " exec ${prefix}/bin/openpkg rc all stop"
2594 echo " eend 0"
2595 echo "}"
2596 ) >/etc/init.d/${name}
2597 chmod 755 /etc/init.d/${name}
2598 /sbin/rc-update add ${name} default
2599 fi
2600 elif [ -f /etc/redhat-release ]; then
2601 sroot=/etc/rc.d/init.d
2602 if [ ! -f $sroot/${name} ]; then
2603 # install transfer script
2604 ( echo "#!/bin/sh"
2605 echo "##"
2606 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2607 echo "##"
2608 echo ""
2609 echo "# chkconfig: 2345 99 00"
2610 echo "# description: OpenPKG ${prefix}"
2611 echo ""
2612 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2613 echo "case \$1 in"
2614 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2615 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2616 echo "esac"
2617 ) >$sroot/${name}
2618 chmod 755 $sroot/${name}
2619 # activate script
2620 /sbin/chkconfig --add ${name}
2621 /sbin/chkconfig ${name} on
2622 fi
2623 else
2624 # sroot: script root directory
2625 # lroot: link root directory
2626 if [ -f /etc/debian_version ]; then
2627 sroot=/etc/init.d
2628 lroot=/etc/rc%%d.d
2629 elif [ -f /etc/mandrake-release ]; then
2630 sroot=/etc/rc.d/init.d
2631 lroot=/etc/rc.d/rc%%d.d
2632 elif [ -f /etc/SuSE-release ]; then
2633 sroot=/etc/init.d
2634 lroot=/etc/init.d/rc%%d.d
2635 elif [ -f /etc/slackware-version ]; then
2636 sroot=/etc/rc.d
2637 lroot=/etc/rc.d/rc%%d.d
2638 name="rc.${name}"
2639 for i in 0 1 2 3 4 5 6; do
2640 l=`echo $lroot | sed -e "s;%%d;$i;"`
2641 if [ ! -d $l ]; then
2642 mkdir $l 2>&1 || true
2643 fi
2644 done
2645 else
2646 echo "WARNING: you are not running one of the supported standard" 1>&2
2647 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
2648 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
2649 sroot=""
2650 lroot=""
2651 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
2652 if [ -d $sr ]; then
2653 sroot="$sr"
2654 break
2655 fi
2656 done
2657 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
2658 if [ -d $lr ]; then
2659 lroot="`echo $lr | sed -e 's;2;%%d;'`"
2660 break
2661 fi
2662 done
2663 if [ ".$sroot" = . -o ".$lroot" = . ]; then
2664 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
2665 exit 1
2666 fi
2667 fi
2668 if [ -f $sroot/${name_old} ]; then
2669 rm -f $sroot/${name_old}
2670 fi
2671 if [ ! -f $sroot/${name} ]; then
2672 # install transfer script
2673 ( echo "#!/bin/sh"
2674 echo "##"
2675 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2676 echo "##"
2677 echo ""
2678 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2679 echo "case \$1 in"
2680 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2681 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2682 echo "esac"
2683 ) >$sroot/${name}
2684 chmod 755 $sroot/${name}
2685 # create corresponding symbolic links
2686 for i in 2 3 4 5; do
2687 ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/S99${name}
2688 done
2689 for i in 0 1 6; do
2690 ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/K00${name}
2691 done
2692 fi
2693 fi
2694 ;;
2695 SunOS/5.1* )
2696 if [ ! -d /var/svc/manifest/openpkg ]; then
2697 mkdir /var/svc/manifest/openpkg
2698 fi
2699 if [ ! -f /var/svc/manifest/openpkg/${name}.xml ]; then
2700 # install SMF manifest
2701 ( echo "<?xml version=\"1.0\"?>"
2702 echo "<!DOCTYPE service_bundle SYSTEM \"/usr/share/lib/xml/dtd/service_bundle.dtd.1\">"
2703 echo "<service_bundle type='manifest' name='OpenPKG:${name}'>"
2704 echo " <service"
2705 echo " name='openpkg/${name}'"
2706 echo " type='service'"
2707 echo " version='1'>"
2708 echo " <single_instance />"
2709 echo " <dependency"
2710 echo " name='filesystem'"
2711 echo " type='service'"
2712 echo " grouping='require_all'"
2713 echo " restart_on='none'>"
2714 echo " <service_fmri value='svc:/system/filesystem/local' />"
2715 echo " </dependency>"
2716 echo " <dependency"
2717 echo " name='name-services'"
2718 echo " type='service'"
2719 echo " grouping='require_all'"
2720 echo " restart_on='none'>"
2721 echo " <service_fmri value='svc:/milestone/name-services' />"
2722 echo " </dependency>"
2723 echo " <dependency"
2724 echo " name='multi-user-server'"
2725 echo " type='service'"
2726 echo " grouping='require_all'"
2727 echo " restart_on='none'>"
2728 echo " <service_fmri value='svc:/milestone/multi-user-server' />"
2729 echo " </dependency>"
2730 echo " <dependency"
2731 echo " name='network'"
2732 echo " type='service'"
2733 echo " grouping='require_all'"
2734 echo " restart_on='none'>"
2735 echo " <service_fmri value='svc:/milestone/network' />"
2736 echo " </dependency>"
2737 echo " <exec_method"
2738 echo " type='method'"
2739 echo " name='start'"
2740 echo " exec='${prefix}/etc/rc all start'"
2741 echo " timeout_seconds='180'>"
2742 echo " <method_context>"
2743 echo " <method_credential user='root' group='root' />"
2744 echo " </method_context>"
2745 echo " </exec_method>"
2746 echo " <exec_method"
2747 echo " type='method'"
2748 echo " name='stop'"
2749 echo " exec='${prefix}/etc/rc all stop'"
2750 echo " timeout_seconds='180'>"
2751 echo " </exec_method>"
2752 echo " <property_group name='startd' type='framework'>"
2753 echo " <propval"
2754 echo " name='ignore_error'"
2755 echo " type='astring'"
2756 echo " value='core,signal' />"
2757 echo " </property_group>"
2758 echo " <property_group name='startd' type='framework'>"
2759 echo " <propval"
2760 echo " name='duration'"
2761 echo " type='astring'"
2762 echo " value='transient' />"
2763 echo " </property_group>"
2764 echo " <property_group name='general' type='framework'>"
2765 echo " <propval"
2766 echo " name='action_authorization'"
2767 echo " type='astring'"
2768 echo " value='solaris.smf.manage.openpkg.${name}' />"
2769 echo " </property_group>"
2770 echo " <instance name='default' enabled='false' />"
2771 echo " <stability value='Unstable' />"
2772 echo " <template>"
2773 echo " <common_name>"
2774 echo " <loctext xml:lang='C'>OpenPKG Instance ${prefix}</loctext>"
2775 echo " </common_name>"
2776 echo " </template>"
2777 echo " </service>"
2778 echo "</service_bundle>"
2779 ) >/var/svc/manifest/openpkg/${name}.xml
2780 chmod 644 /var/svc/manifest/openpkg/${name}.xml
2781 /usr/sbin/svccfg import /var/svc/manifest/openpkg/${name}.xml
2782 ( echo "/usr/sbin/svcadm enable \"svc:/openpkg/${name}:default\""
2783 ) >%{l_prefix}.pre-post-process.sh
2784 fi
2785 ;;
2786 SunOS/5.* )
2787 if [ -f /etc/init.d/${name_old} ]; then
2788 rm -f /etc/init.d/${name_old}
2789 fi
2790 if [ ! -f /etc/init.d/${name} ]; then
2791 # install transfer script
2792 ( echo "#!/bin/sh"
2793 echo "##"
2794 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2795 echo "##"
2796 echo ""
2797 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2798 echo "case \$1 in"
2799 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2800 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2801 echo "esac"
2802 ) >/etc/init.d/${name}
2803 chmod 755 /etc/init.d/${name}
2804 # create corresponding symbolic links
2805 ( cd /etc
2806 ln init.d/${name} rc3.d/S99${name}
2807 ln init.d/${name} rc0.d/K00${name}
2808 ln init.d/${name} rc1.d/K00${name}
2809 ) || exit $?
2810 fi
2811 ;;
2812 UnixWare/* )
2813 if [ -f /etc/init.d/${name_old} ]; then
2814 rm -f /etc/init.d/${name_old}
2815 fi
2816 if [ ! -f /etc/init.d/${name} ]; then
2817 # install transfer script
2818 ( echo "#!/bin/sh"
2819 echo "##"
2820 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2821 echo "##"
2822 echo ""
2823 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2824 echo "case \$1 in"
2825 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2826 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2827 echo "esac"
2828 ) >/etc/init.d/${name}
2829 chmod 755 /etc/init.d/${name}
2830 # create corresponding symbolic links
2831 ( cd /etc
2832 ln init.d/${name} rc2.d/S99${name}
2833 ln init.d/${name} rc0.d/K00${name}
2834 ln init.d/${name} rc1.d/K00${name}
2835 ) || exit $?
2836 fi
2837 ;;
2838 AIX/* )
2839 if [ -f /etc/rc.d/init.d/${name_old} ]; then
2840 rm -f /etc/rc.d/init.d/${name_old}
2841 fi
2842 if [ ! -f /etc/rc.d/init.d/${name} ]; then
2843 # install transfer script
2844 ( echo "#!/bin/sh"
2845 echo "##"
2846 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2847 echo "##"
2848 echo ""
2849 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2850 echo "case \$1 in"
2851 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2852 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2853 echo "esac"
2854 ) >/etc/rc.d/init.d/${name}
2855 chmod 755 /etc/rc.d/init.d/${name}
2856 # create corresponding symbolic links
2857 ( cd /etc/rc.d
2858 ln -s ../init.d/${name} rc2.d/S99${name}
2859 ) || exit $?
2860 fi
2861 ;;
2862 OSF1/V5.* )
2863 if [ -f /sbin/init.d/${name_old} ]; then
2864 rm -f /sbin/init.d/${name_old}
2865 fi
2866 if [ ! -f /sbin/init.d/${name} ]; then
2867 # install transfer script
2868 ( echo "#!/bin/sh"
2869 echo "##"
2870 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2871 echo "##"
2872 echo ""
2873 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2874 echo "case \$1 in"
2875 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2876 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2877 echo "esac"
2878 ) >/sbin/init.d/${name}
2879 chmod 755 /sbin/init.d/${name}
2880 # create corresponding symbolic links
2881 ( cd /sbin
2882 ln -s ../init.d/${name} rc3.d/S99${name}
2883 ln -s ../init.d/${name} rc0.d/K00${name}
2884 ) || exit $?
2885 fi
2886 ;;
2887 HP-UX/* )
2888 if [ -f /sbin/init.d/${name_old} ]; then
2889 rm -f /sbin/init.d/${name_old}
2890 fi
2891 if [ ! -f /sbin/init.d/${name} ]; then
2892 # install transfer script
2893 ( echo "#!/bin/sh"
2894 echo "##"
2895 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2896 echo "##"
2897 echo ""
2898 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2899 echo "case \$1 in"
2900 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2901 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2902 echo "esac"
2903 ) >/sbin/init.d/${name}
2904 chmod 755 /sbin/init.d/${name}
2905 # create corresponding symbolic links
2906 ( cd /sbin
2907 ln -s ../init.d/${name} rc2.d/S900${name}
2908 ln -s ../init.d/${name} rc1.d/K100${name}
2909 ) || exit $?
2910 fi
2911 ;;
2912 Darwin/* )
2913 if [ -d /Library/StartupItems/${name_old} ]; then
2914 rm -rf /Library/StartupItems/${name_old}
2915 fi
2916 darwin_rc_dir="/Library/StartupItems/${name}"
2917 if [ ! -d ${darwin_rc_dir} ]; then
2918 mkdir -p ${darwin_rc_dir}
2919 fi
2921 # make sure hierarchy is activated in /etc/hostconfig
2922 # FIXME: cs: simple and bad code here without any detection of existing entries
2923 darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
2924 echo "${darwin_rc_var}=-YES-" >>/etc/hostconfig
2926 # install transfer script
2927 if [ ! -f ${darwin_rc_dir}/${name} ]; then
2928 rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
2929 ( echo "#!/bin/sh"
2930 echo "##"
2931 echo "## ${darwin_rc_dir}/${name}"
2932 echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy"
2933 echo "##"
2934 echo ""
2935 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2936 echo ""
2937 echo ". /etc/rc.common"
2938 echo ""
2939 echo "if [ \"\${${darwin_rc_var}:=-NO-}\" = \"-YES-\" ]; then"
2940 echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
2941 echo " ${prefix}/bin/openpkg rc all start"
2942 echo "fi"
2943 ) >${darwin_rc_dir}/${name}
2944 chmod 755 ${darwin_rc_dir}/${name}
2945 fi
2947 # install startup parameter list
2948 if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
2949 rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
2950 ( echo "{"
2951 echo " Description = \"OpenPKG ${prefix} hierarchy\";"
2952 echo " Provides = (\"OpenPKG ${prefix}\");"
2953 echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
2954 echo " Uses = (\"Cron\");"
2955 echo " OrderPreference = \"Last\";"
2956 echo " Messages ="
2957 echo " {"
2958 echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
2959 echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
2960 echo " };"
2961 echo "}"
2962 ) >${darwin_rc_dir}/StartupParameters.plist
2963 chmod 644 ${darwin_rc_dir}/StartupParameters.plist
2964 fi
2965 ;;
2966 IRIX*/6.* )
2967 if [ -f /etc/init.d/${name_old} ]; then
2968 rm -f /etc/init.d/${name_old}
2969 fi
2970 if [ ! -f /etc/init.d/${name} ]; then
2971 # install transfer script
2972 ( echo "#!/bin/sh"
2973 echo "##"
2974 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2975 echo "##"
2976 echo ""
2977 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
2978 echo "case \$1 in"
2979 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
2980 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
2981 echo "esac"
2982 ) >/etc/init.d/${name}
2983 chmod 755 /etc/init.d/${name}
2984 # create corresponding links
2985 ( cd /etc
2986 ln -f init.d/${name} rc2.d/S99${name}
2987 ln -f init.d/${name} rc0.d/K00${name}
2988 ) || exit $?
2989 fi
2990 ;;
2991 CYGWIN*/* )
2992 if [ -f /etc/rc.d/init.d/${name_old} ]; then
2993 rm -f /etc/rc.d/init.d/${name_old}
2994 fi
2995 if [ ! -f /etc/rc.d/init.d/${name} ]; then
2996 # install transfer script
2997 ( echo "#!/bin/sh"
2998 echo "##"
2999 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
3000 echo "##"
3001 echo ""
3002 echo "test -f /etc/rc.d/init.d/functions && . /etc/rc.d/init.d/functions"
3003 echo "test -f /etc/sysconfig/network && . /etc/sysconfig/network"
3004 echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
3005 echo "case \$1 in"
3006 echo " start ) exec ${prefix}/bin/openpkg rc all start ;;"
3007 echo " stop ) exec ${prefix}/bin/openpkg rc all stop ;;"
3008 echo "esac"
3009 ) >/etc/rc.d/init.d/${name}
3010 chmod 755 /etc/rc.d/init.d/${name}
3011 # create corresponding symbolic links
3012 ( cd /etc/rc.d
3013 ln -s ../init.d/${name} rc2.d/S90${name}
3014 ln -s ../init.d/${name} rc1.d/K10${name}
3015 ) || exit $?
3016 fi
3017 ;;
3018 esac
3019 fi
3021 # create the cron transfer entries
3022 if [ ".$cusr" != ".root" ]; then
3023 echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
3024 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3025 else
3026 case "$plid" in
3027 FreeBSD/* | Linux/* )
3028 if [ -f /etc/slackware-version ]; then
3029 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
3030 if [ ".$exists" = . ]; then
3031 EDITOR=/tmp/vipw.$$
3032 VISUAL="$EDITOR"
3033 export EDITOR
3034 export VISUAL
3035 ( echo "#!/bin/sh"
3036 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
3037 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
3038 echo " echo \"0 0 1 * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
3039 echo " echo \"0 0 * * 0 [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
3040 echo " echo \"0 0 * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
3041 echo " echo \"0 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
3042 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
3043 echo " echo \"# </OpenPKG>\""
3044 echo ") >>\$1"
3045 ) >$EDITOR
3046 chmod a+x $EDITOR
3047 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3048 rm -f $EDITOR
3049 fi
3050 else
3051 exists=`egrep "($prefix/bin/openpkg|$prefix/etc/rc)" /etc/crontab`
3052 if [ ".$exists" = . ]; then
3053 ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
3054 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
3055 echo "0 0 1 * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
3056 echo "0 0 * * 0 root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
3057 echo "0 0 * * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
3058 echo "0 * * * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
3059 echo "*/15 * * * * root [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
3060 echo "# </OpenPKG>"
3061 ) >>/etc/crontab
3062 fi
3063 fi
3064 ;;
3065 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
3066 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
3067 if [ ".$exists" = . ]; then
3068 EDITOR=/tmp/vipw.$$
3069 VISUAL="$EDITOR"
3070 export EDITOR
3071 export VISUAL
3072 ( echo "#!/bin/sh"
3073 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
3074 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
3075 echo " echo \"0 0 1 * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
3076 echo " echo \"0 0 * * 0 [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
3077 echo " echo \"0 0 * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
3078 echo " echo \"0 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
3079 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
3080 echo " echo \"# </OpenPKG>\""
3081 echo ") >>\$1"
3082 ) >$EDITOR
3083 chmod a+x $EDITOR
3084 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3085 rm -f $EDITOR
3086 fi
3087 ;;
3088 IRIX*/6.* )
3089 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
3090 if [ ".$exists" = . ]; then
3091 ( crontab -l
3092 echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
3093 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
3094 echo "0 0 1 * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
3095 echo "0 0 * * 0 [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
3096 echo "0 0 * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
3097 echo "0 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
3098 echo "0,15,30,45 * * * * [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
3099 echo "# </OpenPKG>"
3100 ) | /usr/bin/crontab || exit $?
3101 fi
3102 ;;
3103 esac
3104 fi
3106 # remember what OpenPKG RPM version was installed, so we can
3107 # correctly upgrade the RPM database in the %post section (see below).
3108 if [ -d ${prefix}/RPM/DB ]; then
3109 if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
3110 # OpenPKG >= 2.0
3111 rpm="${prefix}/bin/openpkg rpm"
3112 else
3113 # OpenPKG 1.x
3114 rpm="${prefix}/bin/rpm"
3115 fi
3116 rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
3117 $rpm --version 2>/dev/null |\
3118 sed -e 's;^;X;' \
3119 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
3120 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
3121 -e 's;^X.*$;0.0;' \
3122 >${prefix}/RPM/DB/.version
3123 fi
3125 %post
3126 # optional post-processing from "pre" section
3127 if [ -f %{l_prefix}.pre-post-process.sh ]; then
3128 sh %{l_prefix}.pre-post-process.sh
3129 rm -f %{l_prefix}.pre-post-process.sh
3130 fi
3132 # update or initially create OpenPKG UUID configuration
3133 %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
3135 # when upgrading from RPM 4 to RPM 5 there will be no
3136 # initial license at all, so create one
3137 if [ ! -f %{l_prefix}/etc/openpkg/license ]; then
3138 echo "BOOT" >%{l_prefix}/etc/openpkg/license
3139 ( chown %{l_musr}:%{l_mgrp} %{l_prefix}/etc/openpkg/license
3140 chmod 644 %{l_prefix}/etc/openpkg/license
3141 ) >/dev/null 2>&1 || true
3142 fi
3144 # finally switch from a possibly active BOOT license to EVAL license
3145 # (notice: this is really the earliest time we can switch because the
3146 # previous command had to create the <prefix>/etc/openpkg/uuid first!)
3147 if [ ".`cat %{l_prefix}/etc/openpkg/license`" = ".BOOT" ]; then
3148 echo "EVAL" >%{l_prefix}/etc/openpkg/license
3149 fi
3151 # determine new and old OpenPKG RPM version
3152 V_rpm_new="%{V_rpm_major}.%{V_rpm_minor}"
3153 if [ -f %{l_prefix}/RPM/DB/.version ]; then
3154 V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
3155 rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
3156 else
3157 V_rpm_old="0.0"
3158 fi
3160 # make sure all RPM database files are present and that their
3161 # attributes are correct, etc. This is not a database rebuild
3162 # operation, so this is fully harmless and can be done always.
3163 %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate >/dev/null 2>&1 || true
3165 # check RPM database for upgrade requirements
3166 if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
3167 # RPM 4.0/4.1 does not allow concurrent database access, so we
3168 # cannot upgrade the database immediately from here (because
3169 # we are still running within the execution context of the
3170 # old RPM which in turn has the database locked) and instead
3171 # have to just drop a note to the administrator about database
3172 # upgrading. RPM >= 4.2 in general allows concurrent database
3173 # access, but the whole stuff is too risky here, too.
3174 ( echo "You are upgrading the OpenPKG bootstrap from a previous"
3175 echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
3176 echo "version. The RPM database in %{l_prefix}/RPM/DB/ can be"
3177 echo "reused, but you first have to upgrade it as soon as"
3178 echo "possible to the latest format files by executing:"
3179 echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
3180 echo "In case of problems with the RPM database you can always"
3181 echo "execute the command:"
3182 echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
3183 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
3184 fi
3186 # system command overriding support
3187 # ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
3188 # BUILD COMMAND OVERRIDE SOLUTION!
3189 if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
3190 mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
3191 fi
3192 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
3193 case "`cat %{l_prefix}/etc/openpkg/platform`" in
3194 *-*-debian* | *-*-ubuntu* )
3195 # FIXME: Evil hack to workaround build problems under Debian
3196 # (at least 3.1) (and similar platforms) where a Debian
3197 # install-info(8) exists which is both API and functionally
3198 # incompatible to the de-facto standardized install-info(8)
3199 # command from GNU Texinfo.
3200 if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
3201 ( echo "#!/bin/sh"
3202 echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
3203 echo "exit 0"
3204 ) >%{l_prefix}/lib/openpkg/override/install-info
3205 chmod 775 %{l_prefix}/lib/openpkg/override/install-info
3206 fi
3207 ;;
3208 *-*-macosx* | *-*-darwin* )
3209 # FIXME: Evil hack to workaround the fact that Mac OS X'
3210 # linker by default prefers the /usr/lib libraries and does
3211 # not honor the -L options the way one would expect it.
3212 gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
3213 cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
3214 ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
3215 if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
3216 ( echo "#!/bin/sh"
3217 echo "case \" \$* \" in"
3218 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
3219 echo " * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
3220 echo "esac"
3221 ) >%{l_prefix}/lib/openpkg/override/gcc
3222 chmod 775 %{l_prefix}/lib/openpkg/override/gcc
3223 fi
3224 if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
3225 ( echo "#!/bin/sh"
3226 echo "case \" \$* \" in"
3227 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
3228 echo " * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
3229 echo "esac"
3230 ) >%{l_prefix}/lib/openpkg/override/cc
3231 chmod 775 %{l_prefix}/lib/openpkg/override/cc
3232 fi
3233 if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
3234 ( echo "#!/bin/sh"
3235 echo "exec $ld -search_paths_first \"\$@\""
3236 ) >%{l_prefix}/lib/openpkg/override/ld
3237 chmod 775 %{l_prefix}/lib/openpkg/override/ld
3238 fi
3239 ;;
3240 esac
3242 # special support for fully unprivileged environments
3243 # where we cannot switch the user at all with su(1),
3244 # so we provide a dummy su(1) override command.
3245 if [ ".%{l_unprivileged}" = ".yes" ]; then
3246 ( echo "#!/bin/sh"
3247 echo "while [ \$# -gt 0 ]; do"
3248 echo " case \"\$1\" in"
3249 echo " - | -* ) shift ;;"
3250 echo " * ) shift; break ;;"
3251 echo " esac"
3252 echo "done"
3253 echo "exec /bin/sh \${1+\"\$@\"}"
3254 ) >%{l_prefix}/lib/openpkg/override/su
3255 chmod 775 %{l_prefix}/lib/openpkg/override/su
3256 fi
3258 # FIXME: hack to workaround problems in environments with too few
3259 # development tools. ATTENTION: see one paragraph above.
3260 if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
3261 mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
3262 fi
3263 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
3265 # cruel platform hack
3266 case "`cat %{l_prefix}/etc/openpkg/platform`" in
3267 *-*-cygwin* )
3268 # Cygwin under Windows Vista dislikes executables with
3269 # "patch" in the same and would require a "*.manifest"
3270 # file applied with the "mt.exe" from the "Windows
3271 # Software Development Kit (SDK)" in order to escape from
3272 # UAC. An easy alternative is to just rename the file to a
3273 # different name.
3274 cp %{l_prefix}/lib/openpkg/patch \
3275 %{l_prefix}/lib/openpkg/pitch
3276 %{l_prefix}/lib/openpkg/shtool subst \
3277 -e 's;openpkg/patch;openpkg/pitch;g' \
3278 %{l_prefix}/etc/openpkg/rpmmacros
3279 ;;
3280 esac
3282 # print license
3283 ( echo ""
3284 echo "NOTICE: Proprietary components of the OpenPKG Framework are covered"
3285 echo "by the following terms and conditions and require a valid run-time"
3286 echo "license, issued by the OpenPKG GmbH. An initial license, which allows"
3287 echo "30 days of free use for evaluation purposes, is already pre-installed."
3288 echo "Please go to http://openpkg.com/go/framework-license to obtain"
3289 echo "your permanent license."
3290 echo ""
3291 %{l_prefix}/bin/openpkg --license
3292 echo "______________________________________________________________________________"
3293 echo ""
3294 echo "NOTICE: Open Source components of the OpenPKG Framework are covered"
3295 echo "by various standard Open Source distribution licenses, including"
3296 echo "the MIT, BSD, LGPL, GPL, Public-Domain and Artistic licenses."
3297 echo "They all allow you the use of those components free of charge."
3298 echo "See http://www.opensource.org/licenses for more details."
3299 echo ""
3300 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
3302 # register package with central OpenPKG registry
3303 ( nohup %{l_prefix}/bin/openpkg register \
3304 </dev/null >/dev/null 2>&1 &
3305 ) </dev/null >/dev/null 2>&1 || true
3307 %preun
3308 [ ".$1" != .0 ] && exit 0
3310 # remove override files
3311 if [ -d %{l_prefix}/lib/openpkg/override ]; then
3312 rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
3313 fi
3315 # remove fallback files
3316 if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
3317 rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
3318 fi
3320 # remove files which are not RPM controlled
3321 rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
3322 rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
3323 rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
3324 rm -rf %{l_prefix}/RPM/TR/* %{l_prefix}/RPM/TR/.[a-z]* >/dev/null 2>&1 || true
3325 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
3327 # The following code usually would be done in a %postun section.
3328 # But because we already had to remove the database in this %preun
3329 # section (see the 'rm' commands above) in order to make RPM happy
3330 # inside its own removal procedure, RPM would no longer find the
3331 # %postun script (because it's recorded in the database files). So
3332 # we have to perform the procedure already in this %preun script.
3333 # except for the removal of the top-level directory it does not
3334 # matter. But the top-level directory can only be removed after
3335 # the RPM removal procedure took place, so we play a little delay
3336 # trick below.
3338 # determine current user
3339 cusr=`(id -un) 2>/dev/null ||\
3340 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
3341 (whoami) 2>/dev/null ||\
3342 (who am i | cut "-d " -f1) 2>/dev/null ||\
3343 echo $LOGNAME`
3345 # determine runtime details (for both inside and outside RPM!!)
3346 user="%{l_musr}"
3347 group="%{l_mgrp}"
3348 prefix="%{l_prefix}"
3349 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
3351 # determine platform id
3352 s=`(uname -s) 2>/dev/null` || s='Unknown'
3353 r=`(uname -r) 2>/dev/null` || r='0.0'
3354 plid="${s}/${r}"
3356 # unregister instance in presence file
3357 presence="/etc/openpkg"
3358 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
3359 if [ ".$exists" != . ]; then
3360 if [ ".$cusr" != ".root" ]; then
3361 echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
3362 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3363 else
3364 cp $presence $presence.bak && \
3365 egrep -v "^ *${prefix} *\$" $presence.bak >$presence
3366 rm -f $presence.bak >/dev/null 2>&1
3367 if [ ".`cat $presence`" = . ]; then
3368 rm -f $presence >/dev/null 2>&1
3369 fi
3370 fi
3371 fi
3373 # remove entry in /etc/shells
3374 shell="${prefix}/lib/openpkg/bash"
3375 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
3376 if [ ".$exists" != . ]; then
3377 if [ ".$cusr" != ".root" ]; then
3378 echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
3379 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3380 else
3381 cp /etc/shells /etc/shells.bak && \
3382 grep -v "^${shell}" /etc/shells.bak >/etc/shells
3383 rm -f /etc/shells.bak >/dev/null 2>&1
3384 fi
3385 fi
3387 # remove the hierarchy user/group
3388 for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
3389 "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
3390 "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
3391 "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
3392 # split request into class/usr/uid/grp/gid
3393 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
3394 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
3396 # check whether user already exists
3397 exists=`(getent passwd "$usr"; \
3398 grep "^$usr:" /etc/passwd; \
3399 ypmatch "$usr" passwd; \
3400 nismatch "$usr" passwd; \
3401 nidump passwd . | grep "^$usr:"; \
3402 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
3403 sed -e 'q'`
3404 if [ ".$exists" != . ]; then
3405 if [ ".$cusr" != ".root" ]; then
3406 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
3407 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3408 elif [ ".$usr" = ".root" ]; then
3409 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
3410 echo "openpkg:WARNING: (would remove system standard user)" 1>&2
3411 else
3412 case "$plid" in
3413 FreeBSD/* | NetBSD/* )
3414 cp /etc/master.passwd /etc/master.passwd.bak && \
3415 grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
3416 ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
3417 rm -f /etc/master.passwd.bak >/dev/null 2>&1
3418 ;;
3419 Linux/* | SunOS/5.* | UnixWare/* )
3420 cp /etc/passwd /etc/passwd.bak && \
3421 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3422 ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
3423 rm -f /etc/passwd.bak >/dev/null 2>&1
3424 ;;
3425 AIX/* )
3426 rmuser -p "${usr}"
3427 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
3428 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
3429 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
3430 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
3431 ;;
3432 OSF1/V5.* )
3433 cp /etc/passwd /etc/passwd.bak && \
3434 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3435 ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
3436 rm -f /etc/passwd.bak >/dev/null 2>&1
3437 ;;
3438 HP-UX/* )
3439 cp /etc/passwd /etc/passwd.bak && \
3440 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3441 rm -f /etc/passwd.bak >/dev/null 2>&1
3442 ;;
3443 Darwin/10.[1-9]* | Darwin/1[1-9].* )
3444 dscl . -delete "/users/${usr}"
3445 ;;
3446 Darwin/* )
3447 niutil -destroy . "/users/${usr}"
3448 ;;
3449 IRIX*/6.* )
3450 cp /etc/passwd /etc/passwd.bak && \
3451 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3452 if [ -f /etc/shadow ]
3453 then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
3454 fi
3455 rm -f /etc/passwd.bak >/dev/null 2>&1
3456 ;;
3457 CYGWIN*/* )
3458 cp /etc/passwd /etc/passwd.bak && \
3459 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
3460 rm -f /etc/passwd.bak >/dev/null 2>&1
3461 ;;
3462 esac
3463 fi
3464 fi
3466 # check whether group already exists
3467 exists=`(getent group "$grp"; \
3468 grep "^$grp:" /etc/group; \
3469 ypmatch "$grp" group; \
3470 nismatch "$grp" group; \
3471 nidump group . | grep "^$grp:"; \
3472 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
3473 sed -e 'q'`
3474 if [ ".$exists" != . ]; then
3475 if [ ".$cusr" != ".root" ]; then
3476 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
3477 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3478 elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
3479 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
3480 echo "openpkg:WARNING: (would remove system standard group)" 1>&2
3481 else
3482 case "$plid" in
3483 Darwin/10.[1-9]* | Darwin/1[1-9].* )
3484 dscl . -delete "/groups/${grp}"
3485 ;;
3486 Darwin/* )
3487 niutil -destroy . "/groups/${grp}"
3488 ;;
3489 AIX/* )
3490 rmgroup "${grp}"
3491 ;;
3492 * )
3493 cp /etc/group /etc/group.bak && \
3494 grep -v "^${grp}:" /etc/group.bak >/etc/group
3495 rm -f /etc/group.bak >/dev/null 2>&1
3496 ;;
3497 esac
3498 fi
3499 fi
3500 done
3502 # invalidate passwd and group tables from Name Service Cache Daemon to
3503 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
3504 if [ -x /usr/sbin/nscd ]; then
3505 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
3506 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
3507 fi
3509 # remove the startup/shutdown transfer scripts
3510 name=`echo "$prefix" | sed -e 's;/;;g'`
3511 if [ ".$cusr" != ".root" ]; then
3512 echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
3513 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3514 else
3515 case "$plid" in
3516 FreeBSD/* )
3517 rm -f /etc/rc.d/${name} >/dev/null 2>&1
3518 ;;
3519 NetBSD/* )
3520 rm -f /etc/rc.d/${name} >/dev/null 2>&1
3521 ;;
3522 Linux/* )
3523 if [ -f /etc/gentoo-release ]; then
3524 /sbin/rc-update del ${name} >/dev/null 2>&1
3525 rm -f /etc/init.d/${name} >/dev/null 2>&1
3526 elif [ -f /etc/redhat-release ]; then
3527 /sbin/chkconfig ${name} off >/dev/null 2>&1
3528 /sbin/chkconfig --del ${name} >/dev/null 2>&1
3529 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
3530 else
3531 # sroot: script root directory
3532 # lroot: link root directory
3533 if [ -f /etc/debian_version ]; then
3534 sroot=/etc/init.d
3535 lroot=/etc/rc%%d.d
3536 elif [ -f /etc/mandrake-release ]; then
3537 sroot=/etc/rc.d/init.d
3538 lroot=/etc/rc.d/rc%%d.d
3539 elif [ -f /etc/SuSE-release ]; then
3540 sroot=/etc/init.d
3541 lroot=/etc/init.d/rc%%d.d
3542 elif [ -f /etc/slackware-version ]; then
3543 sroot=/etc/rc.d
3544 lroot=/etc/rc.d/rc%%d.d
3545 name="rc.${name}"
3546 else
3547 echo "WARNING: you are not running one of the supported standard" 1>&2
3548 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
3549 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
3550 sroot=""
3551 lroot=""
3552 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
3553 if [ -d $sr ]; then
3554 sroot="$sr"
3555 break
3556 fi
3557 done
3558 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
3559 if [ -d $lr ]; then
3560 lroot="`echo $lr | sed -e 's;2;%%d;'`"
3561 break
3562 fi
3563 done
3564 if [ ".$sroot" = . -o ".$lroot" = . ]; then
3565 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
3566 exit 1
3567 fi
3568 fi
3569 rm -f ${sroot}/${name} >/dev/null 2>&1
3570 for i in 2 3 4 5; do
3571 rm -f `echo $lroot | sed -e "s;%%d;$i;"`/S99${name} >/dev/null 2>&1
3572 done
3573 for i in 0 1 6; do
3574 rm -f `echo $lroot | sed -e "s;%%d;$i;"`/K00${name} >/dev/null 2>&1
3575 done
3576 if [ -f /etc/slackware-version ]; then
3577 for i in 0 1 2 3 4 5 6; do
3578 l=`echo $lroot | sed -e "s;%%d;$i;"`
3579 if [ -d $l ]; then
3580 rmdir $l >/dev/null 2>&1 || true
3581 fi
3582 done
3583 fi
3584 fi
3585 ;;
3586 SunOS/5.1* )
3587 /usr/sbin/svcadm disable "svc:/openpkg/${name}:default"; sleep 2
3588 /usr/sbin/svccfg delete -f "svc:/openpkg/${name}:default" >/dev/null 2>&1 || true
3589 rm -f /var/svc/manifest/openpkg/${name}.xml >/dev/null 2>&1
3590 rmdir /var/svc/manifest/openpkg >/dev/null 2>&1 || true
3591 ;;
3592 SunOS/5.* )
3593 rm -f /etc/init.d/${name} >/dev/null 2>&1
3594 rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
3595 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
3596 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
3597 ;;
3598 UnixWare/* )
3599 rm -f /etc/init.d/${name} >/dev/null 2>&1
3600 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
3601 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
3602 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
3603 ;;
3604 AIX/* )
3605 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
3606 rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
3607 ;;
3608 OSF1/V5.* )
3609 rm -f /sbin/init.d/${name} >/dev/null 2>&1
3610 rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
3611 rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
3612 ;;
3613 HP-UX/* )
3614 rm -f /sbin/init.d/${name} >/dev/null 2>&1
3615 rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
3616 rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
3617 ;;
3618 Darwin/* )
3619 darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
3620 cp /etc/hostconfig /etc/hostconfig.bak && \
3621 grep -v "^${darwin_rc_var}=" /etc/hostconfig.bak >/etc/hostconfig
3622 rm -f /etc/hostconfig.bak >/dev/null 2>&1
3623 rm -rf /Library/StartupItems/${name} >/dev/null 2>&1
3624 ;;
3625 IRIX*/6.* )
3626 rm -f /etc/init.d/${name} >/dev/null 2>&1
3627 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
3628 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
3629 ;;
3630 CYGWIN*/* )
3631 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
3632 rm -f /etc/rc.d/rc2.d/S90${name} >/dev/null 2>&1
3633 rm -f /etc/rc.d/rc1.d/K10${name} >/dev/null 2>&1
3634 ;;
3635 esac
3636 fi
3638 # remove the cron transfer entries
3639 if [ ".$cusr" != ".root" ]; then
3640 echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
3641 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
3642 else
3643 case "$plid" in
3644 FreeBSD/* | Linux/* )
3645 if [ -f /etc/slackware-version ]; then
3646 EDITOR=/tmp/vipw.$$
3647 VISUAL="$EDITOR"
3648 export EDITOR
3649 export VISUAL
3650 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
3651 ( echo "cp \$1 \$1.bak"
3652 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
3653 echo "rm -f \$1.bak"
3654 ) >$EDITOR
3655 chmod a+x $EDITOR
3656 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3657 rm -f $EDITOR
3658 else
3659 exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
3660 if [ ".$exists" != . ]; then
3661 p=`echo $prefix | sed -e 's;/;\\\\/;g'`
3662 cp /etc/crontab /etc/crontab.bak
3663 cat /etc/crontab.bak |\
3664 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
3665 >/etc/crontab
3666 rm -f /etc/crontab.bak >/dev/null 2>&1
3667 fi
3668 fi
3669 ;;
3670 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
3671 EDITOR=/tmp/vipw.$$
3672 VISUAL="$EDITOR"
3673 export EDITOR
3674 export VISUAL
3675 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
3676 ( echo "cp \$1 \$1.bak"
3677 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
3678 echo "rm -f \$1.bak"
3679 ) >$EDITOR
3680 chmod a+x $EDITOR
3681 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
3682 rm -f $EDITOR
3683 ;;
3684 IRIX*/6.* )
3685 p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
3686 ( crontab -l |
3687 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
3688 ) | /usr/bin/crontab || exit $?
3689 ;;
3690 esac
3691 fi
3693 # delayed removal of top-level directory.
3694 ( sleep 2
3695 rm -rf %{l_prefix}/RPM/PKG/* >/dev/null 2>&1 || true
3696 rm -rf %{l_prefix}/RPM/SRC/* >/dev/null 2>&1 || true
3697 rm -rf %{l_prefix}/RPM/CACHE/* >/dev/null 2>&1 || true
3698 rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
3699 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
3700 rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
3701 rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
3702 rmdir %{l_prefix} >/dev/null 2>&1 || true
3703 ) </dev/null >/dev/null 2>/dev/null &