openpkg/openpkg.spec

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

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

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

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

mercurial