openpkg/openpkg.spec

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

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

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

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

mercurial