openpkg/openpkg.spec

changeset 13
cb59d6afeb61
child 14
0cd2ee160ef5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/openpkg.spec	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,2827 @@
     1.4 +##
     1.5 +##  openpkg.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     1.8 +##
     1.9 +##  Permission to use, copy, modify, and distribute this software for
    1.10 +##  any purpose with or without fee is hereby granted, provided that
    1.11 +##  the above copyright notice and this permission notice appear in all
    1.12 +##  copies.
    1.13 +##
    1.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.25 +##  SUCH DAMAGE.
    1.26 +##
    1.27 +
    1.28 +#   NOTICE: This OpenPKG RPM specification is _very_ special, because
    1.29 +#   it is used both for bootstrapping OpenPKG with its OpenPKG RPM and
    1.30 +#   for regular builds of OpenPKG RPM in order to upgrade an existing
    1.31 +#   installation. For this it has to interact correctly with the
    1.32 +#   "openpkg.boot" script. See the documentation in the file "README"
    1.33 +#   and the source of the companion script "openpkg.boot" for details,
    1.34 +#   but do not touch anything here until you are 100% sure about what
    1.35 +#   you are doing. In short: This script is allowed to use only a very
    1.36 +#   restricted subset of the OpenPKG RPM functionality!
    1.37 +
    1.38 +#   BUILD REQUIREMENTS:
    1.39 +#   o any sh(1)
    1.40 +#   o any tar(1)
    1.41 +#   o any make(1)
    1.42 +#   o any cc(1)
    1.43 +
    1.44 +#   the package version/release
    1.45 +%define       V_openpkg  20071227
    1.46 +
    1.47 +#   the used software versions
    1.48 +%define       V_rpm      4.2.1
    1.49 +%define       V_zlib     1.2.3
    1.50 +%define       V_bzip2    1.0.4
    1.51 +%define       V_beecrypt 4.1.2
    1.52 +%define       V_curl     7.17.1
    1.53 +%define       V_make     3.81
    1.54 +%define       V_gzip     1.3.12
    1.55 +%define       V_gzip_r   1.13
    1.56 +%define       V_patch    2.5.9
    1.57 +%define       V_tar      1.19
    1.58 +%define       V_bash     3.2
    1.59 +%define       V_uuid     1.6.0
    1.60 +%define       V_config   20060923
    1.61 +%define       V_registry 1.1.3
    1.62 +%define       V_perl     5.10.0
    1.63 +%define       V_openssl  0.9.8g
    1.64 +%define       V_tools    1.4.5
    1.65 +%define       V_exec     2.0.1-C
    1.66 +
    1.67 +#   package information
    1.68 +Name:         openpkg
    1.69 +Summary:      OpenPKG Bootstrap
    1.70 +URL:          http://www.openpkg.org/
    1.71 +Vendor:       OpenPKG
    1.72 +Packager:     OpenPKG Foundation e.V.
    1.73 +Distribution: OpenPKG Community
    1.74 +Class:        CORE
    1.75 +Group:        Bootstrapping
    1.76 +License:      MIT/BSD/LGPL/GPL
    1.77 +Version:      %{V_openpkg}
    1.78 +Release:      %{V_openpkg}
    1.79 +
    1.80 +#   list of sources
    1.81 +Source0:      ftp://alpha.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
    1.82 +Source1:      ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz
    1.83 +Source2:      ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
    1.84 +Source3:      ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
    1.85 +Source4:      ftp://ftp.openpkg.org/sources/CPY/config/config-%{V_config}.tar.gz
    1.86 +Source5:      ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/openpkg-registry-%{V_registry}.tar.gz
    1.87 +Source6:      ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/openpkg-tools-%{V_tools}.tar.gz
    1.88 +Source7:      ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar
    1.89 +Source8:      ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}.tar
    1.90 +Source9:      ftp://ftp.openpkg.org/sources/CPY/openpkg/openpkg-executable-%{V_exec}.tar.gz
    1.91 +Source10:     ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
    1.92 +Source11:     ftp://ftp.openpkg.org/sources/CPY/perl/perl-%{V_perl}-mini.tar.gz
    1.93 +Source12:     ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
    1.94 +Source13:     ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
    1.95 +Source14:     http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
    1.96 +Source15:     http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
    1.97 +Source16:     http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
    1.98 +Source17:     http://www.zlib.net/zlib-%{V_zlib}.tar.gz
    1.99 +Source100:    bash.patch
   1.100 +Source101:    beecrypt.patch
   1.101 +Source102:    make.patch
   1.102 +Source103:    openssl.patch
   1.103 +Source104:    perl.patch
   1.104 +Source105:    tar.patch
   1.105 +Source106:    rpm.patch.bugfix
   1.106 +Source107:    rpm.patch.feature
   1.107 +Source108:    rpm.patch.porting
   1.108 +Source109:    rpm.patch.regen
   1.109 +Source200:    HISTORY
   1.110 +Source201:    README
   1.111 +Source202:    aux.prereq.sh
   1.112 +Source203:    aux.usrgrp.sh
   1.113 +Source204:    aux.wrapbin.sh
   1.114 +Source205:    aux.wrapsrc.sh
   1.115 +Source206:    dot.bash_login
   1.116 +Source207:    dot.bashrc
   1.117 +Source208:    dot.lsyncrc
   1.118 +Source209:    install.sh
   1.119 +Source210:    local.README
   1.120 +Source211:    lsync
   1.121 +Source212:    lsync.8
   1.122 +Source213:    lsync.pod
   1.123 +Source214:    man.sh
   1.124 +Source215:    openpkg.1
   1.125 +Source216:    openpkg.boot
   1.126 +Source217:    openpkg.com.pgp
   1.127 +Source218:    openpkg.net.pgp
   1.128 +Source219:    openpkg.org.pgp
   1.129 +Source220:    openpkg.pod
   1.130 +Source221:    openpkg.sh
   1.131 +Source222:    pod2man.sh
   1.132 +Source223:    rc
   1.133 +Source224:    rc.8
   1.134 +Source225:    rc.conf
   1.135 +Source226:    rc.func
   1.136 +Source227:    rc.openpkg
   1.137 +Source228:    rc.pod
   1.138 +Source229:    release.8
   1.139 +Source230:    release.pod
   1.140 +Source231:    release.sh
   1.141 +Source232:    root.README
   1.142 +Source233:    rpm-config.8
   1.143 +Source234:    rpm-config.pod
   1.144 +Source235:    rpm-config.sh
   1.145 +Source236:    rpmdb
   1.146 +Source237:    rpmtool
   1.147 +Source238:    rpmtool.8
   1.148 +Source239:    rpmtool.pod
   1.149 +Source240:    shtool
   1.150 +Source241:    uuid.8
   1.151 +Source242:    uuid.pod
   1.152 +Source243:    uuid.sh
   1.153 +Source244:    rpmmacros
   1.154 +Source245:    rpmpopt
   1.155 +Source246:    rpmrc
   1.156 +
   1.157 +#   build information
   1.158 +Prefix:       %{l_prefix}
   1.159 +BuildRoot:    %{l_buildroot}
   1.160 +AutoReq:      no
   1.161 +AutoReqProv:  no
   1.162 +Provides:     OpenPKG
   1.163 +
   1.164 +%description
   1.165 +    This is the bootstrap package for the RPM-based Unix Software
   1.166 +    Package Hierarchy OpenPKG. The RPM Package Manager (RPM) is a
   1.167 +    sophisticated and portable package manager for Unix platforms,
   1.168 +    which supports automated building, installation, management and
   1.169 +    deinstallation of Unix software. RPM was originally designed and
   1.170 +    implemented for the RedHat Linux operating system where it manages
   1.171 +    every file on the whole system. OpenPKG uses RPM only for managing
   1.172 +    the files in a particular filesystem hierarchy dedicated to the
   1.173 +    installation of third-party software packages provided by the
   1.174 +    OpenPKG project.
   1.175 +
   1.176 +    The OpenPKG bootstrap package includes the following software:
   1.177 +        RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
   1.178 +        GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
   1.179 +        GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
   1.180 +        OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt},
   1.181 +        OpenSSL %{V_openssl}, Perl %{V_perl}
   1.182 +
   1.183 +%track
   1.184 +    prog openpkg:bash = {
   1.185 +        version   = %{V_bash}
   1.186 +        url       = ftp://ftp.cwru.edu/pub/bash/
   1.187 +        regex     = bash-(__VER__)\.tar\.gz
   1.188 +    }
   1.189 +    prog openpkg:bzip2 = {
   1.190 +        version   = %{V_bzip2}
   1.191 +        url       = http://www.bzip.org/downloads.html
   1.192 +        regex     = bzip2-(__VER__)\.tar\.gz
   1.193 +    }
   1.194 +    prog openpkg:curl = {
   1.195 +        version   = %{V_curl}
   1.196 +        url       = http://curl.haxx.se/download/
   1.197 +        regex     = curl-(__VER__)\.tar\.gz
   1.198 +    }
   1.199 +    prog openpkg:gzip = {
   1.200 +        comment   = "rse: intentionally tracked at gnu.org, although fetched from openpkg.org because of uncompression"
   1.201 +        version   = %{V_gzip}
   1.202 +        url       = ftp://ftp.gnu.org/gnu/gzip/
   1.203 +        regex     = gzip-(__VER__)\.tar(\.gz)?
   1.204 +    }
   1.205 +    prog openpkg:gzip_r = {
   1.206 +        version   = %{V_gzip_r}
   1.207 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg/
   1.208 +        regex     = gzip-%{V_gzip}-openpkg-r(__VER__)\.tar
   1.209 +    }
   1.210 +    prog openpkg:make = {
   1.211 +        version   = %{V_make}
   1.212 +        url       = ftp://ftp.gnu.org/gnu/make/
   1.213 +        regex     = make-(__VER__)\.tar\.gz
   1.214 +    }
   1.215 +    prog openpkg:patch = {
   1.216 +        disabled
   1.217 +        comment   = "rse: directory missing after GNU.org security issues"
   1.218 +        version   = %{V_patch}
   1.219 +        url       = ftp://alpha.gnu.org/gnu/patch/
   1.220 +        regex     = patch-(__VER__)\.tar\.gz
   1.221 +    }
   1.222 +    prog openpkg:rpm = {
   1.223 +        disabled
   1.224 +        comment   = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1"
   1.225 +        version   = %{V_rpm}
   1.226 +        url       = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/
   1.227 +        regex     = rpm-(4\.2\.\d+)\.tar\.gz
   1.228 +    }
   1.229 +    prog openpkg:tar = {
   1.230 +        version   = %{V_tar}
   1.231 +        url       = ftp://ftp.gnu.org/gnu/tar/
   1.232 +        regex     = tar-(__VER__)\.tar\.gz
   1.233 +    }
   1.234 +    prog openpkg:zlib = {
   1.235 +        version   = %{V_zlib}
   1.236 +        url       = http://www.zlib.net/
   1.237 +        regex     = zlib-(__VER__)\.tar\.gz
   1.238 +    }
   1.239 +    prog openpkg:uuid = {
   1.240 +        version   = %{V_uuid}
   1.241 +        url       = ftp://ftp.ossp.org/pkg/lib/uuid/
   1.242 +        regex     = uuid-(__VER__)\.tar\.gz
   1.243 +    }
   1.244 +    prog openpkg:config = {
   1.245 +        version   = %{V_config}
   1.246 +        url       = ftp://ftp.openpkg.org/sources/CPY/config/
   1.247 +        regex     = config-(__VER__)\.tar\.gz
   1.248 +    }
   1.249 +    prog openpkg:beecrypt = {
   1.250 +        version   = %{V_beecrypt}
   1.251 +        url       = http://prdownloads.sourceforge.net/beecrypt/
   1.252 +        regex     = beecrypt-(__VER__)\.tar\.gz
   1.253 +    }
   1.254 +    prog openpkg:registry = {
   1.255 +        version   = %{V_registry}
   1.256 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/
   1.257 +        regex     = openpkg-registry-(__VER__)\.tar\.gz
   1.258 +    }
   1.259 +    prog openpkg:perl = {
   1.260 +        version   = %{V_perl}
   1.261 +        url       = ftp://ftp.openpkg.org/sources/CPY/perl/
   1.262 +        regex     = perl-(__VER__)-mini\.tar\.gz
   1.263 +    }
   1.264 +    prog openpkg:openssl = {
   1.265 +        version   = %{V_openssl}
   1.266 +        url       = ftp://ftp.openssl.org/source/
   1.267 +        regex     = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
   1.268 +    }
   1.269 +    prog openpkg:openpkg-tools = {
   1.270 +        version   = %{V_tools}
   1.271 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/
   1.272 +        regex     = openpkg-tools-(__VER__)\.tar\.gz
   1.273 +    }
   1.274 +    prog openpkg:openpkg-executable = {
   1.275 +        version   = %{V_exec}
   1.276 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg/
   1.277 +        regex     = openpkg-executable-(__VER__-C)\.tar\.gz
   1.278 +    }
   1.279 +
   1.280 +%prep
   1.281 +    #   skip in bootstrap phase 2 (see openpkg.boot)
   1.282 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
   1.283 +
   1.284 +    #   switch into a temporary build area
   1.285 +    rm -rf openpkg-%{version}
   1.286 +    mkdir openpkg-%{version}
   1.287 +    cd openpkg-%{version}
   1.288 +    rm -f .buildenv
   1.289 +    touch .buildenv
   1.290 +
   1.291 +    #   provide a bootstrap alternative to %{SOURCE xxx} because else
   1.292 +    #   it is not possible to upgrade a newer OpenPKG RPM with an older
   1.293 +    #   OpenPKG RPM.
   1.294 +    echo >>.buildenv 'SOURCE () {'
   1.295 +    echo >>.buildenv '    if [ -f "%{_specdir}/$1" ]; then'
   1.296 +    echo >>.buildenv '        echo "%{_specdir}/$1"'
   1.297 +    echo >>.buildenv '    else'
   1.298 +    echo >>.buildenv '        echo "%{_sourcedir}/$1"'
   1.299 +    echo >>.buildenv '    fi'
   1.300 +    echo >>.buildenv '}'
   1.301 +    echo >>.buildenv 'VERBOSE () {'
   1.302 +    echo >>.buildenv '    if [ -f "%{_specdir}/rpmtool" ]; then'
   1.303 +    echo >>.buildenv '        echo "$*" | sh %{_specdir}/rpmtool msg'
   1.304 +    echo >>.buildenv '    else'
   1.305 +    echo >>.buildenv '        echo "$*" | sh %{_sourcedir}/rpmtool msg'
   1.306 +    echo >>.buildenv '    fi'
   1.307 +    echo >>.buildenv '}'
   1.308 +    . ./.buildenv
   1.309 +
   1.310 +    #   display verbosity header
   1.311 +    set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"; set -x
   1.312 +
   1.313 +    #   determine path to shtool
   1.314 +    shtool=`SOURCE shtool`
   1.315 +    echo "shtool=$shtool" >>./.buildenv
   1.316 +
   1.317 +    #   determine development tools
   1.318 +    #   - bootstrapping: %{l_xxx} is set via sed(1)
   1.319 +    #   - upgrading new: %{l_xxx} is set via rpmmacros
   1.320 +    #   - upgrading old: %{l_xxx} is not set at all
   1.321 +
   1.322 +    #   manually make sure tar(1) is available
   1.323 +    l_tar=""; export l_tar
   1.324 +    [ ".%{?l_tar:set}"   = .set ] && l_tar="%{l_tar}"
   1.325 +    [ ".%{?use_tar:set}" = .set ] && l_tar="%{use_tar}"
   1.326 +    if [ ".$l_tar" = . ]; then
   1.327 +        l_tar=`sh $shtool path gtar tar`
   1.328 +        if [ ".$l_tar" = . ]; then
   1.329 +            echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
   1.330 +            exit 1
   1.331 +        fi
   1.332 +    fi
   1.333 +    echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
   1.334 +
   1.335 +    #   manually make sure make(1) is available
   1.336 +    l_make=""; export l_make
   1.337 +    [ ".%{?l_make:set}"   = .set ] && l_make="%{l_make}"
   1.338 +    [ ".%{?use_make:set}" = .set ] && l_make="%{use_make}"
   1.339 +    if [ ".$l_make" = . ]; then
   1.340 +        l_make=`sh $shtool path gmake make`
   1.341 +        if [ ".$l_make" = . ]; then
   1.342 +            echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
   1.343 +            exit 1
   1.344 +        fi
   1.345 +    fi
   1.346 +    echo "l_make=\"$l_make\"; export l_make" >>.buildenv
   1.347 +
   1.348 +    #   manually make sure cc(1) is available
   1.349 +    l_cc=""; export l_cc
   1.350 +    [ ".%{?l_cc:set}"   = .set ] && l_cc="%{l_cc}"
   1.351 +    [ ".%{?use_cc:set}" = .set ] && l_cc="%{use_cc}"
   1.352 +    if [ ".$l_cc" = . ]; then
   1.353 +        l_cc=`sh $shtool path gcc cc`
   1.354 +        if [ ".$l_cc" = . ]; then
   1.355 +            echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
   1.356 +            exit 1
   1.357 +        fi
   1.358 +    fi
   1.359 +    echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
   1.360 +
   1.361 +    #   manually make sure ar(1) is available
   1.362 +    l_ar=""; export l_ar
   1.363 +    [ ".%{?l_ar:set}"   = .set ] && l_ar="%{l_ar}"
   1.364 +    [ ".%{?use_ar:set}" = .set ] && l_ar="%{use_ar}"
   1.365 +    if [ ".$l_ar" = . ]; then
   1.366 +        l_ar=`sh $shtool path ar`
   1.367 +        if [ ".$l_ar" = . ]; then
   1.368 +            echo "openpkg: prerequisite tool \`ar' not found"
   1.369 +            exit 1
   1.370 +        fi
   1.371 +    fi
   1.372 +    echo "l_ar=\"$l_ar\"; export l_ar" >>.buildenv
   1.373 +
   1.374 +    #   manually make sure ld(1) is available
   1.375 +    l_ld=""; export l_ld
   1.376 +    [ ".%{?l_ld:set}"   = .set ] && l_ld="%{l_ld}"
   1.377 +    [ ".%{?use_ld:set}" = .set ] && l_ld="%{use_ld}"
   1.378 +    if [ ".$l_ld" = . ]; then
   1.379 +        l_ld=`sh $shtool path ld`
   1.380 +        if [ ".$l_ld" = . ]; then
   1.381 +            echo "openpkg: prerequisite tool \`ld' not found"
   1.382 +            exit 1
   1.383 +        fi
   1.384 +    fi
   1.385 +    echo "l_ld=\"$l_ld\"; export l_ld" >>.buildenv
   1.386 +
   1.387 +    #   manually make sure as(1) is available
   1.388 +    l_as=""; export l_as
   1.389 +    [ ".%{?l_as:set}"   = .set ] && l_as="%{l_as}"
   1.390 +    [ ".%{?use_as:set}" = .set ] && l_as="%{use_as}"
   1.391 +    if [ ".$l_as" = . ]; then
   1.392 +        l_as=`sh $shtool path as`
   1.393 +        if [ ".$l_as" = . ]; then
   1.394 +            echo "openpkg: prerequisite tool \`as' not found"
   1.395 +            exit 1
   1.396 +        fi
   1.397 +    fi
   1.398 +    echo "l_as=\"$l_as\"; export l_as" >>.buildenv
   1.399 +
   1.400 +    #   manually make sure strip(1) is available or use a null replacement
   1.401 +    l_strip=""; export l_strip
   1.402 +    [ ".%{?l_strip:set}"   = .set ] && l_strip="%{l_strip}"
   1.403 +    [ ".%{?use_strip:set}" = .set ] && l_strip="%{use_strip}"
   1.404 +    if [ ".$l_strip" = . ]; then
   1.405 +        l_strip=`sh $shtool path strip ls`
   1.406 +        if [ ".$l_strip" = . ]; then
   1.407 +            echo "openpkg: prerequisite tool \`strip' not found"
   1.408 +            exit 1
   1.409 +        fi
   1.410 +    fi
   1.411 +    echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv
   1.412 +
   1.413 +    #   determine path to aux.usrgrp.sh script
   1.414 +    usrgrp=`SOURCE aux.usrgrp.sh`
   1.415 +    echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv
   1.416 +
   1.417 +    #   display verbosity header
   1.418 +    set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"; set -x
   1.419 +
   1.420 +    #   determine user/group name/id pairs
   1.421 +    #   - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
   1.422 +    #   - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
   1.423 +    #   - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
   1.424 +    susr=""; [ ".%{?l_susr:set}"  = .set ] && susr="%{l_susr}"
   1.425 +    sgrp=""; [ ".%{?l_sgrp:set}"  = .set ] && sgrp="%{l_sgrp}"
   1.426 +    musr=""; [ ".%{?l_musr:set}"  = .set ] && musr="%{l_musr}"
   1.427 +    mgrp=""; [ ".%{?l_mgrp:set}"  = .set ] && mgrp="%{l_mgrp}"
   1.428 +    rusr=""; [ ".%{?l_rusr:set}"  = .set ] && rusr="%{l_rusr}"
   1.429 +    rgrp=""; [ ".%{?l_rgrp:set}"  = .set ] && rgrp="%{l_rgrp}"
   1.430 +    nusr=""; [ ".%{?l_nusr:set}"  = .set ] && nusr="%{l_nusr}"
   1.431 +    ngrp=""; [ ".%{?l_ngrp:set}"  = .set ] && ngrp="%{l_ngrp}"
   1.432 +    #   corresponding ids
   1.433 +    suid=""; [ ".%{?l_suid:set}"  = .set ] && suid="%{l_suid}"
   1.434 +    sgid=""; [ ".%{?l_sgid:set}"  = .set ] && sgid="%{l_sgid}"
   1.435 +    muid=""; [ ".%{?l_muid:set}"  = .set ] && muid="%{l_muid}"
   1.436 +    mgid=""; [ ".%{?l_mgid:set}"  = .set ] && mgid="%{l_mgid}"
   1.437 +    ruid=""; [ ".%{?l_ruid:set}"  = .set ] && ruid="%{l_ruid}"
   1.438 +    rgid=""; [ ".%{?l_rgid:set}"  = .set ] && rgid="%{l_rgid}"
   1.439 +    nuid=""; [ ".%{?l_nuid:set}"  = .set ] && nuid="%{l_nuid}"
   1.440 +    ngid=""; [ ".%{?l_ngid:set}"  = .set ] && ngid="%{l_ngid}"
   1.441 +    #   compat:
   1.442 +    usr="";  [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
   1.443 +    grp="";  [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
   1.444 +    eval `sh $usrgrp \
   1.445 +          --usr="$usr" --grp="$grp" \
   1.446 +          --susr="$susr" --sgrp="$sgrp" \
   1.447 +          --musr="$musr" --mgrp="$mgrp" \
   1.448 +          --rusr="$rusr" --rgrp="$rgrp" \
   1.449 +          --nusr="$nusr" --ngrp="$ngrp" \
   1.450 +          --suid="$suid" --sgid="$sgid" \
   1.451 +          --muid="$muid" --mgid="$mgid" \
   1.452 +          --ruid="$ruid" --rgid="$rgid" \
   1.453 +          --nuid="$nuid" --ngid="$ngid"`
   1.454 +    echo "susr=\"$susr\"; export susr" >>.buildenv
   1.455 +    echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
   1.456 +    echo "musr=\"$musr\"; export musr" >>.buildenv
   1.457 +    echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
   1.458 +    echo "rusr=\"$rusr\"; export rusr" >>.buildenv
   1.459 +    echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
   1.460 +    echo "nusr=\"$nusr\"; export nusr" >>.buildenv
   1.461 +    echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
   1.462 +    echo "suid=\"$suid\"; export suid" >>.buildenv
   1.463 +    echo "sgid=\"$sgid\"; export sgid" >>.buildenv
   1.464 +    echo "muid=\"$muid\"; export muid" >>.buildenv
   1.465 +    echo "mgid=\"$mgid\"; export mgid" >>.buildenv
   1.466 +    echo "ruid=\"$ruid\"; export ruid" >>.buildenv
   1.467 +    echo "rgid=\"$rgid\"; export rgid" >>.buildenv
   1.468 +    echo "nuid=\"$nuid\"; export nuid" >>.buildenv
   1.469 +    echo "ngid=\"$ngid\"; export ngid" >>.buildenv
   1.470 +
   1.471 +    #   display verbosity header
   1.472 +    set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"; set -x
   1.473 +
   1.474 +    #   determine installation location id
   1.475 +    if [ ".%{?l_tag_fmt:set}" = .set ]; then
   1.476 +        tag="%{l_tag_fmt}"
   1.477 +    else
   1.478 +        tag="<compat>"
   1.479 +    fi
   1.480 +    echo "tag=\"$tag\"; export tag" >>.buildenv
   1.481 +
   1.482 +    #   determine platform id
   1.483 +    s=`(uname -s) 2>/dev/null` || s='Unknown'
   1.484 +    r=`(uname -r) 2>/dev/null` || r='0.0'
   1.485 +    plid="${s}/${r}"
   1.486 +    echo "plid=\"$plid\"; export plid" >>.buildenv
   1.487 +
   1.488 +    #   determine platform-specific build environment
   1.489 +    case $plid in
   1.490 +        FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.491 +        NetBSD/*  ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.492 +        Linux/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.493 +        SunOS/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
   1.494 +        UnixWare/*) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
   1.495 +        AIX/*     ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
   1.496 +        Darwin/*  ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.497 +        OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.498 +        HP-UX/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.499 +        IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.500 +        *         ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
   1.501 +    esac
   1.502 +    case $plid in
   1.503 +        FreeBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
   1.504 +        NetBSD/*  ) l_build_ldlp="/lib:/usr/lib" ;;
   1.505 +        Linux/*   ) l_build_ldlp="/lib:/usr/lib" ;;
   1.506 +        SunOS/*   ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
   1.507 +        UnixWare/*) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
   1.508 +        AIX/*     ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
   1.509 +        Darwin/*  ) l_build_ldlp="/usr/lib" ;;
   1.510 +        OSF1/V5.* ) l_build_ldlp="/usr/lib" ;;
   1.511 +        HP-UX/*   ) l_build_ldlp="/usr/lib" ;;
   1.512 +        IRIX*/6.* ) l_build_ldlp="/usr/lib" ;;
   1.513 +        *         ) l_build_ldlp="/usr/lib" ;;
   1.514 +    esac
   1.515 +    case $plid in
   1.516 +        *         ) l_build_ulim=":" ;;
   1.517 +    esac
   1.518 +    echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
   1.519 +    echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
   1.520 +    echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
   1.521 +
   1.522 +    #   display verbosity header
   1.523 +    set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x
   1.524 +
   1.525 +    #   bootstrap GNU zip tool
   1.526 +    ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
   1.527 +    ${l_tar} xf `SOURCE gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar` 2>/dev/null || true
   1.528 +    ( cd gzip-%{V_gzip}
   1.529 +      echo "ac_cv_prog_cc_g=no" >config.cache
   1.530 +      case $plid in
   1.531 +          Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;;
   1.532 +      esac
   1.533 +      sh $shtool subst -e 's/futimens/gzip_&/' gzip.c lib/utimens.[ch]
   1.534 +      CC="${l_cc}" \
   1.535 +      GREP="grep" \
   1.536 +      ./configure \
   1.537 +          --cache-file=./config.cache
   1.538 +      ${l_make} || exit $?
   1.539 +      ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $?
   1.540 +    ) || exit $?
   1.541 +    l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
   1.542 +    echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
   1.543 +
   1.544 +    #   display verbosity header
   1.545 +    set +x; VERBOSE "PREPARATION: Unpack GNU configuration guessing utilities"; set -x
   1.546 +
   1.547 +    #   unpack GNU config.guess
   1.548 +    ${l_gzip} -dc `SOURCE config-%{V_config}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
   1.549 +
   1.550 +    #   display verbosity header
   1.551 +    set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"; set -x
   1.552 +
   1.553 +    #   bootstrap GNU patch tool
   1.554 +    ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
   1.555 +    ( cd patch-%{V_patch}
   1.556 +      chmod u+w config.guess config.sub >/dev/null 2>&1 || true
   1.557 +      cp ../config/config.guess .
   1.558 +      cp ../config/config.sub   .
   1.559 +      ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
   1.560 +        echo 'ac_cv_prog_cc_g=no'
   1.561 +        false=`sh $shtool path false`
   1.562 +        echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
   1.563 +      ) >config.cache
   1.564 +      CC="${l_cc}" \
   1.565 +      ./configure \
   1.566 +          --cache-file=./config.cache \
   1.567 +          --disable-largefile
   1.568 +      ${l_make} || exit $?
   1.569 +      ( mv patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
   1.570 +    ) || exit $?
   1.571 +    l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
   1.572 +    echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
   1.573 +
   1.574 +    #   display verbosity header
   1.575 +    set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"; set -x
   1.576 +
   1.577 +    #   build GNU tar tool
   1.578 +    ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
   1.579 +    ( cd tar-%{V_tar}
   1.580 +      ${l_patch} -p0 <`SOURCE tar.patch`
   1.581 +      ( echo 'am_cv_func_iconv=no'
   1.582 +        echo 'am_cv_lib_iconv=no'
   1.583 +        echo 'ac_cv_lib_iconv_iconv=no'
   1.584 +        echo 'ac_cv_header_iconv_h=no'
   1.585 +        echo 'ac_cv_type_iconv_t=no'
   1.586 +      ) >config.cache
   1.587 +      CC="${l_cc}" \
   1.588 +      MAKEINFO="true" \
   1.589 +      GREP="grep" \
   1.590 +      ./configure \
   1.591 +          --cache-file=./config.cache \
   1.592 +          --prefix=%{l_prefix} \
   1.593 +          --disable-nls
   1.594 +      ${l_make} || exit $?
   1.595 +      ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $?
   1.596 +    ) || exit $?
   1.597 +    l_tar="`pwd`/tar-%{V_tar}/tar"; export l_tar
   1.598 +    echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
   1.599 +
   1.600 +    #   display verbosity header
   1.601 +    set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x
   1.602 +
   1.603 +    #   unpack distribution tarballs
   1.604 +    ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz`                        | ${l_tar} xf - 2>/dev/null || true
   1.605 +    ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
   1.606 +    ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz`                    | ${l_tar} xf - 2>/dev/null || true
   1.607 +    ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
   1.608 +    ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
   1.609 +    ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
   1.610 +    ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
   1.611 +    ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz`              | ${l_tar} xf - 2>/dev/null || true
   1.612 +    ${l_gzip} -dc `SOURCE openpkg-registry-%{V_registry}.tar.gz`      | ${l_tar} xf - 2>/dev/null || true
   1.613 +    ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz`                 | ${l_tar} xf - 2>/dev/null || true
   1.614 +    ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz`                | ${l_tar} xf - 2>/dev/null || true
   1.615 +    ${l_gzip} -dc `SOURCE openpkg-tools-%{V_tools}.tar.gz`            | ${l_tar} xf - 2>/dev/null || true
   1.616 +    ${l_gzip} -dc `SOURCE openpkg-executable-%{V_exec}.tar.gz`        | ${l_tar} xf - 2>/dev/null || true
   1.617 +
   1.618 +    #   update config.guess/config.sub
   1.619 +    for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
   1.620 +               curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
   1.621 +        chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
   1.622 +        cp config/config.guess $dir/
   1.623 +        cp config/config.sub   $dir/
   1.624 +    done
   1.625 +
   1.626 +    #   display verbosity header
   1.627 +    set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x
   1.628 +
   1.629 +    #   apply OpenPKG patches to distribution trees
   1.630 +    ( cd rpm-%{V_rpm}
   1.631 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix`  | ${l_patch} -p0
   1.632 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
   1.633 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
   1.634 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen`   | ${l_patch} -p0
   1.635 +      rm -rf db/docs # just reduce disk size of source tree
   1.636 +    ) || exit $?
   1.637 +    ( cd make-%{V_make}
   1.638 +      ${l_patch} -p0 <`SOURCE make.patch`
   1.639 +    ) || exit $?
   1.640 +    ( cd bash-%{V_bash}
   1.641 +      ${l_patch} -p0 <`SOURCE bash.patch`
   1.642 +      sleep 1
   1.643 +      touch y.tab.[ch]
   1.644 +      touch configure config.h.in
   1.645 +    ) || exit $?
   1.646 +    ( cd beecrypt-%{V_beecrypt}
   1.647 +      ${l_patch} -p0 <`SOURCE beecrypt.patch`
   1.648 +    ) || exit $?
   1.649 +    ( cd perl-%{V_perl}
   1.650 +      ${l_patch} -p0 <`SOURCE perl.patch`
   1.651 +    ) || exit $?
   1.652 +    ( cd openssl-%{V_openssl}
   1.653 +      ${l_patch} -p0 <`SOURCE openssl.patch`
   1.654 +    ) || exit $?
   1.655 +
   1.656 +    #   display verbosity header
   1.657 +    set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x
   1.658 +
   1.659 +    #   bootstrap GNU make tool
   1.660 +    ( cd make-%{V_make}
   1.661 +      CC="${l_cc}" \
   1.662 +      ./configure \
   1.663 +          --without-libiconv-prefix \
   1.664 +          --without-libintl-prefix \
   1.665 +          --disable-nls \
   1.666 +          --disable-largefile
   1.667 +      ${l_make}
   1.668 +      ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
   1.669 +    ) || exit $?
   1.670 +    l_make="`pwd`/make-%{V_make}/make"; export l_make
   1.671 +    echo "l_make=\"$l_make\"; export l_make" >>.buildenv
   1.672 +
   1.673 +%build
   1.674 +    #   skip in bootstrap phase 2 (see openpkg.boot)
   1.675 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
   1.676 +
   1.677 +    #   switch into a temporary build area
   1.678 +    cd openpkg-%{version}
   1.679 +    . ./.buildenv
   1.680 +
   1.681 +    #   display verbosity header
   1.682 +    set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"; set -x
   1.683 +
   1.684 +    #   build GNU bash tool
   1.685 +    ( cd bash-%{V_bash}
   1.686 +      sh $shtool subst \
   1.687 +          -e 's;@l_openpkg_release@;OpenPKG;' \
   1.688 +          version.c
   1.689 +      ( #   force disabled wide-character support
   1.690 +        echo "ac_cv_header_wchar_h=no"
   1.691 +        echo "ac_cv_header_wctype_h=no"
   1.692 +        echo "ac_cv_func_mbsrtowcs=no"
   1.693 +        #   force disabled internationalization support
   1.694 +        echo "ac_cv_header_libintl_h=no"
   1.695 +        echo "ac_cv_func_gettext=no"
   1.696 +        echo "ac_cv_func_textdomain=no"
   1.697 +        echo "ac_cv_func_bindtextdomain=no"
   1.698 +        echo "ac_cv_lib_intl_bindtextdomain=no"
   1.699 +        #   disable building with debug symbols
   1.700 +        echo "ac_cv_prog_cc_g=no"
   1.701 +      ) >config.cache
   1.702 +      AUTOCONF="true" \
   1.703 +      CC="${l_cc}"
   1.704 +      ./configure \
   1.705 +          --cache-file=./config.cache \
   1.706 +          --prefix=%{l_prefix} \
   1.707 +          --without-curses \
   1.708 +          --without-gnu-malloc \
   1.709 +          --disable-nls
   1.710 +      ${l_make} || exit $?
   1.711 +      ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
   1.712 +    ) || exit $?
   1.713 +
   1.714 +    #   display verbosity header
   1.715 +    set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"; set -x
   1.716 +
   1.717 +    #   build BZIP2 library
   1.718 +    ( cd bzip2-%{V_bzip2}
   1.719 +      ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
   1.720 +      ( echo "# libbz2.la - a libtool library file"
   1.721 +        echo "# Generated by ltmain.sh - GNU libtool x.x.x"
   1.722 +        echo "dlname=''"
   1.723 +        echo "library_names=''"
   1.724 +        echo "old_library='libbz2.a'"
   1.725 +        echo "dependency_libs=''"
   1.726 +        echo "current=0"
   1.727 +        echo "age=0"
   1.728 +        echo "revision=0"
   1.729 +        echo "installed=no"
   1.730 +        echo "dlopen=''"
   1.731 +        echo "dlpreopen=''"
   1.732 +        echo "libdir='%{l_prefix}'"
   1.733 +      ) >libbz2.la
   1.734 +      ln -s . .libs
   1.735 +    ) || exit $?
   1.736 +
   1.737 +    #   display verbosity header
   1.738 +    set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"; set -x
   1.739 +
   1.740 +    #   build ZLIB library
   1.741 +    ( cd zlib-%{V_zlib}
   1.742 +      CC="${l_cc}" CFLAGS="-O" ./configure
   1.743 +      ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here
   1.744 +    ) || exit $?
   1.745 +
   1.746 +    #   display verbosity header
   1.747 +    set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x
   1.748 +
   1.749 +    #   build OSSP uuid tool
   1.750 +    ( cd uuid-%{V_uuid}
   1.751 +      CC="${l_cc}" \
   1.752 +      CFLAGS="-O" \
   1.753 +      GREP="grep" \
   1.754 +      ./configure \
   1.755 +        --prefix=%{l_prefix} \
   1.756 +        --disable-shared
   1.757 +      ${l_make} || exit $?
   1.758 +      ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $?
   1.759 +    ) || exit $?
   1.760 +
   1.761 +    #   display verbosity header
   1.762 +    set +x; VERBOSE "BUILD: Build Perl (Programming Language)"; set -x
   1.763 +
   1.764 +    #   build Perl tool
   1.765 +    ( cd perl-%{V_perl}
   1.766 +      chmod -R u+w .
   1.767 +      sh $shtool subst \
   1.768 +          -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;' \
   1.769 +          -e 's;package=perl5;package=perl;' \
   1.770 +          Configure
   1.771 +      sh $shtool subst \
   1.772 +          -e 's; */usr/local/lib;;' \
   1.773 +          hints/freebsd.sh hints/netbsd.sh
   1.774 +      libdirs=""
   1.775 +      for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
   1.776 +          [ -d $dir ] && libdirs="$libdirs $dir"
   1.777 +      done
   1.778 +      ./Configure \
   1.779 +          -d -e -s \
   1.780 +          -Dprefix=%{l_prefix} \
   1.781 +          -Dvendorprefix=%{l_prefix} \
   1.782 +          -Dinstallprefix=%{l_prefix} \
   1.783 +          -Dinstallstyle="lib/perl5" \
   1.784 +          -Dman1dir=%{l_prefix}/man/man1 \
   1.785 +          -Dman3dir=%{l_prefix}/man/man3 \
   1.786 +          -Dcc="${l_cc}" -Uoptimize \
   1.787 +          -Dlocincpth="%{l_prefix}/include" \
   1.788 +          -Dloclibpth="%{l_prefix}/lib" \
   1.789 +          -Dldflags="-L""%{l_prefix}/lib" \
   1.790 +          -Dlibpth="$libdirs" \
   1.791 +          -Dglibpth="$libdirs" \
   1.792 +          -Dscriptdir="%{l_prefix}/bin" \
   1.793 +          -Uinstallusrbinperl \
   1.794 +          -Adefine:useshrplib='false' \
   1.795 +          -Ui_malloc -Ui_iconv -Ui_db
   1.796 +      ${l_make} miniperl || exit $?
   1.797 +      rm -f *.o >/dev/null 2>&1 || true
   1.798 +    ) || exit $?
   1.799 +    l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl
   1.800 +    echo "l_perl=\"$l_perl\"; export l_perl" >>.buildenv
   1.801 +
   1.802 +    #   display verbosity header
   1.803 +    set +x; VERBOSE "BUILD: Build OpenSSL (Crypography and SSL/TLS Toolkit)"; set -x
   1.804 +
   1.805 +    #   build OpenSSL toolkit
   1.806 +    ( cd openssl-%{V_openssl}
   1.807 +      sh $shtool subst \
   1.808 +          -e 's;-m486;-march=i486;g' \
   1.809 +          -e 's;BN_LLONG *;;' \
   1.810 +          Configure
   1.811 +      sh $shtool subst \
   1.812 +          -e 's;test "$OSTYPE" = msdosdjgpp;true;' \
   1.813 +          util/point.sh
   1.814 +      sh $shtool subst \
   1.815 +          -e "1s;^.*\$;#!$l_perl;" \
   1.816 +          Configure `find . -name "*.pl" -print`
   1.817 +      opts=""
   1.818 +      case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
   1.819 +          *-solaris*       ) opts="-lnsl -lsocket" ;;
   1.820 +      esac
   1.821 +      case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
   1.822 +          amd64-*          ) opts="$opts -fPIC" ;;
   1.823 +          ia64-*           ) opts="$opts -fPIC" ;;
   1.824 +          sparc64-freebsd* ) opts="$opts -fPIC" ;;
   1.825 +      esac
   1.826 +      CC="${l_cc}" \
   1.827 +      PERL="${l_perl}" \
   1.828 +      ./config \
   1.829 +          --prefix=%{l_prefix} \
   1.830 +          no-asm no-shared no-dso \
   1.831 +          no-zlib no-idea no-threads no-krb5 no-hw \
   1.832 +          $opts
   1.833 +      ${l_make} CC="${l_cc}" build_libs build_apps || exit $?
   1.834 +      ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $?
   1.835 +    ) || exit $?
   1.836 +
   1.837 +    #   display verbosity header
   1.838 +    set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x
   1.839 +
   1.840 +    #   build cURL tool
   1.841 +    ( cd curl-%{V_curl}
   1.842 +      sh $shtool subst \
   1.843 +          -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
   1.844 +          configure
   1.845 +      ( echo 'ac_cv_header_openssl_engine_h=no'
   1.846 +        echo 'lt_cv_prog_compiler_c_o_F77=no'
   1.847 +        echo 'lt_cv_sys_max_cmd_len=100'
   1.848 +      ) >config.cache
   1.849 +      CC="${l_cc}" \
   1.850 +      CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
   1.851 +      CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
   1.852 +      LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
   1.853 +      GREP="grep" \
   1.854 +      ./configure \
   1.855 +          --cache-file=./config.cache \
   1.856 +          --without-libidn \
   1.857 +          --disable-shared \
   1.858 +          --disable-thread \
   1.859 +          --disable-ipv6 \
   1.860 +          --disable-ldap \
   1.861 +          --with-zlib=`pwd`/../zlib-%{V_zlib} \
   1.862 +          --with-ssl=`pwd`/../openssl-%{V_openssl} \
   1.863 +          --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509
   1.864 +      ${l_make} || exit $?
   1.865 +      ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
   1.866 +    ) || exit $?
   1.867 +
   1.868 +    #   display verbosity header
   1.869 +    set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"; set -x
   1.870 +
   1.871 +    #   build BeeCrypt library
   1.872 +    ( cd beecrypt-%{V_beecrypt}
   1.873 +      sh $shtool subst \
   1.874 +          -e 's;^[ 	][ 	]*#;#;' \
   1.875 +          aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \
   1.876 +          md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c
   1.877 +      sh $shtool subst \
   1.878 +         -e 's;cppglue\.lo;;g' \
   1.879 +         -e 's;cppglue\.cxx;;g' \
   1.880 +         -e '/^CXX = /s;@CXX@;@CC@;g' \
   1.881 +         Makefile.in
   1.882 +      sh $shtool subst \
   1.883 +          -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
   1.884 +          configure
   1.885 +      ( echo 'ac_cv_have_dev_dsp=no'
   1.886 +        echo 'ac_cv_have_dev_audio=no'
   1.887 +        echo 'ac_cv_func_gettimeofday=yes'
   1.888 +        echo 'bc_cv_as_noexecstack=no'
   1.889 +      ) >config.cache
   1.890 +      CC="${l_cc}" \
   1.891 +      CFLAGS="-O" \
   1.892 +      ./configure \
   1.893 +        --cache-file=./config.cache \
   1.894 +        --prefix=%{l_prefix} \
   1.895 +        --without-cplusplus \
   1.896 +        --without-java \
   1.897 +        --without-python \
   1.898 +        --with-cpu=none \
   1.899 +        --with-arch=none \
   1.900 +        --disable-threads \
   1.901 +        --disable-shared
   1.902 +      ${l_make} || exit $?
   1.903 +      cp .libs/libbeecrypt.a .
   1.904 +    ) || exit $?
   1.905 +
   1.906 +    #   display verbosity header
   1.907 +    set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x
   1.908 +
   1.909 +    #   build RPM
   1.910 +    ( br=`pwd`
   1.911 +      cd rpm-%{V_rpm}
   1.912 +
   1.913 +      #   remove object files accidentally distributed with the RPM tarball
   1.914 +      rm -f db/build_unix/*.o
   1.915 +      rm -f db/build_unix/*.lo
   1.916 +
   1.917 +      #   remove embedded zlib (we are linking with an external one)
   1.918 +      rm -rf zlib
   1.919 +
   1.920 +      #   kill Linux-based preconfigured DB header, to allow the Makefiles to
   1.921 +      #   symlink to it the header that is configured for the current system.
   1.922 +      rm -f rpmdb/db.h
   1.923 +
   1.924 +      #   make sure we do not trigger Autoconf/Automake tools
   1.925 +      touch configure
   1.926 +      touch config.h.in
   1.927 +
   1.928 +      #   disable running of any Autoconf/Automake tools
   1.929 +      ACLOCAL=true
   1.930 +      AUTOCONF=true
   1.931 +      AUTOMAKE=true
   1.932 +      AUTOHEADER=true
   1.933 +      MAKEINFO=true
   1.934 +      AMTAR=true
   1.935 +      export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR
   1.936 +
   1.937 +      #   cheat GNU Autoconf
   1.938 +      ( echo 'ac_cv_path_MSGFMT=:'
   1.939 +        echo 'ac_cv_path_GMSGFMT=:'
   1.940 +        echo 'ac_cv_path_XGETTEXT=:'
   1.941 +        echo 'ac_cv_path_MSGMERGE=:'
   1.942 +        echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
   1.943 +        echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
   1.944 +        echo "ac_cv_path___PYTHON=true"
   1.945 +        echo "ac_cv_path___DOXYGEN=true"
   1.946 +        echo "acl_cv_rpath=no"
   1.947 +        echo "ac_cv_header_getopt_h=no"
   1.948 +      ) >config.cache
   1.949 +
   1.950 +      #   provide platform identification
   1.951 +      os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'
   1.952 +      os_name=`echo "${os_name}" |\
   1.953 +               sed -e 's;[^a-zA-Z0-9];;g' |\
   1.954 +               tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
   1.955 +
   1.956 +      #   set build tool flags
   1.957 +      CC="${l_cc}"
   1.958 +      CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
   1.959 +      CFLAGS="$CPPFLAGS"
   1.960 +      LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
   1.961 +      LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
   1.962 +      case $os_name in
   1.963 +           SUNOS* ) LIBS="$LIBS -lresolv" ;;
   1.964 +           IRIX*  ) LIBS="$LIBS -lgen" ;;
   1.965 +      esac
   1.966 +      export CC CPPFLAGS CFLAGS LDFLAGS LIBS
   1.967 +
   1.968 +      #   adjust for BeeCrypt 4.0
   1.969 +      sh $shtool subst \
   1.970 +          -e 's;beecrypt\.api\.h;beecrypt.h;g' \
   1.971 +          rpmio/rpmio_internal.h
   1.972 +      sh $shtool subst \
   1.973 +          -e 's;\(rsavrfy(\)\(&dig->rsa_pk\);\1\2.n, \2.e;g' \
   1.974 +          lib/signature.c
   1.975 +
   1.976 +      #   configure the package
   1.977 +      sh ./configure \
   1.978 +          --cache-file=./config.cache \
   1.979 +          --prefix=%{l_prefix} \
   1.980 +          --with-db \
   1.981 +          --with-glob \
   1.982 +          --without-python \
   1.983 +          --without-apidocs \
   1.984 +          --disable-shared \
   1.985 +          --disable-rpath \
   1.986 +          --disable-nls
   1.987 +
   1.988 +      #   build the package
   1.989 +      ${l_make}
   1.990 +    ) || exit $?
   1.991 +
   1.992 +    #   display verbosity header
   1.993 +    set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
   1.994 +
   1.995 +    #   build "openpkg" executable
   1.996 +    ( cd openpkg-executable-%{V_exec}
   1.997 +      ${l_make} \
   1.998 +          CC="${l_cc}" \
   1.999 +          OPENPKG_PREFIX="%{l_prefix}" \
  1.1000 +          OPENPKG_SUSR="%{l_susr}" \
  1.1001 +          OPENPKG_MUSR="%{l_musr}"
  1.1002 +    ) || exit $?
  1.1003 +
  1.1004 +%install
  1.1005 +    #   skip in bootstrap phase 2 (see openpkg.boot)
  1.1006 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  1.1007 +
  1.1008 +    #   switch into a temporary build area
  1.1009 +    cd openpkg-%{version}
  1.1010 +    . ./.buildenv
  1.1011 +
  1.1012 +    #   display verbosity header
  1.1013 +    set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
  1.1014 +
  1.1015 +    #   create installation hierarchy
  1.1016 +    rm -rf $RPM_BUILD_ROOT
  1.1017 +    sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  1.1018 +    for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
  1.1019 +        test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
  1.1020 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
  1.1021 +    done
  1.1022 +    for i in 1 2 3 4 5 6 7 8 9; do
  1.1023 +        test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
  1.1024 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
  1.1025 +        test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
  1.1026 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
  1.1027 +    done
  1.1028 +    for dir in PKG bin etc include info lib man sbin; do
  1.1029 +        test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
  1.1030 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
  1.1031 +    done
  1.1032 +    for i in 1 2 3 4 5 6 7 8 9; do
  1.1033 +        test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
  1.1034 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
  1.1035 +        test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
  1.1036 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
  1.1037 +    done
  1.1038 +    test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
  1.1039 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
  1.1040 +    for dir in SRC PKG DB TMP; do
  1.1041 +        test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
  1.1042 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
  1.1043 +    done
  1.1044 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
  1.1045 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
  1.1046 +
  1.1047 +    #   display verbosity header
  1.1048 +    set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
  1.1049 +
  1.1050 +    #   install RPM into installation hierarchy
  1.1051 +    ( cd rpm-%{V_rpm}
  1.1052 +      DESTDIR="$RPM_BUILD_ROOT"
  1.1053 +      export DESTDIR
  1.1054 +      ${l_make} install
  1.1055 +    ) || exit $?
  1.1056 +
  1.1057 +    #   display verbosity header
  1.1058 +    set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
  1.1059 +
  1.1060 +    #   add additional development files
  1.1061 +    cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  1.1062 +    cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  1.1063 +    cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  1.1064 +    cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
  1.1065 +    cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  1.1066 +    cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
  1.1067 +    cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  1.1068 +    cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
  1.1069 +
  1.1070 +    #   display verbosity header
  1.1071 +    set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
  1.1072 +
  1.1073 +    #   post-adjust RPM installation (namespace-clean POPT inclusion)
  1.1074 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
  1.1075 +       $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
  1.1076 +    mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
  1.1077 +       $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
  1.1078 +
  1.1079 +    #   move C API into custom locations
  1.1080 +    mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
  1.1081 +       $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
  1.1082 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
  1.1083 +       $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
  1.1084 +
  1.1085 +    #   move rpm tool to custom location
  1.1086 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
  1.1087 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  1.1088 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
  1.1089 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
  1.1090 +
  1.1091 +    #   move rpm2cpio tool to custom location
  1.1092 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
  1.1093 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
  1.1094 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
  1.1095 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
  1.1096 +
  1.1097 +    #   replace symlinks with hardlinks
  1.1098 +    for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
  1.1099 +        eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
  1.1100 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
  1.1101 +        ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
  1.1102 +           $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
  1.1103 +    done
  1.1104 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
  1.1105 +    ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
  1.1106 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
  1.1107 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
  1.1108 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
  1.1109 +
  1.1110 +    #   display verbosity header
  1.1111 +    set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
  1.1112 +
  1.1113 +    #   strip RPM installation
  1.1114 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
  1.1115 +          $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
  1.1116 +    for dir in man/ja man/pl man/ru man/sk src; do
  1.1117 +        rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
  1.1118 +    done
  1.1119 +    rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true
  1.1120 +    for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
  1.1121 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
  1.1122 +    done
  1.1123 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
  1.1124 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
  1.1125 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
  1.1126 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
  1.1127 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
  1.1128 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
  1.1129 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
  1.1130 +    for file in \
  1.1131 +        u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
  1.1132 +        perl.prov perl.req mkinstalldirs magic.prov magic.req http.req \
  1.1133 +        getpo.sh get_magic.pl find-provides find-requires \
  1.1134 +        find-requires.perl find-req.pl find-provides.perl \
  1.1135 +        find-prov.pl find-lang.sh cpanflute convertrpmrc.sh check-prereqs \
  1.1136 +        rpmputtext rpmgettext brp-compress brp-redhat brp-sparc64-linux \
  1.1137 +        brp-strip brp-strip-shared brp-strip-comment-note rpmrc \
  1.1138 +        config.guess config.sub check-files; do
  1.1139 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
  1.1140 +    done
  1.1141 +
  1.1142 +    #   display verbosity header
  1.1143 +    set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
  1.1144 +
  1.1145 +    #   install lsync tool
  1.1146 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1147 +        <`SOURCE lsync` \
  1.1148 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
  1.1149 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
  1.1150 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1151 +        <`SOURCE dot.lsyncrc` \
  1.1152 +        >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
  1.1153 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1154 +        <`SOURCE lsync.8` \
  1.1155 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
  1.1156 +
  1.1157 +    #   install rpm-config tool
  1.1158 +    ( l_prefix="%{l_prefix}"
  1.1159 +      l_cc="%{l_cc}"
  1.1160 +      l_cflags=""
  1.1161 +      l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
  1.1162 +      l_ldflags="-L${l_prefix}/lib/openpkg"
  1.1163 +      l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
  1.1164 +      sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1165 +          -e "s:@l_cc@:$l_cc:g" \
  1.1166 +          -e "s:@l_cflags@:$l_cflags:g" \
  1.1167 +          -e "s:@l_cppflags@:$l_cppflags:g" \
  1.1168 +          -e "s:@l_ldflags@:$l_ldflags:g" \
  1.1169 +          -e "s:@l_libs@:$l_libs:g" \
  1.1170 +          -e "s:@l_version@:%{V_rpm}:g" \
  1.1171 +          <`SOURCE rpm-config.sh` \
  1.1172 +          >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
  1.1173 +    ) || exit $?
  1.1174 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
  1.1175 +    sed -e "s:RPM_VERSION:%{V_rpm}:g" \
  1.1176 +        <`SOURCE rpm-config.8` \
  1.1177 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
  1.1178 +
  1.1179 +    #   install OpenPKG registry commands
  1.1180 +    ( cd openpkg-registry-%{V_registry}
  1.1181 +      mv  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
  1.1182 +          $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
  1.1183 +      sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1184 +          rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  1.1185 +      chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  1.1186 +      sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1187 +          register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
  1.1188 +      chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
  1.1189 +      cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
  1.1190 +    ) || exit $?
  1.1191 +
  1.1192 +    #   install OpenPKG Tool Chain command subset
  1.1193 +    ( cd openpkg-tools-%{V_tools}
  1.1194 +      cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
  1.1195 +      cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
  1.1196 +      chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
  1.1197 +      cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
  1.1198 +    ) || exit $?
  1.1199 +
  1.1200 +    #   install RPM extension
  1.1201 +    ( cd rpm-%{V_rpm}
  1.1202 +      cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
  1.1203 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
  1.1204 +    ) || exit $?
  1.1205 +    ( cd perl-%{V_perl}
  1.1206 +      cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
  1.1207 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
  1.1208 +    ) || exit $?
  1.1209 +    ( cd openssl-%{V_openssl}
  1.1210 +      cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
  1.1211 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
  1.1212 +    ) || exit $?
  1.1213 +    ( cd curl-%{V_curl}
  1.1214 +      cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
  1.1215 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
  1.1216 +    ) || exit $?
  1.1217 +    ( cd bzip2-%{V_bzip2}
  1.1218 +      cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
  1.1219 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
  1.1220 +    ) || exit $?
  1.1221 +    ( cd gzip-%{V_gzip}
  1.1222 +      cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
  1.1223 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
  1.1224 +    ) || exit $?
  1.1225 +    ( cd patch-%{V_patch}
  1.1226 +      cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
  1.1227 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
  1.1228 +    ) || exit $?
  1.1229 +    ( cd tar-%{V_tar}
  1.1230 +      cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
  1.1231 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
  1.1232 +    ) || exit $?
  1.1233 +    ( cd bash-%{V_bash}
  1.1234 +      cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
  1.1235 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
  1.1236 +    ) || exit $?
  1.1237 +    ( cd uuid-%{V_uuid}
  1.1238 +      cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
  1.1239 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
  1.1240 +    ) || exit $?
  1.1241 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1242 +        -e "s;@l_musr@;%{l_musr};g" \
  1.1243 +        -e "s;@l_mgrp@;%{l_mgrp};g" \
  1.1244 +        <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
  1.1245 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
  1.1246 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1247 +        <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
  1.1248 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1249 +        <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
  1.1250 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
  1.1251 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1252 +        <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
  1.1253 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1254 +        -e "s;@l_musr@;%{l_musr};g" \
  1.1255 +        -e "s;@l_mgrp@;%{l_mgrp};g" \
  1.1256 +        <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
  1.1257 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
  1.1258 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1259 +        <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
  1.1260 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
  1.1261 +
  1.1262 +    #   install OpenPKG tool chain execution frontend and execution wrapper
  1.1263 +    cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  1.1264 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  1.1265 +    chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  1.1266 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1267 +        <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
  1.1268 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
  1.1269 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1270 +        <`SOURCE openpkg.1` \
  1.1271 +        >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
  1.1272 +
  1.1273 +    #   install more OpenPKG tool chain commands
  1.1274 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1275 +        <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
  1.1276 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
  1.1277 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
  1.1278 +        <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
  1.1279 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
  1.1280 +
  1.1281 +    #   install an own copy of shtool
  1.1282 +    cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
  1.1283 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
  1.1284 +
  1.1285 +    #   display verbosity header
  1.1286 +    set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
  1.1287 +
  1.1288 +    #   install a few README files
  1.1289 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1290 +        <`SOURCE root.README` \
  1.1291 +        >$RPM_BUILD_ROOT%{l_prefix}/README
  1.1292 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1293 +        <`SOURCE local.README` \
  1.1294 +        >$RPM_BUILD_ROOT%{l_prefix}/local/README
  1.1295 +
  1.1296 +    #   install Bash environment
  1.1297 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1298 +        <`SOURCE dot.bashrc` \
  1.1299 +        >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
  1.1300 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1301 +        <`SOURCE dot.bash_login` \
  1.1302 +        >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
  1.1303 +
  1.1304 +    #   install Run-Command files
  1.1305 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1306 +        -e "s:@l_susr@:%{l_susr}:g" \
  1.1307 +        -e "s:@l_musr@:%{l_musr}:g" \
  1.1308 +        <`SOURCE rc` \
  1.1309 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
  1.1310 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
  1.1311 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1312 +        <`SOURCE rc.conf` \
  1.1313 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
  1.1314 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
  1.1315 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1316 +        <`SOURCE rc.func` \
  1.1317 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
  1.1318 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
  1.1319 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  1.1320 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1321 +        -e "s:@l_musr@:%{l_musr}:g" \
  1.1322 +        <`SOURCE rc.openpkg` \
  1.1323 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
  1.1324 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
  1.1325 +    ( echo "#!/bin/sh"
  1.1326 +      echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
  1.1327 +    ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
  1.1328 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
  1.1329 +    ln  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
  1.1330 +        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
  1.1331 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1332 +        <`SOURCE rc.8` \
  1.1333 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
  1.1334 +
  1.1335 +    #   create configuration directory
  1.1336 +    test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
  1.1337 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
  1.1338 +
  1.1339 +    #   install platform identification file
  1.1340 +    sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
  1.1341 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
  1.1342 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
  1.1343 +
  1.1344 +    #   install UUID configuration file (ghost)
  1.1345 +    touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
  1.1346 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
  1.1347 +
  1.1348 +    #   install registry configuration files (ghost)
  1.1349 +    touch \
  1.1350 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
  1.1351 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
  1.1352 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
  1.1353 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
  1.1354 +    chmod 644 \
  1.1355 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
  1.1356 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
  1.1357 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
  1.1358 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
  1.1359 +
  1.1360 +    #   install default managers configuration file
  1.1361 +    ( echo "##"
  1.1362 +      echo "##  managers -- OpenPKG Instance Managers"
  1.1363 +      echo "##"
  1.1364 +      echo ""
  1.1365 +      echo "%{l_susr}"
  1.1366 +      echo "%{l_musr}"
  1.1367 +      echo ""
  1.1368 +    ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
  1.1369 +
  1.1370 +    #   install overriding RPM configuration files
  1.1371 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1372 +        <`SOURCE rpmpopt` \
  1.1373 +        >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
  1.1374 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1375 +        <`SOURCE rpmrc` \
  1.1376 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
  1.1377 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
  1.1378 +        -e "s:@l_prefix_static@:%{l_prefix}:g" \
  1.1379 +        -e "s;@l_build_path@;$l_build_path;g" \
  1.1380 +        -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
  1.1381 +        -e "s;@l_build_ulim@;$l_build_ulim;g" \
  1.1382 +        -e "s:@TAG@:$tag:g" \
  1.1383 +        -e "s:@SUSR@:$susr:g" \
  1.1384 +        -e "s:@SGRP@:$sgrp:g" \
  1.1385 +        -e "s:@MUSR@:$musr:g" \
  1.1386 +        -e "s:@MGRP@:$mgrp:g" \
  1.1387 +        -e "s:@RUSR@:$rusr:g" \
  1.1388 +        -e "s:@RGRP@:$rgrp:g" \
  1.1389 +        -e "s:@NUSR@:$nusr:g" \
  1.1390 +        -e "s:@NGRP@:$ngrp:g" \
  1.1391 +        <`SOURCE rpmmacros` \
  1.1392 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
  1.1393 +    cp `SOURCE openpkg.org.pgp` \
  1.1394 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
  1.1395 +    cp `SOURCE openpkg.com.pgp` \
  1.1396 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
  1.1397 +    cp `SOURCE openpkg.net.pgp` \
  1.1398 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
  1.1399 +
  1.1400 +    #   display verbosity header
  1.1401 +    set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
  1.1402 +
  1.1403 +%files
  1.1404 +    %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
  1.1405 +    %{l_prefix}/README
  1.1406 +    %config(noreplace) %{l_prefix}/.bashrc
  1.1407 +    %config(noreplace) %{l_prefix}/.bash_login
  1.1408 +    %dir %{l_prefix}/RPM
  1.1409 +    %dir %{l_prefix}/RPM/SRC
  1.1410 +    %dir %{l_prefix}/RPM/PKG
  1.1411 +    %dir %{l_prefix}/RPM/DB
  1.1412 +    %dir %{l_prefix}/RPM/TMP
  1.1413 +    %dir %{l_prefix}/cgi
  1.1414 +    %dir %{l_prefix}/bin
  1.1415 +    %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
  1.1416 +    %dir %{l_prefix}/etc
  1.1417 +    %{l_prefix}/etc/rc
  1.1418 +    %config(noreplace) %{l_prefix}/etc/rc.conf
  1.1419 +    %{l_prefix}/etc/rc.func
  1.1420 +    %dir %{l_prefix}/etc/rc.d
  1.1421 +    %{l_prefix}/etc/rc.d/rc.openpkg
  1.1422 +    %dir %{l_prefix}/etc/openpkg
  1.1423 +    %ghost %{l_prefix}/etc/openpkg/uuid
  1.1424 +    %config %{l_prefix}/etc/openpkg/platform
  1.1425 +    %config %{l_prefix}/etc/openpkg/rpmmacros
  1.1426 +    %config %{l_prefix}/etc/openpkg/rpmrc
  1.1427 +    %ghost %{l_prefix}/etc/openpkg/register.conf
  1.1428 +    %ghost %{l_prefix}/etc/openpkg/register.prep
  1.1429 +    %ghost %{l_prefix}/etc/openpkg/register.tran
  1.1430 +    %ghost %{l_prefix}/etc/openpkg/register.util
  1.1431 +    %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
  1.1432 +    %{l_prefix}/etc/openpkg/openpkg.org.pgp
  1.1433 +    %{l_prefix}/etc/openpkg/openpkg.com.pgp
  1.1434 +    %{l_prefix}/etc/openpkg/openpkg.net.pgp
  1.1435 +    %dir %{l_prefix}/include
  1.1436 +    %dir %{l_prefix}/include/openpkg
  1.1437 +    %dir %{l_prefix}/include/openpkg/rpm
  1.1438 +    %{l_prefix}/include/openpkg/rpm/argv.h
  1.1439 +    %{l_prefix}/include/openpkg/rpm/beecrypt.h
  1.1440 +    %{l_prefix}/include/openpkg/rpm/bzlib.h
  1.1441 +    %{l_prefix}/include/openpkg/rpm/db.h
  1.1442 +    %{l_prefix}/include/openpkg/rpm/fts.h
  1.1443 +    %{l_prefix}/include/openpkg/rpm/glob.h
  1.1444 +    %{l_prefix}/include/openpkg/rpm/hdrinline.h
  1.1445 +    %{l_prefix}/include/openpkg/rpm/header.h
  1.1446 +    %{l_prefix}/include/openpkg/rpm/misc.h
  1.1447 +    %{l_prefix}/include/openpkg/rpm/popt.h
  1.1448 +    %{l_prefix}/include/openpkg/rpm/rpmal.h
  1.1449 +    %{l_prefix}/include/openpkg/rpm/rpmbuild.h
  1.1450 +    %{l_prefix}/include/openpkg/rpm/rpmcli.h
  1.1451 +    %{l_prefix}/include/openpkg/rpm/rpmdb.h
  1.1452 +    %{l_prefix}/include/openpkg/rpm/rpmds.h
  1.1453 +    %{l_prefix}/include/openpkg/rpm/rpmerr.h
  1.1454 +    %{l_prefix}/include/openpkg/rpm/rpmfc.h
  1.1455 +    %{l_prefix}/include/openpkg/rpm/rpmfi.h
  1.1456 +    %{l_prefix}/include/openpkg/rpm/rpmfile.h
  1.1457 +    %{l_prefix}/include/openpkg/rpm/rpmhash.h
  1.1458 +    %{l_prefix}/include/openpkg/rpm/rpmio.h
  1.1459 +    %{l_prefix}/include/openpkg/rpm/rpmlib.h
  1.1460 +    %{l_prefix}/include/openpkg/rpm/rpmlog.h
  1.1461 +    %{l_prefix}/include/openpkg/rpm/rpmmacro.h
  1.1462 +    %{l_prefix}/include/openpkg/rpm/rpmmessages.h
  1.1463 +    %{l_prefix}/include/openpkg/rpm/rpmpgp.h
  1.1464 +    %{l_prefix}/include/openpkg/rpm/rpmps.h
  1.1465 +    %{l_prefix}/include/openpkg/rpm/rpmspec.h
  1.1466 +    %{l_prefix}/include/openpkg/rpm/rpmsw.h
  1.1467 +    %{l_prefix}/include/openpkg/rpm/rpmte.h
  1.1468 +    %{l_prefix}/include/openpkg/rpm/rpmts.h
  1.1469 +    %{l_prefix}/include/openpkg/rpm/rpmurl.h
  1.1470 +    %{l_prefix}/include/openpkg/rpm/stringbuf.h
  1.1471 +    %{l_prefix}/include/openpkg/rpm/ugid.h
  1.1472 +    %{l_prefix}/include/openpkg/rpm/zconf.h
  1.1473 +    %{l_prefix}/include/openpkg/rpm/zlib.h
  1.1474 +    %dir %{l_prefix}/info
  1.1475 +    %dir %{l_prefix}/lib
  1.1476 +    %dir %{l_prefix}/lib/openpkg
  1.1477 +    %{l_prefix}/lib/openpkg/bash
  1.1478 +    %{l_prefix}/lib/openpkg/bzip2
  1.1479 +    %{l_prefix}/lib/openpkg/curl
  1.1480 +    %{l_prefix}/lib/openpkg/file
  1.1481 +    %{l_prefix}/lib/openpkg/gzip
  1.1482 +    %{l_prefix}/lib/openpkg/librpm.a
  1.1483 +    %{l_prefix}/lib/openpkg/librpmbeecrypt.a
  1.1484 +    %{l_prefix}/lib/openpkg/librpmbuild.a
  1.1485 +    %{l_prefix}/lib/openpkg/librpmbz2.a
  1.1486 +    %{l_prefix}/lib/openpkg/librpmdb.a
  1.1487 +    %{l_prefix}/lib/openpkg/librpmio.a
  1.1488 +    %{l_prefix}/lib/openpkg/librpmpopt.a
  1.1489 +    %{l_prefix}/lib/openpkg/librpmz.a
  1.1490 +    %{l_prefix}/lib/openpkg/macros
  1.1491 +    %{l_prefix}/lib/openpkg/magic
  1.1492 +    %{l_prefix}/lib/openpkg/magic.mgc
  1.1493 +    %{l_prefix}/lib/openpkg/magic.mime
  1.1494 +    %{l_prefix}/lib/openpkg/magic.mime.mgc
  1.1495 +    %{l_prefix}/lib/openpkg/miniperl
  1.1496 +    %{l_prefix}/lib/openpkg/openpkg
  1.1497 +    %{l_prefix}/lib/openpkg/openssl
  1.1498 +    %{l_prefix}/lib/openpkg/patch
  1.1499 +    %{l_prefix}/lib/openpkg/rc
  1.1500 +    %{l_prefix}/lib/openpkg/rpm
  1.1501 +    %{l_prefix}/lib/openpkg/rpmb
  1.1502 +    %{l_prefix}/lib/openpkg/rpmd
  1.1503 +    %{l_prefix}/lib/openpkg/rpmdb
  1.1504 +    %{l_prefix}/lib/openpkg/rpmdb_dump
  1.1505 +    %{l_prefix}/lib/openpkg/rpmdb_load
  1.1506 +    %{l_prefix}/lib/openpkg/rpmdb_verify
  1.1507 +    %{l_prefix}/lib/openpkg/rpme
  1.1508 +    %{l_prefix}/lib/openpkg/rpmi
  1.1509 +    %{l_prefix}/lib/openpkg/rpmk
  1.1510 +    %{l_prefix}/lib/openpkg/rpmpopt
  1.1511 +    %{l_prefix}/lib/openpkg/rpmq
  1.1512 +    %{l_prefix}/lib/openpkg/rpmt
  1.1513 +    %{l_prefix}/lib/openpkg/rpmtool
  1.1514 +    %{l_prefix}/lib/openpkg/rpmu
  1.1515 +    %{l_prefix}/lib/openpkg/rpmv
  1.1516 +    %{l_prefix}/lib/openpkg/shtool
  1.1517 +    %{l_prefix}/lib/openpkg/tar
  1.1518 +    %{l_prefix}/lib/openpkg/uuid
  1.1519 +    %dir %{l_prefix}/libexec
  1.1520 +    %dir %{l_prefix}/libexec/openpkg
  1.1521 +    %{l_prefix}/libexec/openpkg/build.8
  1.1522 +    %{l_prefix}/libexec/openpkg/build.pl
  1.1523 +    %{l_prefix}/libexec/openpkg/curl.sh
  1.1524 +    %{l_prefix}/libexec/openpkg/install
  1.1525 +    %{l_prefix}/libexec/openpkg/lsync
  1.1526 +    %{l_prefix}/libexec/openpkg/lsync.8
  1.1527 +    %{l_prefix}/libexec/openpkg/man
  1.1528 +    %{l_prefix}/libexec/openpkg/rc
  1.1529 +    %{l_prefix}/libexec/openpkg/rc.8
  1.1530 +    %{l_prefix}/libexec/openpkg/register
  1.1531 +    %{l_prefix}/libexec/openpkg/register.8
  1.1532 +    %{l_prefix}/libexec/openpkg/release
  1.1533 +    %{l_prefix}/libexec/openpkg/release.8
  1.1534 +    %{l_prefix}/libexec/openpkg/rpm
  1.1535 +    %{l_prefix}/libexec/openpkg/rpm-config
  1.1536 +    %{l_prefix}/libexec/openpkg/rpm-config.8
  1.1537 +    %{l_prefix}/libexec/openpkg/rpm.8
  1.1538 +    %{l_prefix}/libexec/openpkg/rpm2cpio
  1.1539 +    %{l_prefix}/libexec/openpkg/rpm2cpio.8
  1.1540 +    %{l_prefix}/libexec/openpkg/rpmbuild
  1.1541 +    %{l_prefix}/libexec/openpkg/rpmbuild.8
  1.1542 +    %{l_prefix}/libexec/openpkg/uuid
  1.1543 +    %{l_prefix}/libexec/openpkg/uuid.8
  1.1544 +    %dir %{l_prefix}/man
  1.1545 +    %dir %{l_prefix}/man/man1
  1.1546 +    %dir %{l_prefix}/man/man2
  1.1547 +    %dir %{l_prefix}/man/man3
  1.1548 +    %dir %{l_prefix}/man/man4
  1.1549 +    %dir %{l_prefix}/man/man5
  1.1550 +    %dir %{l_prefix}/man/man6
  1.1551 +    %dir %{l_prefix}/man/man7
  1.1552 +    %dir %{l_prefix}/man/man8
  1.1553 +    %dir %{l_prefix}/man/man9
  1.1554 +    %dir %{l_prefix}/man/cat1
  1.1555 +    %dir %{l_prefix}/man/cat2
  1.1556 +    %dir %{l_prefix}/man/cat3
  1.1557 +    %dir %{l_prefix}/man/cat4
  1.1558 +    %dir %{l_prefix}/man/cat5
  1.1559 +    %dir %{l_prefix}/man/cat6
  1.1560 +    %dir %{l_prefix}/man/cat7
  1.1561 +    %dir %{l_prefix}/man/cat8
  1.1562 +    %dir %{l_prefix}/man/cat9
  1.1563 +    %{l_prefix}/man/man1/openpkg.1
  1.1564 +    %dir %{l_prefix}/sbin
  1.1565 +    %dir %{l_prefix}/pub
  1.1566 +    %dir %{l_prefix}/share
  1.1567 +    %dir %{l_prefix}/var
  1.1568 +    %dir %{l_prefix}/local
  1.1569 +    %{l_prefix}/local/README
  1.1570 +    %{l_prefix}/local/.lsyncrc
  1.1571 +    %dir %{l_prefix}/local/PKG
  1.1572 +    %dir %{l_prefix}/local/bin
  1.1573 +    %dir %{l_prefix}/local/etc
  1.1574 +    %dir %{l_prefix}/local/include
  1.1575 +    %dir %{l_prefix}/local/info
  1.1576 +    %dir %{l_prefix}/local/lib
  1.1577 +    %dir %{l_prefix}/local/man
  1.1578 +    %dir %{l_prefix}/local/man/man1
  1.1579 +    %dir %{l_prefix}/local/man/man2
  1.1580 +    %dir %{l_prefix}/local/man/man3
  1.1581 +    %dir %{l_prefix}/local/man/man4
  1.1582 +    %dir %{l_prefix}/local/man/man5
  1.1583 +    %dir %{l_prefix}/local/man/man6
  1.1584 +    %dir %{l_prefix}/local/man/man7
  1.1585 +    %dir %{l_prefix}/local/man/man8
  1.1586 +    %dir %{l_prefix}/local/man/man9
  1.1587 +    %dir %{l_prefix}/local/man/cat1
  1.1588 +    %dir %{l_prefix}/local/man/cat2
  1.1589 +    %dir %{l_prefix}/local/man/cat3
  1.1590 +    %dir %{l_prefix}/local/man/cat4
  1.1591 +    %dir %{l_prefix}/local/man/cat5
  1.1592 +    %dir %{l_prefix}/local/man/cat6
  1.1593 +    %dir %{l_prefix}/local/man/cat7
  1.1594 +    %dir %{l_prefix}/local/man/cat8
  1.1595 +    %dir %{l_prefix}/local/man/cat9
  1.1596 +    %dir %{l_prefix}/local/sbin
  1.1597 +
  1.1598 +%clean
  1.1599 +    #   skip in bootstrap phase 2 (see openpkg.boot)
  1.1600 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  1.1601 +
  1.1602 +    #   cleanup build area
  1.1603 +    rm -rf openpkg-%{version} >/dev/null 2>&1 || true
  1.1604 +
  1.1605 +    #   cleanup installation area
  1.1606 +    rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
  1.1607 +
  1.1608 +%pre
  1.1609 +    #   always performed for upgrades and because it doesn't harm!
  1.1610 +    #   [ ".$1" != .1 ] && exit 0
  1.1611 +
  1.1612 +    #   this procedure is only usable with root privileges
  1.1613 +    #   (for non-root installations it is not required at all)
  1.1614 +    cusr=`(id -un) 2>/dev/null ||\
  1.1615 +          (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  1.1616 +          (whoami) 2>/dev/null ||\
  1.1617 +          (who am i | cut "-d " -f1) 2>/dev/null ||\
  1.1618 +          echo $LOGNAME`
  1.1619 +
  1.1620 +    #   determine runtime details (for both inside and outside RPM!!)
  1.1621 +    #   - bootstrapping: $xxx is set from aux.wrapbin.sh
  1.1622 +    #   - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
  1.1623 +    #   - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
  1.1624 +    [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
  1.1625 +    [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
  1.1626 +    [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
  1.1627 +    [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
  1.1628 +    [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
  1.1629 +    [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
  1.1630 +    [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
  1.1631 +    [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
  1.1632 +    [ ".$suid" = . ] && suid="%{?l_suid}"
  1.1633 +    [ ".$sgid" = . ] && sgid="%{?l_sgid}"
  1.1634 +    [ ".$muid" = . ] && muid="%{?l_muid}"
  1.1635 +    [ ".$mgid" = . ] && mgid="%{?l_mgid}"
  1.1636 +    [ ".$ruid" = . ] && ruid="%{?l_ruid}"
  1.1637 +    [ ".$rgid" = . ] && rgid="%{?l_rgid}"
  1.1638 +    [ ".$nuid" = . ] && nuid="%{?l_nuid}"
  1.1639 +    [ ".$ngid" = . ] && ngid="%{?l_ngid}"
  1.1640 +
  1.1641 +    #   if any of these optional params are not used we won't have a
  1.1642 +    #   corresponding macro either, so make use of one conditionally
  1.1643 +    [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
  1.1644 +    [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
  1.1645 +    [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
  1.1646 +    [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
  1.1647 +    [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
  1.1648 +    [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
  1.1649 +    [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
  1.1650 +    [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
  1.1651 +
  1.1652 +    #   determine prefix
  1.1653 +    [ ".$prefix" = . ] && prefix="%{l_prefix}"
  1.1654 +    prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  1.1655 +
  1.1656 +    #   register instance in presence file
  1.1657 +    presence="/etc/openpkg"
  1.1658 +    exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
  1.1659 +    if [ ".$exists" = . ]; then
  1.1660 +        ( umask 022
  1.1661 +          echo "${prefix}" >>$presence
  1.1662 +        ) 2>/dev/null || true
  1.1663 +    fi
  1.1664 +
  1.1665 +    #   determine user/group ids
  1.1666 +    for class in s m r n; do
  1.1667 +        eval "xusr=\"\$${class}usr\""
  1.1668 +        eval "xgrp=\"\$${class}grp\""
  1.1669 +        eval "xuid=\"\$${class}uid\""
  1.1670 +        eval "xgid=\"\$${class}gid\""
  1.1671 +        if [ ".$xuid" = . ]; then
  1.1672 +            xuid=`(getent passwd "${xusr}"; \
  1.1673 +                   grep "^${xusr}:" /etc/passwd; \
  1.1674 +                   ypmatch "${xusr}" passwd; \
  1.1675 +                   nismatch "${xusr}" passwd; \
  1.1676 +                   nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
  1.1677 +                   sed -e 'q' | awk -F: '{ print $3; }'`
  1.1678 +            if [ ".$xuid" = . ]; then
  1.1679 +                #   seek for a reasonably uid/gid pair
  1.1680 +                xuid=1000
  1.1681 +                ok=0
  1.1682 +                while [ ".$ok" = .0 ]; do
  1.1683 +                    eval "u_exists=\$u_exists_$xuid"
  1.1684 +                    if [ ".$u_exists" = . ]; then
  1.1685 +                        u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
  1.1686 +                                  grep "^[^:]*:[^:]*:$xuid:"`
  1.1687 +                    fi
  1.1688 +                    eval "g_exists=\$g_exists_$xuid"
  1.1689 +                    if [ ".$g_exists" = . ]; then
  1.1690 +                        g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
  1.1691 +                                  grep "^[^:]*:[^:]*:$xuid:"`
  1.1692 +                    fi
  1.1693 +                    if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
  1.1694 +                        ok=1
  1.1695 +                        break
  1.1696 +                    fi
  1.1697 +                    xuid=`expr $xuid + 1`
  1.1698 +                done
  1.1699 +                eval "u_exists_$xuid=yes"
  1.1700 +                eval "g_exists_$xuid=yes"
  1.1701 +            fi
  1.1702 +        fi
  1.1703 +        if [ ".$xgid" = . ]; then
  1.1704 +            xgid=`(getent group "${xgrp}"; \
  1.1705 +                  grep "^${xgrp}:" /etc/group; \
  1.1706 +                  ypmatch "${xgrp}" group; \
  1.1707 +                  nismatch "${xgrp}" group; \
  1.1708 +                  nidump group . | grep "^${xgrp}:") 2>/dev/null | \
  1.1709 +                  sed -e 'q' | awk -F: '{ print $3; }'`
  1.1710 +            if [ ".$xgid" = . ]; then
  1.1711 +                xgid="$xuid"
  1.1712 +            fi
  1.1713 +        fi
  1.1714 +        eval "${class}uid=\"$xuid\""
  1.1715 +        eval "${class}gid=\"$xgid\""
  1.1716 +    done
  1.1717 +
  1.1718 +    #   determine platform id
  1.1719 +    s=`(uname -s) 2>/dev/null` || s='Unknown'
  1.1720 +    r=`(uname -r) 2>/dev/null` || r='0.0'
  1.1721 +    plid="${s}/${r}"
  1.1722 +
  1.1723 +    #   add entry to /etc/shells
  1.1724 +    shell="${prefix}/lib/openpkg/bash"
  1.1725 +    if [ -f /etc/shells ]; then
  1.1726 +        exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
  1.1727 +        if [ ".$exists" = . ]; then
  1.1728 +            if [ ".$cusr" != ".root" ]; then
  1.1729 +                echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
  1.1730 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.1731 +            else
  1.1732 +                echo "${shell}" >>/etc/shells
  1.1733 +            fi
  1.1734 +        fi
  1.1735 +    fi
  1.1736 +
  1.1737 +    #   clear pending deferred actions
  1.1738 +    rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
  1.1739 +
  1.1740 +    #   create the hierarchy user/group
  1.1741 +    for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
  1.1742 +               "management:${musr}:${muid}:${mgrp}:${mgid}" \
  1.1743 +               "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
  1.1744 +               "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
  1.1745 +        #   split request into class/usr/uid/grp/gid
  1.1746 +        OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
  1.1747 +        class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
  1.1748 +
  1.1749 +        #   check whether user already exists
  1.1750 +        exists=`(getent passwd "$usr"; \
  1.1751 +                 grep "^$usr:" /etc/passwd; \
  1.1752 +                 ypmatch "$usr" passwd; \
  1.1753 +                 nismatch "$usr" passwd; \
  1.1754 +                 nidump passwd . | grep "^$usr:") 2>/dev/null | \
  1.1755 +                 sed -e 'q'`
  1.1756 +        if [ ".$exists" = . ]; then
  1.1757 +            if [ ".$cusr" != ".root" ]; then
  1.1758 +                echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
  1.1759 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.1760 +            else
  1.1761 +                #   add entry to passwd database
  1.1762 +                realname="${prefix} OpenPKG ($class)"
  1.1763 +                case "$plid" in
  1.1764 +                    FreeBSD/* | NetBSD/* )
  1.1765 +                        file=/etc/master.passwd
  1.1766 +                        entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
  1.1767 +                        update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
  1.1768 +                        ;;
  1.1769 +                    Linux/* )
  1.1770 +                        file=/etc/passwd
  1.1771 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1.1772 +                        update="(PATH=\$PATH:/usr/sbin; pwconv)"
  1.1773 +                        ;;
  1.1774 +                    SunOS/5.* | UnixWare/* )
  1.1775 +                        file=/etc/passwd
  1.1776 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1.1777 +                        update="(PATH=\$PATH:/usr/sbin; pwconv)"
  1.1778 +                        ;;
  1.1779 +                    AIX/* )
  1.1780 +                        #   intentionally do nothing here
  1.1781 +                        :
  1.1782 +                        ;;
  1.1783 +                    OSF1/V5.* )
  1.1784 +                        file=/etc/passwd
  1.1785 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1.1786 +                        update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
  1.1787 +                        ;;
  1.1788 +                    HP-UX/* )
  1.1789 +                        file=/etc/passwd
  1.1790 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1.1791 +                        update=":"
  1.1792 +                        ;;
  1.1793 +                    Darwin/* )
  1.1794 +                        #   intentionally do nothing here
  1.1795 +                        :
  1.1796 +                        ;;
  1.1797 +                    IRIX*/6.* )
  1.1798 +                        file=/etc/passwd
  1.1799 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1.1800 +                        if   [ -f /etc/shadow ]
  1.1801 +                        then update="(PATH=\$PATH:/sbin; pwconv)"
  1.1802 +                        else update=":"
  1.1803 +                        fi
  1.1804 +                        ;;
  1.1805 +                esac
  1.1806 +                case "$plid" in
  1.1807 +                    Darwin/* )
  1.1808 +                        niutil -create     . "/users/${usr}"
  1.1809 +                        niutil -createprop . "/users/${usr}" passwd   "*"
  1.1810 +                        niutil -createprop . "/users/${usr}" uid      "${uid}"
  1.1811 +                        niutil -createprop . "/users/${usr}" gid      "${gid}"
  1.1812 +                        niutil -createprop . "/users/${usr}" realname "${realname}"
  1.1813 +                        niutil -createprop . "/users/${usr}" home     "${prefix}"
  1.1814 +                        niutil -createprop . "/users/${usr}" shell    "${shell}"
  1.1815 +                        ;;
  1.1816 +                    AIX/* )
  1.1817 +                        mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
  1.1818 +                        cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
  1.1819 +                        sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
  1.1820 +                            </etc/security/login.cfg.bak >/etc/security/login.cfg && \
  1.1821 +                        rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
  1.1822 +                        #   defer both the setting of the primary group and the shell,
  1.1823 +                        #   as they do not exist at this stage of processing.
  1.1824 +                        echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
  1.1825 +                        echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
  1.1826 +                        ;;
  1.1827 +                    * )
  1.1828 +                        cp $file $file.bak && \
  1.1829 +                        (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
  1.1830 +                        rm -f $file.bak >/dev/null 2>&1
  1.1831 +                        eval $update
  1.1832 +                        [ $? -ne 0 ] && exit $?
  1.1833 +                        ;;
  1.1834 +                esac
  1.1835 +            fi
  1.1836 +        fi
  1.1837 +
  1.1838 +        #   check whether group already exists
  1.1839 +        exists=`(getent group "$grp"; \
  1.1840 +                grep "^$grp:" /etc/group; \
  1.1841 +                ypmatch "$grp" group; \
  1.1842 +                nismatch "$grp" group; \
  1.1843 +                nidump group . | grep "^$grp:") 2>/dev/null | \
  1.1844 +                sed -e 'q'`
  1.1845 +        if [ ".$exists" = . ]; then
  1.1846 +            if [ ".$cusr" != ".root" ]; then
  1.1847 +                echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
  1.1848 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.1849 +            else
  1.1850 +                case "$plid" in
  1.1851 +                    Darwin/* )
  1.1852 +                        niutil -create     . "/groups/${grp}"
  1.1853 +                        niutil -createprop . "/groups/${grp}" gid   "${gid}"
  1.1854 +                        niutil -createprop . "/groups/${grp}" users "${usr}"
  1.1855 +                        ;;
  1.1856 +                    AIX/* )
  1.1857 +                        mkgroup id="${gid}" users="${usr}" "${grp}"
  1.1858 +                        ;;
  1.1859 +                    * )
  1.1860 +                        #   add entry to group database
  1.1861 +                        file=/etc/group
  1.1862 +                        entry="${grp}:*:${gid}:${usr}"
  1.1863 +                        cp $file $file.bak && \
  1.1864 +                        (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
  1.1865 +                        rm -f $file.bak >/dev/null 2>&1
  1.1866 +                    ;;
  1.1867 +                esac
  1.1868 +            fi
  1.1869 +        fi
  1.1870 +    done
  1.1871 +
  1.1872 +    #   optional group processing (deferred adjustment of primary group)
  1.1873 +    if [ -f %{l_prefix}.pre-group-process.sh ]; then
  1.1874 +        sh %{l_prefix}.pre-group-process.sh
  1.1875 +        rm -f %{l_prefix}.pre-group-process.sh
  1.1876 +    fi
  1.1877 +
  1.1878 +    #   invalidate passwd and group tables from Name Service Cache Daemon to
  1.1879 +    #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
  1.1880 +    if [ -x /usr/sbin/nscd ]; then
  1.1881 +        /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
  1.1882 +        /usr/sbin/nscd -i group >/dev/null 2>&1 || true
  1.1883 +    fi
  1.1884 +
  1.1885 +    #   create the startup/shutdown transfer script
  1.1886 +    name=`echo "$prefix" | sed -e 's;/;;g'`
  1.1887 +    if [ ".$cusr" != ".root" ]; then
  1.1888 +        echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
  1.1889 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.1890 +    else
  1.1891 +        case "$plid" in
  1.1892 +            FreeBSD/* )
  1.1893 +                if [ ! -f /etc/rc.d/openpkg-${name} ]; then
  1.1894 +                    #   install transfer script
  1.1895 +                    rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
  1.1896 +                    ( echo "#!/bin/sh"
  1.1897 +                      echo "##"
  1.1898 +                      echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.1899 +                      echo "##"
  1.1900 +                      echo ""
  1.1901 +                      echo "# PROVIDE: openpkg-${name}"
  1.1902 +                      echo "# REQUIRE: LOGIN"
  1.1903 +                      echo "# KEYWORD: shutdown"
  1.1904 +                      echo ""
  1.1905 +                      echo ". /etc/rc.subr"
  1.1906 +                      echo ""
  1.1907 +                      echo "name=\"openpkg_${name}\""
  1.1908 +                      echo "start_cmd=\"openpkg_rc_all start\""
  1.1909 +                      echo "stop_cmd=\"openpkg_rc_all stop\""
  1.1910 +                      echo "restart_cmd=\"openpkg_rc_all stop start\""
  1.1911 +                      echo ""
  1.1912 +                      echo "openpkg_rc_all () {"
  1.1913 +                      echo "    if [ -f ${prefix}/etc/rc ]; then"
  1.1914 +                      echo "        ${prefix}/etc/rc all \"\$@\""
  1.1915 +                      echo "    fi"
  1.1916 +                      echo "}"
  1.1917 +                      echo ""
  1.1918 +                      echo "load_rc_config \$name"
  1.1919 +                      echo "run_rc_command \"\$1\""
  1.1920 +                      echo ""
  1.1921 +                    ) >/etc/rc.d/openpkg-${name}
  1.1922 +                    chmod 755 /etc/rc.d/openpkg-${name}
  1.1923 +                fi
  1.1924 +                ;;
  1.1925 +            NetBSD/* )
  1.1926 +                if [ ! -f /etc/rc.d/${name} ]; then
  1.1927 +                    ( echo "#!/bin/sh"
  1.1928 +                      echo "##"
  1.1929 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.1930 +                      echo "##"
  1.1931 +                      echo "##  PROVIDE: ${name}"
  1.1932 +                      echo "##  REQUIRE: DAEMON LOGIN NETWORK SERVERS"
  1.1933 +                      echo "##"
  1.1934 +                      echo ""
  1.1935 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.1936 +                      echo "case \$1 in"
  1.1937 +                      echo "    start   ) exec ${prefix}/etc/rc all start ;;"
  1.1938 +                      echo "    stop    ) exec ${prefix}/etc/rc all stop  ;;"
  1.1939 +                      echo "    restart ) exec ${prefix}/etc/rc all stop start ;;"
  1.1940 +                      echo "    status  ) ;;"
  1.1941 +                      echo "esac"
  1.1942 +                    ) >/etc/rc.d/${name}
  1.1943 +                    chmod 755 /etc/rc.d/${name}
  1.1944 +                fi
  1.1945 +                ;;
  1.1946 +            Linux/* )
  1.1947 +                if [ -f /etc/gentoo-release ]; then
  1.1948 +                    if [ ! -f /etc/init.d/openpkg-${name} ]; then
  1.1949 +                        #   install transfer script
  1.1950 +                        ( echo "#!/sbin/runscript"
  1.1951 +                          echo "##"
  1.1952 +                          echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.1953 +                          echo "##"
  1.1954 +                          echo ""
  1.1955 +                          echo "depend() {"
  1.1956 +                          echo "    after *"
  1.1957 +                          echo "}"
  1.1958 +                          echo ""
  1.1959 +                          echo "checkconfig() {"
  1.1960 +                          echo "    [ -f ${prefix}/etc/rc ] || return 1"
  1.1961 +                          echo "    case $1 in"
  1.1962 +                          echo "        start ) exec ${prefix}/etc/rc all start ;;"
  1.1963 +                          echo "        stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.1964 +                          echo "    esac"
  1.1965 +                          echo "}"
  1.1966 +                          echo ""
  1.1967 +                          echo "start() {"
  1.1968 +                          echo "    checkconfig || return 1"
  1.1969 +                          echo "    ebegin "Starting OpenPKG ${prefix} hierarchy""
  1.1970 +                          echo "    exec ${prefix}/etc/rc all start"
  1.1971 +                          echo "    eend 0"
  1.1972 +                          echo "}"
  1.1973 +                          echo ""
  1.1974 +                          echo "stop() {"
  1.1975 +                          echo "    checkconfig || return 1"
  1.1976 +                          echo "    ebegin "Stopping OpenPKG ${prefix} hierarchy""
  1.1977 +                          echo "    exec ${prefix}/etc/rc all stop"
  1.1978 +                          echo "    eend 0"
  1.1979 +                          echo "}"
  1.1980 +                        ) >/etc/init.d/openpkg-${name}
  1.1981 +                        chmod 755 /etc/init.d/openpkg-${name}
  1.1982 +                        /sbin/rc-update add openpkg-${name} default
  1.1983 +                    fi
  1.1984 +                else
  1.1985 +                    #   sroot: script root directory
  1.1986 +                    #   lroot: link   root directory
  1.1987 +                    if [ -f /etc/debian_version ]; then
  1.1988 +                        sroot=/etc/init.d
  1.1989 +                        lroot=/etc/rc%d.d
  1.1990 +                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
  1.1991 +                        sroot=/etc/rc.d/init.d
  1.1992 +                        lroot=/etc/rc.d/rc%d.d
  1.1993 +                    elif [ -f /etc/SuSE-release ]; then
  1.1994 +                        sroot=/etc/init.d
  1.1995 +                        lroot=/etc/init.d/rc%d.d
  1.1996 +                    elif [ -f /etc/slackware-version ]; then
  1.1997 +                        sroot=/etc/rc.d
  1.1998 +                        lroot=/etc/rc.d/rc%d.d
  1.1999 +                        name="rc.${name}"
  1.2000 +                        for i in 0 1 2 3 4 5 6; do
  1.2001 +                            l=`echo $lroot | sed -e "s;%d;$i;"`
  1.2002 +                            if [ ! -d $l ]; then
  1.2003 +                                mkdir $l 2>&1 || true
  1.2004 +                            fi
  1.2005 +                        done
  1.2006 +                    else
  1.2007 +                        echo "WARNING: you are not running one of the supported standard" 1>&2
  1.2008 +                        echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)."   1>&2
  1.2009 +                        echo "WARNING: Guessing the location of the system init scripts!" 1>&2
  1.2010 +                        sroot=""
  1.2011 +                        lroot=""
  1.2012 +                        for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
  1.2013 +                            if [ -d $sr ]; then
  1.2014 +                                sroot="$sr"
  1.2015 +                                break
  1.2016 +                            fi
  1.2017 +                        done
  1.2018 +                        for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
  1.2019 +                            if [ -d $lr ]; then
  1.2020 +                                lroot="`echo $lr | sed -e 's;2;%d;'`"
  1.2021 +                                break
  1.2022 +                            fi
  1.2023 +                        done
  1.2024 +                        if [ ".$sroot" = . -o ".$lroot" = . ]; then
  1.2025 +                            echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
  1.2026 +                            exit 1
  1.2027 +                        fi
  1.2028 +                    fi
  1.2029 +                    if [ ! -f $sroot/${name} ]; then
  1.2030 +                        #   install transfer script
  1.2031 +                        ( echo "#!/bin/sh"
  1.2032 +                          echo "##"
  1.2033 +                          echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2034 +                          echo "##"
  1.2035 +                          echo ""
  1.2036 +                          echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2037 +                          echo "case \$1 in"
  1.2038 +                          echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2039 +                          echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2040 +                          echo "esac"
  1.2041 +                        ) >$sroot/${name}
  1.2042 +                        chmod 755 $sroot/${name}
  1.2043 +                        #   create corresponding symbolic links
  1.2044 +                        for i in 2 3 4 5; do
  1.2045 +                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
  1.2046 +                        done
  1.2047 +                        for i in 0 1 6; do
  1.2048 +                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
  1.2049 +                        done
  1.2050 +                    fi
  1.2051 +                fi
  1.2052 +                ;;
  1.2053 +            SunOS/5.* )
  1.2054 +                if [ ! -f /etc/init.d/${name} ]; then
  1.2055 +                    #   install transfer script
  1.2056 +                    ( echo "#!/bin/sh"
  1.2057 +                      echo "##"
  1.2058 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2059 +                      echo "##"
  1.2060 +                      echo ""
  1.2061 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2062 +                      echo "case \$1 in"
  1.2063 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2064 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2065 +                      echo "esac"
  1.2066 +                    ) >/etc/init.d/${name}
  1.2067 +                    chmod 755 /etc/init.d/${name}
  1.2068 +                    #   create corresponding symbolic links
  1.2069 +                    ( cd /etc
  1.2070 +                      ln init.d/${name} rc3.d/S99${name}
  1.2071 +                      ln init.d/${name} rc0.d/K00${name}
  1.2072 +                      ln init.d/${name} rc1.d/K00${name}
  1.2073 +                    ) || exit $?
  1.2074 +                fi
  1.2075 +                ;;
  1.2076 +            UnixWare/* )
  1.2077 +                if [ ! -f /etc/init.d/${name} ]; then
  1.2078 +                    #   install transfer script
  1.2079 +                    ( echo "#!/bin/sh"
  1.2080 +                      echo "##"
  1.2081 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2082 +                      echo "##"
  1.2083 +                      echo ""
  1.2084 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2085 +                      echo "case \$1 in"
  1.2086 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2087 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2088 +                      echo "esac"
  1.2089 +                    ) >/etc/init.d/${name}
  1.2090 +                    chmod 755 /etc/init.d/${name}
  1.2091 +                    #   create corresponding symbolic links
  1.2092 +                    ( cd /etc
  1.2093 +                      ln init.d/${name} rc2.d/S99${name}
  1.2094 +                      ln init.d/${name} rc0.d/K00${name}
  1.2095 +                      ln init.d/${name} rc1.d/K00${name}
  1.2096 +                    ) || exit $?
  1.2097 +                fi
  1.2098 +                ;;
  1.2099 +            AIX/* )
  1.2100 +                if [ ! -f /etc/rc.d/init.d/${name} ]; then
  1.2101 +                    #   install transfer script
  1.2102 +                    ( echo "#!/bin/sh"
  1.2103 +                      echo "##"
  1.2104 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2105 +                      echo "##"
  1.2106 +                      echo ""
  1.2107 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2108 +                      echo "case \$1 in"
  1.2109 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2110 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2111 +                      echo "esac"
  1.2112 +                    ) >/etc/rc.d/init.d/${name}
  1.2113 +                    chmod 755 /etc/rc.d/init.d/${name}
  1.2114 +                    #   create corresponding symbolic links
  1.2115 +                    ( cd /etc/rc.d
  1.2116 +                      ln -s ../init.d/${name} rc2.d/S99${name}
  1.2117 +                    ) || exit $?
  1.2118 +                fi
  1.2119 +                ;;
  1.2120 +            OSF1/V5.* )
  1.2121 +                if [ ! -f /sbin/init.d/${name} ]; then
  1.2122 +                    #   install transfer script
  1.2123 +                    ( echo "#!/bin/sh"
  1.2124 +                      echo "##"
  1.2125 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2126 +                      echo "##"
  1.2127 +                      echo ""
  1.2128 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2129 +                      echo "case \$1 in"
  1.2130 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2131 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2132 +                      echo "esac"
  1.2133 +                    ) >/sbin/init.d/${name}
  1.2134 +                    chmod 755 /sbin/init.d/${name}
  1.2135 +                    #   create corresponding symbolic links
  1.2136 +                    ( cd /sbin
  1.2137 +                      ln -s ../init.d/${name} rc3.d/S99${name}
  1.2138 +                      ln -s ../init.d/${name} rc0.d/K00${name}
  1.2139 +                    ) || exit $?
  1.2140 +                fi
  1.2141 +                ;;
  1.2142 +            HP-UX/* )
  1.2143 +                if [ ! -f /sbin/init.d/${name} ]; then
  1.2144 +                    #   install transfer script
  1.2145 +                    ( echo "#!/bin/sh"
  1.2146 +                      echo "##"
  1.2147 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2148 +                      echo "##"
  1.2149 +                      echo ""
  1.2150 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2151 +                      echo "case \$1 in"
  1.2152 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2153 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2154 +                      echo "esac"
  1.2155 +                    ) >/sbin/init.d/${name}
  1.2156 +                    chmod 755 /sbin/init.d/${name}
  1.2157 +                    #   create corresponding symbolic links
  1.2158 +                    ( cd /sbin
  1.2159 +                      ln -s ../init.d/${name} rc2.d/S900${name}
  1.2160 +                      ln -s ../init.d/${name} rc1.d/K100${name}
  1.2161 +                    ) || exit $?
  1.2162 +                fi
  1.2163 +                ;;
  1.2164 +            Darwin/* )
  1.2165 +                darwin_rc_dir="/System/Library/StartupItems/${name}"
  1.2166 +                if [ ! -d ${darwin_rc_dir} ]; then
  1.2167 +                    mkdir ${darwin_rc_dir}
  1.2168 +                fi
  1.2169 +
  1.2170 +                #   make sure hierarchy is activated in /etc/hostconfig
  1.2171 +                #   FIXME: cs: simple and bad code here without any detection of existing entries
  1.2172 +                echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
  1.2173 +
  1.2174 +                #   install transfer script
  1.2175 +                if [ ! -f ${darwin_rc_dir}/${name} ]; then
  1.2176 +                    rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
  1.2177 +                    ( echo "#!/bin/sh"
  1.2178 +                      echo "##"
  1.2179 +                      echo "##  ${darwin_rc_dir}/${name}"
  1.2180 +                      echo "##      -- startup transfer script for OpenPKG ${prefix} hierarchy"
  1.2181 +                      echo "##"
  1.2182 +                      echo ""
  1.2183 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2184 +                      echo ""
  1.2185 +                      echo ". /etc/rc.common"
  1.2186 +                      echo ""
  1.2187 +                      echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
  1.2188 +                      echo "    ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
  1.2189 +                      echo "    ${prefix}/etc/rc all start"
  1.2190 +                      echo "fi"
  1.2191 +                    ) >${darwin_rc_dir}/${name}
  1.2192 +                    chmod 755 ${darwin_rc_dir}/${name}
  1.2193 +                fi
  1.2194 +                #   install startup parameter list
  1.2195 +                if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
  1.2196 +                    rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
  1.2197 +                    ( echo "{"
  1.2198 +                      echo "  Description     = \"OpenPKG ${prefix} hierarchy\";"
  1.2199 +                      echo "  Provides        = (\"OpenPKG ${prefix}\");"
  1.2200 +                      echo "  Requires        = (\"Disks\", \"Network Configuration\", \"Resolver\");"
  1.2201 +                      echo "  Uses            = (\"Cron\");"
  1.2202 +                      echo "  OrderPreference = \"Last\";"
  1.2203 +                      echo "  Messages ="
  1.2204 +                      echo "  {"
  1.2205 +                      echo "    start = \"Starting OpenPKG ${prefix} hierarchy\";"
  1.2206 +                      echo "    stop  = \"Stopping OpenPKG ${prefix} hierarchy\";"
  1.2207 +                      echo "  };"
  1.2208 +                      echo "}"
  1.2209 +                    ) >${darwin_rc_dir}/StartupParameters.plist
  1.2210 +                    chmod 644 ${darwin_rc_dir}/StartupParameters.plist
  1.2211 +                fi
  1.2212 +                ;;
  1.2213 +            IRIX*/6.* )
  1.2214 +                if [ ! -f /etc/init.d/${name} ]; then
  1.2215 +                    #   install transfer script
  1.2216 +                    ( echo "#!/bin/sh"
  1.2217 +                      echo "##"
  1.2218 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1.2219 +                      echo "##"
  1.2220 +                      echo ""
  1.2221 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1.2222 +                      echo "case \$1 in"
  1.2223 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
  1.2224 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
  1.2225 +                      echo "esac"
  1.2226 +                    ) >/etc/init.d/${name}
  1.2227 +                    chmod 755 /etc/init.d/${name}
  1.2228 +                    #   create corresponding links
  1.2229 +                    ( cd /etc
  1.2230 +                      ln -f init.d/${name} rc2.d/S99${name}
  1.2231 +                      ln -f init.d/${name} rc0.d/K00${name}
  1.2232 +                    ) || exit $?
  1.2233 +                fi
  1.2234 +                ;;
  1.2235 +        esac
  1.2236 +    fi
  1.2237 +
  1.2238 +    #   create the cron transfer entries
  1.2239 +    if [ ".$cusr" != ".root" ]; then
  1.2240 +        echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
  1.2241 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2242 +    else
  1.2243 +        case "$plid" in
  1.2244 +            FreeBSD/* | Linux/* | Darwin/* )
  1.2245 +                if [ -f /etc/slackware-version ]; then
  1.2246 +                    exists=`crontab -l | grep "$prefix/etc/rc"`
  1.2247 +                    if [ ".$exists" = . ]; then
  1.2248 +                        EDITOR=/tmp/vipw.$$
  1.2249 +                        VISUAL="$EDITOR"
  1.2250 +                        export EDITOR
  1.2251 +                        export VISUAL
  1.2252 +                        ( echo "#!/bin/sh"
  1.2253 +                          echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
  1.2254 +                          echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
  1.2255 +                          echo "    echo \"0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
  1.2256 +                          echo "    echo \"0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
  1.2257 +                          echo "    echo \"0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
  1.2258 +                          echo "    echo \"0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
  1.2259 +                          echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
  1.2260 +                          echo "    echo \"# </OpenPKG>\""
  1.2261 +                          echo ") >>\$1"
  1.2262 +                        ) >$EDITOR
  1.2263 +                        chmod a+x $EDITOR
  1.2264 +                        ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  1.2265 +                        rm -f $EDITOR
  1.2266 +                    fi
  1.2267 +                else
  1.2268 +                    exists=`grep "$prefix/etc/rc" /etc/crontab`
  1.2269 +                    if [ ".$exists" = . ]; then
  1.2270 +                        ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
  1.2271 +                          echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
  1.2272 +                          echo "0    0  1  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
  1.2273 +                          echo "0    0  *  *  0  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
  1.2274 +                          echo "0    0  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
  1.2275 +                          echo "0    *  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
  1.2276 +                          echo "*/15 *  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
  1.2277 +                          echo "# </OpenPKG>"
  1.2278 +                        ) >>/etc/crontab
  1.2279 +                    fi
  1.2280 +                fi
  1.2281 +                ;;
  1.2282 +            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
  1.2283 +                exists=`crontab -l | grep "$prefix/etc/rc"`
  1.2284 +                if [ ".$exists" = . ]; then
  1.2285 +                    EDITOR=/tmp/vipw.$$
  1.2286 +                    VISUAL="$EDITOR"
  1.2287 +                    export EDITOR
  1.2288 +                    export VISUAL
  1.2289 +                    ( echo "#!/bin/sh"
  1.2290 +                      echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
  1.2291 +                      echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
  1.2292 +                      echo "    echo \"0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
  1.2293 +                      echo "    echo \"0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
  1.2294 +                      echo "    echo \"0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
  1.2295 +                      echo "    echo \"0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
  1.2296 +                      echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
  1.2297 +                      echo "    echo \"# </OpenPKG>\""
  1.2298 +                      echo ") >>\$1"
  1.2299 +                    ) >$EDITOR
  1.2300 +                    chmod a+x $EDITOR
  1.2301 +                    ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  1.2302 +                    rm -f $EDITOR
  1.2303 +                fi
  1.2304 +                ;;
  1.2305 +            IRIX*/6.* )
  1.2306 +                exists=`crontab -l | grep "$prefix/etc/rc"`
  1.2307 +                if [ ".$exists" = . ]; then
  1.2308 +                    ( crontab -l
  1.2309 +                      echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
  1.2310 +                      echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
  1.2311 +                      echo "0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
  1.2312 +                      echo "0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
  1.2313 +                      echo "0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
  1.2314 +                      echo "0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
  1.2315 +                      echo "0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
  1.2316 +                      echo "# </OpenPKG>"
  1.2317 +                    ) | /usr/bin/crontab || exit $?
  1.2318 +                fi
  1.2319 +                ;;
  1.2320 +        esac
  1.2321 +    fi
  1.2322 +
  1.2323 +    #   remember what OpenPKG RPM version was installed, so we can
  1.2324 +    #   correctly upgrade the RPM database in the %post section (see below).
  1.2325 +    if [ -d ${prefix}/RPM/DB ]; then
  1.2326 +        if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
  1.2327 +            #   OpenPKG 2.0
  1.2328 +            rpm="${prefix}/bin/openpkg rpm"
  1.2329 +        else
  1.2330 +            #   OpenPKG 1.x
  1.2331 +            rpm="${prefix}/bin/rpm"
  1.2332 +        fi
  1.2333 +        rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
  1.2334 +        $rpm --version |\
  1.2335 +            sed -e 's;^;X;' \
  1.2336 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  1.2337 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  1.2338 +                -e 's;^X.*$;4.0;' \
  1.2339 +                >${prefix}/RPM/DB/.version
  1.2340 +    fi
  1.2341 +
  1.2342 +%post
  1.2343 +    #   optional post-processing from "pre" section
  1.2344 +    if [ -f %{l_prefix}.pre-post-process.sh ]; then
  1.2345 +        sh %{l_prefix}.pre-post-process.sh
  1.2346 +        rm -f %{l_prefix}.pre-post-process.sh
  1.2347 +    fi
  1.2348 +
  1.2349 +    #   update or initially create OpenPKG UUID configuration
  1.2350 +    %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
  1.2351 +
  1.2352 +    #   determine new and old OpenPKG RPM version
  1.2353 +    V_rpm_new="%{V_rpm}"
  1.2354 +    if [ -f %{l_prefix}/RPM/DB/.version ]; then
  1.2355 +        V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
  1.2356 +        rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
  1.2357 +    else
  1.2358 +        V_rpm_old="4.0"
  1.2359 +    fi
  1.2360 +
  1.2361 +    #   make sure all RPM database files are present and that their
  1.2362 +    #   attributes are correct, etc. This is not a database rebuild
  1.2363 +    #   operation, so this is fully harmless and can be done always.
  1.2364 +    %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
  1.2365 +
  1.2366 +    #   check RPM database for upgrade requirements
  1.2367 +    if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
  1.2368 +        #   RPM 4.0/4.1 does not allow concurrent database access, so we
  1.2369 +        #   cannot upgrade the database immediately from here (because
  1.2370 +        #   we are still running within the execution context of the
  1.2371 +        #   old RPM which in turn has the database locked) and instead
  1.2372 +        #   have to just drop a note to the administrator about database
  1.2373 +        #   upgrading. RPM 4.2 in general allows concurrent database
  1.2374 +        #   access, but the whole stuff is too risky here, too.
  1.2375 +        ( echo "You are upgrading the OpenPKG bootstrap from a previous"
  1.2376 +          echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
  1.2377 +          echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
  1.2378 +          echo "be used, but it is strongly recommended to upgrade it as"
  1.2379 +          echo "soon as possible to the latest Berkeley-DB format files by"
  1.2380 +          echo "executing the command:"
  1.2381 +          echo "    \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
  1.2382 +          echo "In case of problems with the RPM database you can always"
  1.2383 +          echo "execute the command:"
  1.2384 +          echo "    \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
  1.2385 +        ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
  1.2386 +    fi
  1.2387 +
  1.2388 +    #   system command overriding support
  1.2389 +    #   ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
  1.2390 +    #   BUILD COMMAND OVERRIDE SOLUTION!
  1.2391 +    if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
  1.2392 +        mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
  1.2393 +    fi
  1.2394 +    chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
  1.2395 +    case "`cat %{l_prefix}/etc/openpkg/platform`" in
  1.2396 +        *-*-debian* | *-*-ubuntu* )
  1.2397 +            #   FIXME: Evil hack to workaround build problems under Debian
  1.2398 +            #   (at least 3.1) (and similar platforms) where a Debian
  1.2399 +            #   install-info(8) exists which is both API and functionally
  1.2400 +            #   incompatible to the de-facto standardized install-info(8)
  1.2401 +            #   command from GNU Texinfo.
  1.2402 +            if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
  1.2403 +                ( echo "#!/bin/sh"
  1.2404 +                  echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
  1.2405 +                  echo "exit 0"
  1.2406 +                ) >%{l_prefix}/lib/openpkg/override/install-info
  1.2407 +                chmod 775 %{l_prefix}/lib/openpkg/override/install-info
  1.2408 +            fi
  1.2409 +            ;;
  1.2410 +        *-*-macosx* | *-*-darwin* )
  1.2411 +            #   FIXME: Evil hack to workaround the fact that Mac OS X'
  1.2412 +            #   linker by default prefers the /usr/lib libraries and does
  1.2413 +            #   not honor the -L options the way one would expect it.
  1.2414 +            gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
  1.2415 +            cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
  1.2416 +            ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
  1.2417 +            if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
  1.2418 +                ( echo "#!/bin/sh"
  1.2419 +                  echo "case \" \$* \" in"
  1.2420 +                  echo "    *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
  1.2421 +                  echo "    * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
  1.2422 +                  echo "esac"
  1.2423 +                ) >%{l_prefix}/lib/openpkg/override/gcc
  1.2424 +                chmod 775 %{l_prefix}/lib/openpkg/override/gcc
  1.2425 +            fi
  1.2426 +            if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
  1.2427 +                ( echo "#!/bin/sh"
  1.2428 +                  echo "case \" \$* \" in"
  1.2429 +                  echo "    *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
  1.2430 +                  echo "    * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
  1.2431 +                  echo "esac"
  1.2432 +                ) >%{l_prefix}/lib/openpkg/override/cc
  1.2433 +                chmod 775 %{l_prefix}/lib/openpkg/override/cc
  1.2434 +            fi
  1.2435 +            if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
  1.2436 +                ( echo "#!/bin/sh"
  1.2437 +                  echo "exec $ld -search_paths_first \"\$@\""
  1.2438 +                ) >%{l_prefix}/lib/openpkg/override/ld
  1.2439 +                chmod 775 %{l_prefix}/lib/openpkg/override/ld
  1.2440 +            fi
  1.2441 +            ;;
  1.2442 +    esac
  1.2443 +
  1.2444 +    #   FIXME: hack to workaround problems in environments with too few
  1.2445 +    #   development tools. ATTENTION: see one paragraph above.
  1.2446 +    if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
  1.2447 +        mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
  1.2448 +    fi
  1.2449 +    chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
  1.2450 +
  1.2451 +    #   check for "openpkg" executable from the OpenPKG Community series
  1.2452 +    #   print license if not OSS, otherwise register with openpkg.org
  1.2453 +    community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \
  1.2454 +        sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'`
  1.2455 +    if [ ".$community_version" = . ]; then
  1.2456 +        ( echo ""
  1.2457 +          echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\""
  1.2458 +          echo "executable which is covered by the following terms of use:"
  1.2459 +          echo "______________________________________________________________________________"
  1.2460 +          echo ""
  1.2461 +          %{l_prefix}/bin/openpkg --license | sed -e '1d'
  1.2462 +        ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
  1.2463 +    else
  1.2464 +        %{l_prefix}/bin/openpkg register </dev/null >/dev/null 2>&1 || true
  1.2465 +    fi
  1.2466 +
  1.2467 +%preun
  1.2468 +    [ ".$1" != .0 ] && exit 0
  1.2469 +
  1.2470 +    #   remove override files
  1.2471 +    if [ -d %{l_prefix}/lib/openpkg/override ]; then
  1.2472 +        rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
  1.2473 +    fi
  1.2474 +
  1.2475 +    #   remove fallback files
  1.2476 +    if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
  1.2477 +        rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
  1.2478 +    fi
  1.2479 +
  1.2480 +    #   remove files which are not RPM controlled
  1.2481 +    rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
  1.2482 +    rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
  1.2483 +    rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
  1.2484 +    rm -rf %{l_prefix}/RPM/DB/*  %{l_prefix}/RPM/DB/.[a-z]*  >/dev/null 2>&1 || true
  1.2485 +
  1.2486 +    #   The following code usually would be done in a %postun section.
  1.2487 +    #   But because we already had to remove the database in this %preun
  1.2488 +    #   section (see the 'rm' commands above) in order to make RPM happy
  1.2489 +    #   inside its own removal procedure, RPM would no longer find the
  1.2490 +    #   %postun script (because it's recorded in the database files). So
  1.2491 +    #   we have to perform the procedure already in this %preun script.
  1.2492 +    #   except for the removal of the top-level directory it does not
  1.2493 +    #   matter. But the top-level directory can only be removed after
  1.2494 +    #   the RPM removal procedure took place, so we play a little delay
  1.2495 +    #   trick below.
  1.2496 +
  1.2497 +    #   determine current user
  1.2498 +    cusr=`(id -un) 2>/dev/null ||\
  1.2499 +          (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  1.2500 +          (whoami) 2>/dev/null ||\
  1.2501 +          (who am i | cut "-d " -f1) 2>/dev/null ||\
  1.2502 +          echo $LOGNAME`
  1.2503 +
  1.2504 +    #   determine runtime details (for both inside and outside RPM!!)
  1.2505 +    user="%{l_musr}"
  1.2506 +    group="%{l_mgrp}"
  1.2507 +    prefix="%{l_prefix}"
  1.2508 +    prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  1.2509 +
  1.2510 +    #   determine platform id
  1.2511 +    s=`(uname -s) 2>/dev/null` || s='Unknown'
  1.2512 +    r=`(uname -r) 2>/dev/null` || r='0.0'
  1.2513 +    plid="${s}/${r}"
  1.2514 +
  1.2515 +    #   unregister instance in presence file
  1.2516 +    presence="/etc/openpkg"
  1.2517 +    exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
  1.2518 +    if [ ".$exists" != . ]; then
  1.2519 +        if [ ".$cusr" != ".root" ]; then
  1.2520 +            echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
  1.2521 +            echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2522 +        else
  1.2523 +            cp $presence $presence.bak && \
  1.2524 +            egrep -v "^ *${prefix} *\$" $presence.bak >$presence
  1.2525 +            rm -f $presence.bak >/dev/null 2>&1
  1.2526 +            if [ ".`cat $presence`" = . ]; then
  1.2527 +                rm -f $presence >/dev/null 2>&1
  1.2528 +            fi
  1.2529 +        fi
  1.2530 +    fi
  1.2531 +
  1.2532 +    #   remove entry in /etc/shells
  1.2533 +    shell="${prefix}/lib/openpkg/bash"
  1.2534 +    exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
  1.2535 +    if [ ".$exists" != . ]; then
  1.2536 +        if [ ".$cusr" != ".root" ]; then
  1.2537 +            echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
  1.2538 +            echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2539 +        else
  1.2540 +            cp /etc/shells /etc/shells.bak && \
  1.2541 +            grep -v "^${shell}" /etc/shells.bak >/etc/shells
  1.2542 +            rm -f /etc/shells.bak >/dev/null 2>&1
  1.2543 +        fi
  1.2544 +    fi
  1.2545 +
  1.2546 +    #   remove the hierarchy user/group
  1.2547 +    for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
  1.2548 +               "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
  1.2549 +               "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
  1.2550 +               "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
  1.2551 +        #   split request into class/usr/uid/grp/gid
  1.2552 +        OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
  1.2553 +        class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
  1.2554 +
  1.2555 +        #   check whether user already exists
  1.2556 +        exists=`(getent passwd "$usr"; \
  1.2557 +                 grep "^$usr:" /etc/passwd; \
  1.2558 +                 ypmatch "$usr" passwd; \
  1.2559 +                 nismatch "$usr" passwd; \
  1.2560 +                 nidump passwd . | grep "^$usr:") 2>/dev/null | \
  1.2561 +                 sed -e 'q'`
  1.2562 +        if [ ".$exists" != . ]; then
  1.2563 +            if [ ".$cusr" != ".root" ]; then
  1.2564 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
  1.2565 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2566 +            elif [ ".$usr" = ".root" ]; then
  1.2567 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
  1.2568 +                echo "openpkg:WARNING: (would remove system standard user)" 1>&2
  1.2569 +            else
  1.2570 +                case "$plid" in
  1.2571 +                    FreeBSD/* | NetBSD/* )
  1.2572 +                        cp /etc/master.passwd /etc/master.passwd.bak && \
  1.2573 +                        grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
  1.2574 +                        ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
  1.2575 +                        rm -f /etc/master.passwd.bak >/dev/null 2>&1
  1.2576 +                        ;;
  1.2577 +                    Linux/* | SunOS/5.* | UnixWare/* )
  1.2578 +                        cp /etc/passwd /etc/passwd.bak && \
  1.2579 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1.2580 +                        ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
  1.2581 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
  1.2582 +                        ;;
  1.2583 +                    AIX/* )
  1.2584 +                        rmuser -p "${usr}"
  1.2585 +                        cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
  1.2586 +                        sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
  1.2587 +                            </etc/security/login.cfg.bak >/etc/security/login.cfg && \
  1.2588 +                        rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
  1.2589 +                        ;;
  1.2590 +                    OSF1/V5.* )
  1.2591 +                        cp /etc/passwd /etc/passwd.bak && \
  1.2592 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1.2593 +                        ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
  1.2594 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
  1.2595 +                        ;;
  1.2596 +                    HP-UX/* )
  1.2597 +                        cp /etc/passwd /etc/passwd.bak && \
  1.2598 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1.2599 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
  1.2600 +                        ;;
  1.2601 +                    Darwin/* )
  1.2602 +                        niutil -destroy . "/users/${usr}"
  1.2603 +                        ;;
  1.2604 +                    IRIX*/6.* )
  1.2605 +                        cp /etc/passwd /etc/passwd.bak && \
  1.2606 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1.2607 +                        if   [ -f /etc/shadow ]
  1.2608 +                        then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
  1.2609 +                        fi
  1.2610 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
  1.2611 +                        ;;
  1.2612 +                esac
  1.2613 +            fi
  1.2614 +        fi
  1.2615 +
  1.2616 +        #   check whether group already exists
  1.2617 +        exists=`(getent group "$grp"; \
  1.2618 +                grep "^$grp:" /etc/group; \
  1.2619 +                ypmatch "$grp" group; \
  1.2620 +                nismatch "$grp" group; \
  1.2621 +                nidump group . | grep "^$grp:") 2>/dev/null | \
  1.2622 +                sed -e 'q'`
  1.2623 +        if [ ".$exists" != . ]; then
  1.2624 +            if [ ".$cusr" != ".root" ]; then
  1.2625 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
  1.2626 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2627 +            elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
  1.2628 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
  1.2629 +                echo "openpkg:WARNING: (would remove system standard group)" 1>&2
  1.2630 +            else
  1.2631 +                case "$plid" in
  1.2632 +                    Darwin/* )
  1.2633 +                        niutil -destroy . "/groups/${grp}"
  1.2634 +                        ;;
  1.2635 +                    AIX/* )
  1.2636 +                        rmgroup "${grp}"
  1.2637 +                        ;;
  1.2638 +                    * )
  1.2639 +                        cp /etc/group /etc/group.bak && \
  1.2640 +                        grep -v "^${grp}:" /etc/group.bak >/etc/group
  1.2641 +                        rm -f /etc/group.bak >/dev/null 2>&1
  1.2642 +                        ;;
  1.2643 +                esac
  1.2644 +            fi
  1.2645 +        fi
  1.2646 +    done
  1.2647 +
  1.2648 +    #   invalidate passwd and group tables from Name Service Cache Daemon to
  1.2649 +    #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
  1.2650 +    if [ -x /usr/sbin/nscd ]; then
  1.2651 +        /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
  1.2652 +        /usr/sbin/nscd -i group >/dev/null 2>&1 || true
  1.2653 +    fi
  1.2654 +
  1.2655 +    #   remove the startup/shutdown transfer scripts
  1.2656 +    name=`echo "$prefix" | sed -e 's;/;;g'`
  1.2657 +    if [ ".$cusr" != ".root" ]; then
  1.2658 +        echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
  1.2659 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2660 +    else
  1.2661 +        case "$plid" in
  1.2662 +            FreeBSD/* )
  1.2663 +                rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
  1.2664 +                ;;
  1.2665 +            NetBSD/* )
  1.2666 +                rm -f /etc/rc.d/${name} >/dev/null 2>&1
  1.2667 +                ;;
  1.2668 +            Linux/* )
  1.2669 +                if [ -f /etc/gentoo-release ]; then
  1.2670 +                    /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
  1.2671 +                    rm -f /etc/init.d/openpkg-${name}   >/dev/null 2>&1
  1.2672 +                else
  1.2673 +                    #   sroot: script root directory
  1.2674 +                    #   lroot: link   root directory
  1.2675 +                    if [ -f /etc/debian_version ]; then
  1.2676 +                        sroot=/etc/init.d
  1.2677 +                        lroot=/etc/rc%d.d
  1.2678 +                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
  1.2679 +                        sroot=/etc/rc.d/init.d
  1.2680 +                        lroot=/etc/rc.d/rc%d.d
  1.2681 +                    elif [ -f /etc/SuSE-release ]; then
  1.2682 +                        sroot=/etc/init.d
  1.2683 +                        lroot=/etc/init.d/rc%d.d
  1.2684 +                    elif [ -f /etc/slackware-version ]; then
  1.2685 +                        sroot=/etc/rc.d
  1.2686 +                        lroot=/etc/rc.d/rc%d.d
  1.2687 +                        name="rc.${name}"
  1.2688 +                    else
  1.2689 +                        echo "WARNING: you are not running one of the supported standard" 1>&2
  1.2690 +                        echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)."   1>&2
  1.2691 +                        echo "WARNING: Guessing the location of the system init scripts!" 1>&2
  1.2692 +                        sroot=""
  1.2693 +                        lroot=""
  1.2694 +                        for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
  1.2695 +                            if [ -d $sr ]; then
  1.2696 +                                sroot="$sr"
  1.2697 +                                break
  1.2698 +                            fi
  1.2699 +                        done
  1.2700 +                        for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
  1.2701 +                            if [ -d $lr ]; then
  1.2702 +                                lroot="`echo $lr | sed -e 's;2;%d;'`"
  1.2703 +                                break
  1.2704 +                            fi
  1.2705 +                        done
  1.2706 +                        if [ ".$sroot" = . -o ".$lroot" = . ]; then
  1.2707 +                            echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
  1.2708 +                            exit 1
  1.2709 +                        fi
  1.2710 +                    fi
  1.2711 +                    rm -f ${sroot}/${name} >/dev/null 2>&1
  1.2712 +                    for i in 2 3 4 5; do
  1.2713 +                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
  1.2714 +                    done
  1.2715 +                    for i in 0 1 6; do
  1.2716 +                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
  1.2717 +                    done
  1.2718 +                    if [ -f /etc/slackware-version ]; then
  1.2719 +                        for i in 0 1 2 3 4 5 6; do
  1.2720 +                            l=`echo $lroot | sed -e "s;%d;$i;"`
  1.2721 +                            if [ -d $l ]; then
  1.2722 +                                rmdir $l >/dev/null 2>&1 || true
  1.2723 +                            fi
  1.2724 +                        done
  1.2725 +                    fi
  1.2726 +                fi
  1.2727 +                ;;
  1.2728 +            SunOS/5.* )
  1.2729 +                rm -f /etc/init.d/${name} >/dev/null 2>&1
  1.2730 +                rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
  1.2731 +                rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  1.2732 +                rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
  1.2733 +                ;;
  1.2734 +            UnixWare/* )
  1.2735 +                rm -f /etc/init.d/${name} >/dev/null 2>&1
  1.2736 +                rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
  1.2737 +                rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  1.2738 +                rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
  1.2739 +                ;;
  1.2740 +            AIX/* )
  1.2741 +                rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
  1.2742 +                rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
  1.2743 +                ;;
  1.2744 +            OSF1/V5.* )
  1.2745 +                rm -f /sbin/init.d/${name} >/dev/null 2>&1
  1.2746 +                rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
  1.2747 +                rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
  1.2748 +                ;;
  1.2749 +            HP-UX/* )
  1.2750 +                rm -f /sbin/init.d/${name} >/dev/null 2>&1
  1.2751 +                rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
  1.2752 +                rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
  1.2753 +                ;;
  1.2754 +            Darwin/* )
  1.2755 +                cp /etc/hostconfig /etc/hostconfig.bak && \
  1.2756 +                grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
  1.2757 +                rm -f /etc/hostconfig.bak >/dev/null 2>&1
  1.2758 +                rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
  1.2759 +                ;;
  1.2760 +            IRIX*/6.* )
  1.2761 +                rm -f /etc/init.d/${name} >/dev/null 2>&1
  1.2762 +                rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
  1.2763 +                rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  1.2764 +                ;;
  1.2765 +        esac
  1.2766 +    fi
  1.2767 +
  1.2768 +    #   remove the cron transfer entries
  1.2769 +    if [ ".$cusr" != ".root" ]; then
  1.2770 +        echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
  1.2771 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1.2772 +    else
  1.2773 +        case "$plid" in
  1.2774 +            FreeBSD/* | Linux/* | Darwin/* )
  1.2775 +                if [ -f /etc/slackware-version ]; then
  1.2776 +                    EDITOR=/tmp/vipw.$$
  1.2777 +                    VISUAL="$EDITOR"
  1.2778 +                    export EDITOR
  1.2779 +                    export VISUAL
  1.2780 +                    p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
  1.2781 +                    ( echo "cp \$1 \$1.bak"
  1.2782 +                      echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
  1.2783 +                      echo "rm -f \$1.bak"
  1.2784 +                    ) >$EDITOR
  1.2785 +                    chmod a+x $EDITOR
  1.2786 +                    ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  1.2787 +                    rm -f $EDITOR
  1.2788 +                else
  1.2789 +                    exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
  1.2790 +                    if [ ".$exists" != . ]; then
  1.2791 +                        p=`echo $prefix | sed -e 's;/;\\\\/;g'`
  1.2792 +                        cp /etc/crontab /etc/crontab.bak
  1.2793 +                        cat /etc/crontab.bak |\
  1.2794 +                        sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
  1.2795 +                        >/etc/crontab
  1.2796 +                        rm -f /etc/crontab.bak >/dev/null 2>&1
  1.2797 +                    fi
  1.2798 +                fi
  1.2799 +                ;;
  1.2800 +            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
  1.2801 +                EDITOR=/tmp/vipw.$$
  1.2802 +                VISUAL="$EDITOR"
  1.2803 +                export EDITOR
  1.2804 +                export VISUAL
  1.2805 +                p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
  1.2806 +                ( echo "cp \$1 \$1.bak"
  1.2807 +                  echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
  1.2808 +                  echo "rm -f \$1.bak"
  1.2809 +                ) >$EDITOR
  1.2810 +                chmod a+x $EDITOR
  1.2811 +                ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  1.2812 +                rm -f $EDITOR
  1.2813 +                ;;
  1.2814 +            IRIX*/6.* )
  1.2815 +                p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
  1.2816 +                ( crontab -l |
  1.2817 +                  sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
  1.2818 +                ) | /usr/bin/crontab || exit $?
  1.2819 +                ;;
  1.2820 +        esac
  1.2821 +    fi
  1.2822 +
  1.2823 +    #   delayed removal of top-level directory.
  1.2824 +    ( sleep 2
  1.2825 +      rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
  1.2826 +      rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
  1.2827 +      rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
  1.2828 +      rmdir %{l_prefix} >/dev/null 2>&1 || true
  1.2829 +    ) </dev/null >/dev/null 2>/dev/null &
  1.2830 +

mercurial