openpkg/openpkg.spec

Wed, 01 Aug 2012 23:49:03 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 01 Aug 2012 23:49:03 +0200
changeset 436
f26e9329b115
parent 435
24700f8ed057
child 437
b9d4495f105f
permissions
-rw-r--r--

Hack rpmconstant header file to allow targets to build, because...
Solaris studio cc(1) fails to build targets in rpmconstant with errors:
'undefined symbol first referenced in file constant.o' regarding symbols:
rpmdsInit, rpmdsNext, rpmdsTagN, rpmHeaderFormats, hdrVec, rpmTagTable,
rpmdsSearch, rpmdsResult, rpmTags, rpmdsIx, rpmdsDNEVR, rpmdsSetResult.
It seems that these symbols are not used by RPM in any way, and thus
the build configuration can succeed without including the nasty headers.

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

mercurial