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