Fri, 22 Oct 2010 13:22:33 +0200
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 20100826
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 # build the package
985 ${l_make}
986 ) || exit $?
988 # display verbosity header
989 set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
991 # build "openpkg" executable
992 ( cd openpkg-executable-%{V_exec}
993 ${l_make} \
994 CC="${l_cc}" \
995 OPENPKG_PREFIX="%{l_prefix}" \
996 OPENPKG_SUSR="%{l_susr}" \
997 OPENPKG_MUSR="%{l_musr}"
998 ) || exit $?
1000 %install
1001 # skip in bootstrap phase 2 (see openpkg.boot)
1002 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
1004 # switch into a temporary build area
1005 cd openpkg-%{version}
1006 . ./.buildenv
1008 # display verbosity header
1009 set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
1011 # create installation hierarchy
1012 rm -rf $RPM_BUILD_ROOT
1013 sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
1014 for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
1015 test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
1016 mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
1017 done
1018 for i in 1 2 3 4 5 6 7 8 9; do
1019 test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
1020 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
1021 test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
1022 mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
1023 done
1024 for dir in PKG bin etc include info lib man sbin; do
1025 test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
1026 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
1027 done
1028 for i in 1 2 3 4 5 6 7 8 9; do
1029 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
1030 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
1031 test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
1032 mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
1033 done
1034 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
1035 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
1036 for dir in SRC PKG DB TMP; do
1037 test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
1038 mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
1039 done
1040 mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
1041 mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
1043 # display verbosity header
1044 set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
1046 # install RPM into installation hierarchy
1047 ( cd rpm-%{V_rpm}
1048 DESTDIR="$RPM_BUILD_ROOT"
1049 export DESTDIR
1050 ${l_make} install
1051 ) || exit $?
1053 # display verbosity header
1054 set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
1056 # add additional development files
1057 cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1058 cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1059 cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1060 cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
1061 cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1062 cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
1063 cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
1064 cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
1066 # display verbosity header
1067 set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
1069 # post-adjust RPM installation (namespace-clean POPT inclusion)
1070 mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
1071 $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
1072 mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
1073 $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
1075 # move C API into custom locations
1076 mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
1077 $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
1078 mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
1079 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
1081 # move rpm tool to custom location
1082 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
1083 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1084 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
1085 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
1087 # move rpm2cpio tool to custom location
1088 mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
1089 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
1090 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
1091 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
1093 # replace symlinks with hardlinks
1094 for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
1095 eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
1096 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
1097 ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
1098 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
1099 done
1100 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
1101 ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
1102 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
1103 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
1104 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
1106 # display verbosity header
1107 set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
1109 # strip RPM installation
1110 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
1111 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
1112 for dir in man/ja man/pl man/ru man/sk src; do
1113 rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
1114 done
1115 rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true
1116 for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
1117 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
1118 done
1119 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
1120 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
1121 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
1122 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
1123 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
1124 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
1125 rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
1126 for file in \
1127 u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
1128 perl.prov perl.req mkinstalldirs magic.prov magic.req http.req \
1129 getpo.sh get_magic.pl find-provides find-requires \
1130 find-requires.perl find-req.pl find-provides.perl \
1131 find-prov.pl find-lang.sh cpanflute convertrpmrc.sh check-prereqs \
1132 rpmputtext rpmgettext brp-compress brp-redhat brp-sparc64-linux \
1133 brp-strip brp-strip-shared brp-strip-comment-note rpmrc \
1134 config.guess config.sub check-files; do
1135 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
1136 done
1138 # display verbosity header
1139 set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
1141 # install lsync tool
1142 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1143 <`SOURCE lsync` \
1144 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1145 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
1146 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1147 <`SOURCE dot.lsyncrc` \
1148 >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
1149 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1150 <`SOURCE lsync.8` \
1151 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
1153 # install rpm-config tool
1154 ( l_prefix="%{l_prefix}"
1155 l_cc="%{l_cc}"
1156 l_cflags=""
1157 l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
1158 l_ldflags="-L${l_prefix}/lib/openpkg"
1159 l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
1160 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1161 -e "s:@l_cc@:$l_cc:g" \
1162 -e "s:@l_cflags@:$l_cflags:g" \
1163 -e "s:@l_cppflags@:$l_cppflags:g" \
1164 -e "s:@l_ldflags@:$l_ldflags:g" \
1165 -e "s:@l_libs@:$l_libs:g" \
1166 -e "s:@l_version@:%{V_rpm}:g" \
1167 <`SOURCE rpm-config.sh` \
1168 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1169 ) || exit $?
1170 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
1171 sed -e "s:RPM_VERSION:%{V_rpm}:g" \
1172 <`SOURCE rpm-config.8` \
1173 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
1175 # install OpenPKG registry commands
1176 ( cd openpkg-registry-%{V_registry}
1177 mv $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
1178 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
1179 sed -e "s;@l_prefix@;%{l_prefix};g" \
1180 rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1181 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
1182 sed -e "s;@l_prefix@;%{l_prefix};g" \
1183 register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1184 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
1185 cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
1186 ) || exit $?
1188 # install OpenPKG Tool Chain command subset
1189 ( cd openpkg-tools-%{V_tools}
1190 cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
1191 cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1192 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
1193 cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
1194 ) || exit $?
1196 # install RPM extension
1197 ( cd rpm-%{V_rpm}
1198 cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
1199 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
1200 ) || exit $?
1201 ( cd perl-%{V_perl}
1202 cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1203 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
1204 ) || exit $?
1205 ( cd openssl-%{V_openssl}
1206 cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1207 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
1208 ) || exit $?
1209 ( cd curl-%{V_curl}
1210 cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1211 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
1212 ) || exit $?
1213 ( cd bzip2-%{V_bzip2}
1214 cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1215 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
1216 ) || exit $?
1217 ( cd gzip-%{V_gzip}
1218 cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1219 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
1220 ) || exit $?
1221 ( cd patch-%{V_patch}
1222 cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1223 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
1224 ) || exit $?
1225 ( cd tar-%{V_tar}
1226 cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1227 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
1228 ) || exit $?
1229 ( cd bash-%{V_bash}
1230 cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1231 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
1232 ) || exit $?
1233 ( cd uuid-%{V_uuid}
1234 cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1235 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
1236 ) || exit $?
1237 sed -e "s;@l_prefix@;%{l_prefix};g" \
1238 -e "s;@l_musr@;%{l_musr};g" \
1239 -e "s;@l_mgrp@;%{l_mgrp};g" \
1240 <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1241 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
1242 sed -e "s;@l_prefix@;%{l_prefix};g" \
1243 <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
1244 sed -e "s;@l_prefix@;%{l_prefix};g" \
1245 <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1246 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
1247 sed -e "s;@l_prefix@;%{l_prefix};g" \
1248 <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
1249 sed -e "s;@l_prefix@;%{l_prefix};g" \
1250 -e "s;@l_musr@;%{l_musr};g" \
1251 -e "s;@l_mgrp@;%{l_mgrp};g" \
1252 <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1253 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
1254 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1255 <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1256 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
1258 # install OpenPKG tool chain execution frontend and execution wrapper
1259 cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1260 ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1261 chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
1262 sed -e "s;@l_prefix@;%{l_prefix};g" \
1263 <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1264 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
1265 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1266 <`SOURCE openpkg.1` \
1267 >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
1269 # install more OpenPKG tool chain commands
1270 sed -e "s;@l_prefix@;%{l_prefix};g" \
1271 <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
1272 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
1273 sed -e "s;@l_prefix@;%{l_prefix};g" \
1274 <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1275 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
1277 # install an own copy of shtool
1278 cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1279 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
1281 # display verbosity header
1282 set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
1284 # install a few README files
1285 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1286 <`SOURCE root.README` \
1287 >$RPM_BUILD_ROOT%{l_prefix}/README
1288 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1289 <`SOURCE local.README` \
1290 >$RPM_BUILD_ROOT%{l_prefix}/local/README
1292 # install Bash environment
1293 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1294 <`SOURCE dot.bashrc` \
1295 >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
1296 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1297 <`SOURCE dot.bash_login` \
1298 >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
1300 # install Run-Command files
1301 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1302 -e "s:@l_susr@:%{l_susr}:g" \
1303 -e "s:@l_musr@:%{l_musr}:g" \
1304 <`SOURCE rc` \
1305 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
1306 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
1307 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1308 <`SOURCE rc.conf` \
1309 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1310 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
1311 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1312 <`SOURCE rc.func` \
1313 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1314 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
1315 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
1316 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1317 -e "s:@l_musr@:%{l_musr}:g" \
1318 <`SOURCE rc.openpkg` \
1319 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1320 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
1321 ( echo "#!/bin/sh"
1322 echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
1323 ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1324 chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
1325 ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
1326 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
1327 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1328 <`SOURCE rc.8` \
1329 >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
1331 # create configuration directory
1332 test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
1333 mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
1335 # install platform identification file
1336 sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
1337 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1338 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
1340 # install UUID configuration file (ghost)
1341 touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1342 chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
1344 # install registry configuration files (ghost)
1345 touch \
1346 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
1347 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
1348 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
1349 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
1350 chmod 644 \
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
1356 # install default managers configuration file
1357 ( echo "##"
1358 echo "## managers -- OpenPKG Instance Managers"
1359 echo "##"
1360 echo ""
1361 echo "%{l_susr}"
1362 echo "%{l_musr}"
1363 echo ""
1364 ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
1366 # install overriding RPM configuration files
1367 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1368 <`SOURCE rpmpopt` \
1369 >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
1370 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1371 <`SOURCE rpmrc` \
1372 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
1373 sed -e "s:@l_prefix@:%{l_prefix}:g" \
1374 -e "s:@l_prefix_static@:%{l_prefix}:g" \
1375 -e "s;@l_build_path@;$l_build_path;g" \
1376 -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
1377 -e "s;@l_build_ulim@;$l_build_ulim;g" \
1378 -e "s:@TAG@:$tag:g" \
1379 -e "s:@SUSR@:$susr:g" \
1380 -e "s:@SGRP@:$sgrp:g" \
1381 -e "s:@MUSR@:$musr:g" \
1382 -e "s:@MGRP@:$mgrp:g" \
1383 -e "s:@RUSR@:$rusr:g" \
1384 -e "s:@RGRP@:$rgrp:g" \
1385 -e "s:@NUSR@:$nusr:g" \
1386 -e "s:@NGRP@:$ngrp:g" \
1387 <`SOURCE rpmmacros` \
1388 >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
1389 cp `SOURCE openpkg.org.pgp` \
1390 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
1391 cp `SOURCE openpkg.com.pgp` \
1392 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
1393 cp `SOURCE openpkg.net.pgp` \
1394 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
1396 # display verbosity header
1397 set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
1399 %files
1400 %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
1401 %{l_prefix}/README
1402 %config(noreplace) %{l_prefix}/.bashrc
1403 %config(noreplace) %{l_prefix}/.bash_login
1404 %dir %{l_prefix}/RPM
1405 %dir %{l_prefix}/RPM/SRC
1406 %dir %{l_prefix}/RPM/PKG
1407 %dir %{l_prefix}/RPM/DB
1408 %dir %{l_prefix}/RPM/TMP
1409 %dir %{l_prefix}/cgi
1410 %dir %{l_prefix}/bin
1411 %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
1412 %dir %{l_prefix}/etc
1413 %{l_prefix}/etc/rc
1414 %config(noreplace) %{l_prefix}/etc/rc.conf
1415 %{l_prefix}/etc/rc.func
1416 %dir %{l_prefix}/etc/rc.d
1417 %{l_prefix}/etc/rc.d/rc.openpkg
1418 %dir %{l_prefix}/etc/openpkg
1419 %ghost %{l_prefix}/etc/openpkg/uuid
1420 %config %{l_prefix}/etc/openpkg/platform
1421 %config %{l_prefix}/etc/openpkg/rpmmacros
1422 %config %{l_prefix}/etc/openpkg/rpmrc
1423 %ghost %{l_prefix}/etc/openpkg/register.conf
1424 %ghost %{l_prefix}/etc/openpkg/register.prep
1425 %ghost %{l_prefix}/etc/openpkg/register.tran
1426 %ghost %{l_prefix}/etc/openpkg/register.util
1427 %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
1428 %{l_prefix}/etc/openpkg/openpkg.org.pgp
1429 %{l_prefix}/etc/openpkg/openpkg.com.pgp
1430 %{l_prefix}/etc/openpkg/openpkg.net.pgp
1431 %dir %{l_prefix}/include
1432 %dir %{l_prefix}/include/openpkg
1433 %dir %{l_prefix}/include/openpkg/rpm
1434 %{l_prefix}/include/openpkg/rpm/argv.h
1435 %{l_prefix}/include/openpkg/rpm/beecrypt.h
1436 %{l_prefix}/include/openpkg/rpm/bzlib.h
1437 %{l_prefix}/include/openpkg/rpm/db.h
1438 %{l_prefix}/include/openpkg/rpm/fts.h
1439 %{l_prefix}/include/openpkg/rpm/glob.h
1440 %{l_prefix}/include/openpkg/rpm/hdrinline.h
1441 %{l_prefix}/include/openpkg/rpm/header.h
1442 %{l_prefix}/include/openpkg/rpm/misc.h
1443 %{l_prefix}/include/openpkg/rpm/popt.h
1444 %{l_prefix}/include/openpkg/rpm/rpmal.h
1445 %{l_prefix}/include/openpkg/rpm/rpmbuild.h
1446 %{l_prefix}/include/openpkg/rpm/rpmcli.h
1447 %{l_prefix}/include/openpkg/rpm/rpmdb.h
1448 %{l_prefix}/include/openpkg/rpm/rpmds.h
1449 %{l_prefix}/include/openpkg/rpm/rpmerr.h
1450 %{l_prefix}/include/openpkg/rpm/rpmfc.h
1451 %{l_prefix}/include/openpkg/rpm/rpmfi.h
1452 %{l_prefix}/include/openpkg/rpm/rpmfile.h
1453 %{l_prefix}/include/openpkg/rpm/rpmhash.h
1454 %{l_prefix}/include/openpkg/rpm/rpmio.h
1455 %{l_prefix}/include/openpkg/rpm/rpmlib.h
1456 %{l_prefix}/include/openpkg/rpm/rpmlog.h
1457 %{l_prefix}/include/openpkg/rpm/rpmmacro.h
1458 %{l_prefix}/include/openpkg/rpm/rpmmessages.h
1459 %{l_prefix}/include/openpkg/rpm/rpmpgp.h
1460 %{l_prefix}/include/openpkg/rpm/rpmps.h
1461 %{l_prefix}/include/openpkg/rpm/rpmspec.h
1462 %{l_prefix}/include/openpkg/rpm/rpmsw.h
1463 %{l_prefix}/include/openpkg/rpm/rpmte.h
1464 %{l_prefix}/include/openpkg/rpm/rpmts.h
1465 %{l_prefix}/include/openpkg/rpm/rpmurl.h
1466 %{l_prefix}/include/openpkg/rpm/stringbuf.h
1467 %{l_prefix}/include/openpkg/rpm/ugid.h
1468 %{l_prefix}/include/openpkg/rpm/zconf.h
1469 %{l_prefix}/include/openpkg/rpm/zlib.h
1470 %dir %{l_prefix}/info
1471 %dir %{l_prefix}/lib
1472 %dir %{l_prefix}/lib/openpkg
1473 %{l_prefix}/lib/openpkg/bash
1474 %{l_prefix}/lib/openpkg/bzip2
1475 %{l_prefix}/lib/openpkg/curl
1476 %{l_prefix}/lib/openpkg/file
1477 %{l_prefix}/lib/openpkg/gzip
1478 %{l_prefix}/lib/openpkg/librpm.a
1479 %{l_prefix}/lib/openpkg/librpmbeecrypt.a
1480 %{l_prefix}/lib/openpkg/librpmbuild.a
1481 %{l_prefix}/lib/openpkg/librpmbz2.a
1482 %{l_prefix}/lib/openpkg/librpmdb.a
1483 %{l_prefix}/lib/openpkg/librpmio.a
1484 %{l_prefix}/lib/openpkg/librpmpopt.a
1485 %{l_prefix}/lib/openpkg/librpmz.a
1486 %{l_prefix}/lib/openpkg/macros
1487 %{l_prefix}/lib/openpkg/magic
1488 %{l_prefix}/lib/openpkg/magic.mgc
1489 %{l_prefix}/lib/openpkg/magic.mime
1490 %{l_prefix}/lib/openpkg/magic.mime.mgc
1491 %{l_prefix}/lib/openpkg/miniperl
1492 %{l_prefix}/lib/openpkg/openpkg
1493 %{l_prefix}/lib/openpkg/openssl
1494 %{l_prefix}/lib/openpkg/patch
1495 %{l_prefix}/lib/openpkg/rc
1496 %{l_prefix}/lib/openpkg/rpm
1497 %{l_prefix}/lib/openpkg/rpmb
1498 %{l_prefix}/lib/openpkg/rpmd
1499 %{l_prefix}/lib/openpkg/rpmdb
1500 %{l_prefix}/lib/openpkg/rpmdb_dump
1501 %{l_prefix}/lib/openpkg/rpmdb_load
1502 %{l_prefix}/lib/openpkg/rpmdb_verify
1503 %{l_prefix}/lib/openpkg/rpme
1504 %{l_prefix}/lib/openpkg/rpmi
1505 %{l_prefix}/lib/openpkg/rpmk
1506 %{l_prefix}/lib/openpkg/rpmpopt
1507 %{l_prefix}/lib/openpkg/rpmq
1508 %{l_prefix}/lib/openpkg/rpmt
1509 %{l_prefix}/lib/openpkg/rpmtool
1510 %{l_prefix}/lib/openpkg/rpmu
1511 %{l_prefix}/lib/openpkg/rpmv
1512 %{l_prefix}/lib/openpkg/shtool
1513 %{l_prefix}/lib/openpkg/tar
1514 %{l_prefix}/lib/openpkg/uuid
1515 %dir %{l_prefix}/libexec
1516 %dir %{l_prefix}/libexec/openpkg
1517 %{l_prefix}/libexec/openpkg/build.8
1518 %{l_prefix}/libexec/openpkg/build.pl
1519 %{l_prefix}/libexec/openpkg/curl.sh
1520 %{l_prefix}/libexec/openpkg/install
1521 %{l_prefix}/libexec/openpkg/lsync
1522 %{l_prefix}/libexec/openpkg/lsync.8
1523 %{l_prefix}/libexec/openpkg/man
1524 %{l_prefix}/libexec/openpkg/rc
1525 %{l_prefix}/libexec/openpkg/rc.8
1526 %{l_prefix}/libexec/openpkg/register
1527 %{l_prefix}/libexec/openpkg/register.8
1528 %{l_prefix}/libexec/openpkg/release
1529 %{l_prefix}/libexec/openpkg/release.8
1530 %{l_prefix}/libexec/openpkg/rpm
1531 %{l_prefix}/libexec/openpkg/rpm-config
1532 %{l_prefix}/libexec/openpkg/rpm-config.8
1533 %{l_prefix}/libexec/openpkg/rpm.8
1534 %{l_prefix}/libexec/openpkg/rpm2cpio
1535 %{l_prefix}/libexec/openpkg/rpm2cpio.8
1536 %{l_prefix}/libexec/openpkg/rpmbuild
1537 %{l_prefix}/libexec/openpkg/rpmbuild.8
1538 %{l_prefix}/libexec/openpkg/uuid
1539 %{l_prefix}/libexec/openpkg/uuid.8
1540 %dir %{l_prefix}/man
1541 %dir %{l_prefix}/man/man1
1542 %dir %{l_prefix}/man/man2
1543 %dir %{l_prefix}/man/man3
1544 %dir %{l_prefix}/man/man4
1545 %dir %{l_prefix}/man/man5
1546 %dir %{l_prefix}/man/man6
1547 %dir %{l_prefix}/man/man7
1548 %dir %{l_prefix}/man/man8
1549 %dir %{l_prefix}/man/man9
1550 %dir %{l_prefix}/man/cat1
1551 %dir %{l_prefix}/man/cat2
1552 %dir %{l_prefix}/man/cat3
1553 %dir %{l_prefix}/man/cat4
1554 %dir %{l_prefix}/man/cat5
1555 %dir %{l_prefix}/man/cat6
1556 %dir %{l_prefix}/man/cat7
1557 %dir %{l_prefix}/man/cat8
1558 %dir %{l_prefix}/man/cat9
1559 %{l_prefix}/man/man1/openpkg.1
1560 %dir %{l_prefix}/sbin
1561 %dir %{l_prefix}/pub
1562 %dir %{l_prefix}/share
1563 %dir %{l_prefix}/var
1564 %dir %{l_prefix}/local
1565 %{l_prefix}/local/README
1566 %{l_prefix}/local/.lsyncrc
1567 %dir %{l_prefix}/local/PKG
1568 %dir %{l_prefix}/local/bin
1569 %dir %{l_prefix}/local/etc
1570 %dir %{l_prefix}/local/include
1571 %dir %{l_prefix}/local/info
1572 %dir %{l_prefix}/local/lib
1573 %dir %{l_prefix}/local/man
1574 %dir %{l_prefix}/local/man/man1
1575 %dir %{l_prefix}/local/man/man2
1576 %dir %{l_prefix}/local/man/man3
1577 %dir %{l_prefix}/local/man/man4
1578 %dir %{l_prefix}/local/man/man5
1579 %dir %{l_prefix}/local/man/man6
1580 %dir %{l_prefix}/local/man/man7
1581 %dir %{l_prefix}/local/man/man8
1582 %dir %{l_prefix}/local/man/man9
1583 %dir %{l_prefix}/local/man/cat1
1584 %dir %{l_prefix}/local/man/cat2
1585 %dir %{l_prefix}/local/man/cat3
1586 %dir %{l_prefix}/local/man/cat4
1587 %dir %{l_prefix}/local/man/cat5
1588 %dir %{l_prefix}/local/man/cat6
1589 %dir %{l_prefix}/local/man/cat7
1590 %dir %{l_prefix}/local/man/cat8
1591 %dir %{l_prefix}/local/man/cat9
1592 %dir %{l_prefix}/local/sbin
1594 %clean
1595 # skip in bootstrap phase 2 (see openpkg.boot)
1596 [ ".$OPENPKG_BOOT" = .1 ] && exit 0
1598 # cleanup build area
1599 rm -rf openpkg-%{version} >/dev/null 2>&1 || true
1601 # cleanup installation area
1602 rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
1604 %pre
1605 # always performed for upgrades and because it doesn't harm!
1606 # [ ".$1" != .1 ] && exit 0
1608 # this procedure is only usable with root privileges
1609 # (for non-root installations it is not required at all)
1610 cusr=`(id -un) 2>/dev/null ||\
1611 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
1612 (whoami) 2>/dev/null ||\
1613 (who am i | cut "-d " -f1) 2>/dev/null ||\
1614 echo $LOGNAME`
1616 # determine runtime details (for both inside and outside RPM!!)
1617 # - bootstrapping: $xxx is set from aux.wrapbin.sh
1618 # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
1619 # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
1620 [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
1621 [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
1622 [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
1623 [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
1624 [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
1625 [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
1626 [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
1627 [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
1628 [ ".$suid" = . ] && suid="%{?l_suid}"
1629 [ ".$sgid" = . ] && sgid="%{?l_sgid}"
1630 [ ".$muid" = . ] && muid="%{?l_muid}"
1631 [ ".$mgid" = . ] && mgid="%{?l_mgid}"
1632 [ ".$ruid" = . ] && ruid="%{?l_ruid}"
1633 [ ".$rgid" = . ] && rgid="%{?l_rgid}"
1634 [ ".$nuid" = . ] && nuid="%{?l_nuid}"
1635 [ ".$ngid" = . ] && ngid="%{?l_ngid}"
1637 # if any of these optional params are not used we won't have a
1638 # corresponding macro either, so make use of one conditionally
1639 [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
1640 [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
1641 [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
1642 [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
1643 [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
1644 [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
1645 [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
1646 [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
1648 # determine prefix
1649 [ ".$prefix" = . ] && prefix="%{l_prefix}"
1650 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
1652 # register instance in presence file
1653 presence="/etc/openpkg"
1654 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
1655 if [ ".$exists" = . ]; then
1656 ( umask 022
1657 echo "${prefix}" >>$presence
1658 ) 2>/dev/null || true
1659 fi
1661 # determine user/group ids
1662 for class in s m r n; do
1663 eval "xusr=\"\$${class}usr\""
1664 eval "xgrp=\"\$${class}grp\""
1665 eval "xuid=\"\$${class}uid\""
1666 eval "xgid=\"\$${class}gid\""
1667 if [ ".$xuid" = . ]; then
1668 xuid=`(getent passwd "${xusr}"; \
1669 grep "^${xusr}:" /etc/passwd; \
1670 ypmatch "${xusr}" passwd; \
1671 nismatch "${xusr}" passwd; \
1672 nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
1673 sed -e 'q' | awk -F: '{ print $3; }'`
1674 if [ ".$xuid" = . ]; then
1675 # seek for a reasonably uid/gid pair
1676 xuid=1000
1677 ok=0
1678 while [ ".$ok" = .0 ]; do
1679 eval "u_exists=\$u_exists_$xuid"
1680 if [ ".$u_exists" = . ]; then
1681 u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
1682 grep "^[^:]*:[^:]*:$xuid:"`
1683 fi
1684 eval "g_exists=\$g_exists_$xuid"
1685 if [ ".$g_exists" = . ]; then
1686 g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
1687 grep "^[^:]*:[^:]*:$xuid:"`
1688 fi
1689 if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
1690 ok=1
1691 break
1692 fi
1693 xuid=`expr $xuid + 1`
1694 done
1695 eval "u_exists_$xuid=yes"
1696 eval "g_exists_$xuid=yes"
1697 fi
1698 fi
1699 if [ ".$xgid" = . ]; then
1700 xgid=`(getent group "${xgrp}"; \
1701 grep "^${xgrp}:" /etc/group; \
1702 ypmatch "${xgrp}" group; \
1703 nismatch "${xgrp}" group; \
1704 nidump group . | grep "^${xgrp}:") 2>/dev/null | \
1705 sed -e 'q' | awk -F: '{ print $3; }'`
1706 if [ ".$xgid" = . ]; then
1707 xgid="$xuid"
1708 fi
1709 fi
1710 eval "${class}uid=\"$xuid\""
1711 eval "${class}gid=\"$xgid\""
1712 done
1714 # determine platform id
1715 s=`(uname -s) 2>/dev/null` || s='Unknown'
1716 r=`(uname -r) 2>/dev/null` || r='0.0'
1717 plid="${s}/${r}"
1719 # add entry to /etc/shells
1720 shell="${prefix}/lib/openpkg/bash"
1721 if [ -f /etc/shells ]; then
1722 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
1723 if [ ".$exists" = . ]; then
1724 if [ ".$cusr" != ".root" ]; then
1725 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
1726 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1727 else
1728 echo "${shell}" >>/etc/shells
1729 fi
1730 fi
1731 fi
1733 # clear pending deferred actions
1734 rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
1736 # create the hierarchy user/group
1737 for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
1738 "management:${musr}:${muid}:${mgrp}:${mgid}" \
1739 "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
1740 "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
1741 # split request into class/usr/uid/grp/gid
1742 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
1743 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
1745 # check whether user already exists
1746 exists=`(getent passwd "$usr"; \
1747 grep "^$usr:" /etc/passwd; \
1748 ypmatch "$usr" passwd; \
1749 nismatch "$usr" passwd; \
1750 nidump passwd . | grep "^$usr:") 2>/dev/null | \
1751 sed -e 'q'`
1752 if [ ".$exists" = . ]; then
1753 if [ ".$cusr" != ".root" ]; then
1754 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
1755 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1756 else
1757 # add entry to passwd database
1758 realname="${prefix} OpenPKG ($class)"
1759 case "$plid" in
1760 FreeBSD/* | NetBSD/* )
1761 file=/etc/master.passwd
1762 entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
1763 update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
1764 ;;
1765 Linux/* )
1766 file=/etc/passwd
1767 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1768 update="(PATH=\$PATH:/usr/sbin; pwconv)"
1769 ;;
1770 SunOS/5.* | UnixWare/* )
1771 file=/etc/passwd
1772 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1773 update="(PATH=\$PATH:/usr/sbin; pwconv)"
1774 ;;
1775 AIX/* )
1776 # intentionally do nothing here
1777 :
1778 ;;
1779 OSF1/V5.* )
1780 file=/etc/passwd
1781 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1782 update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
1783 ;;
1784 HP-UX/* )
1785 file=/etc/passwd
1786 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1787 update=":"
1788 ;;
1789 Darwin/* )
1790 # intentionally do nothing here
1791 :
1792 ;;
1793 IRIX*/6.* )
1794 file=/etc/passwd
1795 entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
1796 if [ -f /etc/shadow ]
1797 then update="(PATH=\$PATH:/sbin; pwconv)"
1798 else update=":"
1799 fi
1800 ;;
1801 esac
1802 case "$plid" in
1803 Darwin/* )
1804 niutil -create . "/users/${usr}"
1805 niutil -createprop . "/users/${usr}" passwd "*"
1806 niutil -createprop . "/users/${usr}" uid "${uid}"
1807 niutil -createprop . "/users/${usr}" gid "${gid}"
1808 niutil -createprop . "/users/${usr}" realname "${realname}"
1809 niutil -createprop . "/users/${usr}" home "${prefix}"
1810 niutil -createprop . "/users/${usr}" shell "${shell}"
1811 ;;
1812 AIX/* )
1813 mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
1814 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
1815 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
1816 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
1817 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
1818 # defer both the setting of the primary group and the shell,
1819 # as they do not exist at this stage of processing.
1820 echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
1821 echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
1822 ;;
1823 * )
1824 cp $file $file.bak && \
1825 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
1826 rm -f $file.bak >/dev/null 2>&1
1827 eval $update
1828 [ $? -ne 0 ] && exit $?
1829 ;;
1830 esac
1831 fi
1832 fi
1834 # check whether group already exists
1835 exists=`(getent group "$grp"; \
1836 grep "^$grp:" /etc/group; \
1837 ypmatch "$grp" group; \
1838 nismatch "$grp" group; \
1839 nidump group . | grep "^$grp:") 2>/dev/null | \
1840 sed -e 'q'`
1841 if [ ".$exists" = . ]; then
1842 if [ ".$cusr" != ".root" ]; then
1843 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
1844 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1845 else
1846 case "$plid" in
1847 Darwin/* )
1848 niutil -create . "/groups/${grp}"
1849 niutil -createprop . "/groups/${grp}" gid "${gid}"
1850 niutil -createprop . "/groups/${grp}" users "${usr}"
1851 ;;
1852 AIX/* )
1853 mkgroup id="${gid}" users="${usr}" "${grp}"
1854 ;;
1855 * )
1856 # add entry to group database
1857 file=/etc/group
1858 entry="${grp}:*:${gid}:${usr}"
1859 cp $file $file.bak && \
1860 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
1861 rm -f $file.bak >/dev/null 2>&1
1862 ;;
1863 esac
1864 fi
1865 fi
1866 done
1868 # optional group processing (deferred adjustment of primary group)
1869 if [ -f %{l_prefix}.pre-group-process.sh ]; then
1870 sh %{l_prefix}.pre-group-process.sh
1871 rm -f %{l_prefix}.pre-group-process.sh
1872 fi
1874 # invalidate passwd and group tables from Name Service Cache Daemon to
1875 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
1876 if [ -x /usr/sbin/nscd ]; then
1877 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
1878 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
1879 fi
1881 # create the startup/shutdown transfer script
1882 name=`echo "$prefix" | sed -e 's;/;;g'`
1883 if [ ".$cusr" != ".root" ]; then
1884 echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
1885 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
1886 else
1887 case "$plid" in
1888 FreeBSD/* )
1889 if [ ! -f /etc/rc.d/openpkg-${name} ]; then
1890 # install transfer script
1891 rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
1892 ( echo "#!/bin/sh"
1893 echo "##"
1894 echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
1895 echo "##"
1896 echo ""
1897 echo "# PROVIDE: openpkg-${name}"
1898 echo "# REQUIRE: LOGIN"
1899 echo "# KEYWORD: shutdown"
1900 echo ""
1901 echo ". /etc/rc.subr"
1902 echo ""
1903 echo "name=\"openpkg_${name}\""
1904 echo "start_cmd=\"openpkg_rc_all start\""
1905 echo "stop_cmd=\"openpkg_rc_all stop\""
1906 echo "restart_cmd=\"openpkg_rc_all stop start\""
1907 echo ""
1908 echo "openpkg_rc_all () {"
1909 echo " if [ -f ${prefix}/etc/rc ]; then"
1910 echo " ${prefix}/etc/rc all \"\$@\""
1911 echo " fi"
1912 echo "}"
1913 echo ""
1914 echo "load_rc_config \$name"
1915 echo "run_rc_command \"\$1\""
1916 echo ""
1917 ) >/etc/rc.d/openpkg-${name}
1918 chmod 755 /etc/rc.d/openpkg-${name}
1919 fi
1920 ;;
1921 NetBSD/* )
1922 if [ ! -f /etc/rc.d/${name} ]; then
1923 ( echo "#!/bin/sh"
1924 echo "##"
1925 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
1926 echo "##"
1927 echo "## PROVIDE: ${name}"
1928 echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS"
1929 echo "##"
1930 echo ""
1931 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
1932 echo "case \$1 in"
1933 echo " start ) exec ${prefix}/etc/rc all start ;;"
1934 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
1935 echo " restart ) exec ${prefix}/etc/rc all stop start ;;"
1936 echo " status ) ;;"
1937 echo "esac"
1938 ) >/etc/rc.d/${name}
1939 chmod 755 /etc/rc.d/${name}
1940 fi
1941 ;;
1942 Linux/* )
1943 if [ -f /etc/gentoo-release ]; then
1944 if [ ! -f /etc/init.d/openpkg-${name} ]; then
1945 # install transfer script
1946 ( echo "#!/sbin/runscript"
1947 echo "##"
1948 echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
1949 echo "##"
1950 echo ""
1951 echo "depend() {"
1952 echo " after *"
1953 echo "}"
1954 echo ""
1955 echo "checkconfig() {"
1956 echo " [ -f ${prefix}/etc/rc ] || return 1"
1957 echo " case $1 in"
1958 echo " start ) exec ${prefix}/etc/rc all start ;;"
1959 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
1960 echo " esac"
1961 echo "}"
1962 echo ""
1963 echo "start() {"
1964 echo " checkconfig || return 1"
1965 echo " ebegin "Starting OpenPKG ${prefix} hierarchy""
1966 echo " exec ${prefix}/etc/rc all start"
1967 echo " eend 0"
1968 echo "}"
1969 echo ""
1970 echo "stop() {"
1971 echo " checkconfig || return 1"
1972 echo " ebegin "Stopping OpenPKG ${prefix} hierarchy""
1973 echo " exec ${prefix}/etc/rc all stop"
1974 echo " eend 0"
1975 echo "}"
1976 ) >/etc/init.d/openpkg-${name}
1977 chmod 755 /etc/init.d/openpkg-${name}
1978 /sbin/rc-update add openpkg-${name} default
1979 fi
1980 else
1981 # sroot: script root directory
1982 # lroot: link root directory
1983 if [ -f /etc/debian_version ]; then
1984 sroot=/etc/init.d
1985 lroot=/etc/rc%d.d
1986 elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
1987 sroot=/etc/rc.d/init.d
1988 lroot=/etc/rc.d/rc%d.d
1989 elif [ -f /etc/SuSE-release ]; then
1990 sroot=/etc/init.d
1991 lroot=/etc/init.d/rc%d.d
1992 elif [ -f /etc/slackware-version ]; then
1993 sroot=/etc/rc.d
1994 lroot=/etc/rc.d/rc%d.d
1995 name="rc.${name}"
1996 for i in 0 1 2 3 4 5 6; do
1997 l=`echo $lroot | sed -e "s;%d;$i;"`
1998 if [ ! -d $l ]; then
1999 mkdir $l 2>&1 || true
2000 fi
2001 done
2002 else
2003 echo "WARNING: you are not running one of the supported standard" 1>&2
2004 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
2005 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
2006 sroot=""
2007 lroot=""
2008 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
2009 if [ -d $sr ]; then
2010 sroot="$sr"
2011 break
2012 fi
2013 done
2014 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
2015 if [ -d $lr ]; then
2016 lroot="`echo $lr | sed -e 's;2;%d;'`"
2017 break
2018 fi
2019 done
2020 if [ ".$sroot" = . -o ".$lroot" = . ]; then
2021 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
2022 exit 1
2023 fi
2024 fi
2025 if [ ! -f $sroot/${name} ]; then
2026 # install transfer script
2027 ( echo "#!/bin/sh"
2028 echo "##"
2029 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2030 echo "##"
2031 echo ""
2032 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2033 echo "case \$1 in"
2034 echo " start ) exec ${prefix}/etc/rc all start ;;"
2035 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2036 echo "esac"
2037 ) >$sroot/${name}
2038 chmod 755 $sroot/${name}
2039 # create corresponding symbolic links
2040 for i in 2 3 4 5; do
2041 ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
2042 done
2043 for i in 0 1 6; do
2044 ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
2045 done
2046 fi
2047 fi
2048 ;;
2049 SunOS/5.* )
2050 if [ ! -f /etc/init.d/${name} ]; then
2051 # install transfer script
2052 ( echo "#!/bin/sh"
2053 echo "##"
2054 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2055 echo "##"
2056 echo ""
2057 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2058 echo "case \$1 in"
2059 echo " start ) exec ${prefix}/etc/rc all start ;;"
2060 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2061 echo "esac"
2062 ) >/etc/init.d/${name}
2063 chmod 755 /etc/init.d/${name}
2064 # create corresponding symbolic links
2065 ( cd /etc
2066 ln init.d/${name} rc3.d/S99${name}
2067 ln init.d/${name} rc0.d/K00${name}
2068 ln init.d/${name} rc1.d/K00${name}
2069 ) || exit $?
2070 fi
2071 ;;
2072 UnixWare/* )
2073 if [ ! -f /etc/init.d/${name} ]; then
2074 # install transfer script
2075 ( echo "#!/bin/sh"
2076 echo "##"
2077 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2078 echo "##"
2079 echo ""
2080 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2081 echo "case \$1 in"
2082 echo " start ) exec ${prefix}/etc/rc all start ;;"
2083 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2084 echo "esac"
2085 ) >/etc/init.d/${name}
2086 chmod 755 /etc/init.d/${name}
2087 # create corresponding symbolic links
2088 ( cd /etc
2089 ln init.d/${name} rc2.d/S99${name}
2090 ln init.d/${name} rc0.d/K00${name}
2091 ln init.d/${name} rc1.d/K00${name}
2092 ) || exit $?
2093 fi
2094 ;;
2095 AIX/* )
2096 if [ ! -f /etc/rc.d/init.d/${name} ]; then
2097 # install transfer script
2098 ( echo "#!/bin/sh"
2099 echo "##"
2100 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2101 echo "##"
2102 echo ""
2103 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2104 echo "case \$1 in"
2105 echo " start ) exec ${prefix}/etc/rc all start ;;"
2106 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2107 echo "esac"
2108 ) >/etc/rc.d/init.d/${name}
2109 chmod 755 /etc/rc.d/init.d/${name}
2110 # create corresponding symbolic links
2111 ( cd /etc/rc.d
2112 ln -s ../init.d/${name} rc2.d/S99${name}
2113 ) || exit $?
2114 fi
2115 ;;
2116 OSF1/V5.* )
2117 if [ ! -f /sbin/init.d/${name} ]; then
2118 # install transfer script
2119 ( echo "#!/bin/sh"
2120 echo "##"
2121 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2122 echo "##"
2123 echo ""
2124 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2125 echo "case \$1 in"
2126 echo " start ) exec ${prefix}/etc/rc all start ;;"
2127 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2128 echo "esac"
2129 ) >/sbin/init.d/${name}
2130 chmod 755 /sbin/init.d/${name}
2131 # create corresponding symbolic links
2132 ( cd /sbin
2133 ln -s ../init.d/${name} rc3.d/S99${name}
2134 ln -s ../init.d/${name} rc0.d/K00${name}
2135 ) || exit $?
2136 fi
2137 ;;
2138 HP-UX/* )
2139 if [ ! -f /sbin/init.d/${name} ]; then
2140 # install transfer script
2141 ( echo "#!/bin/sh"
2142 echo "##"
2143 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2144 echo "##"
2145 echo ""
2146 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2147 echo "case \$1 in"
2148 echo " start ) exec ${prefix}/etc/rc all start ;;"
2149 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2150 echo "esac"
2151 ) >/sbin/init.d/${name}
2152 chmod 755 /sbin/init.d/${name}
2153 # create corresponding symbolic links
2154 ( cd /sbin
2155 ln -s ../init.d/${name} rc2.d/S900${name}
2156 ln -s ../init.d/${name} rc1.d/K100${name}
2157 ) || exit $?
2158 fi
2159 ;;
2160 Darwin/* )
2161 darwin_rc_dir="/System/Library/StartupItems/${name}"
2162 if [ ! -d ${darwin_rc_dir} ]; then
2163 mkdir ${darwin_rc_dir}
2164 fi
2166 # make sure hierarchy is activated in /etc/hostconfig
2167 # FIXME: cs: simple and bad code here without any detection of existing entries
2168 echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
2170 # install transfer script
2171 if [ ! -f ${darwin_rc_dir}/${name} ]; then
2172 rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
2173 ( echo "#!/bin/sh"
2174 echo "##"
2175 echo "## ${darwin_rc_dir}/${name}"
2176 echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy"
2177 echo "##"
2178 echo ""
2179 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2180 echo ""
2181 echo ". /etc/rc.common"
2182 echo ""
2183 echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
2184 echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
2185 echo " ${prefix}/etc/rc all start"
2186 echo "fi"
2187 ) >${darwin_rc_dir}/${name}
2188 chmod 755 ${darwin_rc_dir}/${name}
2189 fi
2190 # install startup parameter list
2191 if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
2192 rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
2193 ( echo "{"
2194 echo " Description = \"OpenPKG ${prefix} hierarchy\";"
2195 echo " Provides = (\"OpenPKG ${prefix}\");"
2196 echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
2197 echo " Uses = (\"Cron\");"
2198 echo " OrderPreference = \"Last\";"
2199 echo " Messages ="
2200 echo " {"
2201 echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
2202 echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
2203 echo " };"
2204 echo "}"
2205 ) >${darwin_rc_dir}/StartupParameters.plist
2206 chmod 644 ${darwin_rc_dir}/StartupParameters.plist
2207 fi
2208 ;;
2209 IRIX*/6.* )
2210 if [ ! -f /etc/init.d/${name} ]; then
2211 # install transfer script
2212 ( echo "#!/bin/sh"
2213 echo "##"
2214 echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
2215 echo "##"
2216 echo ""
2217 echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
2218 echo "case \$1 in"
2219 echo " start ) exec ${prefix}/etc/rc all start ;;"
2220 echo " stop ) exec ${prefix}/etc/rc all stop ;;"
2221 echo "esac"
2222 ) >/etc/init.d/${name}
2223 chmod 755 /etc/init.d/${name}
2224 # create corresponding links
2225 ( cd /etc
2226 ln -f init.d/${name} rc2.d/S99${name}
2227 ln -f init.d/${name} rc0.d/K00${name}
2228 ) || exit $?
2229 fi
2230 ;;
2231 esac
2232 fi
2234 # create the cron transfer entries
2235 if [ ".$cusr" != ".root" ]; then
2236 echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
2237 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2238 else
2239 case "$plid" in
2240 FreeBSD/* | Linux/* | Darwin/* )
2241 if [ -f /etc/slackware-version ]; then
2242 exists=`crontab -l | grep "$prefix/etc/rc"`
2243 if [ ".$exists" = . ]; then
2244 EDITOR=/tmp/vipw.$$
2245 VISUAL="$EDITOR"
2246 export EDITOR
2247 export VISUAL
2248 ( echo "#!/bin/sh"
2249 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
2250 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
2251 echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
2252 echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
2253 echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
2254 echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
2255 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
2256 echo " echo \"# </OpenPKG>\""
2257 echo ") >>\$1"
2258 ) >$EDITOR
2259 chmod a+x $EDITOR
2260 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2261 rm -f $EDITOR
2262 fi
2263 else
2264 exists=`grep "$prefix/etc/rc" /etc/crontab`
2265 if [ ".$exists" = . ]; then
2266 ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
2267 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
2268 echo "0 0 1 * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
2269 echo "0 0 * * 0 root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
2270 echo "0 0 * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
2271 echo "0 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
2272 echo "*/15 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
2273 echo "# </OpenPKG>"
2274 ) >>/etc/crontab
2275 fi
2276 fi
2277 ;;
2278 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
2279 exists=`crontab -l | grep "$prefix/etc/rc"`
2280 if [ ".$exists" = . ]; then
2281 EDITOR=/tmp/vipw.$$
2282 VISUAL="$EDITOR"
2283 export EDITOR
2284 export VISUAL
2285 ( echo "#!/bin/sh"
2286 echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
2287 echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
2288 echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
2289 echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
2290 echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
2291 echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
2292 echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
2293 echo " echo \"# </OpenPKG>\""
2294 echo ") >>\$1"
2295 ) >$EDITOR
2296 chmod a+x $EDITOR
2297 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2298 rm -f $EDITOR
2299 fi
2300 ;;
2301 IRIX*/6.* )
2302 exists=`crontab -l | grep "$prefix/etc/rc"`
2303 if [ ".$exists" = . ]; then
2304 ( crontab -l
2305 echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
2306 echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
2307 echo "0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
2308 echo "0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
2309 echo "0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
2310 echo "0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
2311 echo "0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
2312 echo "# </OpenPKG>"
2313 ) | /usr/bin/crontab || exit $?
2314 fi
2315 ;;
2316 esac
2317 fi
2319 # remember what OpenPKG RPM version was installed, so we can
2320 # correctly upgrade the RPM database in the %post section (see below).
2321 if [ -d ${prefix}/RPM/DB ]; then
2322 if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
2323 # OpenPKG 2.0
2324 rpm="${prefix}/bin/openpkg rpm"
2325 else
2326 # OpenPKG 1.x
2327 rpm="${prefix}/bin/rpm"
2328 fi
2329 rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
2330 $rpm --version |\
2331 sed -e 's;^;X;' \
2332 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
2333 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
2334 -e 's;^X.*$;4.0;' \
2335 >${prefix}/RPM/DB/.version
2336 fi
2338 %post
2339 # optional post-processing from "pre" section
2340 if [ -f %{l_prefix}.pre-post-process.sh ]; then
2341 sh %{l_prefix}.pre-post-process.sh
2342 rm -f %{l_prefix}.pre-post-process.sh
2343 fi
2345 # update or initially create OpenPKG UUID configuration
2346 %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
2348 # determine new and old OpenPKG RPM version
2349 V_rpm_new="%{V_rpm}"
2350 if [ -f %{l_prefix}/RPM/DB/.version ]; then
2351 V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
2352 rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
2353 else
2354 V_rpm_old="4.0"
2355 fi
2357 # make sure all RPM database files are present and that their
2358 # attributes are correct, etc. This is not a database rebuild
2359 # operation, so this is fully harmless and can be done always.
2360 %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
2362 # check RPM database for upgrade requirements
2363 if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
2364 # RPM 4.0/4.1 does not allow concurrent database access, so we
2365 # cannot upgrade the database immediately from here (because
2366 # we are still running within the execution context of the
2367 # old RPM which in turn has the database locked) and instead
2368 # have to just drop a note to the administrator about database
2369 # upgrading. RPM 4.2 in general allows concurrent database
2370 # access, but the whole stuff is too risky here, too.
2371 ( echo "You are upgrading the OpenPKG bootstrap from a previous"
2372 echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
2373 echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
2374 echo "be used, but it is strongly recommended to upgrade it as"
2375 echo "soon as possible to the latest Berkeley-DB format files by"
2376 echo "executing the command:"
2377 echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
2378 echo "In case of problems with the RPM database you can always"
2379 echo "execute the command:"
2380 echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
2381 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
2382 fi
2384 # system command overriding support
2385 # ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
2386 # BUILD COMMAND OVERRIDE SOLUTION!
2387 if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
2388 mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
2389 fi
2390 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
2391 case "`cat %{l_prefix}/etc/openpkg/platform`" in
2392 *-*-debian* | *-*-ubuntu* )
2393 # FIXME: Evil hack to workaround build problems under Debian
2394 # (at least 3.1) (and similar platforms) where a Debian
2395 # install-info(8) exists which is both API and functionally
2396 # incompatible to the de-facto standardized install-info(8)
2397 # command from GNU Texinfo.
2398 if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
2399 ( echo "#!/bin/sh"
2400 echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
2401 echo "exit 0"
2402 ) >%{l_prefix}/lib/openpkg/override/install-info
2403 chmod 775 %{l_prefix}/lib/openpkg/override/install-info
2404 fi
2405 ;;
2406 *-*-macosx* | *-*-darwin* )
2407 # FIXME: Evil hack to workaround the fact that Mac OS X'
2408 # linker by default prefers the /usr/lib libraries and does
2409 # not honor the -L options the way one would expect it.
2410 gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
2411 cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
2412 ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
2413 if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
2414 ( echo "#!/bin/sh"
2415 echo "case \" \$* \" in"
2416 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
2417 echo " * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
2418 echo "esac"
2419 ) >%{l_prefix}/lib/openpkg/override/gcc
2420 chmod 775 %{l_prefix}/lib/openpkg/override/gcc
2421 fi
2422 if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
2423 ( echo "#!/bin/sh"
2424 echo "case \" \$* \" in"
2425 echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
2426 echo " * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
2427 echo "esac"
2428 ) >%{l_prefix}/lib/openpkg/override/cc
2429 chmod 775 %{l_prefix}/lib/openpkg/override/cc
2430 fi
2431 if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
2432 ( echo "#!/bin/sh"
2433 echo "exec $ld -search_paths_first \"\$@\""
2434 ) >%{l_prefix}/lib/openpkg/override/ld
2435 chmod 775 %{l_prefix}/lib/openpkg/override/ld
2436 fi
2437 ;;
2438 esac
2440 # FIXME: hack to workaround problems in environments with too few
2441 # development tools. ATTENTION: see one paragraph above.
2442 if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
2443 mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
2444 fi
2445 chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
2447 # check for "openpkg" executable from the OpenPKG Community series
2448 # print license if not OSS, otherwise register with openpkg.org
2449 community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \
2450 sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'`
2451 if [ ".$community_version" = . ]; then
2452 ( echo ""
2453 echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\""
2454 echo "executable which is covered by the following terms of use:"
2455 echo "______________________________________________________________________________"
2456 echo ""
2457 %{l_prefix}/bin/openpkg --license | sed -e '1d'
2458 ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
2459 else
2460 %{l_prefix}/bin/openpkg register </dev/null >/dev/null 2>&1 || true
2461 fi
2463 %preun
2464 [ ".$1" != .0 ] && exit 0
2466 # remove override files
2467 if [ -d %{l_prefix}/lib/openpkg/override ]; then
2468 rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
2469 fi
2471 # remove fallback files
2472 if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
2473 rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
2474 fi
2476 # remove files which are not RPM controlled
2477 rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
2478 rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
2479 rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
2480 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
2482 # The following code usually would be done in a %postun section.
2483 # But because we already had to remove the database in this %preun
2484 # section (see the 'rm' commands above) in order to make RPM happy
2485 # inside its own removal procedure, RPM would no longer find the
2486 # %postun script (because it's recorded in the database files). So
2487 # we have to perform the procedure already in this %preun script.
2488 # except for the removal of the top-level directory it does not
2489 # matter. But the top-level directory can only be removed after
2490 # the RPM removal procedure took place, so we play a little delay
2491 # trick below.
2493 # determine current user
2494 cusr=`(id -un) 2>/dev/null ||\
2495 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
2496 (whoami) 2>/dev/null ||\
2497 (who am i | cut "-d " -f1) 2>/dev/null ||\
2498 echo $LOGNAME`
2500 # determine runtime details (for both inside and outside RPM!!)
2501 user="%{l_musr}"
2502 group="%{l_mgrp}"
2503 prefix="%{l_prefix}"
2504 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
2506 # determine platform id
2507 s=`(uname -s) 2>/dev/null` || s='Unknown'
2508 r=`(uname -r) 2>/dev/null` || r='0.0'
2509 plid="${s}/${r}"
2511 # unregister instance in presence file
2512 presence="/etc/openpkg"
2513 exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
2514 if [ ".$exists" != . ]; then
2515 if [ ".$cusr" != ".root" ]; then
2516 echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
2517 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2518 else
2519 cp $presence $presence.bak && \
2520 egrep -v "^ *${prefix} *\$" $presence.bak >$presence
2521 rm -f $presence.bak >/dev/null 2>&1
2522 if [ ".`cat $presence`" = . ]; then
2523 rm -f $presence >/dev/null 2>&1
2524 fi
2525 fi
2526 fi
2528 # remove entry in /etc/shells
2529 shell="${prefix}/lib/openpkg/bash"
2530 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
2531 if [ ".$exists" != . ]; then
2532 if [ ".$cusr" != ".root" ]; then
2533 echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
2534 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2535 else
2536 cp /etc/shells /etc/shells.bak && \
2537 grep -v "^${shell}" /etc/shells.bak >/etc/shells
2538 rm -f /etc/shells.bak >/dev/null 2>&1
2539 fi
2540 fi
2542 # remove the hierarchy user/group
2543 for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
2544 "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
2545 "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
2546 "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
2547 # split request into class/usr/uid/grp/gid
2548 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
2549 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
2551 # check whether user already exists
2552 exists=`(getent passwd "$usr"; \
2553 grep "^$usr:" /etc/passwd; \
2554 ypmatch "$usr" passwd; \
2555 nismatch "$usr" passwd; \
2556 nidump passwd . | grep "^$usr:") 2>/dev/null | \
2557 sed -e 'q'`
2558 if [ ".$exists" != . ]; then
2559 if [ ".$cusr" != ".root" ]; then
2560 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
2561 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2562 elif [ ".$usr" = ".root" ]; then
2563 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
2564 echo "openpkg:WARNING: (would remove system standard user)" 1>&2
2565 else
2566 case "$plid" in
2567 FreeBSD/* | NetBSD/* )
2568 cp /etc/master.passwd /etc/master.passwd.bak && \
2569 grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
2570 ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
2571 rm -f /etc/master.passwd.bak >/dev/null 2>&1
2572 ;;
2573 Linux/* | SunOS/5.* | UnixWare/* )
2574 cp /etc/passwd /etc/passwd.bak && \
2575 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2576 ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
2577 rm -f /etc/passwd.bak >/dev/null 2>&1
2578 ;;
2579 AIX/* )
2580 rmuser -p "${usr}"
2581 cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
2582 sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
2583 </etc/security/login.cfg.bak >/etc/security/login.cfg && \
2584 rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
2585 ;;
2586 OSF1/V5.* )
2587 cp /etc/passwd /etc/passwd.bak && \
2588 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2589 ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
2590 rm -f /etc/passwd.bak >/dev/null 2>&1
2591 ;;
2592 HP-UX/* )
2593 cp /etc/passwd /etc/passwd.bak && \
2594 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2595 rm -f /etc/passwd.bak >/dev/null 2>&1
2596 ;;
2597 Darwin/* )
2598 niutil -destroy . "/users/${usr}"
2599 ;;
2600 IRIX*/6.* )
2601 cp /etc/passwd /etc/passwd.bak && \
2602 grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
2603 if [ -f /etc/shadow ]
2604 then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
2605 fi
2606 rm -f /etc/passwd.bak >/dev/null 2>&1
2607 ;;
2608 esac
2609 fi
2610 fi
2612 # check whether group already exists
2613 exists=`(getent group "$grp"; \
2614 grep "^$grp:" /etc/group; \
2615 ypmatch "$grp" group; \
2616 nismatch "$grp" group; \
2617 nidump group . | grep "^$grp:") 2>/dev/null | \
2618 sed -e 'q'`
2619 if [ ".$exists" != . ]; then
2620 if [ ".$cusr" != ".root" ]; then
2621 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
2622 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2623 elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
2624 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
2625 echo "openpkg:WARNING: (would remove system standard group)" 1>&2
2626 else
2627 case "$plid" in
2628 Darwin/* )
2629 niutil -destroy . "/groups/${grp}"
2630 ;;
2631 AIX/* )
2632 rmgroup "${grp}"
2633 ;;
2634 * )
2635 cp /etc/group /etc/group.bak && \
2636 grep -v "^${grp}:" /etc/group.bak >/etc/group
2637 rm -f /etc/group.bak >/dev/null 2>&1
2638 ;;
2639 esac
2640 fi
2641 fi
2642 done
2644 # invalidate passwd and group tables from Name Service Cache Daemon to
2645 # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
2646 if [ -x /usr/sbin/nscd ]; then
2647 /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
2648 /usr/sbin/nscd -i group >/dev/null 2>&1 || true
2649 fi
2651 # remove the startup/shutdown transfer scripts
2652 name=`echo "$prefix" | sed -e 's;/;;g'`
2653 if [ ".$cusr" != ".root" ]; then
2654 echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
2655 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2656 else
2657 case "$plid" in
2658 FreeBSD/* )
2659 rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
2660 ;;
2661 NetBSD/* )
2662 rm -f /etc/rc.d/${name} >/dev/null 2>&1
2663 ;;
2664 Linux/* )
2665 if [ -f /etc/gentoo-release ]; then
2666 /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
2667 rm -f /etc/init.d/openpkg-${name} >/dev/null 2>&1
2668 else
2669 # sroot: script root directory
2670 # lroot: link root directory
2671 if [ -f /etc/debian_version ]; then
2672 sroot=/etc/init.d
2673 lroot=/etc/rc%d.d
2674 elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
2675 sroot=/etc/rc.d/init.d
2676 lroot=/etc/rc.d/rc%d.d
2677 elif [ -f /etc/SuSE-release ]; then
2678 sroot=/etc/init.d
2679 lroot=/etc/init.d/rc%d.d
2680 elif [ -f /etc/slackware-version ]; then
2681 sroot=/etc/rc.d
2682 lroot=/etc/rc.d/rc%d.d
2683 name="rc.${name}"
2684 else
2685 echo "WARNING: you are not running one of the supported standard" 1>&2
2686 echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
2687 echo "WARNING: Guessing the location of the system init scripts!" 1>&2
2688 sroot=""
2689 lroot=""
2690 for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
2691 if [ -d $sr ]; then
2692 sroot="$sr"
2693 break
2694 fi
2695 done
2696 for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
2697 if [ -d $lr ]; then
2698 lroot="`echo $lr | sed -e 's;2;%d;'`"
2699 break
2700 fi
2701 done
2702 if [ ".$sroot" = . -o ".$lroot" = . ]; then
2703 echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
2704 exit 1
2705 fi
2706 fi
2707 rm -f ${sroot}/${name} >/dev/null 2>&1
2708 for i in 2 3 4 5; do
2709 rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
2710 done
2711 for i in 0 1 6; do
2712 rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
2713 done
2714 if [ -f /etc/slackware-version ]; then
2715 for i in 0 1 2 3 4 5 6; do
2716 l=`echo $lroot | sed -e "s;%d;$i;"`
2717 if [ -d $l ]; then
2718 rmdir $l >/dev/null 2>&1 || true
2719 fi
2720 done
2721 fi
2722 fi
2723 ;;
2724 SunOS/5.* )
2725 rm -f /etc/init.d/${name} >/dev/null 2>&1
2726 rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
2727 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
2728 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
2729 ;;
2730 UnixWare/* )
2731 rm -f /etc/init.d/${name} >/dev/null 2>&1
2732 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
2733 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
2734 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
2735 ;;
2736 AIX/* )
2737 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
2738 rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
2739 ;;
2740 OSF1/V5.* )
2741 rm -f /sbin/init.d/${name} >/dev/null 2>&1
2742 rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
2743 rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
2744 ;;
2745 HP-UX/* )
2746 rm -f /sbin/init.d/${name} >/dev/null 2>&1
2747 rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
2748 rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
2749 ;;
2750 Darwin/* )
2751 cp /etc/hostconfig /etc/hostconfig.bak && \
2752 grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
2753 rm -f /etc/hostconfig.bak >/dev/null 2>&1
2754 rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
2755 ;;
2756 IRIX*/6.* )
2757 rm -f /etc/init.d/${name} >/dev/null 2>&1
2758 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
2759 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
2760 ;;
2761 esac
2762 fi
2764 # remove the cron transfer entries
2765 if [ ".$cusr" != ".root" ]; then
2766 echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
2767 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
2768 else
2769 case "$plid" in
2770 FreeBSD/* | Linux/* | Darwin/* )
2771 if [ -f /etc/slackware-version ]; then
2772 EDITOR=/tmp/vipw.$$
2773 VISUAL="$EDITOR"
2774 export EDITOR
2775 export VISUAL
2776 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
2777 ( echo "cp \$1 \$1.bak"
2778 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
2779 echo "rm -f \$1.bak"
2780 ) >$EDITOR
2781 chmod a+x $EDITOR
2782 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2783 rm -f $EDITOR
2784 else
2785 exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
2786 if [ ".$exists" != . ]; then
2787 p=`echo $prefix | sed -e 's;/;\\\\/;g'`
2788 cp /etc/crontab /etc/crontab.bak
2789 cat /etc/crontab.bak |\
2790 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
2791 >/etc/crontab
2792 rm -f /etc/crontab.bak >/dev/null 2>&1
2793 fi
2794 fi
2795 ;;
2796 SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
2797 EDITOR=/tmp/vipw.$$
2798 VISUAL="$EDITOR"
2799 export EDITOR
2800 export VISUAL
2801 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
2802 ( echo "cp \$1 \$1.bak"
2803 echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
2804 echo "rm -f \$1.bak"
2805 ) >$EDITOR
2806 chmod a+x $EDITOR
2807 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
2808 rm -f $EDITOR
2809 ;;
2810 IRIX*/6.* )
2811 p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
2812 ( crontab -l |
2813 sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
2814 ) | /usr/bin/crontab || exit $?
2815 ;;
2816 esac
2817 fi
2819 # delayed removal of top-level directory.
2820 ( sleep 2
2821 rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
2822 rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
2823 rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
2824 rmdir %{l_prefix} >/dev/null 2>&1 || true
2825 ) </dev/null >/dev/null 2>/dev/null &