openpkg/openpkg.spec

Wed, 01 Aug 2012 23:56:04 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 01 Aug 2012 23:56:04 +0200
changeset 438
3e6a6a3025fe
parent 437
b9d4495f105f
child 439
085c98460a58
permissions
-rw-r--r--

Remove nonportable compiler parameter from libarchive buildconf.

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

mercurial