openpkg/openpkg.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 570
d7167d2b16f4
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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

mercurial