openpkg/openpkg.spec

Thu, 02 Aug 2012 00:01:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 02 Aug 2012 00:01:34 +0200
changeset 439
085c98460a58
parent 438
3e6a6a3025fe
child 440
6a2e97ed1f86
permissions
-rw-r--r--

Use upstream man pages to avoid local help2man failures, likely due to
shell capability assumptions or cross platform environment variance.
The upstream man pages are probably better formatted anyway.

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

mercurial