openpkg/openpkg.spec

Wed, 01 Aug 2012 23:37:13 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 01 Aug 2012 23:37:13 +0200
changeset 434
66c3db5d26f6
parent 429
b363f8ef6dcb
child 435
24700f8ed057
permissions
-rw-r--r--

Hack up to build 64 bit bins and libs on 64 bit platforms, why not?
...I just hope this is a portable way to do it, using the '-m64' switch.

     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       #   cheat GNU Autoconf
  1197       ( echo 'ac_cv_path_MSGFMT=:'
  1198         echo 'ac_cv_path_GMSGFMT=:'
  1199         echo 'ac_cv_path_XGETTEXT=:'
  1200         echo 'ac_cv_path_MSGMERGE=:'
  1201         echo "ac_cv_header_getopt_h=no"
  1202         echo "ac_cv_lib_gz_gzread=no"
  1203       ) >config.cache
  1205       #   use miniperl
  1206       PERL="${l_perl}"
  1207       export PERL
  1209       #   set build tool flags
  1210       CC="${l_cc}"
  1211       CFLAGS="$bitopt"
  1212       CPPFLAGS="-DRPM_VENDOR_OPENPKG"
  1213       LDFLAGS="$bitopt"
  1214       LIBS=""
  1215       LIBS="$LIBS -lm"
  1216       export CC
  1217       export CFLAGS
  1218       export CPPFLAGS
  1219       export LDFLAGS
  1220       export LIBS
  1222       #   special platform workarounds
  1223       GREP="grep"
  1224       export GREP
  1226       #   determine POPT option, RPM macros and Lua script file paths
  1227       RPMPOPT="%{l_prefix}/lib/openpkg/rpmpopt"
  1228       RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt"
  1229       RPMPOPT="$RPMPOPT:%{l_prefix}/etc/openpkg/rpmpopt.d/*"
  1230       RPMPOPT="$RPMPOPT:~/.openpkg/rpmpopt"
  1231       RPMPOPT="$RPMPOPT:@../../.openpkg/rpmpopt"
  1232       RPMPOPT="$RPMPOPT:@../.openpkg/rpmpopt"
  1233       RPMPOPT="$RPMPOPT:@./.openpkg/rpmpopt"
  1234       RPMMACROS="%{l_prefix}/lib/openpkg/rpmmacros"
  1235       RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros"
  1236       RPMMACROS="$RPMMACROS:%{l_prefix}/etc/openpkg/rpmmacros.d/*"
  1237       RPMMACROS="$RPMMACROS:~/.openpkg/rpmmacros"
  1238       RPMMACROS="$RPMMACROS:@../../.openpkg/rpmmacros"
  1239       RPMMACROS="$RPMMACROS:@../.openpkg/rpmmacros"
  1240       RPMMACROS="$RPMMACROS:@./.openpkg/rpmmacros"
  1241       RPMLUA="%{l_prefix}/lib/openpkg/rpmlua"
  1242       RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua"
  1243       RPMLUA="$RPMLUA:%{l_prefix}/etc/openpkg/rpmlua.d/*"
  1244       RPMLUA="$RPMLUA:~/.openpkg/rpmlua"
  1245       RPMLUA="$RPMLUA:@../../.openpkg/rpmlua"
  1246       RPMLUA="$RPMLUA:@../.openpkg/rpmlua"
  1247       RPMLUA="$RPMLUA:@./.openpkg/rpmlua"
  1249       #   parametrize integrity checking framework
  1250       sh $shtool subst \
  1251           -e "s;0000000000000000000000000000000000000000;7D121A8FC05DC18A4329E9EF67042EC961B7AE34;" \
  1252           -e "s;0\\.0\\.0;0.9.0;" \
  1253           rpmqv.c
  1255       #   disable building of any tests
  1256       #   (mainly because those would fail because of integrity checking anyway)
  1257       sh $shtool subst \
  1258           -e 's;tools scripts tests doc;tools scripts doc;' \
  1259           Makefile.in
  1261       #   configure program
  1262       ./configure \
  1263           --cache-file=./config.cache \
  1264           --prefix=%{l_prefix} \
  1265           --libdir="%{l_prefix}/lib" \
  1266           --mandir="%{l_prefix}/man" \
  1267           --includedir="%{l_prefix}/include/openpkg" \
  1268           --with-name="OpenPKG RPM" \
  1269           --with-path-cfg="%{l_prefix}/etc/openpkg" \
  1270           --with-path-rpmpopt="$RPMPOPT" \
  1271           --with-path-macros="$RPMMACROS" \
  1272           --with-path-rpmlua="$RPMLUA" \
  1273           --with-path-lib="%{l_prefix}/lib/openpkg" \
  1274           --with-path-locale="%{l_prefix}/share/openpkg/locale" \
  1275           --with-path-database="%{l_prefix}/RPM/DB" \
  1276           --with-path-sources="%{l_prefix}/RPM" \
  1277           --with-bugreport="openpkg-users@openpkg.org" \
  1278           --with-beecrypt="$br/beecrypt-%{V_beecrypt}" \
  1279           --with-openssl="$br/openssl-%{V_openssl}" \
  1280           --with-zlib="$br/zlib-%{V_zlib}" \
  1281           --with-bzip2="$br/bzip2-%{V_bzip2}" \
  1282           --with-popt="$br/popt-%{V_popt}" \
  1283           --with-sqlite="$br/sqlite-%{V_sqlite}" \
  1284           --with-pcre="$br/pcre-%{V_pcre}" \
  1285           --with-uuid="$br/uuid-%{V_uuid}" \
  1286           --with-lua="internal" \
  1287           --with-db="internal" \
  1288           --without-db-rpc \
  1289           --without-db-largefile \
  1290           --with-db-tools-integrated \
  1291           --with-db-mutex="UNIX/fcntl" \
  1292           --without-file \
  1293           --without-neon \
  1294           --without-pthreads \
  1295           --without-libelf \
  1296           --without-selinux \
  1297           --without-perl \
  1298           --without-python \
  1299           --without-apidocs \
  1300           --disable-build-warnings \
  1301           --disable-build-extlibdep \
  1302           --disable-build-intlibdep \
  1303           --disable-build-lafiles \
  1304           --disable-shared \
  1305           --disable-rpath \
  1306           --disable-nls
  1308       #   build program
  1309       ${l_make}
  1310     ) || exit $?
  1312     #   display verbosity header
  1313     set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
  1315     #   build "openpkg" executable
  1316     ${l_make} -f `SOURCE openpkg.mk` \
  1317           CC="${l_cc}" \
  1318           OPENPKG_PREFIX="%{l_prefix}" \
  1319           OPENPKG_SUSR="%{l_susr}" \
  1320           OPENPKG_MUSR="%{l_musr}" \
  1321           OPENPKG_DOT_C="`SOURCE openpkg.c`"
  1323     #   display verbosity header
  1324     set +x; VERBOSE "BUILD: Build OpenPKG Mutual Exclusion (MutEx) Utility"; set -x
  1326     #   build "mutex" executable
  1327     ${l_make} -f `SOURCE mutex.mk` \
  1328           CC="${l_cc}" \
  1329           CPPFLAGS="-Ipopt-%{V_popt}" \
  1330           LDFLAGS="$bitopt -Lpopt-%{V_popt} -Lpopt-%{V_popt}/.libs" \
  1331           MUTEX_DOT_C="`SOURCE mutex.c`"
  1333 %install
  1334     #   skip in bootstrap phase 2 (see openpkg.boot)
  1335     [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  1337     #   switch into a temporary build area
  1338     cd openpkg-%{version}
  1339     . ./.buildenv
  1341     #   display verbosity header
  1342     set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
  1344     #   create installation hierarchy
  1345     rm -rf $RPM_BUILD_ROOT
  1346     sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  1347     for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
  1348         test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
  1349         mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
  1350     done
  1351     for i in 1 2 3 4 5 6 7 8 9; do
  1352         test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
  1353         mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
  1354         test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
  1355         mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
  1356     done
  1357     for dir in PKG bin etc include info lib man sbin; do
  1358         test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
  1359         mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
  1360     done
  1361     for i in 1 2 3 4 5 6 7 8 9; do
  1362         test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
  1363         mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
  1364         test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
  1365         mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
  1366     done
  1367     test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
  1368     mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
  1369     for dir in SRC PKG DB TR TMP; do
  1370         test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
  1371         mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
  1372     done
  1373     mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
  1375     #   display verbosity header
  1376     set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
  1378     #   install RPM into installation hierarchy
  1379     ( cd rpm-%{V_rpm_major}.%{V_rpm_minor}
  1380       ${l_make} install DESTDIR="$RPM_BUILD_ROOT"
  1381       cp lua/rpmlua $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
  1382       chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua
  1383     ) || exit $?
  1385     #   post-adjust RPM installation
  1386     mv  $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/macros \
  1387         $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmmacros
  1389     #   display verbosity header
  1390     set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
  1392     #   add additional development files
  1393     cp rpm-%{V_rpm_major}.%{V_rpm_minor}/rpmio/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1394     cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1395     cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1396     cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
  1397     cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1398     cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
  1399     cp beecrypt-%{V_beecrypt}/include/beecrypt/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1400     cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
  1401     cp popt-%{V_popt}/popt.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1402     cp popt-%{V_popt}/.libs/libpopt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
  1403     cp sqlite-%{V_sqlite}/sqlite3.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/
  1404     cp sqlite-%{V_sqlite}/.libs/libsqlite3.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmsqlite3.a
  1406     #   display verbosity header
  1407     set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
  1409     #   move C API into custom locations
  1410     mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
  1411        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
  1412     mv $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/rpm.pc \
  1413        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
  1414     #   FIXME: does the rpm.pc really work this way?
  1416     #   move rpm tool to custom location
  1417     mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
  1418        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  1419     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
  1420        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
  1421     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm >/dev/null 2>&1 || true
  1423     #   move rpm2cpio tool to custom location
  1424     mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
  1425        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
  1426     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
  1427        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
  1428     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio >/dev/null 2>&1 || true
  1430     #   move rpmconstant tool to custom location
  1431     mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmconstant \
  1432        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant
  1433     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmconstant.8 \
  1434        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant.8
  1435     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmconstant >/dev/null 2>&1 || true
  1437     #   move rpmcache tool to custom location
  1438     mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmcache \
  1439        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache
  1440     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmcache.8 \
  1441        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache.8
  1442     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmcache >/dev/null 2>&1 || true
  1444     #   move rpmgrep tool to custom location
  1445     mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpmgrep \
  1446        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep
  1447     mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/rpmgrep.1 \
  1448        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep.1
  1449     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgrep >/dev/null 2>&1 || true
  1451     #   move manual pages to custom location
  1452     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmdeps.8 \
  1453        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmdeps.8
  1454     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmgraph.8 \
  1455        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmgraph.8
  1456     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
  1457        $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
  1459     #   display verbosity header
  1460     set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
  1462     #   strip RPM installation
  1463     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
  1464           $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
  1465     for file in rpmbuild gendiff; do
  1466         rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
  1467     done
  1468     for dir in RPMS SRPMS SPEC SOURCES BUILD; do
  1469         rm -rf $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir >/dev/null 2>&1 || true
  1470     done
  1471     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
  1472     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
  1473     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
  1474     rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig >/dev/null 2>&1 || true
  1475     for file in \
  1476         brp-compress brp-python-bytecompile brp-java-gcjcompile brp-strip brp-strip-comment-note \
  1477         brp-nobuildrootpath brp-strip-shared brp-strip-static-archive brp-sparc64-linux check-files \
  1478         cross-build executabledeps.sh find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
  1479         find-provides.perl find-requires.perl getpo.sh http.req javadeps.sh libtooldeps.sh mono-find-provides \
  1480         mono-find-requires osgideps.pl pkgconfigdeps.sh perldeps.pl perl.prov perl.req pythondeps.sh \
  1481         php.prov php.req rpmdb_loadcvt rpm.daily rpm.log rpm.xinetd symclash.py symclash.sh tgpg u_pkg.sh \
  1482         vpkg-provides.sh vpkg-provides2.sh install-sh mkinstalldirs; do
  1483         rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
  1484     done
  1485     for file in \
  1486         db_archive db_checkpoint db_deadlock db_dump db_hotbackup db_load \
  1487         db_printlog db_recover db_stat db_upgrade db_verify; do
  1488         rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
  1489     done
  1491     #   display verbosity header
  1492     set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
  1494     #   install lsync tool
  1495     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1496         <`SOURCE lsync` \
  1497         >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
  1498     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
  1499     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1500         <`SOURCE dot.lsyncrc` \
  1501         >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
  1502     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1503         <`SOURCE lsync.8` \
  1504         >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
  1506     #   install rpm-config tool
  1507     ( l_prefix="%{l_prefix}"
  1508       l_cc="%{l_cc}"
  1509       l_cflags=""
  1510       l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
  1511       l_ldflags="-L${l_prefix}/lib/openpkg"
  1512       l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmmisc -lrpmsqlite3 -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
  1513       sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1514           -e "s:@l_cc@:$l_cc:g" \
  1515           -e "s:@l_cflags@:$l_cflags:g" \
  1516           -e "s:@l_cppflags@:$l_cppflags:g" \
  1517           -e "s:@l_ldflags@:$l_ldflags:g" \
  1518           -e "s:@l_libs@:$l_libs:g" \
  1519           -e "s:@l_version@:%{V_rpm_major}.%{V_rpm_minor}:g" \
  1520           <`SOURCE rpm-config.sh` \
  1521           >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
  1522     ) || exit $?
  1523     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
  1524     sed -e "s:RPM_VERSION:%{V_rpm_major}.%{V_rpm_minor}:g" \
  1525         <`SOURCE rpm-config.8` \
  1526         >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
  1528     #   install OpenPKG registry commands
  1529     mv  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
  1530         $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
  1531     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1532         `SOURCE rpm.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  1533     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  1534     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1535         `SOURCE register.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
  1536     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
  1537     cp `SOURCE register.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
  1539     #   allow GNU shtool to be called as "openpkg shtool" from external, too.
  1540     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1541         `SOURCE shtool.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
  1542     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/shtool.sh
  1544     #   install OpenPKG tool chain command subset
  1545     cp `SOURCE curl.sh`  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
  1546     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
  1547     cp `SOURCE build.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
  1548     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
  1549     cp `SOURCE build.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
  1550     cp `SOURCE index.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
  1551     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.pl
  1552     cp `SOURCE index.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/index.8
  1553     cp `SOURCE search.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
  1554     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.pl
  1555     cp `SOURCE search.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/search.8
  1556     cp `SOURCE mirror.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
  1557     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.pl
  1558     cp `SOURCE mirror.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/mirror.8
  1559     cp `SOURCE makeproxy.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
  1560     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.pl
  1561     cp `SOURCE makeproxy.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/makeproxy.8
  1562     cp `SOURCE lint-fsl.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
  1563     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-fsl.pl
  1564     cp `SOURCE lint-rc.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
  1565     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rc.pl
  1566     cp `SOURCE lint-rpm.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
  1567     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-rpm.pl
  1568     cp `SOURCE lint-spec.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
  1569     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lint-spec.pl
  1570     cp `SOURCE dev.pl` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
  1571     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.pl
  1572     cp `SOURCE dev.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/dev.8
  1573     cp `SOURCE sea.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
  1574     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.sh
  1575     cp `SOURCE sea.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/sea.8
  1576     cp `SOURCE stack.sh` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
  1577     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.sh
  1578     cp `SOURCE stack.8` $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/stack.8
  1580     #   install RPM extension
  1581     ( cd perl-%{V_perl}
  1582       cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
  1583       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
  1584     ) || exit $?
  1585     ( cd openssl-%{V_openssl}
  1586       cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
  1587       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
  1588     ) || exit $?
  1589     ( cd curl-%{V_curl}
  1590       cp curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
  1591       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
  1592     ) || exit $?
  1593     ( cd bzip2-%{V_bzip2}
  1594       cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
  1595       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
  1596     ) || exit $?
  1597     ( cd gzip-%{V_gzip}
  1598       cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
  1599       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
  1600     ) || exit $?
  1601     ( cd xz-%{V_xz}
  1602       cp src/xz/xz $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
  1603       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/xz
  1604     ) || exit $?
  1605     ( cd patch-%{V_patch}
  1606       cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
  1607       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
  1608     ) || exit $?
  1609     ( cd tar-%{V_tar}
  1610       cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
  1611       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
  1612     ) || exit $?
  1613     ( cd bash-%{V_bash}
  1614       cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
  1615       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
  1616     ) || exit $?
  1617     ( cd uuid-%{V_uuid}
  1618       cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
  1619       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
  1620     ) || exit $?
  1621     ( cd sqlite-%{V_sqlite}
  1622       cp sqlite3 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
  1623       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/sqlite3
  1624     ) || exit $?
  1625     ( cd libarchive-%{V_libarchive}
  1626       cp bsdcpio $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
  1627       cp bsdtar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
  1628       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdcpio
  1629       ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bsdtar
  1630     ) || exit $?
  1631     ( cd diffutils-%{V_diffutils}
  1632       ${l_strip} diff diff3 sdiff cmp
  1633       cp diff diff3 sdiff cmp $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
  1634     ) || exit $?
  1635     ( cd svs-%{V_svs}
  1636       sed -e "s;/bin/sh;%{l_prefix}/lib/openpkg/bash;" \
  1637           -e "s;^\(  *\)\(diff \);\1%{l_prefix}/lib/openpkg/\2;" \
  1638           <svs.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
  1639       chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs
  1640       cp svs.1 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/svs.1
  1641     ) || exit $?
  1642     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1643         -e "s;@l_musr@;%{l_musr};g" \
  1644         -e "s;@l_mgrp@;%{l_mgrp};g" \
  1645         <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
  1646     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
  1647     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1648         <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
  1649     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1650         <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
  1651     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
  1652     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1653         <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
  1654     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1655         -e "s;@l_musr@;%{l_musr};g" \
  1656         -e "s;@l_mgrp@;%{l_mgrp};g" \
  1657         <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
  1658     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
  1659     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1660         <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
  1661     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
  1662     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1663         -e "s;@l_musr@;%{l_musr};g" \
  1664         -e "s;@l_mgrp@;%{l_mgrp};g" \
  1665         <`SOURCE license.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
  1666     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license
  1667     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1668         <`SOURCE license.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/license.8
  1670     #   install OpenPKG tool chain execution frontend and execution wrapper
  1671     cp openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  1672     ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  1673     chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  1674     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1675         <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
  1676     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
  1677     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1678         <`SOURCE openpkg.1` \
  1679         >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
  1681     #   install more OpenPKG tool chain commands
  1682     sed -e "s;@l_prefix@;%{l_prefix};g" \
  1683         <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
  1684     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
  1686     #   install OpenPKG mutex utility
  1687     cp mutex $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/mutex
  1689     #   install an own copy of shtool
  1690     cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
  1691     chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
  1693     #   display verbosity header
  1694     set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
  1696     #   install a few README files
  1697     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1698         <`SOURCE root.README` \
  1699         >$RPM_BUILD_ROOT%{l_prefix}/README
  1700     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1701         <`SOURCE local.README` \
  1702         >$RPM_BUILD_ROOT%{l_prefix}/local/README
  1704     #   install Bash environment
  1705     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1706         <`SOURCE dot.bashrc` \
  1707         >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
  1708     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1709         <`SOURCE dot.bash_login` \
  1710         >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
  1712     #   install Run-Command files
  1713     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1714         -e "s:@l_susr@:%{l_susr}:g" \
  1715         -e "s:@l_musr@:%{l_musr}:g" \
  1716         <`SOURCE rc` \
  1717         >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
  1718     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
  1719     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1720         <`SOURCE rc.conf` \
  1721         >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
  1722     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
  1723     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1724         <`SOURCE rc.func` \
  1725         >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
  1726     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
  1727     mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  1728     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1729         -e "s:@l_musr@:%{l_musr}:g" \
  1730         <`SOURCE rc.openpkg` \
  1731         >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
  1732     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
  1733     ( echo "#!/bin/sh"
  1734       echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
  1735     ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
  1736     chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
  1737     ln  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
  1738         $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
  1739     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1740         <`SOURCE rc.8` \
  1741         >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
  1743     #   create configuration directory
  1744     test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
  1745         mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
  1747     #   install platform identification file
  1748     sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
  1749         >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
  1750     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
  1752     #   install UUID configuration file (ghost)
  1753     touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
  1754     chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
  1756     #   install registry configuration files (ghost)
  1757     touch \
  1758         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
  1759         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
  1760         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
  1761         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
  1762     chmod 644 \
  1763         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
  1764         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
  1765         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
  1766         $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
  1768     #   install default managers configuration file
  1769     ( echo "##"
  1770       echo "##  managers -- OpenPKG Instance Managers"
  1771       echo "##"
  1772       echo ""
  1773       echo "%{l_susr}"
  1774       echo "%{l_musr}"
  1775       echo ""
  1776     ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
  1778     #   install default release information file
  1779     release_tag=""
  1780     release_url=""
  1781     l_stack=""; [ ".%{?l_stack:set}"  = .set ] && l_stack="%{l_stack}"
  1782     case "$l_stack" in
  1783         http: | https: | ftp: | file: )
  1784             release_url="$l_stack"
  1785             ;;
  1786         [a-zA-Z]* )
  1787             release_tag="$l_stack"
  1788             ;;
  1789     esac
  1790     ( echo "##"
  1791       echo "##  release -- OpenPKG Release Information"
  1792       echo "##"
  1793       echo ""
  1794       echo "TAG=$release_tag"
  1795       echo "URL=$release_url"
  1796       echo ""
  1797     ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/release
  1799     #   install overriding RPM configuration files
  1800     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1801         <`SOURCE rpmpopt` \
  1802         >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt
  1803     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1804         -e "s:@l_prefix_static@:%{l_prefix}:g" \
  1805         -e "s;@l_build_path@;$l_build_path;g" \
  1806         -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
  1807         -e "s;@l_build_ulim@;$l_build_ulim;g" \
  1808         -e "s;@l_unprivileged@;$l_unprivileged;g" \
  1809         -e "s:@TAG@:$tag:g" \
  1810         -e "s:@SUSR@:$susr:g" \
  1811         -e "s:@SGRP@:$sgrp:g" \
  1812         -e "s:@MUSR@:$musr:g" \
  1813         -e "s:@MGRP@:$mgrp:g" \
  1814         -e "s:@RUSR@:$rusr:g" \
  1815         -e "s:@RGRP@:$rgrp:g" \
  1816         -e "s:@NUSR@:$nusr:g" \
  1817         -e "s:@NGRP@:$ngrp:g" \
  1818         <`SOURCE rpmmacros` \
  1819         >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
  1820     sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1821         <`SOURCE rpmlua` \
  1822         >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua
  1823     cp `SOURCE openpkg.org.pgp` \
  1824        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
  1825     cp `SOURCE openpkg.com.pgp` \
  1826        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
  1827     cp `SOURCE openpkg.net.pgp` \
  1828        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
  1830     #   install license data
  1831     test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d || \
  1832         mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d
  1833     cp `SOURCE license-BOOT.txt` \
  1834        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/BOOT
  1835     cp `SOURCE license-COMMUNITY.txt` \
  1836        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/COMMUNITY
  1837     cp `SOURCE license-EVAL.txt` \
  1838        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EVAL
  1839     cp `SOURCE license-EXAMPLE.txt` \
  1840        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/EXAMPLE
  1841     cp `SOURCE license-PROMO.txt` \
  1842        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/PROMO
  1843     cp `SOURCE license-RECOVERY.txt` \
  1844        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license.d/RECOVERY
  1845     cp `SOURCE license.lua` \
  1846        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/license.lua
  1847     touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/license
  1849     #   provide directories for easy overriding of RPM configuration files
  1850     test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d || \
  1851         mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros.d
  1852     test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d || \
  1853         mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmpopt.d
  1854     test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d || \
  1855         mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmlua.d
  1857     #   display verbosity header
  1858     set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
  1860 %files
  1861     %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
  1862     %{l_prefix}/README
  1863     %config(noreplace) %{l_prefix}/.bashrc
  1864     %config(noreplace) %{l_prefix}/.bash_login
  1865     %dir %{l_prefix}/RPM
  1866     %dir %{l_prefix}/RPM/SRC
  1867     %dir %{l_prefix}/RPM/PKG
  1868     %dir %{l_prefix}/RPM/TR
  1869     %dir %{l_prefix}/RPM/DB
  1870     %dir %{l_prefix}/RPM/TMP
  1871     %dir %{l_prefix}/cgi
  1872     %dir %{l_prefix}/bin
  1873     %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
  1874     %dir %{l_prefix}/etc
  1875     %{l_prefix}/etc/rc
  1876     %config(noreplace) %{l_prefix}/etc/rc.conf
  1877     %{l_prefix}/etc/rc.func
  1878     %dir %{l_prefix}/etc/rc.d
  1879     %{l_prefix}/etc/rc.d/rc.openpkg
  1880     %dir %{l_prefix}/etc/openpkg
  1881     %ghost %{l_prefix}/etc/openpkg/license
  1882     %dir %{l_prefix}/etc/openpkg/license.d
  1883     %{l_prefix}/etc/openpkg/license.d/BOOT
  1884     %{l_prefix}/etc/openpkg/license.d/COMMUNITY
  1885     %{l_prefix}/etc/openpkg/license.d/EVAL
  1886     %{l_prefix}/etc/openpkg/license.d/EXAMPLE
  1887     %{l_prefix}/etc/openpkg/license.d/PROMO
  1888     %{l_prefix}/etc/openpkg/license.d/RECOVERY
  1889     %ghost %{l_prefix}/etc/openpkg/uuid
  1890     %config %{l_prefix}/etc/openpkg/release
  1891     %config %{l_prefix}/etc/openpkg/platform
  1892     %config %{l_prefix}/etc/openpkg/rpmmacros
  1893     %config %{l_prefix}/etc/openpkg/rpmpopt
  1894     %config %{l_prefix}/etc/openpkg/rpmlua
  1895     %dir %{l_prefix}/etc/openpkg/rpmmacros.d
  1896     %dir %{l_prefix}/etc/openpkg/rpmpopt.d
  1897     %dir %{l_prefix}/etc/openpkg/rpmlua.d
  1898     %ghost %{l_prefix}/etc/openpkg/register.conf
  1899     %ghost %{l_prefix}/etc/openpkg/register.prep
  1900     %ghost %{l_prefix}/etc/openpkg/register.tran
  1901     %ghost %{l_prefix}/etc/openpkg/register.util
  1902     %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
  1903     %{l_prefix}/etc/openpkg/openpkg.org.pgp
  1904     %{l_prefix}/etc/openpkg/openpkg.com.pgp
  1905     %{l_prefix}/etc/openpkg/openpkg.net.pgp
  1906     %dir %{l_prefix}/include
  1907     %dir %{l_prefix}/include/openpkg
  1908     %dir %{l_prefix}/include/openpkg/rpm
  1909     %{l_prefix}/include/openpkg/rpm/argv.h
  1910     %{l_prefix}/include/openpkg/rpm/beecrypt.h
  1911     %{l_prefix}/include/openpkg/rpm/bzlib.h
  1912     %{l_prefix}/include/openpkg/rpm/db.h
  1913     %{l_prefix}/include/openpkg/rpm/envvar.h
  1914     %{l_prefix}/include/openpkg/rpm/fs.h
  1915     %{l_prefix}/include/openpkg/rpm/fts.h
  1916     %{l_prefix}/include/openpkg/rpm/glob.h
  1917     %{l_prefix}/include/openpkg/rpm/mire.h
  1918     %{l_prefix}/include/openpkg/rpm/misc.h
  1919     %{l_prefix}/include/openpkg/rpm/pkgio.h
  1920     %{l_prefix}/include/openpkg/rpm/popt.h
  1921     %{l_prefix}/include/openpkg/rpm/rpm4compat.h
  1922     %{l_prefix}/include/openpkg/rpm/rpmal.h
  1923     %{l_prefix}/include/openpkg/rpm/rpmbc.h
  1924     %{l_prefix}/include/openpkg/rpm/rpmbuild.h
  1925     %{l_prefix}/include/openpkg/rpm/rpmcb.h
  1926     %{l_prefix}/include/openpkg/rpm/rpmcli.h
  1927     %{l_prefix}/include/openpkg/rpm/rpmconstant.h
  1928     %{l_prefix}/include/openpkg/rpm/rpmdav.h
  1929     %{l_prefix}/include/openpkg/rpm/rpmdb.h
  1930     %{l_prefix}/include/openpkg/rpm/rpmds.h
  1931     %{l_prefix}/include/openpkg/rpm/rpmevr.h
  1932     %{l_prefix}/include/openpkg/rpm/rpmfc.h
  1933     %{l_prefix}/include/openpkg/rpm/rpmfi.h
  1934     %{l_prefix}/include/openpkg/rpm/rpmgc.h
  1935     %{l_prefix}/include/openpkg/rpm/rpmgi.h
  1936     %{l_prefix}/include/openpkg/rpm/rpmhash.h
  1937     %{l_prefix}/include/openpkg/rpm/rpmio-stub.h
  1938     %{l_prefix}/include/openpkg/rpm/rpmio.h
  1939     %{l_prefix}/include/openpkg/rpm/rpmiotypes.h
  1940     %{l_prefix}/include/openpkg/rpm/rpmku.h
  1941     %{l_prefix}/include/openpkg/rpm/rpmlib.h
  1942     %{l_prefix}/include/openpkg/rpm/rpmlog.h
  1943     %{l_prefix}/include/openpkg/rpm/rpmmacro.h
  1944     %{l_prefix}/include/openpkg/rpm/rpmmg.h
  1945     %{l_prefix}/include/openpkg/rpm/rpmns.h
  1946     %{l_prefix}/include/openpkg/rpm/rpmnss.h
  1947     %{l_prefix}/include/openpkg/rpm/rpmpgp.h
  1948     %{l_prefix}/include/openpkg/rpm/rpmps.h
  1949     %{l_prefix}/include/openpkg/rpm/rpmspec.h
  1950     %{l_prefix}/include/openpkg/rpm/rpmsq.h
  1951     %{l_prefix}/include/openpkg/rpm/rpmssl.h
  1952     %{l_prefix}/include/openpkg/rpm/rpmsw.h
  1953     %{l_prefix}/include/openpkg/rpm/rpmsx.h
  1954     %{l_prefix}/include/openpkg/rpm/rpmtag.h
  1955     %{l_prefix}/include/openpkg/rpm/rpmte.h
  1956     %{l_prefix}/include/openpkg/rpm/rpmts.h
  1957     %{l_prefix}/include/openpkg/rpm/rpmurl.h
  1958     %{l_prefix}/include/openpkg/rpm/rpmuuid.h
  1959     %{l_prefix}/include/openpkg/rpm/rpmversion.h
  1960     %{l_prefix}/include/openpkg/rpm/rpmwf.h
  1961     %{l_prefix}/include/openpkg/rpm/rpmxar.h
  1962     %{l_prefix}/include/openpkg/rpm/rpmzlog.h
  1963     %{l_prefix}/include/openpkg/rpm/signature.h
  1964     %{l_prefix}/include/openpkg/rpm/sqlite3.h
  1965     %{l_prefix}/include/openpkg/rpm/ugid.h
  1966     %{l_prefix}/include/openpkg/rpm/yarn.h
  1967     %{l_prefix}/include/openpkg/rpm/zconf.h
  1968     %{l_prefix}/include/openpkg/rpm/zlib.h
  1969     %dir %{l_prefix}/info
  1970     %dir %{l_prefix}/lib
  1971     %dir %{l_prefix}/lib/openpkg
  1972     %{l_prefix}/lib/openpkg/bash
  1973     %{l_prefix}/lib/openpkg/bsdcpio
  1974     %{l_prefix}/lib/openpkg/bsdtar
  1975     %{l_prefix}/lib/openpkg/bzip2
  1976     %{l_prefix}/lib/openpkg/curl
  1977     %{l_prefix}/lib/openpkg/db_tool
  1978     %{l_prefix}/lib/openpkg/cmp
  1979     %{l_prefix}/lib/openpkg/diff
  1980     %{l_prefix}/lib/openpkg/diff3
  1981     %{l_prefix}/lib/openpkg/sdiff
  1982     %{l_prefix}/lib/openpkg/gzip
  1983     %{l_prefix}/lib/openpkg/librpm.a
  1984     %{l_prefix}/lib/openpkg/librpmbeecrypt.a
  1985     %{l_prefix}/lib/openpkg/librpmbuild.a
  1986     %{l_prefix}/lib/openpkg/librpmbz2.a
  1987     %{l_prefix}/lib/openpkg/librpmdb.a
  1988     %{l_prefix}/lib/openpkg/librpmio.a
  1989     %{l_prefix}/lib/openpkg/librpmmisc.a
  1990     %{l_prefix}/lib/openpkg/librpmpopt.a
  1991     %{l_prefix}/lib/openpkg/librpmsqlite3.a
  1992     %{l_prefix}/lib/openpkg/librpmz.a
  1993     %{l_prefix}/lib/openpkg/license.lua
  1994     %{l_prefix}/lib/openpkg/miniperl
  1995     %{l_prefix}/lib/openpkg/mutex
  1996     %{l_prefix}/lib/openpkg/openpkg
  1997     %{l_prefix}/lib/openpkg/openssl
  1998     %{l_prefix}/lib/openpkg/patch
  1999     %{l_prefix}/lib/openpkg/rc
  2000     %{l_prefix}/lib/openpkg/rpm
  2001     %{l_prefix}/lib/openpkg/rpm.pc
  2002     %{l_prefix}/lib/openpkg/rpmdb
  2003     %{l_prefix}/lib/openpkg/rpmdeps
  2004     %{l_prefix}/lib/openpkg/lua
  2005     %{l_prefix}/lib/openpkg/rpmmacros
  2006     %{l_prefix}/lib/openpkg/rpmpopt
  2007     %{l_prefix}/lib/openpkg/rpmtool
  2008     %{l_prefix}/lib/openpkg/shtool
  2009     %{l_prefix}/lib/openpkg/sqlite3
  2010     %{l_prefix}/lib/openpkg/tar
  2011     %{l_prefix}/lib/openpkg/uuid
  2012     %{l_prefix}/lib/openpkg/xz
  2013     %dir %{l_prefix}/libexec
  2014     %dir %{l_prefix}/libexec/openpkg
  2015     %{l_prefix}/libexec/openpkg/build.8
  2016     %{l_prefix}/libexec/openpkg/build.pl
  2017     %{l_prefix}/libexec/openpkg/curl.sh
  2018     %{l_prefix}/libexec/openpkg/dev.8
  2019     %{l_prefix}/libexec/openpkg/dev.pl
  2020     %{l_prefix}/libexec/openpkg/index.8
  2021     %{l_prefix}/libexec/openpkg/index.pl
  2022     %{l_prefix}/libexec/openpkg/license
  2023     %{l_prefix}/libexec/openpkg/license.8
  2024     %{l_prefix}/libexec/openpkg/lsync
  2025     %{l_prefix}/libexec/openpkg/lsync.8
  2026     %{l_prefix}/libexec/openpkg/lint-fsl.pl
  2027     %{l_prefix}/libexec/openpkg/lint-rc.pl
  2028     %{l_prefix}/libexec/openpkg/lint-rpm.pl
  2029     %{l_prefix}/libexec/openpkg/lint-spec.pl
  2030     %{l_prefix}/libexec/openpkg/makeproxy.8
  2031     %{l_prefix}/libexec/openpkg/makeproxy.pl
  2032     %{l_prefix}/libexec/openpkg/man
  2033     %{l_prefix}/libexec/openpkg/mirror.8
  2034     %{l_prefix}/libexec/openpkg/mirror.pl
  2035     %{l_prefix}/libexec/openpkg/rc
  2036     %{l_prefix}/libexec/openpkg/rc.8
  2037     %{l_prefix}/libexec/openpkg/register
  2038     %{l_prefix}/libexec/openpkg/register.8
  2039     %{l_prefix}/libexec/openpkg/release
  2040     %{l_prefix}/libexec/openpkg/release.8
  2041     %{l_prefix}/libexec/openpkg/rpm
  2042     %{l_prefix}/libexec/openpkg/rpm-config
  2043     %{l_prefix}/libexec/openpkg/rpm-config.8
  2044     %{l_prefix}/libexec/openpkg/rpm.8
  2045     %{l_prefix}/libexec/openpkg/rpmconstant
  2046     %{l_prefix}/libexec/openpkg/rpmconstant.8
  2047     %{l_prefix}/libexec/openpkg/rpm2cpio
  2048     %{l_prefix}/libexec/openpkg/rpm2cpio.8
  2049     %{l_prefix}/libexec/openpkg/rpmbuild.8
  2050     %{l_prefix}/libexec/openpkg/rpmcache
  2051     %{l_prefix}/libexec/openpkg/rpmcache.8
  2052     %{l_prefix}/libexec/openpkg/rpmdeps.8
  2053     %{l_prefix}/libexec/openpkg/rpmgraph.8
  2054     %{l_prefix}/libexec/openpkg/rpmgrep
  2055     %{l_prefix}/libexec/openpkg/rpmgrep.1
  2056     %{l_prefix}/libexec/openpkg/sea.8
  2057     %{l_prefix}/libexec/openpkg/sea.sh
  2058     %{l_prefix}/libexec/openpkg/search.8
  2059     %{l_prefix}/libexec/openpkg/search.pl
  2060     %{l_prefix}/libexec/openpkg/stack.8
  2061     %{l_prefix}/libexec/openpkg/stack.sh
  2062     %{l_prefix}/libexec/openpkg/shtool.sh
  2063     %{l_prefix}/libexec/openpkg/svs
  2064     %{l_prefix}/libexec/openpkg/svs.1
  2065     %{l_prefix}/libexec/openpkg/uuid
  2066     %{l_prefix}/libexec/openpkg/uuid.8
  2067     %dir %{l_prefix}/man
  2068     %dir %{l_prefix}/man/man1
  2069     %dir %{l_prefix}/man/man2
  2070     %dir %{l_prefix}/man/man3
  2071     %dir %{l_prefix}/man/man4
  2072     %dir %{l_prefix}/man/man5
  2073     %dir %{l_prefix}/man/man6
  2074     %dir %{l_prefix}/man/man7
  2075     %dir %{l_prefix}/man/man8
  2076     %dir %{l_prefix}/man/man9
  2077     %dir %{l_prefix}/man/cat1
  2078     %dir %{l_prefix}/man/cat2
  2079     %dir %{l_prefix}/man/cat3
  2080     %dir %{l_prefix}/man/cat4
  2081     %dir %{l_prefix}/man/cat5
  2082     %dir %{l_prefix}/man/cat6
  2083     %dir %{l_prefix}/man/cat7
  2084     %dir %{l_prefix}/man/cat8
  2085     %dir %{l_prefix}/man/cat9
  2086     %{l_prefix}/man/man1/openpkg.1
  2087     %dir %{l_prefix}/sbin
  2088     %dir %{l_prefix}/pub
  2089     %dir %{l_prefix}/share
  2090     %dir %{l_prefix}/var
  2091     %dir %{l_prefix}/local
  2092     %{l_prefix}/local/README
  2093     %{l_prefix}/local/.lsyncrc
  2094     %dir %{l_prefix}/local/PKG
  2095     %dir %{l_prefix}/local/bin
  2096     %dir %{l_prefix}/local/etc
  2097     %dir %{l_prefix}/local/include
  2098     %dir %{l_prefix}/local/info
  2099     %dir %{l_prefix}/local/lib
  2100     %dir %{l_prefix}/local/man
  2101     %dir %{l_prefix}/local/man/man1
  2102     %dir %{l_prefix}/local/man/man2
  2103     %dir %{l_prefix}/local/man/man3
  2104     %dir %{l_prefix}/local/man/man4
  2105     %dir %{l_prefix}/local/man/man5
  2106     %dir %{l_prefix}/local/man/man6
  2107     %dir %{l_prefix}/local/man/man7
  2108     %dir %{l_prefix}/local/man/man8
  2109     %dir %{l_prefix}/local/man/man9
  2110     %dir %{l_prefix}/local/man/cat1
  2111     %dir %{l_prefix}/local/man/cat2
  2112     %dir %{l_prefix}/local/man/cat3
  2113     %dir %{l_prefix}/local/man/cat4
  2114     %dir %{l_prefix}/local/man/cat5
  2115     %dir %{l_prefix}/local/man/cat6
  2116     %dir %{l_prefix}/local/man/cat7
  2117     %dir %{l_prefix}/local/man/cat8
  2118     %dir %{l_prefix}/local/man/cat9
  2119     %dir %{l_prefix}/local/sbin
  2121 %clean
  2122     #   skip in bootstrap phase 2 (see openpkg.boot)
  2123     [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  2125     #   cleanup build area
  2126     rm -rf openpkg-%{version} >/dev/null 2>&1 || true
  2128     #   cleanup installation area
  2129     rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
  2131 %pre
  2132     #   always performed for upgrades and because it doesn't harm!
  2133     #   [ ".$1" != .1 ] && exit 0
  2135     #   this procedure is only usable with root privileges
  2136     #   (for non-root installations it is not required at all)
  2137     cusr=`(id -un) 2>/dev/null ||\
  2138           (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  2139           (whoami) 2>/dev/null ||\
  2140           (who am i | cut "-d " -f1) 2>/dev/null ||\
  2141           echo $LOGNAME`
  2143     #   determine runtime details (for both inside and outside RPM!!)
  2144     #   - bootstrapping: $xxx is set from etc.wrapbin.sh
  2145     #   - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
  2146     #   - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
  2147     [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
  2148     [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
  2149     [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
  2150     [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
  2151     [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
  2152     [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
  2153     [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
  2154     [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
  2155     [ ".$suid" = . ] && suid="%{?l_suid}"
  2156     [ ".$sgid" = . ] && sgid="%{?l_sgid}"
  2157     [ ".$muid" = . ] && muid="%{?l_muid}"
  2158     [ ".$mgid" = . ] && mgid="%{?l_mgid}"
  2159     [ ".$ruid" = . ] && ruid="%{?l_ruid}"
  2160     [ ".$rgid" = . ] && rgid="%{?l_rgid}"
  2161     [ ".$nuid" = . ] && nuid="%{?l_nuid}"
  2162     [ ".$ngid" = . ] && ngid="%{?l_ngid}"
  2164     #   if any of these optional params are not used we won't have a
  2165     #   corresponding macro either, so make use of one conditionally
  2166     [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
  2167     [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
  2168     [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
  2169     [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
  2170     [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
  2171     [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
  2172     [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
  2173     [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
  2175     #   determine prefix
  2176     [ ".$prefix" = . ] && prefix="%{l_prefix}"
  2177     prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  2179     #   Pre-flight check before update to make sure that the currently
  2180     #   activated license is still valid. This is done just be friendly
  2181     #   to people and to not too easily shoot theirself into the foot
  2182     #   by blindly upgrading and then having to recognize that the new
  2183     #   OpenPKG Framework is no longer covered by the old license.
  2184     if [ ".$1" = .2 ]; then
  2185         ( OPENPKG_FRAMEWORK_RELEASE="%{release}"
  2186           export OPENPKG_FRAMEWORK_RELEASE
  2187           #   LATER:
  2188           #   $prefix/bin/openpkg rpm -q openpkg >/dev/null 2>&1 || exit $?
  2189           #   if [ $? -ne 0 ]; then
  2190           #   NOW:
  2191           output="`$prefix/bin/openpkg rpm -q openpkg 2>&1 | grep 'ENVIRONMENT ANOMALY'`"
  2192           if [ ".$output" != . ]; then
  2193               id="`($prefix/bin/openpkg license active) 2>/dev/null`"
  2194               [ ".$id" = . ] && id="UNKNOWN"
  2195               ( echo "Attention, your currently active license \"$id\" does"
  2196                 echo "not allow you to use this newer version of the OpenPKG Framework!"
  2197                 echo "We cancel this update to prevent you from a run-time failure."
  2198                 echo "Please first upgrade to a newer license with the command:"
  2199                 echo "  \$ $prefix/bin/openpkg license update $id <file>"
  2200               ) | $prefix/lib/openpkg/rpmtool msg -b -t error
  2201               exit 42
  2202           fi
  2203         ) || exit $?
  2204     fi
  2206     #   register instance in presence file
  2207     presence="/etc/openpkg"
  2208     exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
  2209     if [ ".$exists" = . ]; then
  2210         ( umask 022
  2211           echo "${prefix}" >>$presence
  2212         ) 2>/dev/null || true
  2213     fi
  2215     #   determine user/group ids
  2216     for class in s m r n; do
  2217         eval "xusr=\"\$${class}usr\""
  2218         eval "xgrp=\"\$${class}grp\""
  2219         eval "xuid=\"\$${class}uid\""
  2220         eval "xgid=\"\$${class}gid\""
  2221         if [ ".$xuid" = . ]; then
  2222             case "$plid" in
  2223                 Darwin/10.[1-9]* | Darwin/1[1-9].* )
  2224                     xuid=`dscl . -read "/users/${xusr}" UniqueID 2>/dev/null | awk '{ print $2; }'`
  2225                     ;;
  2226                 * )
  2227                     xuid=`(getent passwd "${xusr}"; \
  2228                         grep "^${xusr}:" /etc/passwd; \
  2229                         ypmatch "${xusr}" passwd; \
  2230                         nismatch "${xusr}" passwd; \
  2231                         nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
  2232                         sed -e 'q' | awk -F: '{ print $3; }'`
  2233                     ;;
  2234             esac
  2235             if [ ".$xuid" = . ]; then
  2236                 #   seek for a reasonably uid/gid pair
  2237                 xuid=1000
  2238                 ok=0
  2239                 while [ ".$ok" = .0 ]; do
  2240                     eval "u_exists=\$u_exists_$xuid"
  2241                     if [ ".$u_exists" = . ]; then
  2242                         case "$plid" in
  2243                             Darwin/10.[1-9]* | Darwin/1[1-9].* )
  2244                                 u_exists=`dscl . -search /users UniqueID "$xuid" 2>/dev/null`
  2245                                 ;;
  2246                             * )
  2247                                 u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
  2248                                           grep "^[^:]*:[^:]*:$xuid:"`
  2249                                 ;;
  2250                         esac
  2251                     fi
  2252                     eval "g_exists=\$g_exists_$xuid"
  2253                     if [ ".$g_exists" = . ]; then
  2254                         case "$plid" in
  2255                             Darwin/10.[1-9]* | Darwin/1[1-9].* )
  2256                                 g_exists=`dscl . -search /groups PrimaryGroupID "$xuid" 2>/dev/null`
  2257                                 ;;
  2258                             * )
  2259                                 g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
  2260                                           grep "^[^:]*:[^:]*:$xuid:"`
  2261                         esac
  2262                     fi
  2263                     if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
  2264                         ok=1
  2265                         break
  2266                     fi
  2267                     xuid=`expr $xuid + 1`
  2268                 done
  2269                 eval "u_exists_$xuid=yes"
  2270                 eval "g_exists_$xuid=yes"
  2271             fi
  2272         fi
  2273         if [ ".$xgid" = . ]; then
  2274             xgid=`(getent group "${xgrp}"; \
  2275                   grep "^${xgrp}:" /etc/group; \
  2276                   ypmatch "${xgrp}" group; \
  2277                   nismatch "${xgrp}" group; \
  2278                   nidump group . | grep "^${xgrp}:"; \
  2279                   dscl . -read "/groups/${xgrp}" | grep RecordName) 2>/dev/null | \
  2280                   sed -e 'q' | awk -F: '{ print $3; }'`
  2281             if [ ".$xgid" = . ]; then
  2282                 xgid="$xuid"
  2283             fi
  2284         fi
  2285         eval "${class}uid=\"$xuid\""
  2286         eval "${class}gid=\"$xgid\""
  2287     done
  2289     #   determine platform id
  2290     s=`(uname -s) 2>/dev/null` || s='Unknown'
  2291     r=`(uname -r) 2>/dev/null` || r='0.0'
  2292     plid="${s}/${r}"
  2294     #   add entry to /etc/shells
  2295     shell="${prefix}/lib/openpkg/bash"
  2296     if [ -f /etc/shells ]; then
  2297         exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
  2298         if [ ".$exists" = . ]; then
  2299             if [ ".$cusr" != ".root" ]; then
  2300                 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
  2301                 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  2302             else
  2303                 echo "${shell}" >>/etc/shells
  2304             fi
  2305         fi
  2306     fi
  2308     #   clear pending deferred actions
  2309     rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
  2311     #   create the hierarchy user/group
  2312     for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
  2313                "management:${musr}:${muid}:${mgrp}:${mgid}" \
  2314                "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
  2315                "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
  2316         #   split request into class/usr/uid/grp/gid
  2317         OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
  2318         class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
  2320         #   check whether user already exists
  2321         exists=`(getent passwd "$usr"; \
  2322                  grep "^$usr:" /etc/passwd; \
  2323                  ypmatch "$usr" passwd; \
  2324                  nismatch "$usr" passwd; \
  2325                  nidump passwd . | grep "^$usr:"; \
  2326                  dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
  2327                  sed -e 'q'`
  2328         if [ ".$exists" = . ]; then
  2329             if [ ".$cusr" != ".root" ]; then
  2330                 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
  2331                 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  2332             else
  2333                 #   add entry to passwd database
  2334                 realname="${prefix} OpenPKG ($class)"
  2335                 case "$plid" in
  2336                     FreeBSD/* | NetBSD/* )
  2337                         file=/etc/master.passwd
  2338                         entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
  2339                         update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
  2340                         ;;
  2341                     Linux/* )
  2342                         file=/etc/passwd
  2343                         entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  2344                         update="(PATH=\$PATH:/usr/sbin; pwconv)"
  2345                         ;;
  2346                     SunOS/5.* | UnixWare/* )
  2347                         file=/etc/passwd
  2348                         entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  2349                         update="(PATH=\$PATH:/usr/sbin; pwconv)"
  2350                         ;;
  2351                     AIX/* )
  2352                         #   intentionally do nothing here
  2354                         ;;
  2355                     OSF1/V5.* )
  2356                         file=/etc/passwd
  2357                         entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  2358                         update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
  2359                         ;;
  2360                     HP-UX/* )
  2361                         file=/etc/passwd
  2362                         entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  2363                         update=":"
  2364                         ;;
  2365                     Darwin/* )
  2366                         #   intentionally do nothing here
  2368                         ;;
  2369                     IRIX*/6.* )
  2370                         file=/etc/passwd
  2371                         entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  2372                         if   [ -f /etc/shadow ]
  2373                         then update="(PATH=\$PATH:/sbin; pwconv)"
  2374                         else update=":"
  2375                         fi
  2376                         ;;
  2377                     CYGWIN*/* )
  2378                         file=/etc/passwd
  2379                         entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  2380                         update=":"
  2381                         ;;
  2382                 esac
  2383                 case "$plid" in
  2384                     Darwin/10.[1-9]* | Darwin/1[1-9].* )
  2385                         dscl . -create "/users/${usr}"
  2386                         dscl . -create "/users/${usr}" Password         "*"
  2387                         dscl . -create "/users/${usr}" UniqueID         "${uid}"
  2388                         dscl . -create "/users/${usr}" PrimaryGroupID   "${gid}"
  2389                         dscl . -create "/users/${usr}" RealName         "${realname}"
  2390                         dscl . -create "/users/${usr}" NFSHomeDirectory "${prefix}"
  2391                         dscl . -create "/users/${usr}" UserShell        "${shell}"
  2392                         ;;
  2393                     Darwin/* )
  2394                         niutil -create     . "/users/${usr}"
  2395                         niutil -createprop . "/users/${usr}" passwd   "*"
  2396                         niutil -createprop . "/users/${usr}" uid      "${uid}"
  2397                         niutil -createprop . "/users/${usr}" gid      "${gid}"
  2398                         niutil -createprop . "/users/${usr}" realname "${realname}"
  2399                         niutil -createprop . "/users/${usr}" home     "${prefix}"
  2400                         niutil -createprop . "/users/${usr}" shell    "${shell}"
  2401                         ;;
  2402                     AIX/* )
  2403                         mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
  2404                         cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
  2405                         sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
  2406                             </etc/security/login.cfg.bak >/etc/security/login.cfg && \
  2407                         rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
  2408                         #   defer both the setting of the primary group and the shell,
  2409                         #   as they do not exist at this stage of processing.
  2410                         echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
  2411                         echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
  2412                         ;;
  2413                     * )
  2414                         cp $file $file.bak && \
  2415                         (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
  2416                         rm -f $file.bak >/dev/null 2>&1
  2417                         eval $update
  2418                         [ $? -ne 0 ] && exit $?
  2419                         ;;
  2420                 esac
  2421             fi
  2422         fi
  2424         #   check whether group already exists
  2425         exists=`(getent group "$grp"; \
  2426                 grep "^$grp:" /etc/group; \
  2427                 ypmatch "$grp" group; \
  2428                 nismatch "$grp" group; \
  2429                 nidump group . | grep "^$grp:"; \
  2430                 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
  2431                 sed -e 'q'`
  2432         if [ ".$exists" = . ]; then
  2433             if [ ".$cusr" != ".root" ]; then
  2434                 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
  2435                 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  2436             else
  2437                 case "$plid" in
  2438                     Darwin/10.[1-9]* | Darwin/1[1-9].* )
  2439                         dscl . -create "/groups/${grp}"
  2440                         dscl . -create "/groups/${grp}" Password        "*"
  2441                         dscl . -create "/groups/${grp}" PrimaryGroupID  "${gid}"
  2442                         dscl . -create "/groups/${grp}" GroupMembership "${usr}"
  2443                         ;;
  2444                     Darwin/* )
  2445                         niutil -create     . "/groups/${grp}"
  2446                         niutil -createprop . "/groups/${grp}" gid   "${gid}"
  2447                         niutil -createprop . "/groups/${grp}" users "${usr}"
  2448                         ;;
  2449                     AIX/* )
  2450                         mkgroup id="${gid}" users="${usr}" "${grp}"
  2451                         ;;
  2452                     * )
  2453                         #   add entry to group database
  2454                         file=/etc/group
  2455                         entry="${grp}:*:${gid}:${usr}"
  2456                         cp $file $file.bak && \
  2457                         (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
  2458                         rm -f $file.bak >/dev/null 2>&1
  2459                     ;;
  2460                 esac
  2461             fi
  2462         fi
  2463     done
  2465     #   optional group processing (deferred adjustment of primary group)
  2466     if [ -f %{l_prefix}.pre-group-process.sh ]; then
  2467         sh %{l_prefix}.pre-group-process.sh
  2468         rm -f %{l_prefix}.pre-group-process.sh
  2469     fi
  2471     #   invalidate passwd and group tables from Name Service Cache Daemon to
  2472     #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
  2473     if [ -x /usr/sbin/nscd ]; then
  2474         /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
  2475         /usr/sbin/nscd -i group  >/dev/null 2>&1 || true
  2476     fi
  2478     #   create the startup/shutdown transfer script
  2479     name_old="`echo "$prefix" | sed -e 's;/;;g'`"
  2480     name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`"
  2481     if [ ".$cusr" != ".root" ]; then
  2482         echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
  2483         echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  2484     else
  2485         case "$plid" in
  2486             FreeBSD/* )
  2487                 if [ -f /etc/rc.d/${name_old} ]; then
  2488                     rm -f /etc/rc.d/${name_old}
  2489                 fi
  2490                 if [ ! -f /etc/rc.d/${name} ]; then
  2491                     #   install transfer script
  2492                     rm -f /etc/rc.d/${name} >/dev/null 2>&1
  2493                     ( echo "#!/bin/sh"
  2494                       echo "##"
  2495                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2496                       echo "##"
  2497                       echo ""
  2498                       echo "# PROVIDE: ${name}"
  2499                       echo "# REQUIRE: LOGIN"
  2500                       echo "# KEYWORD: shutdown"
  2501                       echo ""
  2502                       echo ". /etc/rc.subr"
  2503                       echo ""
  2504                       echo "name=\"openpkg_${name}\""
  2505                       echo "start_cmd=\"openpkg_rc_all start\""
  2506                       echo "stop_cmd=\"openpkg_rc_all stop\""
  2507                       echo "restart_cmd=\"openpkg_rc_all stop start\""
  2508                       echo ""
  2509                       echo "openpkg_rc_all () {"
  2510                       echo "    if [ -f ${prefix}/bin/openpkg ]; then"
  2511                       echo "        ${prefix}/bin/openpkg rc all \"\$@\""
  2512                       echo "    fi"
  2513                       echo "}"
  2514                       echo ""
  2515                       echo "load_rc_config \$name"
  2516                       echo "run_rc_command \"\$1\""
  2517                       echo ""
  2518                     ) >/etc/rc.d/${name}
  2519                     chmod 755 /etc/rc.d/${name}
  2520                 fi
  2521                 ;;
  2522             NetBSD/* )
  2523                 if [ -f /etc/rc.d/${name_old} ]; then
  2524                     rm -f /etc/rc.d/${name_old}
  2525                 fi
  2526                 if [ ! -f /etc/rc.d/${name} ]; then
  2527                     ( echo "#!/bin/sh"
  2528                       echo "##"
  2529                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2530                       echo "##"
  2531                       echo "##  PROVIDE: ${name}"
  2532                       echo "##  REQUIRE: DAEMON LOGIN NETWORK SERVERS"
  2533                       echo "##"
  2534                       echo ""
  2535                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2536                       echo "case \$1 in"
  2537                       echo "    start   ) exec ${prefix}/bin/openpkg rc all start ;;"
  2538                       echo "    stop    ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2539                       echo "    restart ) exec ${prefix}/bin/openpkg rc all stop start ;;"
  2540                       echo "    status  ) ;;"
  2541                       echo "esac"
  2542                     ) >/etc/rc.d/${name}
  2543                     chmod 755 /etc/rc.d/${name}
  2544                 fi
  2545                 ;;
  2546             Linux/* )
  2547                 if [ -f /etc/gentoo-release ]; then
  2548                     if [ -f /etc/init.d/${name_old} ]; then
  2549                         rm -f /etc/init.d/${name_old}
  2550                     fi
  2551                     if [ ! -f /etc/init.d/${name} ]; then
  2552                         #   install transfer script
  2553                         ( echo "#!/sbin/runscript"
  2554                           echo "##"
  2555                           echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2556                           echo "##"
  2557                           echo ""
  2558                           echo "depend() {"
  2559                           echo "    after *"
  2560                           echo "}"
  2561                           echo ""
  2562                           echo "checkconfig() {"
  2563                           echo "    [ -f ${prefix}/bin/openpkg ] || return 1"
  2564                           echo "    case $1 in"
  2565                           echo "        start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2566                           echo "        stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2567                           echo "    esac"
  2568                           echo "}"
  2569                           echo ""
  2570                           echo "start() {"
  2571                           echo "    checkconfig || return 1"
  2572                           echo "    ebegin "Starting OpenPKG ${prefix} hierarchy""
  2573                           echo "    exec ${prefix}/bin/openpkg rc all start"
  2574                           echo "    eend 0"
  2575                           echo "}"
  2576                           echo ""
  2577                           echo "stop() {"
  2578                           echo "    checkconfig || return 1"
  2579                           echo "    ebegin "Stopping OpenPKG ${prefix} hierarchy""
  2580                           echo "    exec ${prefix}/bin/openpkg rc all stop"
  2581                           echo "    eend 0"
  2582                           echo "}"
  2583                         ) >/etc/init.d/${name}
  2584                         chmod 755 /etc/init.d/${name}
  2585                         /sbin/rc-update add ${name} default
  2586                     fi
  2587                 elif [ -f /etc/redhat-release ]; then
  2588                     sroot=/etc/rc.d/init.d
  2589                     if [ ! -f $sroot/${name} ]; then
  2590                         #   install transfer script
  2591                         ( echo "#!/bin/sh"
  2592                           echo "##"
  2593                           echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2594                           echo "##"
  2595                           echo ""
  2596                           echo "# chkconfig: 2345 99 00"
  2597                           echo "# description: OpenPKG ${prefix}"
  2598                           echo ""
  2599                           echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2600                           echo "case \$1 in"
  2601                           echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2602                           echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2603                           echo "esac"
  2604                         ) >$sroot/${name}
  2605                         chmod 755 $sroot/${name}
  2606                         #   activate script
  2607                         /sbin/chkconfig --add ${name}
  2608                         /sbin/chkconfig ${name} on
  2609                     fi
  2610                 else
  2611                     #   sroot: script root directory
  2612                     #   lroot: link   root directory
  2613                     if [ -f /etc/debian_version ]; then
  2614                         sroot=/etc/init.d
  2615                         lroot=/etc/rc%%d.d
  2616                     elif [ -f /etc/mandrake-release ]; then
  2617                         sroot=/etc/rc.d/init.d
  2618                         lroot=/etc/rc.d/rc%%d.d
  2619                     elif [ -f /etc/SuSE-release ]; then
  2620                         sroot=/etc/init.d
  2621                         lroot=/etc/init.d/rc%%d.d
  2622                     elif [ -f /etc/slackware-version ]; then
  2623                         sroot=/etc/rc.d
  2624                         lroot=/etc/rc.d/rc%%d.d
  2625                         name="rc.${name}"
  2626                         for i in 0 1 2 3 4 5 6; do
  2627                             l=`echo $lroot | sed -e "s;%%d;$i;"`
  2628                             if [ ! -d $l ]; then
  2629                                 mkdir $l 2>&1 || true
  2630                             fi
  2631                         done
  2632                     else
  2633                         echo "WARNING: you are not running one of the supported standard" 1>&2
  2634                         echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)."   1>&2
  2635                         echo "WARNING: Guessing the location of the system init scripts!" 1>&2
  2636                         sroot=""
  2637                         lroot=""
  2638                         for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
  2639                             if [ -d $sr ]; then
  2640                                 sroot="$sr"
  2641                                 break
  2642                             fi
  2643                         done
  2644                         for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
  2645                             if [ -d $lr ]; then
  2646                                 lroot="`echo $lr | sed -e 's;2;%%d;'`"
  2647                                 break
  2648                             fi
  2649                         done
  2650                         if [ ".$sroot" = . -o ".$lroot" = . ]; then
  2651                             echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
  2652                             exit 1
  2653                         fi
  2654                     fi
  2655                     if [ -f $sroot/${name_old} ]; then
  2656                         rm -f $sroot/${name_old}
  2657                     fi
  2658                     if [ ! -f $sroot/${name} ]; then
  2659                         #   install transfer script
  2660                         ( echo "#!/bin/sh"
  2661                           echo "##"
  2662                           echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2663                           echo "##"
  2664                           echo ""
  2665                           echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2666                           echo "case \$1 in"
  2667                           echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2668                           echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2669                           echo "esac"
  2670                         ) >$sroot/${name}
  2671                         chmod 755 $sroot/${name}
  2672                         #   create corresponding symbolic links
  2673                         for i in 2 3 4 5; do
  2674                             ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/S99${name}
  2675                         done
  2676                         for i in 0 1 6; do
  2677                             ln -s $sroot/${name} `echo $lroot | sed -e "s;%%d;$i;"`/K00${name}
  2678                         done
  2679                     fi
  2680                 fi
  2681                 ;;
  2682             SunOS/5.* )
  2683                 if [ -f /etc/init.d/${name_old} ]; then
  2684                     rm -f /etc/init.d/${name_old}
  2685                 fi
  2686                 if [ ! -f /etc/init.d/${name} ]; then
  2687                     #   install transfer script
  2688                     ( echo "#!/bin/sh"
  2689                       echo "##"
  2690                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2691                       echo "##"
  2692                       echo ""
  2693                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2694                       echo "case \$1 in"
  2695                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2696                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2697                       echo "esac"
  2698                     ) >/etc/init.d/${name}
  2699                     chmod 755 /etc/init.d/${name}
  2700                     #   create corresponding symbolic links
  2701                     ( cd /etc
  2702                       ln init.d/${name} rc3.d/S99${name}
  2703                       ln init.d/${name} rc0.d/K00${name}
  2704                       ln init.d/${name} rc1.d/K00${name}
  2705                     ) || exit $?
  2706                 fi
  2707                 ;;
  2708             UnixWare/* )
  2709                 if [ -f /etc/init.d/${name_old} ]; then
  2710                     rm -f /etc/init.d/${name_old}
  2711                 fi
  2712                 if [ ! -f /etc/init.d/${name} ]; then
  2713                     #   install transfer script
  2714                     ( echo "#!/bin/sh"
  2715                       echo "##"
  2716                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2717                       echo "##"
  2718                       echo ""
  2719                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2720                       echo "case \$1 in"
  2721                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2722                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2723                       echo "esac"
  2724                     ) >/etc/init.d/${name}
  2725                     chmod 755 /etc/init.d/${name}
  2726                     #   create corresponding symbolic links
  2727                     ( cd /etc
  2728                       ln init.d/${name} rc2.d/S99${name}
  2729                       ln init.d/${name} rc0.d/K00${name}
  2730                       ln init.d/${name} rc1.d/K00${name}
  2731                     ) || exit $?
  2732                 fi
  2733                 ;;
  2734             AIX/* )
  2735                 if [ -f /etc/rc.d/init.d/${name_old} ]; then
  2736                     rm -f /etc/rc.d/init.d/${name_old}
  2737                 fi
  2738                 if [ ! -f /etc/rc.d/init.d/${name} ]; then
  2739                     #   install transfer script
  2740                     ( echo "#!/bin/sh"
  2741                       echo "##"
  2742                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2743                       echo "##"
  2744                       echo ""
  2745                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2746                       echo "case \$1 in"
  2747                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2748                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2749                       echo "esac"
  2750                     ) >/etc/rc.d/init.d/${name}
  2751                     chmod 755 /etc/rc.d/init.d/${name}
  2752                     #   create corresponding symbolic links
  2753                     ( cd /etc/rc.d
  2754                       ln -s ../init.d/${name} rc2.d/S99${name}
  2755                     ) || exit $?
  2756                 fi
  2757                 ;;
  2758             OSF1/V5.* )
  2759                 if [ -f /sbin/init.d/${name_old} ]; then
  2760                     rm -f /sbin/init.d/${name_old}
  2761                 fi
  2762                 if [ ! -f /sbin/init.d/${name} ]; then
  2763                     #   install transfer script
  2764                     ( echo "#!/bin/sh"
  2765                       echo "##"
  2766                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2767                       echo "##"
  2768                       echo ""
  2769                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2770                       echo "case \$1 in"
  2771                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2772                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2773                       echo "esac"
  2774                     ) >/sbin/init.d/${name}
  2775                     chmod 755 /sbin/init.d/${name}
  2776                     #   create corresponding symbolic links
  2777                     ( cd /sbin
  2778                       ln -s ../init.d/${name} rc3.d/S99${name}
  2779                       ln -s ../init.d/${name} rc0.d/K00${name}
  2780                     ) || exit $?
  2781                 fi
  2782                 ;;
  2783             HP-UX/* )
  2784                 if [ -f /sbin/init.d/${name_old} ]; then
  2785                     rm -f /sbin/init.d/${name_old}
  2786                 fi
  2787                 if [ ! -f /sbin/init.d/${name} ]; then
  2788                     #   install transfer script
  2789                     ( echo "#!/bin/sh"
  2790                       echo "##"
  2791                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2792                       echo "##"
  2793                       echo ""
  2794                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2795                       echo "case \$1 in"
  2796                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2797                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2798                       echo "esac"
  2799                     ) >/sbin/init.d/${name}
  2800                     chmod 755 /sbin/init.d/${name}
  2801                     #   create corresponding symbolic links
  2802                     ( cd /sbin
  2803                       ln -s ../init.d/${name} rc2.d/S900${name}
  2804                       ln -s ../init.d/${name} rc1.d/K100${name}
  2805                     ) || exit $?
  2806                 fi
  2807                 ;;
  2808             Darwin/* )
  2809                 if [ -d /Library/StartupItems/${name_old} ]; then
  2810                     rm -rf /Library/StartupItems/${name_old}
  2811                 fi
  2812                 darwin_rc_dir="/Library/StartupItems/${name}"
  2813                 if [ ! -d ${darwin_rc_dir} ]; then
  2814                     mkdir -p ${darwin_rc_dir}
  2815                 fi
  2817                 #   make sure hierarchy is activated in /etc/hostconfig
  2818                 #   FIXME: cs: simple and bad code here without any detection of existing entries
  2819                 darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
  2820                 echo "${darwin_rc_var}=-YES-" >>/etc/hostconfig
  2822                 #   install transfer script
  2823                 if [ ! -f ${darwin_rc_dir}/${name} ]; then
  2824                     rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
  2825                     ( echo "#!/bin/sh"
  2826                       echo "##"
  2827                       echo "##  ${darwin_rc_dir}/${name}"
  2828                       echo "##  -- startup transfer script for OpenPKG ${prefix} hierarchy"
  2829                       echo "##"
  2830                       echo ""
  2831                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2832                       echo ""
  2833                       echo ". /etc/rc.common"
  2834                       echo ""
  2835                       echo "if [ \"\${${darwin_rc_var}:=-NO-}\" = \"-YES-\" ]; then"
  2836                       echo "    ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
  2837                       echo "    ${prefix}/bin/openpkg rc all start"
  2838                       echo "fi"
  2839                     ) >${darwin_rc_dir}/${name}
  2840                     chmod 755 ${darwin_rc_dir}/${name}
  2841                 fi
  2843                 #   install startup parameter list
  2844                 if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
  2845                     rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
  2846                     ( echo "{"
  2847                       echo "  Description     = \"OpenPKG ${prefix} hierarchy\";"
  2848                       echo "  Provides        = (\"OpenPKG ${prefix}\");"
  2849                       echo "  Requires        = (\"Disks\", \"Network Configuration\", \"Resolver\");"
  2850                       echo "  Uses            = (\"Cron\");"
  2851                       echo "  OrderPreference = \"Last\";"
  2852                       echo "  Messages ="
  2853                       echo "  {"
  2854                       echo "    start = \"Starting OpenPKG ${prefix} hierarchy\";"
  2855                       echo "    stop  = \"Stopping OpenPKG ${prefix} hierarchy\";"
  2856                       echo "  };"
  2857                       echo "}"
  2858                     ) >${darwin_rc_dir}/StartupParameters.plist
  2859                     chmod 644 ${darwin_rc_dir}/StartupParameters.plist
  2860                 fi
  2861                 ;;
  2862             IRIX*/6.* )
  2863                 if [ -f /etc/init.d/${name_old} ]; then
  2864                     rm -f /etc/init.d/${name_old}
  2865                 fi
  2866                 if [ ! -f /etc/init.d/${name} ]; then
  2867                     #   install transfer script
  2868                     ( echo "#!/bin/sh"
  2869                       echo "##"
  2870                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2871                       echo "##"
  2872                       echo ""
  2873                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2874                       echo "case \$1 in"
  2875                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2876                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2877                       echo "esac"
  2878                     ) >/etc/init.d/${name}
  2879                     chmod 755 /etc/init.d/${name}
  2880                     #   create corresponding links
  2881                     ( cd /etc
  2882                       ln -f init.d/${name} rc2.d/S99${name}
  2883                       ln -f init.d/${name} rc0.d/K00${name}
  2884                     ) || exit $?
  2885                 fi
  2886                 ;;
  2887             CYGWIN*/* )
  2888                 if [ -f /etc/rc.d/init.d/${name_old} ]; then
  2889                     rm -f /etc/rc.d/init.d/${name_old}
  2890                 fi
  2891                 if [ ! -f /etc/rc.d/init.d/${name} ]; then
  2892                     #   install transfer script
  2893                     ( echo "#!/bin/sh"
  2894                       echo "##"
  2895                       echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  2896                       echo "##"
  2897                       echo ""
  2898                       echo "test -f /etc/rc.d/init.d/functions && . /etc/rc.d/init.d/functions"
  2899                       echo "test -f /etc/sysconfig/network && . /etc/sysconfig/network"
  2900                       echo "[ ! -f ${prefix}/bin/openpkg ] && exit 0"
  2901                       echo "case \$1 in"
  2902                       echo "    start ) exec ${prefix}/bin/openpkg rc all start ;;"
  2903                       echo "    stop  ) exec ${prefix}/bin/openpkg rc all stop  ;;"
  2904                       echo "esac"
  2905                     ) >/etc/rc.d/init.d/${name}
  2906                     chmod 755 /etc/rc.d/init.d/${name}
  2907                     #   create corresponding symbolic links
  2908                     ( cd /etc/rc.d
  2909                       ln -s ../init.d/${name} rc2.d/S90${name}
  2910                       ln -s ../init.d/${name} rc1.d/K10${name}
  2911                     ) || exit $?
  2912                 fi
  2913                 ;;
  2914         esac
  2915     fi
  2917     #   create the cron transfer entries
  2918     if [ ".$cusr" != ".root" ]; then
  2919         echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
  2920         echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  2921     else
  2922         case "$plid" in
  2923             FreeBSD/* | Linux/* )
  2924                 if [ -f /etc/slackware-version ]; then
  2925                     exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
  2926                     if [ ".$exists" = . ]; then
  2927                         EDITOR=/tmp/vipw.$$
  2928                         VISUAL="$EDITOR"
  2929                         export EDITOR
  2930                         export VISUAL
  2931                         ( echo "#!/bin/sh"
  2932                           echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
  2933                           echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
  2934                           echo "    echo \"0          0  1  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
  2935                           echo "    echo \"0          0  *  *  0  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
  2936                           echo "    echo \"0          0  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
  2937                           echo "    echo \"0          *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
  2938                           echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
  2939                           echo "    echo \"# </OpenPKG>\""
  2940                           echo ") >>\$1"
  2941                         ) >$EDITOR
  2942                         chmod a+x $EDITOR
  2943                         ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  2944                         rm -f $EDITOR
  2945                     fi
  2946                 else
  2947                     exists=`egrep "($prefix/bin/openpkg|$prefix/etc/rc)" /etc/crontab`
  2948                     if [ ".$exists" = . ]; then
  2949                         ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
  2950                           echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
  2951                           echo "0    0  1  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
  2952                           echo "0    0  *  *  0  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
  2953                           echo "0    0  *  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
  2954                           echo "0    *  *  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
  2955                           echo "*/15 *  *  *  *  root  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
  2956                           echo "# </OpenPKG>"
  2957                         ) >>/etc/crontab
  2958                     fi
  2959                 fi
  2960                 ;;
  2961             SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
  2962                 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
  2963                 if [ ".$exists" = . ]; then
  2964                     EDITOR=/tmp/vipw.$$
  2965                     VISUAL="$EDITOR"
  2966                     export EDITOR
  2967                     export VISUAL
  2968                     ( echo "#!/bin/sh"
  2969                       echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
  2970                       echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
  2971                       echo "    echo \"0          0  1  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly\""
  2972                       echo "    echo \"0          0  *  *  0  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly\""
  2973                       echo "    echo \"0          0  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily\""
  2974                       echo "    echo \"0          *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly\""
  2975                       echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly\""
  2976                       echo "    echo \"# </OpenPKG>\""
  2977                       echo ") >>\$1"
  2978                     ) >$EDITOR
  2979                     chmod a+x $EDITOR
  2980                     ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  2981                     rm -f $EDITOR
  2982                 fi
  2983                 ;;
  2984             IRIX*/6.* )
  2985                 exists=`crontab -l | egrep "($prefix/bin/openpkg|$prefix/etc/rc)"`
  2986                 if [ ".$exists" = . ]; then
  2987                     ( crontab -l
  2988                       echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
  2989                       echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
  2990                       echo "0          0  1  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron monthly"
  2991                       echo "0          0  *  *  0  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron weekly"
  2992                       echo "0          0  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron daily"
  2993                       echo "0          *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron hourly"
  2994                       echo "0,15,30,45 *  *  *  *  [ -f ${prefix}/bin/openpkg ] && ${prefix}/bin/openpkg rc cron quarterly"
  2995                       echo "# </OpenPKG>"
  2996                     ) | /usr/bin/crontab || exit $?
  2997                 fi
  2998                 ;;
  2999         esac
  3000     fi
  3002     #   remember what OpenPKG RPM version was installed, so we can
  3003     #   correctly upgrade the RPM database in the %post section (see below).
  3004     if [ -d ${prefix}/RPM/DB ]; then
  3005         if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
  3006             #   OpenPKG >= 2.0
  3007             rpm="${prefix}/bin/openpkg rpm"
  3008         else
  3009             #   OpenPKG 1.x
  3010             rpm="${prefix}/bin/rpm"
  3011         fi
  3012         rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
  3013         $rpm --version 2>/dev/null |\
  3014             sed -e 's;^;X;' \
  3015                 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  3016                 -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  3017                 -e 's;^X.*$;0.0;' \
  3018                 >${prefix}/RPM/DB/.version
  3019     fi
  3021 %post
  3022     #   optional post-processing from "pre" section
  3023     if [ -f %{l_prefix}.pre-post-process.sh ]; then
  3024         sh %{l_prefix}.pre-post-process.sh
  3025         rm -f %{l_prefix}.pre-post-process.sh
  3026     fi
  3028     #   update or initially create OpenPKG UUID configuration
  3029     %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
  3031     #   when upgrading from RPM 4 to RPM 5 there will be no
  3032     #   initial license at all, so create one
  3033     if [ ! -f %{l_prefix}/etc/openpkg/license ]; then
  3034         echo "BOOT" >%{l_prefix}/etc/openpkg/license
  3035         ( chown %{l_musr}:%{l_mgrp} %{l_prefix}/etc/openpkg/license
  3036           chmod 644 %{l_prefix}/etc/openpkg/license
  3037         ) >/dev/null 2>&1 || true
  3038     fi
  3040     #   finally switch from a possibly active BOOT license to EVAL license
  3041     #   (notice: this is really the earliest time we can switch because the
  3042     #   previous command had to create the <prefix>/etc/openpkg/uuid first!)
  3043     if [ ".`cat %{l_prefix}/etc/openpkg/license`" = ".BOOT" ]; then
  3044         echo "EVAL" >%{l_prefix}/etc/openpkg/license
  3045     fi
  3047     #   determine new and old OpenPKG RPM version
  3048     V_rpm_new="%{V_rpm_major}.%{V_rpm_minor}"
  3049     if [ -f %{l_prefix}/RPM/DB/.version ]; then
  3050         V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
  3051         rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
  3052     else
  3053         V_rpm_old="0.0"
  3054     fi
  3056     #   make sure all RPM database files are present and that their
  3057     #   attributes are correct, etc. This is not a database rebuild
  3058     #   operation, so this is fully harmless and can be done always.
  3059     %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate >/dev/null 2>&1 || true
  3061     #   check RPM database for upgrade requirements
  3062     if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
  3063         #   RPM 4.0/4.1 does not allow concurrent database access, so we
  3064         #   cannot upgrade the database immediately from here (because
  3065         #   we are still running within the execution context of the
  3066         #   old RPM which in turn has the database locked) and instead
  3067         #   have to just drop a note to the administrator about database
  3068         #   upgrading. RPM >= 4.2 in general allows concurrent database
  3069         #   access, but the whole stuff is too risky here, too.
  3070         ( echo "You are upgrading the OpenPKG bootstrap from a previous"
  3071           echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
  3072           echo "version. The RPM database in %{l_prefix}/RPM/DB/ can be"
  3073           echo "reused, but you first have to upgrade it as soon as"
  3074           echo "possible to the latest format files by executing:"
  3075           echo "    \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
  3076           echo "In case of problems with the RPM database you can always"
  3077           echo "execute the command:"
  3078           echo "    \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
  3079         ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
  3080     fi
  3082     #   system command overriding support
  3083     #   ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
  3084     #   BUILD COMMAND OVERRIDE SOLUTION!
  3085     if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
  3086         mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
  3087     fi
  3088     chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
  3089     case "`cat %{l_prefix}/etc/openpkg/platform`" in
  3090         *-*-debian* | *-*-ubuntu* )
  3091             #   FIXME: Evil hack to workaround build problems under Debian
  3092             #   (at least 3.1) (and similar platforms) where a Debian
  3093             #   install-info(8) exists which is both API and functionally
  3094             #   incompatible to the de-facto standardized install-info(8)
  3095             #   command from GNU Texinfo.
  3096             if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
  3097                 ( echo "#!/bin/sh"
  3098                   echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
  3099                   echo "exit 0"
  3100                 ) >%{l_prefix}/lib/openpkg/override/install-info
  3101                 chmod 775 %{l_prefix}/lib/openpkg/override/install-info
  3102             fi
  3103             ;;
  3104         *-*-macosx* | *-*-darwin* )
  3105             #   FIXME: Evil hack to workaround the fact that Mac OS X'
  3106             #   linker by default prefers the /usr/lib libraries and does
  3107             #   not honor the -L options the way one would expect it.
  3108             gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
  3109             cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
  3110             ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
  3111             if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
  3112                 ( echo "#!/bin/sh"
  3113                   echo "case \" \$* \" in"
  3114                   echo "    *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
  3115                   echo "    * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
  3116                   echo "esac"
  3117                 ) >%{l_prefix}/lib/openpkg/override/gcc
  3118                 chmod 775 %{l_prefix}/lib/openpkg/override/gcc
  3119             fi
  3120             if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
  3121                 ( echo "#!/bin/sh"
  3122                   echo "case \" \$* \" in"
  3123                   echo "    *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
  3124                   echo "    * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
  3125                   echo "esac"
  3126                 ) >%{l_prefix}/lib/openpkg/override/cc
  3127                 chmod 775 %{l_prefix}/lib/openpkg/override/cc
  3128             fi
  3129             if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
  3130                 ( echo "#!/bin/sh"
  3131                   echo "exec $ld -search_paths_first \"\$@\""
  3132                 ) >%{l_prefix}/lib/openpkg/override/ld
  3133                 chmod 775 %{l_prefix}/lib/openpkg/override/ld
  3134             fi
  3135             ;;
  3136     esac
  3138     #   special support for fully unprivileged environments
  3139     #   where we cannot switch the user at all with su(1),
  3140     #   so we provide a dummy su(1) override command.
  3141     if [ ".%{l_unprivileged}" = ".yes" ]; then
  3142         ( echo "#!/bin/sh"
  3143           echo "while [ \$# -gt 0 ]; do"
  3144           echo "    case \"\$1\" in"
  3145           echo "        - | -* ) shift        ;;"
  3146           echo "        *      ) shift; break ;;"
  3147           echo "    esac"
  3148           echo "done"
  3149           echo "exec /bin/sh \${1+\"\$@\"}"
  3150         ) >%{l_prefix}/lib/openpkg/override/su
  3151         chmod 775 %{l_prefix}/lib/openpkg/override/su
  3152     fi
  3154     #   FIXME: hack to workaround problems in environments with too few
  3155     #   development tools. ATTENTION: see one paragraph above.
  3156     if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
  3157         mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
  3158     fi
  3159     chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
  3161     #   cruel platform hack
  3162     case "`cat %{l_prefix}/etc/openpkg/platform`" in
  3163         *-*-cygwin* )
  3164             #   Cygwin under Windows Vista dislikes executables with
  3165             #   "patch" in the same and would require a "*.manifest"
  3166             #   file applied with the "mt.exe" from the "Windows
  3167             #   Software Development Kit (SDK)" in order to escape from
  3168             #   UAC. An easy alternative is to just rename the file to a
  3169             #   different name.
  3170             cp  %{l_prefix}/lib/openpkg/patch \
  3171                 %{l_prefix}/lib/openpkg/pitch
  3172             %{l_prefix}/lib/openpkg/shtool subst \
  3173                 -e 's;openpkg/patch;openpkg/pitch;g' \
  3174                 %{l_prefix}/etc/openpkg/rpmmacros
  3175             ;;
  3176     esac
  3178     #   print license
  3179     ( echo ""
  3180       echo "NOTICE: Proprietary components of the OpenPKG Framework are covered"
  3181       echo "by the following terms and conditions and require a valid run-time"
  3182       echo "license, issued by the OpenPKG GmbH. An initial license, which allows"
  3183       echo "30 days of free use for evaluation purposes, is already pre-installed."
  3184       echo "Please go to http://openpkg.com/go/framework-license to obtain"
  3185       echo "your permanent license."
  3186       echo ""
  3187       %{l_prefix}/bin/openpkg --license
  3188       echo "______________________________________________________________________________"
  3189       echo ""
  3190       echo "NOTICE: Open Source components of the OpenPKG Framework are covered"
  3191       echo "by various standard Open Source distribution licenses, including"
  3192       echo "the MIT, BSD, LGPL, GPL, Public-Domain and Artistic licenses."
  3193       echo "They all allow you the use of those components free of charge."
  3194       echo "See http://www.opensource.org/licenses for more details."
  3195       echo ""
  3196     ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
  3198     #   register package with central OpenPKG registry
  3199     ( nohup %{l_prefix}/bin/openpkg register \
  3200       </dev/null >/dev/null 2>&1 &
  3201     ) </dev/null >/dev/null 2>&1 || true
  3203 %preun
  3204     [ ".$1" != .0 ] && exit 0
  3206     #   remove override files
  3207     if [ -d %{l_prefix}/lib/openpkg/override ]; then
  3208         rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
  3209     fi
  3211     #   remove fallback files
  3212     if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
  3213         rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
  3214     fi
  3216     #   remove files which are not RPM controlled
  3217     rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
  3218     rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
  3219     rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
  3220     rm -rf %{l_prefix}/RPM/TR/*  %{l_prefix}/RPM/TR/.[a-z]*  >/dev/null 2>&1 || true
  3221     rm -rf %{l_prefix}/RPM/DB/*  %{l_prefix}/RPM/DB/.[a-z]*  >/dev/null 2>&1 || true
  3223     #   The following code usually would be done in a %postun section.
  3224     #   But because we already had to remove the database in this %preun
  3225     #   section (see the 'rm' commands above) in order to make RPM happy
  3226     #   inside its own removal procedure, RPM would no longer find the
  3227     #   %postun script (because it's recorded in the database files). So
  3228     #   we have to perform the procedure already in this %preun script.
  3229     #   except for the removal of the top-level directory it does not
  3230     #   matter. But the top-level directory can only be removed after
  3231     #   the RPM removal procedure took place, so we play a little delay
  3232     #   trick below.
  3234     #   determine current user
  3235     cusr=`(id -un) 2>/dev/null ||\
  3236           (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  3237           (whoami) 2>/dev/null ||\
  3238           (who am i | cut "-d " -f1) 2>/dev/null ||\
  3239           echo $LOGNAME`
  3241     #   determine runtime details (for both inside and outside RPM!!)
  3242     user="%{l_musr}"
  3243     group="%{l_mgrp}"
  3244     prefix="%{l_prefix}"
  3245     prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  3247     #   determine platform id
  3248     s=`(uname -s) 2>/dev/null` || s='Unknown'
  3249     r=`(uname -r) 2>/dev/null` || r='0.0'
  3250     plid="${s}/${r}"
  3252     #   unregister instance in presence file
  3253     presence="/etc/openpkg"
  3254     exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
  3255     if [ ".$exists" != . ]; then
  3256         if [ ".$cusr" != ".root" ]; then
  3257             echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
  3258             echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  3259         else
  3260             cp $presence $presence.bak && \
  3261             egrep -v "^ *${prefix} *\$" $presence.bak >$presence
  3262             rm -f $presence.bak >/dev/null 2>&1
  3263             if [ ".`cat $presence`" = . ]; then
  3264                 rm -f $presence >/dev/null 2>&1
  3265             fi
  3266         fi
  3267     fi
  3269     #   remove entry in /etc/shells
  3270     shell="${prefix}/lib/openpkg/bash"
  3271     exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
  3272     if [ ".$exists" != . ]; then
  3273         if [ ".$cusr" != ".root" ]; then
  3274             echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
  3275             echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  3276         else
  3277             cp /etc/shells /etc/shells.bak && \
  3278             grep -v "^${shell}" /etc/shells.bak >/etc/shells
  3279             rm -f /etc/shells.bak >/dev/null 2>&1
  3280         fi
  3281     fi
  3283     #   remove the hierarchy user/group
  3284     for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
  3285                "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
  3286                "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
  3287                "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
  3288         #   split request into class/usr/uid/grp/gid
  3289         OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
  3290         class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
  3292         #   check whether user already exists
  3293         exists=`(getent passwd "$usr"; \
  3294                  grep "^$usr:" /etc/passwd; \
  3295                  ypmatch "$usr" passwd; \
  3296                  nismatch "$usr" passwd; \
  3297                  nidump passwd . | grep "^$usr:"; \
  3298                  dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \
  3299                  sed -e 'q'`
  3300         if [ ".$exists" != . ]; then
  3301             if [ ".$cusr" != ".root" ]; then
  3302                 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
  3303                 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  3304             elif [ ".$usr" = ".root" ]; then
  3305                 echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
  3306                 echo "openpkg:WARNING: (would remove system standard user)" 1>&2
  3307             else
  3308                 case "$plid" in
  3309                     FreeBSD/* | NetBSD/* )
  3310                         cp /etc/master.passwd /etc/master.passwd.bak && \
  3311                         grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
  3312                         ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
  3313                         rm -f /etc/master.passwd.bak >/dev/null 2>&1
  3314                         ;;
  3315                     Linux/* | SunOS/5.* | UnixWare/* )
  3316                         cp /etc/passwd /etc/passwd.bak && \
  3317                         grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  3318                         ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
  3319                         rm -f /etc/passwd.bak >/dev/null 2>&1
  3320                         ;;
  3321                     AIX/* )
  3322                         rmuser -p "${usr}"
  3323                         cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
  3324                         sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
  3325                             </etc/security/login.cfg.bak >/etc/security/login.cfg && \
  3326                         rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
  3327                         ;;
  3328                     OSF1/V5.* )
  3329                         cp /etc/passwd /etc/passwd.bak && \
  3330                         grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  3331                         ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
  3332                         rm -f /etc/passwd.bak >/dev/null 2>&1
  3333                         ;;
  3334                     HP-UX/* )
  3335                         cp /etc/passwd /etc/passwd.bak && \
  3336                         grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  3337                         rm -f /etc/passwd.bak >/dev/null 2>&1
  3338                         ;;
  3339                     Darwin/10.[1-9]* | Darwin/1[1-9].* )
  3340                         dscl . -delete "/users/${usr}"
  3341                         ;;
  3342                     Darwin/* )
  3343                         niutil -destroy . "/users/${usr}"
  3344                         ;;
  3345                     IRIX*/6.* )
  3346                         cp /etc/passwd /etc/passwd.bak && \
  3347                         grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  3348                         if   [ -f /etc/shadow ]
  3349                         then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
  3350                         fi
  3351                         rm -f /etc/passwd.bak >/dev/null 2>&1
  3352                         ;;
  3353                     CYGWIN*/* )
  3354                         cp /etc/passwd /etc/passwd.bak && \
  3355                         grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  3356                         rm -f /etc/passwd.bak >/dev/null 2>&1
  3357                         ;;
  3358                 esac
  3359             fi
  3360         fi
  3362         #   check whether group already exists
  3363         exists=`(getent group "$grp"; \
  3364                 grep "^$grp:" /etc/group; \
  3365                 ypmatch "$grp" group; \
  3366                 nismatch "$grp" group; \
  3367                 nidump group . | grep "^$grp:"; \
  3368                 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \
  3369                 sed -e 'q'`
  3370         if [ ".$exists" != . ]; then
  3371             if [ ".$cusr" != ".root" ]; then
  3372                 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
  3373                 echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  3374             elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
  3375                 echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
  3376                 echo "openpkg:WARNING: (would remove system standard group)" 1>&2
  3377             else
  3378                 case "$plid" in
  3379                     Darwin/10.[1-9]* | Darwin/1[1-9].* )
  3380                         dscl . -delete "/groups/${grp}"
  3381                         ;;
  3382                     Darwin/* )
  3383                         niutil -destroy . "/groups/${grp}"
  3384                         ;;
  3385                     AIX/* )
  3386                         rmgroup "${grp}"
  3387                         ;;
  3388                     * )
  3389                         cp /etc/group /etc/group.bak && \
  3390                         grep -v "^${grp}:" /etc/group.bak >/etc/group
  3391                         rm -f /etc/group.bak >/dev/null 2>&1
  3392                         ;;
  3393                 esac
  3394             fi
  3395         fi
  3396     done
  3398     #   invalidate passwd and group tables from Name Service Cache Daemon to
  3399     #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
  3400     if [ -x /usr/sbin/nscd ]; then
  3401         /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
  3402         /usr/sbin/nscd -i group >/dev/null 2>&1 || true
  3403     fi
  3405     #   remove the startup/shutdown transfer scripts
  3406     name=`echo "$prefix" | sed -e 's;/;;g'`
  3407     if [ ".$cusr" != ".root" ]; then
  3408         echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
  3409         echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  3410     else
  3411         case "$plid" in
  3412             FreeBSD/* )
  3413                 rm -f /etc/rc.d/${name} >/dev/null 2>&1
  3414                 ;;
  3415             NetBSD/* )
  3416                 rm -f /etc/rc.d/${name} >/dev/null 2>&1
  3417                 ;;
  3418             Linux/* )
  3419                 if [ -f /etc/gentoo-release ]; then
  3420                     /sbin/rc-update del ${name} >/dev/null 2>&1
  3421                     rm -f /etc/init.d/${name}   >/dev/null 2>&1
  3422                 elif [ -f /etc/redhat-release ]; then
  3423                     /sbin/chkconfig ${name} off    >/dev/null 2>&1
  3424                     /sbin/chkconfig --del ${name}  >/dev/null 2>&1
  3425                     rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
  3426                 else
  3427                     #   sroot: script root directory
  3428                     #   lroot: link   root directory
  3429                     if [ -f /etc/debian_version ]; then
  3430                         sroot=/etc/init.d
  3431                         lroot=/etc/rc%%d.d
  3432                     elif [ -f /etc/mandrake-release ]; then
  3433                         sroot=/etc/rc.d/init.d
  3434                         lroot=/etc/rc.d/rc%%d.d
  3435                     elif [ -f /etc/SuSE-release ]; then
  3436                         sroot=/etc/init.d
  3437                         lroot=/etc/init.d/rc%%d.d
  3438                     elif [ -f /etc/slackware-version ]; then
  3439                         sroot=/etc/rc.d
  3440                         lroot=/etc/rc.d/rc%%d.d
  3441                         name="rc.${name}"
  3442                     else
  3443                         echo "WARNING: you are not running one of the supported standard" 1>&2
  3444                         echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)."   1>&2
  3445                         echo "WARNING: Guessing the location of the system init scripts!" 1>&2
  3446                         sroot=""
  3447                         lroot=""
  3448                         for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
  3449                             if [ -d $sr ]; then
  3450                                 sroot="$sr"
  3451                                 break
  3452                             fi
  3453                         done
  3454                         for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
  3455                             if [ -d $lr ]; then
  3456                                 lroot="`echo $lr | sed -e 's;2;%%d;'`"
  3457                                 break
  3458                             fi
  3459                         done
  3460                         if [ ".$sroot" = . -o ".$lroot" = . ]; then
  3461                             echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
  3462                             exit 1
  3463                         fi
  3464                     fi
  3465                     rm -f ${sroot}/${name} >/dev/null 2>&1
  3466                     for i in 2 3 4 5; do
  3467                         rm -f `echo $lroot | sed -e "s;%%d;$i;"`/S99${name} >/dev/null 2>&1
  3468                     done
  3469                     for i in 0 1 6; do
  3470                         rm -f `echo $lroot | sed -e "s;%%d;$i;"`/K00${name} >/dev/null 2>&1
  3471                     done
  3472                     if [ -f /etc/slackware-version ]; then
  3473                         for i in 0 1 2 3 4 5 6; do
  3474                             l=`echo $lroot | sed -e "s;%%d;$i;"`
  3475                             if [ -d $l ]; then
  3476                                 rmdir $l >/dev/null 2>&1 || true
  3477                             fi
  3478                         done
  3479                     fi
  3480                 fi
  3481                 ;;
  3482             SunOS/5.* )
  3483                 rm -f /etc/init.d/${name} >/dev/null 2>&1
  3484                 rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
  3485                 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  3486                 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
  3487                 ;;
  3488             UnixWare/* )
  3489                 rm -f /etc/init.d/${name} >/dev/null 2>&1
  3490                 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
  3491                 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  3492                 rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
  3493                 ;;
  3494             AIX/* )
  3495                 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
  3496                 rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
  3497                 ;;
  3498             OSF1/V5.* )
  3499                 rm -f /sbin/init.d/${name} >/dev/null 2>&1
  3500                 rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
  3501                 rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
  3502                 ;;
  3503             HP-UX/* )
  3504                 rm -f /sbin/init.d/${name} >/dev/null 2>&1
  3505                 rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
  3506                 rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
  3507                 ;;
  3508             Darwin/* )
  3509                 darwin_rc_var="`echo ${name} | sed -e 's;-;_;g' | tr '[a-z]' '[A-Z]'`"
  3510                 cp /etc/hostconfig /etc/hostconfig.bak && \
  3511                 grep -v "^${darwin_rc_var}=" /etc/hostconfig.bak >/etc/hostconfig
  3512                 rm -f /etc/hostconfig.bak >/dev/null 2>&1
  3513                 rm -rf /Library/StartupItems/${name} >/dev/null 2>&1
  3514                 ;;
  3515             IRIX*/6.* )
  3516                 rm -f /etc/init.d/${name} >/dev/null 2>&1
  3517                 rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
  3518                 rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  3519                 ;;
  3520             CYGWIN*/* )
  3521                 rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
  3522                 rm -f /etc/rc.d/rc2.d/S90${name} >/dev/null 2>&1
  3523                 rm -f /etc/rc.d/rc1.d/K10${name} >/dev/null 2>&1
  3524                 ;;
  3525         esac
  3526     fi
  3528     #   remove the cron transfer entries
  3529     if [ ".$cusr" != ".root" ]; then
  3530         echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
  3531         echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  3532     else
  3533         case "$plid" in
  3534             FreeBSD/* | Linux/* )
  3535                 if [ -f /etc/slackware-version ]; then
  3536                     EDITOR=/tmp/vipw.$$
  3537                     VISUAL="$EDITOR"
  3538                     export EDITOR
  3539                     export VISUAL
  3540                     p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
  3541                     ( echo "cp \$1 \$1.bak"
  3542                       echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
  3543                       echo "rm -f \$1.bak"
  3544                     ) >$EDITOR
  3545                     chmod a+x $EDITOR
  3546                     ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  3547                     rm -f $EDITOR
  3548                 else
  3549                     exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
  3550                     if [ ".$exists" != . ]; then
  3551                         p=`echo $prefix | sed -e 's;/;\\\\/;g'`
  3552                         cp /etc/crontab /etc/crontab.bak
  3553                         cat /etc/crontab.bak |\
  3554                         sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
  3555                         >/etc/crontab
  3556                         rm -f /etc/crontab.bak >/dev/null 2>&1
  3557                     fi
  3558                 fi
  3559                 ;;
  3560             SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* | CYGWIN*/* | Darwin/* )
  3561                 EDITOR=/tmp/vipw.$$
  3562                 VISUAL="$EDITOR"
  3563                 export EDITOR
  3564                 export VISUAL
  3565                 p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
  3566                 ( echo "cp \$1 \$1.bak"
  3567                   echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
  3568                   echo "rm -f \$1.bak"
  3569                 ) >$EDITOR
  3570                 chmod a+x $EDITOR
  3571                 ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  3572                 rm -f $EDITOR
  3573                 ;;
  3574             IRIX*/6.* )
  3575                 p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
  3576                 ( crontab -l |
  3577                   sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
  3578                 ) | /usr/bin/crontab || exit $?
  3579                 ;;
  3580         esac
  3581     fi
  3583     #   delayed removal of top-level directory.
  3584     ( sleep 2
  3585       rm -rf %{l_prefix}/RPM/PKG/* >/dev/null 2>&1 || true
  3586       rm -rf %{l_prefix}/RPM/SRC/* >/dev/null 2>&1 || true
  3587       rm -rf %{l_prefix}/RPM/CACHE/* >/dev/null 2>&1 || true
  3588       rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
  3589       rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
  3590       rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
  3591       rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
  3592       rmdir %{l_prefix} >/dev/null 2>&1 || true
  3593     ) </dev/null >/dev/null 2>/dev/null &

mercurial