openpkg/openpkg.spec

Fri, 03 Aug 2012 20:11:53 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 03 Aug 2012 20:11:53 +0200
changeset 470
f8813e60f168
parent 461
09d8a3107646
child 472
0746a003fc03
permissions
-rw-r--r--

Neutralize buggy code causing OpenPKG to have 'fatal problems' in
spite of correct installation, configuration, and operation. An
administrator suffering from this failure is even unable to
uninstall the flawed software.

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

mercurial