Mon, 10 Jan 2011 20:54:01 +0100
Import package vendor original specs for necessary manipulations.
1 ##
2 ## openpkg.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
5 ##
6 ## Permission to use, copy, modify, and distribute this software for
7 ## any purpose with or without fee is hereby granted, provided that
8 ## the above copyright notice and this permission notice appear in all
9 ## copies.
10 ##
11 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 ## SUCH DAMAGE.
23 ##
25 # NOTICE: This OpenPKG RPM specification is _very_ special, because
26 # it is used both for bootstrapping OpenPKG with its OpenPKG RPM and
27 # for regular builds of OpenPKG RPM in order to upgrade an existing
28 # installation. For this it has to interact correctly with the
29 # "openpkg.boot" script. See the documentation in the file "README"
30 # and the source of the companion script "openpkg.boot" for details,
31 # but do not touch anything here until you are 100% sure about what
32 # you are doing. In short: This script is allowed to use only a very
33 # restricted subset of the OpenPKG RPM functionality!
35 # BUILD REQUIREMENTS:
36 # o any sh(1)
37 # o any tar(1)
38 # o any make(1)
39 # o any cc(1)
41 # the package version/release
42 %define V_openpkg 20101018
44 # the used software versions
45 %define V_rpm 4.2.1
46 %define V_zlib 1.2.5
47 %define V_bzip2 1.0.5
48 %define V_beecrypt 4.1.2
49 %define V_curl 7.21.1
50 %define V_make 3.82
51 %define V_gzip 1.4
52 %define V_gzip_r 1.13
53 %define V_patch 2.6.1
54 %define V_tar 1.23
55 %define V_bash 3.2
56 %define V_uuid 1.6.2
57 %define V_config 20060923
58 %define V_registry 1.1.3
59 %define V_perl 5.10.0
60 %define V_openssl 0.9.8g
61 %define V_tools 1.4.5
62 %define V_exec 2.0.1-C
64 # package information
65 Name: openpkg
66 Summary: OpenPKG Bootstrap
67 URL: http://www.openpkg.org/
68 Vendor: OpenPKG
69 Packager: OpenPKG Foundation e.V.
70 Distribution: OpenPKG Community
71 Class: CORE
72 Group: Bootstrapping
73 License: MIT/BSD/LGPL/GPL
74 Version: %{V_openpkg}
75 Release: %{V_openpkg}
77 # list of sources
78 Source0: ftp://ftp.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
79 Source1: ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz
80 Source2: ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
81 Source3: ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
82 Source4: ftp://ftp.openpkg.org/sources/CPY/config/config-%{V_config}.tar.gz
83 Source5: ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/openpkg-registry-%{V_registry}.tar.gz
84 Source6: ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/openpkg-tools-%{V_tools}.tar.gz
85 Source7: ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar
86 Source8: ftp://ftp.gnu.org/gnu/gzip/gzip-%{V_gzip}.tar
87 Source9: ftp://ftp.openpkg.org/sources/CPY/openpkg/openpkg-executable-%{V_exec}.tar.gz
88 Source10: ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
89 Source11: ftp://ftp.openpkg.org/sources/CPY/perl/perl-%{V_perl}-mini.tar.gz
90 Source12: ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
91 Source13: ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
92 Source14: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
93 Source15: http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
94 Source16: http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
95 Source17: http://www.zlib.net/zlib-%{V_zlib}.tar.gz
96 Source100: bash.patch
97 Source101: beecrypt.patch
98 Source102: make.patch
99 Source103: openssl.patch
100 Source104: perl.patch
101 Source105: tar.patch
102 Source106: rpm.patch.bugfix
103 Source107: rpm.patch.feature
104 Source108: rpm.patch.porting
105 Source109: rpm.patch.regen
106 Source200: HISTORY
107 Source201: README
108 Source202: aux.prereq.sh
109 Source203: aux.usrgrp.sh
110 Source204: aux.wrapbin.sh
111 Source205: aux.wrapsrc.sh
112 Source206: dot.bash_login
113 Source207: dot.bashrc
114 Source208: dot.lsyncrc
115 Source209: install.sh
116 Source210: local.README
117 Source211: lsync
118 Source212: lsync.8
119 Source213: lsync.pod
120 Source214: man.sh
121 Source215: openpkg.1
122 Source216: openpkg.boot
123 Source217: openpkg.com.pgp
124 Source218: openpkg.net.pgp
125 Source219: openpkg.org.pgp
126 Source220: openpkg.pod
127 Source221: openpkg.sh
128 Source222: pod2man.sh
129 Source223: rc
130 Source224: rc.8
131 Source225: rc.conf
132 Source226: rc.func
133 Source227: rc.openpkg
134 Source228: rc.pod
135 Source229: release.8
136 Source230: release.pod
137 Source231: release.sh
138 Source232: root.README
139 Source233: rpm-config.8
140 Source234: rpm-config.pod
141 Source235: rpm-config.sh
142 Source236: rpmdb
143 Source237: rpmtool
144 Source238: rpmtool.8
145 Source239: rpmtool.pod
146 Source240: shtool
147 Source241: uuid.8
148 Source242: uuid.pod
149 Source243: uuid.sh
150 Source244: rpmmacros
151 Source245: rpmpopt
152 Source246: rpmrc
154 # build information
155 Prefix: %{l_prefix}
156 BuildRoot: %{l_buildroot}
157 AutoReq: no
158 AutoReqProv: no
159 Provides: OpenPKG
161 %description
162 This is the bootstrap package for the RPM-based Unix Software
163 Package Hierarchy OpenPKG. The RPM Package Manager (RPM) is a
164 sophisticated and portable package manager for Unix platforms,
165 which supports automated building, installation, management and
166 deinstallation of Unix software. RPM was originally designed and
167 implemented for the RedHat Linux operating system where it manages
168 every file on the whole system. OpenPKG uses RPM only for managing
169 the files in a particular filesystem hierarchy dedicated to the
170 installation of third-party software packages provided by the
171 OpenPKG project.
173 The OpenPKG bootstrap package includes the following software:
174 RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
175 GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
176 GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
177 OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt},
178 OpenSSL %{V_openssl}, Perl %{V_perl}
180 %track
181 prog openpkg:bash = {
182 version = %{V_bash}
183 url = ftp://ftp.cwru.edu/pub/bash/
184 regex = bash-(__VER__)\.tar\.gz
185 }
186 prog openpkg:bzip2 = {
187 version = %{V_bzip2}
188 url = http://www.bzip.org/downloads.html
189 regex = bzip2-(__VER__)\.tar\.gz
190 }
191 prog openpkg:curl = {
192 version = %{V_curl}
193 url = http://curl.haxx.se/download/
194 regex = curl-(__VER__)\.tar\.gz
195 }
196 prog openpkg:gzip = {
197 comment = "rse: intentionally tracked at gnu.org, although fetched from openpkg.org because of uncompression"
198 version = %{V_gzip}
199 url = ftp://ftp.gnu.org/gnu/gzip/
200 regex = gzip-(__VER__)\.tar(\.gz)?
201 }
202 prog openpkg:gzip_r = {
203 version = %{V_gzip_r}
204 url = ftp://ftp.openpkg.org/sources/CPY/openpkg/
205 regex = gzip-%{V_gzip}-openpkg-r(__VER__)\.tar
206 }
207 prog openpkg:make = {
208 version = %{V_make}
209 url = ftp://ftp.gnu.org/gnu/make/
210 regex = make-(__VER__)\.tar\.gz
211 }
212 prog openpkg:patch = {
213 disabled
214 comment = "rse: directory missing after GNU.org security issues"
215 version = %{V_patch}
216 url = ftp://alpha.gnu.org/gnu/patch/
217 regex = patch-(__VER__)\.tar\.gz
218 }
219 prog openpkg:rpm = {
220 disabled
221 comment = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1"
222 version = %{V_rpm}
223 url = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/
224 regex = rpm-(4\.2\.\d+)\.tar\.gz
225 }
226 prog openpkg:tar = {
227 version = %{V_tar}
228 url = ftp://ftp.gnu.org/gnu/tar/
229 regex = tar-(__VER__)\.tar\.gz
230 }
231 prog openpkg:zlib = {
232 version = %{V_zlib}
233 url = http://www.zlib.net/
234 regex = zlib-(__VER__)\.tar\.gz
235 }
236 prog openpkg:uuid = {
237 version = %{V_uuid}
238 url = ftp://ftp.ossp.org/pkg/lib/uuid/
239 regex = uuid-(__VER__)\.tar\.gz
240 }
241 prog openpkg:config = {
242 version = %{V_config}
243 url = ftp://ftp.openpkg.org/sources/CPY/config/
244 regex = config-(__VER__)\.tar\.gz
245 }
246 prog openpkg:beecrypt = {
247 version = %{V_beecrypt}
248 url = http://prdownloads.sourceforge.net/beecrypt/
249 regex = beecrypt-(__VER__)\.tar\.gz
250 }
251 prog openpkg:registry = {
252 version = %{V_registry}
253 url = ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/
254 regex = openpkg-registry-(__VER__)\.tar\.gz
255 }
256 prog openpkg:perl = {
257 version = %{V_perl}
258 url = ftp://ftp.openpkg.org/sources/CPY/perl/
259 regex = perl-(__VER__)-mini\.tar\.gz
260 }
261 prog openpkg:openssl = {
262 version = %{V_openssl}
263 url = ftp://ftp.openssl.org/source/
264 regex = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
265 }
266 prog openpkg:openpkg-tools = {
267 version = %{V_tools}
268 url = ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/
269 regex = openpkg-tools-(__VER__)\.tar\.gz
270 }
271 prog openpkg:openpkg-executable = {
272 version = %{V_exec}
273 url = ftp://ftp.openpkg.org/sources/CPY/openpkg/
274 regex = openpkg-executable-(__VER__-C)\.tar\.gz
275 }
277 %prep
278 # skip in bootstrap phase 2 (see openpkg.boot)
279 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
281 # switch into a temporary build area
282 rm -rf openpkg-%{version}
283 mkdir openpkg-%{version}
284 cd openpkg-%{version}
285 rm -f .buildenv
286 touch .buildenv
288 # provide a bootstrap alternative to %{SOURCE xxx} because else
289 # it is not possible to upgrade a newer OpenPKG RPM with an older
290 # OpenPKG RPM.
291 echo >>.buildenv 'SOURCE () {'
292 echo >>.buildenv ' if [ -f "%{_specdir}/$1" ]; then'
293 echo >>.buildenv ' echo "%{_specdir}/$1"'
294 echo >>.buildenv ' else'
295 echo >>.buildenv ' echo "%{_sourcedir}/$1"'
296 echo >>.buildenv ' fi'
297 echo >>.buildenv '}'
298 echo >>.buildenv 'VERBOSE () {'
299 echo >>.buildenv ' if [ -f "%{_specdir}/rpmtool" ]; then'
300 echo >>.buildenv ' echo "$*" | sh %{_specdir}/rpmtool msg'
301 echo >>.buildenv ' else'
302 echo >>.buildenv ' echo "$*" | sh %{_sourcedir}/rpmtool msg'
303 echo >>.buildenv ' fi'
304 echo >>.buildenv '}'
305 . ./.buildenv
307 # display verbosity header
308 set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"; set -x
310 # determine path to shtool
311 shtool=`SOURCE shtool`
312 echo "shtool=$shtool" >>./.buildenv
314 # determine development tools
315 # - bootstrapping: %{l_xxx} is set via sed(1)
316 # - upgrading new: %{l_xxx} is set via rpmmacros
317 # - upgrading old: %{l_xxx} is not set at all
319 # manually make sure tar(1) is available
320 l_tar=""; export l_tar
321 [ ".%{?l_tar:set}" = .set ] && l_tar="%{l_tar}"
322 [ ".%{?use_tar:set}" = .set ] && l_tar="%{use_tar}"
323 if [ ".$l_tar" = . ]; then
324 l_tar=`sh $shtool path gtar tar`
325 if [ ".$l_tar" = . ]; then
326 echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
327 exit 1
328 fi
329 fi
330 echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
332 # manually make sure make(1) is available
333 l_make=""; export l_make
334 [ ".%{?l_make:set}" = .set ] && l_make="%{l_make}"
335 [ ".%{?use_make:set}" = .set ] && l_make="%{use_make}"
336 if [ ".$l_make" = . ]; then
337 l_make=`sh $shtool path gmake make`
338 if [ ".$l_make" = . ]; then
339 echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
340 exit 1
341 fi
342 fi
343 echo "l_make=\"$l_make\"; export l_make" >>.buildenv
345 # manually make sure cc(1) is available
346 l_cc=""; export l_cc
347 [ ".%{?l_cc:set}" = .set ] && l_cc="%{l_cc}"
348 [ ".%{?use_cc:set}" = .set ] && l_cc="%{use_cc}"
349 if [ ".$l_cc" = . ]; then
350 l_cc=`sh $shtool path gcc cc`
351 if [ ".$l_cc" = . ]; then
352 echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
353 exit 1
354 fi
355 fi
356 echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
358 # manually make sure ar(1) is available
359 l_ar=""; export l_ar
360 [ ".%{?l_ar:set}" = .set ] && l_ar="%{l_ar}"
361 [ ".%{?use_ar:set}" = .set ] && l_ar="%{use_ar}"
362 if [ ".$l_ar" = . ]; then
363 l_ar=`sh $shtool path ar`
364 if [ ".$l_ar" = . ]; then
365 echo "openpkg: prerequisite tool \`ar' not found"
366 exit 1
367 fi
368 fi
369 echo "l_ar=\"$l_ar\"; export l_ar" >>.buildenv
371 # manually make sure ld(1) is available
372 l_ld=""; export l_ld
373 [ ".%{?l_ld:set}" = .set ] && l_ld="%{l_ld}"
374 [ ".%{?use_ld:set}" = .set ] && l_ld="%{use_ld}"
375 if [ ".$l_ld" = . ]; then
376 l_ld=`sh $shtool path ld`
377 if [ ".$l_ld" = . ]; then
378 echo "openpkg: prerequisite tool \`ld' not found"
379 exit 1
380 fi
381 fi
382 echo "l_ld=\"$l_ld\"; export l_ld" >>.buildenv
384 # manually make sure as(1) is available
385 l_as=""; export l_as
386 [ ".%{?l_as:set}" = .set ] && l_as="%{l_as}"
387 [ ".%{?use_as:set}" = .set ] && l_as="%{use_as}"
388 if [ ".$l_as" = . ]; then
389 l_as=`sh $shtool path as`
390 if [ ".$l_as" = . ]; then
391 echo "openpkg: prerequisite tool \`as' not found"
392 exit 1
393 fi
394 fi
395 echo "l_as=\"$l_as\"; export l_as" >>.buildenv
397 # manually make sure strip(1) is available or use a null replacement
398 l_strip=""; export l_strip
399 [ ".%{?l_strip:set}" = .set ] && l_strip="%{l_strip}"
400 [ ".%{?use_strip:set}" = .set ] && l_strip="%{use_strip}"
401 if [ ".$l_strip" = . ]; then
402 l_strip=`sh $shtool path strip ls`
403 if [ ".$l_strip" = . ]; then
404 echo "openpkg: prerequisite tool \`strip' not found"
405 exit 1
406 fi
407 fi
408 echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv
410 # determine path to aux.usrgrp.sh script
411 usrgrp=`SOURCE aux.usrgrp.sh`
412 echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv
414 # display verbosity header
415 set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"; set -x
417 # determine user/group name/id pairs
418 # - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
419 # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
420 # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
421 susr=""; [ ".%{?l_susr:set}" = .set ] && susr="%{l_susr}"
422 sgrp=""; [ ".%{?l_sgrp:set}" = .set ] && sgrp="%{l_sgrp}"
423 musr=""; [ ".%{?l_musr:set}" = .set ] && musr="%{l_musr}"
424 mgrp=""; [ ".%{?l_mgrp:set}" = .set ] && mgrp="%{l_mgrp}"
425 rusr=""; [ ".%{?l_rusr:set}" = .set ] && rusr="%{l_rusr}"
426 rgrp=""; [ ".%{?l_rgrp:set}" = .set ] && rgrp="%{l_rgrp}"
427 nusr=""; [ ".%{?l_nusr:set}" = .set ] && nusr="%{l_nusr}"
428 ngrp=""; [ ".%{?l_ngrp:set}" = .set ] && ngrp="%{l_ngrp}"
429 # corresponding ids
430 suid=""; [ ".%{?l_suid:set}" = .set ] && suid="%{l_suid}"
431 sgid=""; [ ".%{?l_sgid:set}" = .set ] && sgid="%{l_sgid}"
432 muid=""; [ ".%{?l_muid:set}" = .set ] && muid="%{l_muid}"
433 mgid=""; [ ".%{?l_mgid:set}" = .set ] && mgid="%{l_mgid}"
434 ruid=""; [ ".%{?l_ruid:set}" = .set ] && ruid="%{l_ruid}"
435 rgid=""; [ ".%{?l_rgid:set}" = .set ] && rgid="%{l_rgid}"
436 nuid=""; [ ".%{?l_nuid:set}" = .set ] && nuid="%{l_nuid}"
437 ngid=""; [ ".%{?l_ngid:set}" = .set ] && ngid="%{l_ngid}"
438 # compat:
439 usr=""; [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
440 grp=""; [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
441 eval `sh $usrgrp \
442 --usr="$usr" --grp="$grp" \
443 --susr="$susr" --sgrp="$sgrp" \
444 --musr="$musr" --mgrp="$mgrp" \
445 --rusr="$rusr" --rgrp="$rgrp" \
446 --nusr="$nusr" --ngrp="$ngrp" \
447 --suid="$suid" --sgid="$sgid" \
448 --muid="$muid" --mgid="$mgid" \
449 --ruid="$ruid" --rgid="$rgid" \
450 --nuid="$nuid" --ngid="$ngid"`
451 echo "susr=\"$susr\"; export susr" >>.buildenv
452 echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
453 echo "musr=\"$musr\"; export musr" >>.buildenv
454 echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
455 echo "rusr=\"$rusr\"; export rusr" >>.buildenv
456 echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
457 echo "nusr=\"$nusr\"; export nusr" >>.buildenv
458 echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
459 echo "suid=\"$suid\"; export suid" >>.buildenv
460 echo "sgid=\"$sgid\"; export sgid" >>.buildenv
461 echo "muid=\"$muid\"; export muid" >>.buildenv
462 echo "mgid=\"$mgid\"; export mgid" >>.buildenv
463 echo "ruid=\"$ruid\"; export ruid" >>.buildenv
464 echo "rgid=\"$rgid\"; export rgid" >>.buildenv
465 echo "nuid=\"$nuid\"; export nuid" >>.buildenv
466 echo "ngid=\"$ngid\"; export ngid" >>.buildenv
468 # display verbosity header
469 set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"; set -x
471 # determine installation location id
472 if [ ".%{?l_tag_fmt:set}" = .set ]; then
473 tag="%{l_tag_fmt}"
474 else
475 tag="<compat>"
476 fi
477 echo "tag=\"$tag\"; export tag" >>.buildenv
479 # determine platform id
480 s=`(uname -s) 2>/dev/null` || s='Unknown'
481 r=`(uname -r) 2>/dev/null` || r='0.0'
482 plid="${s}/${r}"
483 echo "plid=\"$plid\"; export plid" >>.buildenv
485 # determine platform-specific build environment
486 case $plid in
487 FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
488 NetBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
489 Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
490 SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
491 UnixWare/*) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
492 AIX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
493 Darwin/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
494 OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
495 HP-UX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
496 IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
497 * ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
498 esac
499 case $plid in
500 FreeBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
501 NetBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
502 Linux/* ) l_build_ldlp="/lib:/usr/lib" ;;
503 SunOS/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
504 UnixWare/*) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
505 AIX/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
506 Darwin/* ) l_build_ldlp="/usr/lib" ;;
507 OSF1/V5.* ) l_build_ldlp="/usr/lib" ;;
508 HP-UX/* ) l_build_ldlp="/usr/lib" ;;
509 IRIX*/6.* ) l_build_ldlp="/usr/lib" ;;
510 * ) l_build_ldlp="/usr/lib" ;;
511 esac
512 case $plid in
513 * ) l_build_ulim=":" ;;
514 esac
515 echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
516 echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
517 echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
519 # display verbosity header
520 set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x
522 # bootstrap GNU zip tool
523 ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
524 ${l_tar} xf `SOURCE gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar` 2>/dev/null || true
525 ( cd gzip-%{V_gzip}
526 echo "ac_cv_prog_cc_g=no" >config.cache
527 case $plid in
528 Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;;
529 esac
530 CC="${l_cc}" \
531 GREP="grep" \
532 ./configure \
533 --cache-file=./config.cache
534 ${l_make} || exit $?
535 ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $?
536 ) || exit $?
537 l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
538 echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
540 # display verbosity header
541 set +x; VERBOSE "PREPARATION: Unpack GNU configuration guessing utilities"; set -x
543 # unpack GNU config.guess
544 ${l_gzip} -dc `SOURCE config-%{V_config}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
546 # display verbosity header
547 set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"; set -x
549 # bootstrap GNU patch tool
550 ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
551 ( cd patch-%{V_patch}
552 chmod u+w config.guess config.sub >/dev/null 2>&1 || true
553 cp ../config/config.guess .
554 cp ../config/config.sub .
555 ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
556 echo 'ac_cv_prog_cc_g=no'
557 false=`sh $shtool path false`
558 echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
559 ) >config.cache
560 CC="${l_cc}" \
561 ./configure \
562 --cache-file=./config.cache \
563 --disable-largefile
564 ${l_make} || exit $?
565 ( mv src/patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
566 ) || exit $?
567 l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
568 echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
570 # display verbosity header
571 set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"; set -x
573 # build GNU tar tool
574 ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
575 ( cd tar-%{V_tar}
576 ${l_patch} -p0 <`SOURCE tar.patch`
577 ( echo 'am_cv_func_iconv=no'
578 echo 'am_cv_lib_iconv=no'
579 echo 'ac_cv_lib_iconv_iconv=no'
580 echo 'ac_cv_header_iconv_h=no'
581 echo 'ac_cv_type_iconv_t=no'
582 ) >config.cache
583 CC="${l_cc}" \
584 MAKEINFO="true" \
585 GREP="grep" \
586 ./configure \
587 --cache-file=./config.cache \
588 --prefix=%{l_prefix} \
589 --disable-nls
590 ${l_make} || exit $?
591 ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $?
592 ) || exit $?
593 l_tar="`pwd`/tar-%{V_tar}/tar"; export l_tar
594 echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
596 # display verbosity header
597 set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x
599 # unpack distribution tarballs
600 ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
601 ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
602 ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
603 ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
604 ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
605 ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
606 ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
607 ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
608 ${l_gzip} -dc `SOURCE openpkg-registry-%{V_registry}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
609 ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz` | ${l_tar} xf - 2>/dev/null || true
610 ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
611 ${l_gzip} -dc `SOURCE openpkg-tools-%{V_tools}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
612 ${l_gzip} -dc `SOURCE openpkg-executable-%{V_exec}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
614 # update config.guess/config.sub
615 for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
616 curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
617 chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
618 cp config/config.guess $dir/
619 cp config/config.sub $dir/
620 done
622 # display verbosity header
623 set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x
625 # apply OpenPKG patches to distribution trees
626 ( cd rpm-%{V_rpm}
627 sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix` | ${l_patch} -p0
628 sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
629 sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
630 sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen` | ${l_patch} -p0
631 rm -rf db/docs # just reduce disk size of source tree
632 ) || exit $?
633 ( cd make-%{V_make}
634 ${l_patch} -p0 <`SOURCE make.patch`
635 ) || exit $?
636 ( cd bash-%{V_bash}
637 ${l_patch} -p0 <`SOURCE bash.patch`
638 sleep 1
639 touch y.tab.[ch]
640 touch configure config.h.in
641 ) || exit $?
642 ( cd beecrypt-%{V_beecrypt}
643 ${l_patch} -p0 <`SOURCE beecrypt.patch`
644 ) || exit $?
645 ( cd perl-%{V_perl}
646 ${l_patch} -p0 <`SOURCE perl.patch`
647 ) || exit $?
648 ( cd openssl-%{V_openssl}
649 ${l_patch} -p0 <`SOURCE openssl.patch`
650 ) || exit $?
652 # display verbosity header
653 set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x
655 # bootstrap GNU make tool
656 ( cd make-%{V_make}
657 CC="${l_cc}" \
658 ./configure \
659 --without-libiconv-prefix \
660 --without-libintl-prefix \
661 --disable-nls \
662 --disable-largefile
663 ${l_make}
664 ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
665 ) || exit $?
666 l_make="`pwd`/make-%{V_make}/make"; export l_make
667 echo "l_make=\"$l_make\"; export l_make" >>.buildenv
669 %build
670 # skip in bootstrap phase 2 (see openpkg.boot)
671 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
673 # switch into a temporary build area
674 cd openpkg-%{version}
675 . ./.buildenv
677 # display verbosity header
678 set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"; set -x
680 # build GNU bash tool
681 ( cd bash-%{V_bash}
682 sh $shtool subst \
683 -e 's;@l_openpkg_release@;OpenPKG;' \
684 version.c
685 ( # force disabled wide-character support
686 echo "ac_cv_header_wchar_h=no"
687 echo "ac_cv_header_wctype_h=no"
688 echo "ac_cv_func_mbsrtowcs=no"
689 # force disabled internationalization support
690 echo "ac_cv_header_libintl_h=no"
691 echo "ac_cv_func_gettext=no"
692 echo "ac_cv_func_textdomain=no"
693 echo "ac_cv_func_bindtextdomain=no"
694 echo "ac_cv_lib_intl_bindtextdomain=no"
695 # disable building with debug symbols
696 echo "ac_cv_prog_cc_g=no"
697 ) >config.cache
698 AUTOCONF="true" \
699 CC="${l_cc}"
700 ./configure \
701 --cache-file=./config.cache \
702 --prefix=%{l_prefix} \
703 --without-curses \
704 --without-gnu-malloc \
705 --disable-nls
706 ${l_make} || exit $?
707 ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
708 ) || exit $?
710 # display verbosity header
711 set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"; set -x
713 # build BZIP2 library
714 ( cd bzip2-%{V_bzip2}
715 ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
716 ( echo "# libbz2.la - a libtool library file"
717 echo "# Generated by ltmain.sh - GNU libtool x.x.x"
718 echo "dlname=''"
719 echo "library_names=''"
720 echo "old_library='libbz2.a'"
721 echo "dependency_libs=''"
722 echo "current=0"
723 echo "age=0"
724 echo "revision=0"
725 echo "installed=no"
726 echo "dlopen=''"
727 echo "dlpreopen=''"
728 echo "libdir='%{l_prefix}'"
729 ) >libbz2.la
730 ln -s . .libs
731 ) || exit $?
733 # display verbosity header
734 set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"; set -x
736 # build ZLIB library
737 ( cd zlib-%{V_zlib}
738 CC="${l_cc}" CFLAGS="-O" ./configure
739 ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here
740 ) || exit $?
742 # display verbosity header
743 set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x
745 # build OSSP uuid tool
746 ( cd uuid-%{V_uuid}
747 CC="${l_cc}" \
748 CFLAGS="-O" \
749 GREP="grep" \
750 ./configure \
751 --prefix=%{l_prefix} \
752 --disable-shared
753 ${l_make} || exit $?
754 ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $?
755 ) || exit $?
757 # display verbosity header
758 set +x; VERBOSE "BUILD: Build Perl (Programming Language)"; set -x
760 # build Perl tool
761 ( cd perl-%{V_perl}
762 chmod -R u+w .
763 sh $shtool subst \
764 -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;' \
765 -e 's;package=perl5;package=perl;' \
766 Configure
767 sh $shtool subst \
768 -e 's; */usr/local/lib;;' \
769 hints/freebsd.sh hints/netbsd.sh
770 libdirs=""
771 for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
772 [ -d $dir ] && libdirs="$libdirs $dir"
773 done
774 ./Configure \
775 -d -e -s \
776 -Dprefix=%{l_prefix} \
777 -Dvendorprefix=%{l_prefix} \
778 -Dinstallprefix=%{l_prefix} \
779 -Dinstallstyle="lib/perl5" \
780 -Dman1dir=%{l_prefix}/man/man1 \
781 -Dman3dir=%{l_prefix}/man/man3 \
782 -Dcc="${l_cc}" -Uoptimize \
783 -Dlocincpth="%{l_prefix}/include" \
784 -Dloclibpth="%{l_prefix}/lib" \
785 -Dldflags="-L""%{l_prefix}/lib" \
786 -Dlibpth="$libdirs" \
787 -Dglibpth="$libdirs" \
788 -Dscriptdir="%{l_prefix}/bin" \
789 -Uinstallusrbinperl \
790 -Adefine:useshrplib='false' \
791 -Ui_malloc -Ui_iconv -Ui_db
792 ${l_make} miniperl || exit $?
793 rm -f *.o >/dev/null 2>&1 || true
794 ) || exit $?
795 l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl
796 echo "l_perl=\"$l_perl\"; export l_perl" >>.buildenv
798 # display verbosity header
799 set +x; VERBOSE "BUILD: Build OpenSSL (Crypography and SSL/TLS Toolkit)"; set -x
801 # build OpenSSL toolkit
802 ( cd openssl-%{V_openssl}
803 sh $shtool subst \
804 -e 's;-m486;-march=i486;g' \
805 -e 's;BN_LLONG *;;' \
806 Configure
807 sh $shtool subst \
808 -e 's;test "$OSTYPE" = msdosdjgpp;true;' \
809 util/point.sh
810 sh $shtool subst \
811 -e "1s;^.*\$;#!$l_perl;" \
812 Configure `find . -name "*.pl" -print`
813 opts=""
814 case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
815 *-solaris* ) opts="-lnsl -lsocket" ;;
816 esac
817 case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
818 amd64-* ) opts="$opts -fPIC" ;;
819 ia64-* ) opts="$opts -fPIC" ;;
820 sparc64-freebsd* ) opts="$opts -fPIC" ;;
821 esac
822 CC="${l_cc}" \
823 PERL="${l_perl}" \
824 ./config \
825 --prefix=%{l_prefix} \
826 no-asm no-shared no-dso \
827 no-zlib no-idea no-threads no-krb5 no-hw \
828 $opts
829 ${l_make} CC="${l_cc}" build_libs build_apps || exit $?
830 ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $?
831 ) || exit $?
833 # display verbosity header
834 set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x
836 # build cURL tool
837 ( cd curl-%{V_curl}
838 sh $shtool subst \
839 -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
840 configure
841 ( echo 'ac_cv_header_openssl_engine_h=no'
842 echo 'lt_cv_prog_compiler_c_o_F77=no'
843 echo 'lt_cv_sys_max_cmd_len=100'
844 ) >config.cache
845 CC="${l_cc}" \
846 CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
847 CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
848 LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
849 GREP="grep" \
850 ./configure \
851 --cache-file=./config.cache \
852 --without-libidn \
853 --disable-shared \
854 --disable-thread \
855 --disable-ipv6 \
856 --disable-ldap \
857 --with-zlib=`pwd`/../zlib-%{V_zlib} \
858 --with-ssl=`pwd`/../openssl-%{V_openssl} \
859 --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509
860 ${l_make} || exit $?
861 ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
862 ) || exit $?
864 # display verbosity header
865 set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"; set -x
867 # build BeeCrypt library
868 ( cd beecrypt-%{V_beecrypt}
869 sh $shtool subst \
870 -e 's;^[ ][ ]*#;#;' \
871 aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \
872 md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c
873 sh $shtool subst \
874 -e 's;cppglue\.lo;;g' \
875 -e 's;cppglue\.cxx;;g' \
876 -e '/^CXX = /s;@CXX@;@CC@;g' \
877 Makefile.in
878 sh $shtool subst \
879 -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
880 configure
881 ( echo 'ac_cv_have_dev_dsp=no'
882 echo 'ac_cv_have_dev_audio=no'
883 echo 'ac_cv_func_gettimeofday=yes'
884 echo 'bc_cv_as_noexecstack=no'
885 ) >config.cache
886 CC="${l_cc}" \
887 CFLAGS="-O" \
888 ./configure \
889 --cache-file=./config.cache \
890 --prefix=%{l_prefix} \
891 --without-cplusplus \
892 --without-java \
893 --without-python \
894 --with-cpu=none \
895 --with-arch=none \
896 --disable-threads \
897 --disable-shared
898 ${l_make} || exit $?
899 cp .libs/libbeecrypt.a .
900 ) || exit $?
902 # display verbosity header
903 set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x
905 # build RPM
906 ( br=`pwd`
907 cd rpm-%{V_rpm}
909 # remove object files accidentally distributed with the RPM tarball
910 rm -f db/build_unix/*.o
911 rm -f db/build_unix/*.lo
913 # remove embedded zlib (we are linking with an external one)
914 rm -rf zlib
916 # kill Linux-based preconfigured DB header, to allow the Makefiles to
917 # symlink to it the header that is configured for the current system.
918 rm -f rpmdb/db.h
920 # make sure we do not trigger Autoconf/Automake tools
921 touch configure
922 touch config.h.in
924 # disable running of any Autoconf/Automake tools
925 ACLOCAL=true
926 AUTOCONF=true
927 AUTOMAKE=true
928 AUTOHEADER=true
929 MAKEINFO=true
930 AMTAR=true
931 export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR
933 # cheat GNU Autoconf
934 ( echo 'ac_cv_path_MSGFMT=:'
935 echo 'ac_cv_path_GMSGFMT=:'
936 echo 'ac_cv_path_XGETTEXT=:'
937 echo 'ac_cv_path_MSGMERGE=:'
938 echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
939 echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
940 echo "ac_cv_path___PYTHON=true"
941 echo "ac_cv_path___DOXYGEN=true"
942 echo "acl_cv_rpath=no"
943 echo "ac_cv_header_getopt_h=no"
944 ) >config.cache
946 # provide platform identification
947 os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'
948 os_name=`echo "${os_name}" |\
949 sed -e 's;[^a-zA-Z0-9];;g' |\
950 tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
952 # set build tool flags
953 CC="${l_cc}"
954 CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
955 CFLAGS="$CPPFLAGS"
956 LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
957 LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
958 case $os_name in
959 SUNOS* ) LIBS="$LIBS -lresolv" ;;
960 IRIX* ) LIBS="$LIBS -lgen" ;;
961 esac
962 export CC CPPFLAGS CFLAGS LDFLAGS LIBS
964 # adjust for BeeCrypt 4.0
965 sh $shtool subst \
966 -e 's;beecrypt\.api\.h;beecrypt.h;g' \
967 rpmio/rpmio_internal.h
968 sh $shtool subst \
969 -e 's;\(rsavrfy(\)\(&dig->rsa_pk\);\1\2.n, \2.e;g' \
970 lib/signature.c
972 # configure the package
973 sh ./configure \
974 --cache-file=./config.cache \
975 --prefix=%{l_prefix} \
976 --with-db \
977 --with-glob \
978 --without-python \
979 --without-apidocs \
980 --disable-shared \
981 --disable-rpath \
982 --disable-nls
984 # deny automatic dependency calculations
985 rm -f find-provides find-requires
986 ln -s autodeps/none find-provides
987 ln -s autodeps/none find-requires
989 # build the package
990 ${l_make}
991 ) || exit $?
993 # display verbosity header
994 set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
996 # build "openpkg" executable
997 ( cd openpkg-executable-%{V_exec}
998 ${l_make} \
999 CC="${l_cc}" \
1000 OPENPKG_PREFIX="%{l_prefix}" \
1001 OPENPKG_SUSR="%{l_susr}" \
1002 OPENPKG_MUSR="%{l_musr}"
1003 ) || exit $?
1005 %install
1006 # skip in bootstrap phase 2 (see openpkg.boot)
1007 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
1009 # switch into a temporary build area
1010 cd openpkg-%{version}
1011 . ./.buildenv
1013 # display verbosity header
1014 set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
1016 # create installation hierarchy
1017 rm -rf $RPM_BUILD_ROOT
1018 sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
1019 for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
1020 test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
1021 mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
1022 done
1023 for i in 1 2 3 4 5 6 7 8 9; do
1024 test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
1025 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
1026 test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
1027 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
1028 done
1029 for dir in PKG bin etc include info lib man sbin; do
1030 test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
1031 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
1032 done
1033 for i in 1 2 3 4 5 6 7 8 9; do
1034 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
1035 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
1036 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
1037 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
1038 done
1039 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
1040 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
1041 for dir in SRC PKG DB TMP; do
1042 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
1043 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
1044 done
1045 mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
1046 mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
1048 # display verbosity header
1049 set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
1051 # install RPM into installation hierarchy
1052 ( cd rpm-%{V_rpm}
1053 DESTDIR="$RPM_BUILD_ROOT"
1054 export DESTDIR
1055 ${l_make} install
1056 ) || exit $?
1058 # display verbosity header
1059 set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
1061 # add additional development files
1062 cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1063 cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1064 cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1065 cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
1066 cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1067 cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
1068 cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1069 cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
1071 # display verbosity header
1072 set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
1074 # post-adjust RPM installation (namespace-clean POPT inclusion)
1075 mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
1076 $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
1077 mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
1078 $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
1080 # move C API into custom locations
1081 mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
1082 $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
1083 mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
1084 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1086 # move rpm tool to custom location
1087 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
1088 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1089 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
1090 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
1092 # move rpm2cpio tool to custom location
1093 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
1094 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
1095 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
1096 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
1098 # replace symlinks with hardlinks
1099 for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
1100 eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
1101 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
1102 ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
1103 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
1104 done
1105 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
1106 ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
1107 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
1108 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
1109 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
1111 # display verbosity header
1112 set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
1114 # strip RPM installation
1115 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
1116 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
1117 for dir in man/ja man/pl man/ru man/sk src; do
1118 rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
1119 done
1120 rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true
1121 for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
1122 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
1123 done
1124 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
1125 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
1126 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
1127 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
1128 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
1129 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
1130 rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
1131 for file in \
1132 u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
1133 mkinstalldirs magic.prov magic.req http.req getpo.sh \
1134 get_magic.pl find-provides find-requires find-requires.perl \
1135 find-req.pl find-provides.perl find-prov.pl find-lang.sh \
1136 cpanflute convertrpmrc.sh check-prereqs rpmputtext rpmgettext \
1137 brp-compress brp-redhat brp-sparc64-linux brp-strip \
1138 brp-strip-shared brp-strip-comment-note rpmrc \
1139 config.guess config.sub check-files; do
1140 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
1141 done
1143 # display verbosity header
1144 set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
1146 # install lsync tool
1147 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1148 <`SOURCE lsync` \
1149 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1150 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1151 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1152 <`SOURCE dot.lsyncrc` \
1153 >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
1154 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1155 <`SOURCE lsync.8` \
1156 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
1158 # install rpm-config tool
1159 ( l_prefix="%{l_prefix}"
1160 l_cc="%{l_cc}"
1161 l_cflags=""
1162 l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
1163 l_ldflags="-L${l_prefix}/lib/openpkg"
1164 l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
1165 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1166 -e "s:@l_cc@:$l_cc:g" \
1167 -e "s:@l_cflags@:$l_cflags:g" \
1168 -e "s:@l_cppflags@:$l_cppflags:g" \
1169 -e "s:@l_ldflags@:$l_ldflags:g" \
1170 -e "s:@l_libs@:$l_libs:g" \
1171 -e "s:@l_version@:%{V_rpm}:g" \
1172 <`SOURCE rpm-config.sh` \
1173 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1174 ) || exit $?
1175 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1176 sed -e "s:RPM_VERSION:%{V_rpm}:g" \
1177 <`SOURCE rpm-config.8` \
1178 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
1180 # install OpenPKG registry commands
1181 ( cd openpkg-registry-%{V_registry}
1182 mv $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
1183 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
1184 sed -e "s;@l_prefix@;%{l_prefix};g" \
1185 rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1186 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1187 sed -e "s;@l_prefix@;%{l_prefix};g" \
1188 register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1189 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1190 cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
1191 ) || exit $?
1193 # install OpenPKG Tool Chain command subset
1194 ( cd openpkg-tools-%{V_tools}
1195 cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
1196 cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1197 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1198 cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
1199 ) || exit $?
1201 # install RPM extension
1202 ( cd rpm-%{V_rpm}
1203 cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
1204 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
1205 ) || exit $?
1206 ( cd perl-%{V_perl}
1207 cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1208 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1209 ) || exit $?
1210 ( cd openssl-%{V_openssl}
1211 cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1212 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1213 ) || exit $?
1214 ( cd curl-%{V_curl}
1215 cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1216 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1217 ) || exit $?
1218 ( cd bzip2-%{V_bzip2}
1219 cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1220 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1221 ) || exit $?
1222 ( cd gzip-%{V_gzip}
1223 cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1224 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1225 ) || exit $?
1226 ( cd patch-%{V_patch}
1227 cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1228 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1229 ) || exit $?
1230 ( cd tar-%{V_tar}
1231 cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1232 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1233 ) || exit $?
1234 ( cd bash-%{V_bash}
1235 cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1236 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1237 ) || exit $?
1238 ( cd uuid-%{V_uuid}
1239 cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1240 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1241 ) || exit $?
1242 sed -e "s;@l_prefix@;%{l_prefix};g" \
1243 -e "s;@l_musr@;%{l_musr};g" \
1244 -e "s;@l_mgrp@;%{l_mgrp};g" \
1245 <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1246 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1247 sed -e "s;@l_prefix@;%{l_prefix};g" \
1248 <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
1249 sed -e "s;@l_prefix@;%{l_prefix};g" \
1250 <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1251 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1252 sed -e "s;@l_prefix@;%{l_prefix};g" \
1253 <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
1254 sed -e "s;@l_prefix@;%{l_prefix};g" \
1255 -e "s;@l_musr@;%{l_musr};g" \
1256 -e "s;@l_mgrp@;%{l_mgrp};g" \
1257 <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1258 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1259 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1260 <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1261 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1263 # install OpenPKG tool chain execution frontend and execution wrapper
1264 cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1265 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1266 chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1267 sed -e "s;@l_prefix@;%{l_prefix};g" \
1268 <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1269 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1270 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1271 <`SOURCE openpkg.1` \
1272 >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
1274 # install more OpenPKG tool chain commands
1275 sed -e "s;@l_prefix@;%{l_prefix};g" \
1276 <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
1277 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
1278 sed -e "s;@l_prefix@;%{l_prefix};g" \
1279 <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1280 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1282 # install an own copy of shtool
1283 cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1284 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1286 # display verbosity header
1287 set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
1289 # install a few README files
1290 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1291 <`SOURCE root.README` \
1292 >$RPM_BUILD_ROOT%{l_prefix}/README
1293 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1294 <`SOURCE local.README` \
1295 >$RPM_BUILD_ROOT%{l_prefix}/local/README
1297 # install Bash environment
1298 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1299 <`SOURCE dot.bashrc` \
1300 >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
1301 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1302 <`SOURCE dot.bash_login` \
1303 >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
1305 # install Run-Command files
1306 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1307 -e "s:@l_susr@:%{l_susr}:g" \
1308 -e "s:@l_musr@:%{l_musr}:g" \
1309 <`SOURCE rc` \
1310 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
1311 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
1312 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1313 <`SOURCE rc.conf` \
1314 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1315 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1316 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1317 <`SOURCE rc.func` \
1318 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1319 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1320 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
1321 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1322 -e "s:@l_musr@:%{l_musr}:g" \
1323 <`SOURCE rc.openpkg` \
1324 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1325 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1326 ( echo "#!/bin/sh"
1327 echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
1328 ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1329 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1330 ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
1331 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
1332 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1333 <`SOURCE rc.8` \
1334 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
1336 # create configuration directory
1337 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
1338 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
1340 # install platform identification file
1341 sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
1342 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1343 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1345 # install UUID configuration file (ghost)
1346 touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1347 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1349 # install registry configuration files (ghost)
1350 touch \
1351 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
1352 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
1353 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
1354 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
1355 chmod 644 \
1356 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
1357 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
1358 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
1359 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
1361 # install default managers configuration file
1362 ( echo "##"
1363 echo "## managers -- OpenPKG Instance Managers"
1364 echo "##"
1365 echo ""
1366 echo "%{l_susr}"
1367 echo "%{l_musr}"
1368 echo ""
1369 ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
1371 # install overriding RPM configuration files
1372 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1373 <`SOURCE rpmpopt` \
1374 >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
1375 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1376 <`SOURCE rpmrc` \
1377 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
1378 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1379 -e "s:@l_prefix_static@:%{l_prefix}:g" \
1380 -e "s;@l_build_path@;$l_build_path;g" \
1381 -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
1382 -e "s;@l_build_ulim@;$l_build_ulim;g" \
1383 -e "s:@TAG@:$tag:g" \
1384 -e "s:@SUSR@:$susr:g" \
1385 -e "s:@SGRP@:$sgrp:g" \
1386 -e "s:@MUSR@:$musr:g" \
1387 -e "s:@MGRP@:$mgrp:g" \
1388 -e "s:@RUSR@:$rusr:g" \
1389 -e "s:@RGRP@:$rgrp:g" \
1390 -e "s:@NUSR@:$nusr:g" \
1391 -e "s:@NGRP@:$ngrp:g" \
1392 <`SOURCE rpmmacros` \
1393 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
1394 cp `SOURCE openpkg.org.pgp` \
1395 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
1396 cp `SOURCE openpkg.com.pgp` \
1397 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
1398 cp `SOURCE openpkg.net.pgp` \
1399 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
1401 # display verbosity header
1402 set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
1404 %files
1405 %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
1406 %{l_prefix}/README
1407 %config(noreplace) %{l_prefix}/.bashrc
1408 %config(noreplace) %{l_prefix}/.bash_login
1409 %dir %{l_prefix}/RPM
1410 %dir %{l_prefix}/RPM/SRC
1411 %dir %{l_prefix}/RPM/PKG
1412 %dir %{l_prefix}/RPM/DB
1413 %dir %{l_prefix}/RPM/TMP
1414 %dir %{l_prefix}/cgi
1415 %dir %{l_prefix}/bin
1416 %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
1417 %dir %{l_prefix}/etc
1418 %{l_prefix}/etc/rc
1419 %config(noreplace) %{l_prefix}/etc/rc.conf
1420 %{l_prefix}/etc/rc.func
1421 %dir %{l_prefix}/etc/rc.d
1422 %{l_prefix}/etc/rc.d/rc.openpkg
1423 %dir %{l_prefix}/etc/openpkg
1424 %ghost %{l_prefix}/etc/openpkg/uuid
1425 %config %{l_prefix}/etc/openpkg/platform
1426 %config %{l_prefix}/etc/openpkg/rpmmacros
1427 %config %{l_prefix}/etc/openpkg/rpmrc
1428 %ghost %{l_prefix}/etc/openpkg/register.conf
1429 %ghost %{l_prefix}/etc/openpkg/register.prep
1430 %ghost %{l_prefix}/etc/openpkg/register.tran
1431 %ghost %{l_prefix}/etc/openpkg/register.util
1432 %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
1433 %{l_prefix}/etc/openpkg/openpkg.org.pgp
1434 %{l_prefix}/etc/openpkg/openpkg.com.pgp
1435 %{l_prefix}/etc/openpkg/openpkg.net.pgp
1436 %dir %{l_prefix}/include
1437 %dir %{l_prefix}/include/openpkg
1438 %dir %{l_prefix}/include/openpkg/rpm
1439 %{l_prefix}/include/openpkg/rpm/argv.h
1440 %{l_prefix}/include/openpkg/rpm/beecrypt.h
1441 %{l_prefix}/include/openpkg/rpm/bzlib.h
1442 %{l_prefix}/include/openpkg/rpm/db.h
1443 %{l_prefix}/include/openpkg/rpm/fts.h
1444 %{l_prefix}/include/openpkg/rpm/glob.h
1445 %{l_prefix}/include/openpkg/rpm/hdrinline.h
1446 %{l_prefix}/include/openpkg/rpm/header.h
1447 %{l_prefix}/include/openpkg/rpm/misc.h
1448 %{l_prefix}/include/openpkg/rpm/popt.h
1449 %{l_prefix}/include/openpkg/rpm/rpmal.h
1450 %{l_prefix}/include/openpkg/rpm/rpmbuild.h
1451 %{l_prefix}/include/openpkg/rpm/rpmcli.h
1452 %{l_prefix}/include/openpkg/rpm/rpmdb.h
1453 %{l_prefix}/include/openpkg/rpm/rpmds.h
1454 %{l_prefix}/include/openpkg/rpm/rpmerr.h
1455 %{l_prefix}/include/openpkg/rpm/rpmfc.h
1456 %{l_prefix}/include/openpkg/rpm/rpmfi.h
1457 %{l_prefix}/include/openpkg/rpm/rpmfile.h
1458 %{l_prefix}/include/openpkg/rpm/rpmhash.h
1459 %{l_prefix}/include/openpkg/rpm/rpmio.h
1460 %{l_prefix}/include/openpkg/rpm/rpmlib.h
1461 %{l_prefix}/include/openpkg/rpm/rpmlog.h
1462 %{l_prefix}/include/openpkg/rpm/rpmmacro.h
1463 %{l_prefix}/include/openpkg/rpm/rpmmessages.h
1464 %{l_prefix}/include/openpkg/rpm/rpmpgp.h
1465 %{l_prefix}/include/openpkg/rpm/rpmps.h
1466 %{l_prefix}/include/openpkg/rpm/rpmspec.h
1467 %{l_prefix}/include/openpkg/rpm/rpmsw.h
1468 %{l_prefix}/include/openpkg/rpm/rpmte.h
1469 %{l_prefix}/include/openpkg/rpm/rpmts.h
1470 %{l_prefix}/include/openpkg/rpm/rpmurl.h
1471 %{l_prefix}/include/openpkg/rpm/stringbuf.h
1472 %{l_prefix}/include/openpkg/rpm/ugid.h
1473 %{l_prefix}/include/openpkg/rpm/zconf.h
1474 %{l_prefix}/include/openpkg/rpm/zlib.h
1475 %dir %{l_prefix}/info
1476 %dir %{l_prefix}/lib
1477 %dir %{l_prefix}/lib/openpkg
1478 %{l_prefix}/lib/openpkg/bash
1479 %{l_prefix}/lib/openpkg/bzip2
1480 %{l_prefix}/lib/openpkg/curl
1481 %{l_prefix}/lib/openpkg/file
1482 %{l_prefix}/lib/openpkg/gzip
1483 %{l_prefix}/lib/openpkg/librpm.a
1484 %{l_prefix}/lib/openpkg/librpmbeecrypt.a
1485 %{l_prefix}/lib/openpkg/librpmbuild.a
1486 %{l_prefix}/lib/openpkg/librpmbz2.a
1487 %{l_prefix}/lib/openpkg/librpmdb.a
1488 %{l_prefix}/lib/openpkg/librpmio.a
1489 %{l_prefix}/lib/openpkg/librpmpopt.a
1490 %{l_prefix}/lib/openpkg/librpmz.a
1491 %{l_prefix}/lib/openpkg/macros
1492 %{l_prefix}/lib/openpkg/magic
1493 %{l_prefix}/lib/openpkg/magic.mgc
1494 %{l_prefix}/lib/openpkg/magic.mime
1495 %{l_prefix}/lib/openpkg/magic.mime.mgc
1496 %{l_prefix}/lib/openpkg/miniperl
1497 %{l_prefix}/lib/openpkg/openpkg
1498 %{l_prefix}/lib/openpkg/openssl
1499 %{l_prefix}/lib/openpkg/patch
1500 %{l_prefix}/lib/openpkg/rc
1501 %{l_prefix}/lib/openpkg/rpm
1502 %{l_prefix}/lib/openpkg/rpmb
1503 %{l_prefix}/lib/openpkg/rpmd
1504 %{l_prefix}/lib/openpkg/rpmdb
1505 %{l_prefix}/lib/openpkg/rpmdb_dump
1506 %{l_prefix}/lib/openpkg/rpmdb_load
1507 %{l_prefix}/lib/openpkg/rpmdb_verify
1508 %{l_prefix}/lib/openpkg/rpme
1509 %{l_prefix}/lib/openpkg/rpmi
1510 %{l_prefix}/lib/openpkg/rpmk
1511 %{l_prefix}/lib/openpkg/rpmpopt
1512 %{l_prefix}/lib/openpkg/rpmq
1513 %{l_prefix}/lib/openpkg/rpmt
1514 %{l_prefix}/lib/openpkg/rpmtool
1515 %{l_prefix}/lib/openpkg/rpmu
1516 %{l_prefix}/lib/openpkg/rpmv
1517 %{l_prefix}/lib/openpkg/shtool
1518 %{l_prefix}/lib/openpkg/tar
1519 %{l_prefix}/lib/openpkg/uuid
1520 %dir %{l_prefix}/libexec
1521 %dir %{l_prefix}/libexec/openpkg
1522 %{l_prefix}/libexec/openpkg/build.8
1523 %{l_prefix}/libexec/openpkg/build.pl
1524 %{l_prefix}/libexec/openpkg/curl.sh
1525 %{l_prefix}/libexec/openpkg/install
1526 %{l_prefix}/libexec/openpkg/lsync
1527 %{l_prefix}/libexec/openpkg/lsync.8
1528 %{l_prefix}/libexec/openpkg/man
1529 %{l_prefix}/libexec/openpkg/rc
1530 %{l_prefix}/libexec/openpkg/rc.8
1531 %{l_prefix}/libexec/openpkg/register
1532 %{l_prefix}/libexec/openpkg/register.8
1533 %{l_prefix}/libexec/openpkg/release
1534 %{l_prefix}/libexec/openpkg/release.8
1535 %{l_prefix}/libexec/openpkg/rpm
1536 %{l_prefix}/libexec/openpkg/rpm-config
1537 %{l_prefix}/libexec/openpkg/rpm-config.8
1538 %{l_prefix}/libexec/openpkg/rpm.8
1539 %{l_prefix}/libexec/openpkg/rpm2cpio
1540 %{l_prefix}/libexec/openpkg/rpm2cpio.8
1541 %{l_prefix}/libexec/openpkg/rpmbuild
1542 %{l_prefix}/libexec/openpkg/rpmbuild.8
1543 %{l_prefix}/libexec/openpkg/uuid
1544 %{l_prefix}/libexec/openpkg/uuid.8
1545 %dir %{l_prefix}/man
1546 %dir %{l_prefix}/man/man1
1547 %dir %{l_prefix}/man/man2
1548 %dir %{l_prefix}/man/man3
1549 %dir %{l_prefix}/man/man4
1550 %dir %{l_prefix}/man/man5
1551 %dir %{l_prefix}/man/man6
1552 %dir %{l_prefix}/man/man7
1553 %dir %{l_prefix}/man/man8
1554 %dir %{l_prefix}/man/man9
1555 %dir %{l_prefix}/man/cat1
1556 %dir %{l_prefix}/man/cat2
1557 %dir %{l_prefix}/man/cat3
1558 %dir %{l_prefix}/man/cat4
1559 %dir %{l_prefix}/man/cat5
1560 %dir %{l_prefix}/man/cat6
1561 %dir %{l_prefix}/man/cat7
1562 %dir %{l_prefix}/man/cat8
1563 %dir %{l_prefix}/man/cat9
1564 %{l_prefix}/man/man1/openpkg.1
1565 %dir %{l_prefix}/sbin
1566 %dir %{l_prefix}/pub
1567 %dir %{l_prefix}/share
1568 %dir %{l_prefix}/var
1569 %dir %{l_prefix}/local
1570 %{l_prefix}/local/README
1571 %{l_prefix}/local/.lsyncrc
1572 %dir %{l_prefix}/local/PKG
1573 %dir %{l_prefix}/local/bin
1574 %dir %{l_prefix}/local/etc
1575 %dir %{l_prefix}/local/include
1576 %dir %{l_prefix}/local/info
1577 %dir %{l_prefix}/local/lib
1578 %dir %{l_prefix}/local/man
1579 %dir %{l_prefix}/local/man/man1
1580 %dir %{l_prefix}/local/man/man2
1581 %dir %{l_prefix}/local/man/man3
1582 %dir %{l_prefix}/local/man/man4
1583 %dir %{l_prefix}/local/man/man5
1584 %dir %{l_prefix}/local/man/man6
1585 %dir %{l_prefix}/local/man/man7
1586 %dir %{l_prefix}/local/man/man8
1587 %dir %{l_prefix}/local/man/man9
1588 %dir %{l_prefix}/local/man/cat1
1589 %dir %{l_prefix}/local/man/cat2
1590 %dir %{l_prefix}/local/man/cat3
1591 %dir %{l_prefix}/local/man/cat4
1592 %dir %{l_prefix}/local/man/cat5
1593 %dir %{l_prefix}/local/man/cat6
1594 %dir %{l_prefix}/local/man/cat7
1595 %dir %{l_prefix}/local/man/cat8
1596 %dir %{l_prefix}/local/man/cat9
1597 %dir %{l_prefix}/local/sbin
1599 %clean
1600 # skip in bootstrap phase 2 (see openpkg.boot)
1601 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
1603 # cleanup build area
1604 rm -rf openpkg-%{version} >/dev/null 2>&1 || true
1606 # cleanup installation area
1607 rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
1609 %pre
1610 # always performed for upgrades and because it doesn't harm!
1611 # [ ".$1" != .1 ] && exit 0
1613 # this procedure is only usable with root privileges
1614 # (for non-root installations it is not required at all)
1615 cusr=`(id -un) 2>/dev/null ||\
1616 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
1617 (whoami) 2>/dev/null ||\
1618 (who am i | cut "-d " -f1) 2>/dev/null ||\
1619 echo $LOGNAME`
1621 # determine runtime details (for both inside and outside RPM!!)
1622 # - bootstrapping: $xxx is set from aux.wrapbin.sh
1623 # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
1624 # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
1625 [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
1626 [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
1627 [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
1628 [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
1629 [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
1630 [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
1631 [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
1632 [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
1633 [ ".$suid" = . ] && suid="%{?l_suid}"
1634 [ ".$sgid" = . ] && sgid="%{?l_sgid}"
1635 [ ".$muid" = . ] && muid="%{?l_muid}"
1636 [ ".$mgid" = . ] && mgid="%{?l_mgid}"
1637 [ ".$ruid" = . ] && ruid="%{?l_ruid}"
1638 [ ".$rgid" = . ] && rgid="%{?l_rgid}"
1639 [ ".$nuid" = . ] && nuid="%{?l_nuid}"
1640 [ ".$ngid" = . ] && ngid="%{?l_ngid}"
1642 # if any of these optional params are not used we won't have a
1643 # corresponding macro either, so make use of one conditionally
1644 [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
1645 [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
1646 [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
1647 [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
1648 [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
1649 [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
1650 [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
1651 [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
1653 # determine prefix
1654 [ ".$prefix" = . ] && prefix="%{l_prefix}"
1655 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
1657 # register instance in presence file
1658 presence="/etc/openpkg"
1659 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
1660 if [ ".$exists" = . ]; then
1661 ( umask 022
1662 echo "${prefix}" >>$presence
1663 ) 2>/dev/null || true
1664 fi
1666 # determine user/group ids
1667 for class in s m r n; do
1668 eval "xusr=\"\$${class}usr\""
1669 eval "xgrp=\"\$${class}grp\""
1670 eval "xuid=\"\$${class}uid\""
1671 eval "xgid=\"\$${class}gid\""
1672 if [ ".$xuid" = . ]; then
1673 xuid=`(getent passwd "${xusr}"; \
1674 grep "^${xusr}:" /etc/passwd; \
1675 ypmatch "${xusr}" passwd; \
1676 nismatch "${xusr}" passwd; \
1677 nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
1678 sed -e 'q' | awk -F: '{ print $3; }'`
1679 if [ ".$xuid" = . ]; then
1680 # seek for a reasonably uid/gid pair
1681 xuid=1000
1682 ok=0
1683 while [ ".$ok" = .0 ]; do
1684 eval "u_exists=\$u_exists_$xuid"
1685 if [ ".$u_exists" = . ]; then
1686 u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
1687 grep "^[^:]*:[^:]*:$xuid:"`
1688 fi
1689 eval "g_exists=\$g_exists_$xuid"
1690 if [ ".$g_exists" = . ]; then
1691 g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
1692 grep "^[^:]*:[^:]*:$xuid:"`
1693 fi
1694 if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
1695 ok=1
1696 break
1697 fi
1698 xuid=`expr $xuid + 1`
1699 done
1700 eval "u_exists_$xuid=yes"
1701 eval "g_exists_$xuid=yes"
1702 fi
1703 fi
1704 if [ ".$xgid" = . ]; then
1705 xgid=`(getent group "${xgrp}"; \
1706 grep "^${xgrp}:" /etc/group; \
1707 ypmatch "${xgrp}" group; \
1708 nismatch "${xgrp}" group; \
1709 nidump group . | grep "^${xgrp}:") 2>/dev/null | \
1710 sed -e 'q' | awk -F: '{ print $3; }'`
1711 if [ ".$xgid" = . ]; then
1712 xgid="$xuid"
1713 fi
1714 fi
1715 eval "${class}uid=\"$xuid\""
1716 eval "${class}gid=\"$xgid\""
1717 done
1719 # determine platform id
1720 s=`(uname -s) 2>/dev/null` || s='Unknown'
1721 r=`(uname -r) 2>/dev/null` || r='0.0'
1722 plid="${s}/${r}"
1724 # add entry to /etc/shells
1725 shell="${prefix}/lib/openpkg/bash"
1726 if [ -f /etc/shells ]; then
1727 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
1728 if [ ".$exists" = . ]; then
1729 if [ ".$cusr" != ".root" ]; then
1730 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
1731 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1732 else
1733 echo "${shell}" >>/etc/shells
1734 fi
1735 fi
1736 fi
1738 # clear pending deferred actions
1739 rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
1741 # create the hierarchy user/group
1742 for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
1743 "management:${musr}:${muid}:${mgrp}:${mgid}" \
1744 "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
1745 "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
1746 # split request into class/usr/uid/grp/gid
1747 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
1748 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
1750 # check whether user already exists
1751 exists=`(getent passwd "$usr"; \
1752 grep "^$usr:" /etc/passwd; \
1753 ypmatch "$usr" passwd; \
1754 nismatch "$usr" passwd; \
1755 nidump passwd . | grep "^$usr:") 2>/dev/null | \
1756 sed -e 'q'`
1757 if [ ".$exists" = . ]; then
1758 if [ ".$cusr" != ".root" ]; then
1759 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
1760 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1761 else
1762 # add entry to passwd database
1763 realname="${prefix} OpenPKG ($class)"
1764 case "$plid" in
1765 FreeBSD/* | NetBSD/* )
1766 file=/etc/master.passwd
1767 entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
1768 update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
1769 ;;
1770 Linux/* )
1771 file=/etc/passwd
1772 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1773 update="(PATH=\$PATH:/usr/sbin; pwconv)"
1774 ;;
1775 SunOS/5.* | UnixWare/* )
1776 file=/etc/passwd
1777 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1778 update="(PATH=\$PATH:/usr/sbin; pwconv)"
1779 ;;
1780 AIX/* )
1781 # intentionally do nothing here
1782 :
1783 ;;
1784 OSF1/V5.* )
1785 file=/etc/passwd
1786 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1787 update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
1788 ;;
1789 HP-UX/* )
1790 file=/etc/passwd
1791 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1792 update=":"
1793 ;;
1794 Darwin/* )
1795 # intentionally do nothing here
1796 :
1797 ;;
1798 IRIX*/6.* )
1799 file=/etc/passwd
1800 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1801 if [ -f /etc/shadow ]
1802 then update="(PATH=\$PATH:/sbin; pwconv)"
1803 else update=":"
1804 fi
1805 ;;
1806 esac
1807 case "$plid" in
1808 Darwin/* )
1809 niutil -create . "/users/${usr}"
1810 niutil -createprop . "/users/${usr}" passwd "*"
1811 niutil -createprop . "/users/${usr}" uid "${uid}"
1812 niutil -createprop . "/users/${usr}" gid "${gid}"
1813 niutil -createprop . "/users/${usr}" realname "${realname}"
1814 niutil -createprop . "/users/${usr}" home "${prefix}"
1815 niutil -createprop . "/users/${usr}" shell "${shell}"
1816 ;;
1817 AIX/* )
1818 mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
1819 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
1820 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
1821 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
1822 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
1823 # defer both the setting of the primary group and the shell,
1824 # as they do not exist at this stage of processing.
1825 echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
1826 echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
1827 ;;
1828 * )
1829 cp $file $file.bak && \
1830 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
1831 rm -f $file.bak >/dev/null 2>&1
1832 eval $update
1833 [ $? -ne 0 ] && exit $?
1834 ;;
1835 esac
1836 fi
1837 fi
1839 # check whether group already exists
1840 exists=`(getent group "$grp"; \
1841 grep "^$grp:" /etc/group; \
1842 ypmatch "$grp" group; \
1843 nismatch "$grp" group; \
1844 nidump group . | grep "^$grp:") 2>/dev/null | \
1845 sed -e 'q'`
1846 if [ ".$exists" = . ]; then
1847 if [ ".$cusr" != ".root" ]; then
1848 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
1849 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1850 else
1851 case "$plid" in
1852 Darwin/* )
1853 niutil -create . "/groups/${grp}"
1854 niutil -createprop . "/groups/${grp}" gid "${gid}"
1855 niutil -createprop . "/groups/${grp}" users "${usr}"
1856 ;;
1857 AIX/* )
1858 mkgroup id="${gid}" users="${usr}" "${grp}"
1859 ;;
1860 * )
1861 # add entry to group database
1862 file=/etc/group
1863 entry="${grp}:*:${gid}:${usr}"
1864 cp $file $file.bak && \
1865 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
1866 rm -f $file.bak >/dev/null 2>&1
1867 ;;
1868 esac
1869 fi
1870 fi
1871 done
1873 # optional group processing (deferred adjustment of primary group)
1874 if [ -f %{l_prefix}.pre-group-process.sh ]; then
1875 sh %{l_prefix}.pre-group-process.sh
1876 rm -f %{l_prefix}.pre-group-process.sh
1877 fi
1879 # invalidate passwd and group tables from Name Service Cache Daemon to
1880 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
1881 if [ -x /usr/sbin/nscd ]; then
1882 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
1883 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
1884 fi
1886 # create the startup/shutdown transfer script
1887 name=`echo "$prefix" | sed -e 's;/;;g'`
1888 if [ ".$cusr" != ".root" ]; then
1889 echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
1890 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1891 else
1892 case "$plid" in
1893 FreeBSD/* )
1894 if [ ! -f /etc/rc.d/openpkg-${name} ]; then
1895 # install transfer script
1896 rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
1897 ( echo "#!/bin/sh"
1898 echo "##"
1899 echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
1900 echo "##"
1901 echo ""
1902 echo "# PROVIDE: openpkg-${name}"
1903 echo "# REQUIRE: LOGIN"
1904 echo "# KEYWORD: shutdown"
1905 echo ""
1906 echo ". /etc/rc.subr"
1907 echo ""
1908 echo "name=\"openpkg_${name}\""
1909 echo "start_cmd=\"openpkg_rc_all start\""
1910 echo "stop_cmd=\"openpkg_rc_all stop\""
1911 echo "restart_cmd=\"openpkg_rc_all stop start\""
1912 echo ""
1913 echo "openpkg_rc_all () {"
1914 echo " if [ -f ${prefix}/etc/rc ]; then"
1915 echo " ${prefix}/etc/rc all \"\$@\""
1916 echo " fi"
1917 echo "}"
1918 echo ""
1919 echo "load_rc_config \$name"
1920 echo "run_rc_command \"\$1\""
1921 echo ""
1922 ) >/etc/rc.d/openpkg-${name}
1923 chmod 755 /etc/rc.d/openpkg-${name}
1924 fi
1925 ;;
1926 NetBSD/* )
1927 if [ ! -f /etc/rc.d/${name} ]; then
1928 ( echo "#!/bin/sh"
1929 echo "##"
1930 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
1931 echo "##"
1932 echo "## PROVIDE: ${name}"
1933 echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS"
1934 echo "##"
1935 echo ""
1936 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
1937 echo "case \$1 in"
1938 echo " start ) exec ${prefix}/etc/rc all start ;;"
1939 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
1940 echo " restart ) exec ${prefix}/etc/rc all stop start ;;"
1941 echo " status ) ;;"
1942 echo "esac"
1943 ) >/etc/rc.d/${name}
1944 chmod 755 /etc/rc.d/${name}
1945 fi
1946 ;;
1947 Linux/* )
1948 if [ -f /etc/gentoo-release ]; then
1949 if [ ! -f /etc/init.d/openpkg-${name} ]; then
1950 # install transfer script
1951 ( echo "#!/sbin/runscript"
1952 echo "##"
1953 echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
1954 echo "##"
1955 echo ""
1956 echo "depend() {"
1957 echo " after *"
1958 echo "}"
1959 echo ""
1960 echo "checkconfig() {"
1961 echo " [ -f ${prefix}/etc/rc ] || return 1"
1962 echo " case $1 in"
1963 echo " start ) exec ${prefix}/etc/rc all start ;;"
1964 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
1965 echo " esac"
1966 echo "}"
1967 echo ""
1968 echo "start() {"
1969 echo " checkconfig || return 1"
1970 echo " ebegin "Starting OpenPKG ${prefix} hierarchy""
1971 echo " exec ${prefix}/etc/rc all start"
1972 echo " eend 0"
1973 echo "}"
1974 echo ""
1975 echo "stop() {"
1976 echo " checkconfig || return 1"
1977 echo " ebegin "Stopping OpenPKG ${prefix} hierarchy""
1978 echo " exec ${prefix}/etc/rc all stop"
1979 echo " eend 0"
1980 echo "}"
1981 ) >/etc/init.d/openpkg-${name}
1982 chmod 755 /etc/init.d/openpkg-${name}
1983 /sbin/rc-update add openpkg-${name} default
1984 fi
1985 else
1986 # sroot: script root directory
1987 # lroot: link root directory
1988 if [ -f /etc/debian_version ]; then
1989 sroot=/etc/init.d
1990 lroot=/etc/rc%d.d
1991 elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
1992 sroot=/etc/rc.d/init.d
1993 lroot=/etc/rc.d/rc%d.d
1994 elif [ -f /etc/SuSE-release ]; then
1995 sroot=/etc/init.d
1996 lroot=/etc/init.d/rc%d.d
1997 elif [ -f /etc/slackware-version ]; then
1998 sroot=/etc/rc.d
1999 lroot=/etc/rc.d/rc%d.d
2000 name="rc.${name}"
2001 for i in 0 1 2 3 4 5 6; do
2002 l=`echo $lroot | sed -e "s;%d;$i;"`
2003 if [ ! -d $l ]; then
2004 mkdir $l 2>&1 || true
2005 fi
2006 done
2007 else
2008 echo "WARNING: you are not running one of the supported standard" 1>&2
2009 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
2010 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
2011 sroot=""
2012 lroot=""
2013 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
2014 if [ -d $sr ]; then
2015 sroot="$sr"
2016 break
2017 fi
2018 done
2019 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
2020 if [ -d $lr ]; then
2021 lroot="`echo $lr | sed -e 's;2;%d;'`"
2022 break
2023 fi
2024 done
2025 if [ ".$sroot" = . -o ".$lroot" = . ]; then
2026 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
2027 exit 1
2028 fi
2029 fi
2030 if [ ! -f $sroot/${name} ]; then
2031 # install transfer script
2032 ( echo "#!/bin/sh"
2033 echo "##"
2034 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2035 echo "##"
2036 echo ""
2037 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2038 echo "case \$1 in"
2039 echo " start ) exec ${prefix}/etc/rc all start ;;"
2040 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2041 echo "esac"
2042 ) >$sroot/${name}
2043 chmod 755 $sroot/${name}
2044 # create corresponding symbolic links
2045 for i in 2 3 4 5; do
2046 ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
2047 done
2048 for i in 0 1 6; do
2049 ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
2050 done
2051 fi
2052 fi
2053 ;;
2054 SunOS/5.* )
2055 if [ ! -f /etc/init.d/${name} ]; then
2056 # install transfer script
2057 ( echo "#!/bin/sh"
2058 echo "##"
2059 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2060 echo "##"
2061 echo ""
2062 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2063 echo "case \$1 in"
2064 echo " start ) exec ${prefix}/etc/rc all start ;;"
2065 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2066 echo "esac"
2067 ) >/etc/init.d/${name}
2068 chmod 755 /etc/init.d/${name}
2069 # create corresponding symbolic links
2070 ( cd /etc
2071 ln init.d/${name} rc3.d/S99${name}
2072 ln init.d/${name} rc0.d/K00${name}
2073 ln init.d/${name} rc1.d/K00${name}
2074 ) || exit $?
2075 fi
2076 ;;
2077 UnixWare/* )
2078 if [ ! -f /etc/init.d/${name} ]; then
2079 # install transfer script
2080 ( echo "#!/bin/sh"
2081 echo "##"
2082 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2083 echo "##"
2084 echo ""
2085 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2086 echo "case \$1 in"
2087 echo " start ) exec ${prefix}/etc/rc all start ;;"
2088 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2089 echo "esac"
2090 ) >/etc/init.d/${name}
2091 chmod 755 /etc/init.d/${name}
2092 # create corresponding symbolic links
2093 ( cd /etc
2094 ln init.d/${name} rc2.d/S99${name}
2095 ln init.d/${name} rc0.d/K00${name}
2096 ln init.d/${name} rc1.d/K00${name}
2097 ) || exit $?
2098 fi
2099 ;;
2100 AIX/* )
2101 if [ ! -f /etc/rc.d/init.d/${name} ]; then
2102 # install transfer script
2103 ( echo "#!/bin/sh"
2104 echo "##"
2105 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2106 echo "##"
2107 echo ""
2108 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2109 echo "case \$1 in"
2110 echo " start ) exec ${prefix}/etc/rc all start ;;"
2111 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2112 echo "esac"
2113 ) >/etc/rc.d/init.d/${name}
2114 chmod 755 /etc/rc.d/init.d/${name}
2115 # create corresponding symbolic links
2116 ( cd /etc/rc.d
2117 ln -s ../init.d/${name} rc2.d/S99${name}
2118 ) || exit $?
2119 fi
2120 ;;
2121 OSF1/V5.* )
2122 if [ ! -f /sbin/init.d/${name} ]; then
2123 # install transfer script
2124 ( echo "#!/bin/sh"
2125 echo "##"
2126 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2127 echo "##"
2128 echo ""
2129 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2130 echo "case \$1 in"
2131 echo " start ) exec ${prefix}/etc/rc all start ;;"
2132 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2133 echo "esac"
2134 ) >/sbin/init.d/${name}
2135 chmod 755 /sbin/init.d/${name}
2136 # create corresponding symbolic links
2137 ( cd /sbin
2138 ln -s ../init.d/${name} rc3.d/S99${name}
2139 ln -s ../init.d/${name} rc0.d/K00${name}
2140 ) || exit $?
2141 fi
2142 ;;
2143 HP-UX/* )
2144 if [ ! -f /sbin/init.d/${name} ]; then
2145 # install transfer script
2146 ( echo "#!/bin/sh"
2147 echo "##"
2148 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2149 echo "##"
2150 echo ""
2151 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2152 echo "case \$1 in"
2153 echo " start ) exec ${prefix}/etc/rc all start ;;"
2154 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2155 echo "esac"
2156 ) >/sbin/init.d/${name}
2157 chmod 755 /sbin/init.d/${name}
2158 # create corresponding symbolic links
2159 ( cd /sbin
2160 ln -s ../init.d/${name} rc2.d/S900${name}
2161 ln -s ../init.d/${name} rc1.d/K100${name}
2162 ) || exit $?
2163 fi
2164 ;;
2165 Darwin/* )
2166 darwin_rc_dir="/System/Library/StartupItems/${name}"
2167 if [ ! -d ${darwin_rc_dir} ]; then
2168 mkdir ${darwin_rc_dir}
2169 fi
2171 # make sure hierarchy is activated in /etc/hostconfig
2172 # FIXME: cs: simple and bad code here without any detection of existing entries
2173 echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
2175 # install transfer script
2176 if [ ! -f ${darwin_rc_dir}/${name} ]; then
2177 rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
2178 ( echo "#!/bin/sh"
2179 echo "##"
2180 echo "## ${darwin_rc_dir}/${name}"
2181 echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy"
2182 echo "##"
2183 echo ""
2184 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2185 echo ""
2186 echo ". /etc/rc.common"
2187 echo ""
2188 echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
2189 echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
2190 echo " ${prefix}/etc/rc all start"
2191 echo "fi"
2192 ) >${darwin_rc_dir}/${name}
2193 chmod 755 ${darwin_rc_dir}/${name}
2194 fi
2195 # install startup parameter list
2196 if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
2197 rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
2198 ( echo "{"
2199 echo " Description = \"OpenPKG ${prefix} hierarchy\";"
2200 echo " Provides = (\"OpenPKG ${prefix}\");"
2201 echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
2202 echo " Uses = (\"Cron\");"
2203 echo " OrderPreference = \"Last\";"
2204 echo " Messages ="
2205 echo " {"
2206 echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
2207 echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
2208 echo " };"
2209 echo "}"
2210 ) >${darwin_rc_dir}/StartupParameters.plist
2211 chmod 644 ${darwin_rc_dir}/StartupParameters.plist
2212 fi
2213 ;;
2214 IRIX*/6.* )
2215 if [ ! -f /etc/init.d/${name} ]; then
2216 # install transfer script
2217 ( echo "#!/bin/sh"
2218 echo "##"
2219 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2220 echo "##"
2221 echo ""
2222 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2223 echo "case \$1 in"
2224 echo " start ) exec ${prefix}/etc/rc all start ;;"
2225 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2226 echo "esac"
2227 ) >/etc/init.d/${name}
2228 chmod 755 /etc/init.d/${name}
2229 # create corresponding links
2230 ( cd /etc
2231 ln -f init.d/${name} rc2.d/S99${name}
2232 ln -f init.d/${name} rc0.d/K00${name}
2233 ) || exit $?
2234 fi
2235 ;;
2236 esac
2237 fi
2239 # create the cron transfer entries
2240 if [ ".$cusr" != ".root" ]; then
2241 echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
2242 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2243 else
2244 case "$plid" in
2245 FreeBSD/* | Linux/* | Darwin/* )
2246 if [ -f /etc/slackware-version ]; then
2247 exists=`crontab -l | grep "$prefix/etc/rc"`
2248 if [ ".$exists" = . ]; then
2249 EDITOR=/tmp/vipw.$$
2250 VISUAL="$EDITOR"
2251 export EDITOR
2252 export VISUAL
2253 ( echo "#!/bin/sh"
2254 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
2255 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
2256 echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
2257 echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
2258 echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
2259 echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
2260 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
2261 echo " echo \"# </OpenPKG>\""
2262 echo ") >>\$1"
2263 ) >$EDITOR
2264 chmod a+x $EDITOR
2265 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2266 rm -f $EDITOR
2267 fi
2268 else
2269 exists=`grep "$prefix/etc/rc" /etc/crontab`
2270 if [ ".$exists" = . ]; then
2271 ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
2272 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
2273 echo "0 0 1 * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
2274 echo "0 0 * * 0 root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
2275 echo "0 0 * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
2276 echo "0 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
2277 echo "*/15 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
2278 echo "# </OpenPKG>"
2279 ) >>/etc/crontab
2280 fi
2281 fi
2282 ;;
2283 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
2284 exists=`crontab -l | grep "$prefix/etc/rc"`
2285 if [ ".$exists" = . ]; then
2286 EDITOR=/tmp/vipw.$$
2287 VISUAL="$EDITOR"
2288 export EDITOR
2289 export VISUAL
2290 ( echo "#!/bin/sh"
2291 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
2292 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
2293 echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
2294 echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
2295 echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
2296 echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
2297 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
2298 echo " echo \"# </OpenPKG>\""
2299 echo ") >>\$1"
2300 ) >$EDITOR
2301 chmod a+x $EDITOR
2302 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2303 rm -f $EDITOR
2304 fi
2305 ;;
2306 IRIX*/6.* )
2307 exists=`crontab -l | grep "$prefix/etc/rc"`
2308 if [ ".$exists" = . ]; then
2309 ( crontab -l
2310 echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
2311 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
2312 echo "0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
2313 echo "0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
2314 echo "0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
2315 echo "0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
2316 echo "0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
2317 echo "# </OpenPKG>"
2318 ) | /usr/bin/crontab || exit $?
2319 fi
2320 ;;
2321 esac
2322 fi
2324 # remember what OpenPKG RPM version was installed, so we can
2325 # correctly upgrade the RPM database in the %post section (see below).
2326 if [ -d ${prefix}/RPM/DB ]; then
2327 if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
2328 # OpenPKG 2.0
2329 rpm="${prefix}/bin/openpkg rpm"
2330 else
2331 # OpenPKG 1.x
2332 rpm="${prefix}/bin/rpm"
2333 fi
2334 rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
2335 $rpm --version |\
2336 sed -e 's;^;X;' \
2337 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
2338 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
2339 -e 's;^X.*$;4.0;' \
2340 >${prefix}/RPM/DB/.version
2341 fi
2343 %post
2344 # optional post-processing from "pre" section
2345 if [ -f %{l_prefix}.pre-post-process.sh ]; then
2346 sh %{l_prefix}.pre-post-process.sh
2347 rm -f %{l_prefix}.pre-post-process.sh
2348 fi
2350 # update or initially create OpenPKG UUID configuration
2351 %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
2353 # determine new and old OpenPKG RPM version
2354 V_rpm_new="%{V_rpm}"
2355 if [ -f %{l_prefix}/RPM/DB/.version ]; then
2356 V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
2357 rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
2358 else
2359 V_rpm_old="4.0"
2360 fi
2362 # make sure all RPM database files are present and that their
2363 # attributes are correct, etc. This is not a database rebuild
2364 # operation, so this is fully harmless and can be done always.
2365 %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
2367 # check RPM database for upgrade requirements
2368 if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
2369 # RPM 4.0/4.1 does not allow concurrent database access, so we
2370 # cannot upgrade the database immediately from here (because
2371 # we are still running within the execution context of the
2372 # old RPM which in turn has the database locked) and instead
2373 # have to just drop a note to the administrator about database
2374 # upgrading. RPM 4.2 in general allows concurrent database
2375 # access, but the whole stuff is too risky here, too.
2376 ( echo "You are upgrading the OpenPKG bootstrap from a previous"
2377 echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
2378 echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
2379 echo "be used, but it is strongly recommended to upgrade it as"
2380 echo "soon as possible to the latest Berkeley-DB format files by"
2381 echo "executing the command:"
2382 echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
2383 echo "In case of problems with the RPM database you can always"
2384 echo "execute the command:"
2385 echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
2386 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
2387 fi
2389 # system command overriding support
2390 # ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
2391 # BUILD COMMAND OVERRIDE SOLUTION!
2392 if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
2393 mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
2394 fi
2395 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
2396 case "`cat %{l_prefix}/etc/openpkg/platform`" in
2397 *-*-debian* | *-*-ubuntu* )
2398 # FIXME: Evil hack to workaround build problems under Debian
2399 # (at least 3.1) (and similar platforms) where a Debian
2400 # install-info(8) exists which is both API and functionally
2401 # incompatible to the de-facto standardized install-info(8)
2402 # command from GNU Texinfo.
2403 if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
2404 ( echo "#!/bin/sh"
2405 echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
2406 echo "exit 0"
2407 ) >%{l_prefix}/lib/openpkg/override/install-info
2408 chmod 775 %{l_prefix}/lib/openpkg/override/install-info
2409 fi
2410 ;;
2411 *-*-macosx* | *-*-darwin* )
2412 # FIXME: Evil hack to workaround the fact that Mac OS X'
2413 # linker by default prefers the /usr/lib libraries and does
2414 # not honor the -L options the way one would expect it.
2415 gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
2416 cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
2417 ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
2418 if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
2419 ( echo "#!/bin/sh"
2420 echo "case \" \$* \" in"
2421 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
2422 echo " * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
2423 echo "esac"
2424 ) >%{l_prefix}/lib/openpkg/override/gcc
2425 chmod 775 %{l_prefix}/lib/openpkg/override/gcc
2426 fi
2427 if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
2428 ( echo "#!/bin/sh"
2429 echo "case \" \$* \" in"
2430 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
2431 echo " * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
2432 echo "esac"
2433 ) >%{l_prefix}/lib/openpkg/override/cc
2434 chmod 775 %{l_prefix}/lib/openpkg/override/cc
2435 fi
2436 if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
2437 ( echo "#!/bin/sh"
2438 echo "exec $ld -search_paths_first \"\$@\""
2439 ) >%{l_prefix}/lib/openpkg/override/ld
2440 chmod 775 %{l_prefix}/lib/openpkg/override/ld
2441 fi
2442 ;;
2443 esac
2445 # FIXME: hack to workaround problems in environments with too few
2446 # development tools. ATTENTION: see one paragraph above.
2447 if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
2448 mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
2449 fi
2450 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
2452 # check for "openpkg" executable from the OpenPKG Community series
2453 # print license if not OSS, otherwise register with openpkg.org
2454 community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \
2455 sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'`
2456 if [ ".$community_version" = . ]; then
2457 ( echo ""
2458 echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\""
2459 echo "executable which is covered by the following terms of use:"
2460 echo "______________________________________________________________________________"
2461 echo ""
2462 %{l_prefix}/bin/openpkg --license | sed -e '1d'
2463 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
2464 else
2465 %{l_prefix}/bin/openpkg register </dev/null >/dev/null 2>&1 || true
2466 fi
2468 %preun
2469 [ ".$1" != .0 ] && exit 0
2471 # remove override files
2472 if [ -d %{l_prefix}/lib/openpkg/override ]; then
2473 rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
2474 fi
2476 # remove fallback files
2477 if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
2478 rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
2479 fi
2481 # remove files which are not RPM controlled
2482 rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
2483 rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
2484 rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
2485 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
2487 # The following code usually would be done in a %postun section.
2488 # But because we already had to remove the database in this %preun
2489 # section (see the 'rm' commands above) in order to make RPM happy
2490 # inside its own removal procedure, RPM would no longer find the
2491 # %postun script (because it's recorded in the database files). So
2492 # we have to perform the procedure already in this %preun script.
2493 # except for the removal of the top-level directory it does not
2494 # matter. But the top-level directory can only be removed after
2495 # the RPM removal procedure took place, so we play a little delay
2496 # trick below.
2498 # determine current user
2499 cusr=`(id -un) 2>/dev/null ||\
2500 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
2501 (whoami) 2>/dev/null ||\
2502 (who am i | cut "-d " -f1) 2>/dev/null ||\
2503 echo $LOGNAME`
2505 # determine runtime details (for both inside and outside RPM!!)
2506 user="%{l_musr}"
2507 group="%{l_mgrp}"
2508 prefix="%{l_prefix}"
2509 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
2511 # determine platform id
2512 s=`(uname -s) 2>/dev/null` || s='Unknown'
2513 r=`(uname -r) 2>/dev/null` || r='0.0'
2514 plid="${s}/${r}"
2516 # unregister instance in presence file
2517 presence="/etc/openpkg"
2518 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
2519 if [ ".$exists" != . ]; then
2520 if [ ".$cusr" != ".root" ]; then
2521 echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
2522 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2523 else
2524 cp $presence $presence.bak && \
2525 egrep -v "^ *${prefix} *\$" $presence.bak >$presence
2526 rm -f $presence.bak >/dev/null 2>&1
2527 if [ ".`cat $presence`" = . ]; then
2528 rm -f $presence >/dev/null 2>&1
2529 fi
2530 fi
2531 fi
2533 # remove entry in /etc/shells
2534 shell="${prefix}/lib/openpkg/bash"
2535 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
2536 if [ ".$exists" != . ]; then
2537 if [ ".$cusr" != ".root" ]; then
2538 echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
2539 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2540 else
2541 cp /etc/shells /etc/shells.bak && \
2542 grep -v "^${shell}" /etc/shells.bak >/etc/shells
2543 rm -f /etc/shells.bak >/dev/null 2>&1
2544 fi
2545 fi
2547 # remove the hierarchy user/group
2548 for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
2549 "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
2550 "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
2551 "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
2552 # split request into class/usr/uid/grp/gid
2553 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
2554 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
2556 # check whether user already exists
2557 exists=`(getent passwd "$usr"; \
2558 grep "^$usr:" /etc/passwd; \
2559 ypmatch "$usr" passwd; \
2560 nismatch "$usr" passwd; \
2561 nidump passwd . | grep "^$usr:") 2>/dev/null | \
2562 sed -e 'q'`
2563 if [ ".$exists" != . ]; then
2564 if [ ".$cusr" != ".root" ]; then
2565 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
2566 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2567 elif [ ".$usr" = ".root" ]; then
2568 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
2569 echo "openpkg:WARNING: (would remove system standard user)" 1>&2
2570 else
2571 case "$plid" in
2572 FreeBSD/* | NetBSD/* )
2573 cp /etc/master.passwd /etc/master.passwd.bak && \
2574 grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
2575 ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
2576 rm -f /etc/master.passwd.bak >/dev/null 2>&1
2577 ;;
2578 Linux/* | SunOS/5.* | UnixWare/* )
2579 cp /etc/passwd /etc/passwd.bak && \
2580 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2581 ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
2582 rm -f /etc/passwd.bak >/dev/null 2>&1
2583 ;;
2584 AIX/* )
2585 rmuser -p "${usr}"
2586 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
2587 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
2588 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
2589 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
2590 ;;
2591 OSF1/V5.* )
2592 cp /etc/passwd /etc/passwd.bak && \
2593 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2594 ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
2595 rm -f /etc/passwd.bak >/dev/null 2>&1
2596 ;;
2597 HP-UX/* )
2598 cp /etc/passwd /etc/passwd.bak && \
2599 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2600 rm -f /etc/passwd.bak >/dev/null 2>&1
2601 ;;
2602 Darwin/* )
2603 niutil -destroy . "/users/${usr}"
2604 ;;
2605 IRIX*/6.* )
2606 cp /etc/passwd /etc/passwd.bak && \
2607 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2608 if [ -f /etc/shadow ]
2609 then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
2610 fi
2611 rm -f /etc/passwd.bak >/dev/null 2>&1
2612 ;;
2613 esac
2614 fi
2615 fi
2617 # check whether group already exists
2618 exists=`(getent group "$grp"; \
2619 grep "^$grp:" /etc/group; \
2620 ypmatch "$grp" group; \
2621 nismatch "$grp" group; \
2622 nidump group . | grep "^$grp:") 2>/dev/null | \
2623 sed -e 'q'`
2624 if [ ".$exists" != . ]; then
2625 if [ ".$cusr" != ".root" ]; then
2626 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
2627 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2628 elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
2629 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
2630 echo "openpkg:WARNING: (would remove system standard group)" 1>&2
2631 else
2632 case "$plid" in
2633 Darwin/* )
2634 niutil -destroy . "/groups/${grp}"
2635 ;;
2636 AIX/* )
2637 rmgroup "${grp}"
2638 ;;
2639 * )
2640 cp /etc/group /etc/group.bak && \
2641 grep -v "^${grp}:" /etc/group.bak >/etc/group
2642 rm -f /etc/group.bak >/dev/null 2>&1
2643 ;;
2644 esac
2645 fi
2646 fi
2647 done
2649 # invalidate passwd and group tables from Name Service Cache Daemon to
2650 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
2651 if [ -x /usr/sbin/nscd ]; then
2652 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
2653 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
2654 fi
2656 # remove the startup/shutdown transfer scripts
2657 name=`echo "$prefix" | sed -e 's;/;;g'`
2658 if [ ".$cusr" != ".root" ]; then
2659 echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
2660 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2661 else
2662 case "$plid" in
2663 FreeBSD/* )
2664 rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
2665 ;;
2666 NetBSD/* )
2667 rm -f /etc/rc.d/${name} >/dev/null 2>&1
2668 ;;
2669 Linux/* )
2670 if [ -f /etc/gentoo-release ]; then
2671 /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
2672 rm -f /etc/init.d/openpkg-${name} >/dev/null 2>&1
2673 else
2674 # sroot: script root directory
2675 # lroot: link root directory
2676 if [ -f /etc/debian_version ]; then
2677 sroot=/etc/init.d
2678 lroot=/etc/rc%d.d
2679 elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
2680 sroot=/etc/rc.d/init.d
2681 lroot=/etc/rc.d/rc%d.d
2682 elif [ -f /etc/SuSE-release ]; then
2683 sroot=/etc/init.d
2684 lroot=/etc/init.d/rc%d.d
2685 elif [ -f /etc/slackware-version ]; then
2686 sroot=/etc/rc.d
2687 lroot=/etc/rc.d/rc%d.d
2688 name="rc.${name}"
2689 else
2690 echo "WARNING: you are not running one of the supported standard" 1>&2
2691 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
2692 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
2693 sroot=""
2694 lroot=""
2695 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
2696 if [ -d $sr ]; then
2697 sroot="$sr"
2698 break
2699 fi
2700 done
2701 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
2702 if [ -d $lr ]; then
2703 lroot="`echo $lr | sed -e 's;2;%d;'`"
2704 break
2705 fi
2706 done
2707 if [ ".$sroot" = . -o ".$lroot" = . ]; then
2708 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
2709 exit 1
2710 fi
2711 fi
2712 rm -f ${sroot}/${name} >/dev/null 2>&1
2713 for i in 2 3 4 5; do
2714 rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
2715 done
2716 for i in 0 1 6; do
2717 rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
2718 done
2719 if [ -f /etc/slackware-version ]; then
2720 for i in 0 1 2 3 4 5 6; do
2721 l=`echo $lroot | sed -e "s;%d;$i;"`
2722 if [ -d $l ]; then
2723 rmdir $l >/dev/null 2>&1 || true
2724 fi
2725 done
2726 fi
2727 fi
2728 ;;
2729 SunOS/5.* )
2730 rm -f /etc/init.d/${name} >/dev/null 2>&1
2731 rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
2732 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
2733 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
2734 ;;
2735 UnixWare/* )
2736 rm -f /etc/init.d/${name} >/dev/null 2>&1
2737 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
2738 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
2739 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
2740 ;;
2741 AIX/* )
2742 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
2743 rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
2744 ;;
2745 OSF1/V5.* )
2746 rm -f /sbin/init.d/${name} >/dev/null 2>&1
2747 rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
2748 rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
2749 ;;
2750 HP-UX/* )
2751 rm -f /sbin/init.d/${name} >/dev/null 2>&1
2752 rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
2753 rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
2754 ;;
2755 Darwin/* )
2756 cp /etc/hostconfig /etc/hostconfig.bak && \
2757 grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
2758 rm -f /etc/hostconfig.bak >/dev/null 2>&1
2759 rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
2760 ;;
2761 IRIX*/6.* )
2762 rm -f /etc/init.d/${name} >/dev/null 2>&1
2763 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
2764 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
2765 ;;
2766 esac
2767 fi
2769 # remove the cron transfer entries
2770 if [ ".$cusr" != ".root" ]; then
2771 echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
2772 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2773 else
2774 case "$plid" in
2775 FreeBSD/* | Linux/* | Darwin/* )
2776 if [ -f /etc/slackware-version ]; then
2777 EDITOR=/tmp/vipw.$$
2778 VISUAL="$EDITOR"
2779 export EDITOR
2780 export VISUAL
2781 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
2782 ( echo "cp \$1 \$1.bak"
2783 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
2784 echo "rm -f \$1.bak"
2785 ) >$EDITOR
2786 chmod a+x $EDITOR
2787 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2788 rm -f $EDITOR
2789 else
2790 exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
2791 if [ ".$exists" != . ]; then
2792 p=`echo $prefix | sed -e 's;/;\\\\/;g'`
2793 cp /etc/crontab /etc/crontab.bak
2794 cat /etc/crontab.bak |\
2795 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
2796 >/etc/crontab
2797 rm -f /etc/crontab.bak >/dev/null 2>&1
2798 fi
2799 fi
2800 ;;
2801 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
2802 EDITOR=/tmp/vipw.$$
2803 VISUAL="$EDITOR"
2804 export EDITOR
2805 export VISUAL
2806 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
2807 ( echo "cp \$1 \$1.bak"
2808 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
2809 echo "rm -f \$1.bak"
2810 ) >$EDITOR
2811 chmod a+x $EDITOR
2812 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2813 rm -f $EDITOR
2814 ;;
2815 IRIX*/6.* )
2816 p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
2817 ( crontab -l |
2818 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
2819 ) | /usr/bin/crontab || exit $?
2820 ;;
2821 esac
2822 fi
2824 # delayed removal of top-level directory.
2825 ( sleep 2
2826 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
2827 rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
2828 rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
2829 rmdir %{l_prefix} >/dev/null 2>&1 || true
2830 ) </dev/null >/dev/null 2>/dev/null &