Import package vendor original specs for necessary manipulations.

Tue, 06 Jan 2009 23:40:39 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2009 23:40:39 +0100
changeset 13
cb59d6afeb61
parent 12
333964c621f1
child 14
0cd2ee160ef5

Import package vendor original specs for necessary manipulations.

dhcpd/dhcpd.conf file | annotate | diff | comparison | revisions
dhcpd/dhcpd.spec file | annotate | diff | comparison | revisions
dhcpd/fsl.dhcpd file | annotate | diff | comparison | revisions
dhcpd/rc.dhcpd file | annotate | diff | comparison | revisions
openpkg/HISTORY file | annotate | diff | comparison | revisions
openpkg/README file | annotate | diff | comparison | revisions
openpkg/aux.prereq.sh file | annotate | diff | comparison | revisions
openpkg/aux.usrgrp.sh file | annotate | diff | comparison | revisions
openpkg/aux.wrapbin.sh file | annotate | diff | comparison | revisions
openpkg/aux.wrapsrc.sh file | annotate | diff | comparison | revisions
openpkg/bash.patch file | annotate | diff | comparison | revisions
openpkg/beecrypt.patch file | annotate | diff | comparison | revisions
openpkg/dot.bash_login file | annotate | diff | comparison | revisions
openpkg/dot.bashrc file | annotate | diff | comparison | revisions
openpkg/dot.lsyncrc file | annotate | diff | comparison | revisions
openpkg/install.sh file | annotate | diff | comparison | revisions
openpkg/local.README file | annotate | diff | comparison | revisions
openpkg/lsync file | annotate | diff | comparison | revisions
openpkg/lsync.8 file | annotate | diff | comparison | revisions
openpkg/lsync.pod file | annotate | diff | comparison | revisions
openpkg/make.patch file | annotate | diff | comparison | revisions
openpkg/man.sh file | annotate | diff | comparison | revisions
openpkg/openpkg.1 file | annotate | diff | comparison | revisions
openpkg/openpkg.boot file | annotate | diff | comparison | revisions
openpkg/openpkg.com.pgp file | annotate | diff | comparison | revisions
openpkg/openpkg.net.pgp file | annotate | diff | comparison | revisions
openpkg/openpkg.org.pgp file | annotate | diff | comparison | revisions
openpkg/openpkg.pod file | annotate | diff | comparison | revisions
openpkg/openpkg.sh file | annotate | diff | comparison | revisions
openpkg/openpkg.spec file | annotate | diff | comparison | revisions
openpkg/openssl.patch file | annotate | diff | comparison | revisions
openpkg/perl.patch file | annotate | diff | comparison | revisions
openpkg/pod2man.sh file | annotate | diff | comparison | revisions
openpkg/rc file | annotate | diff | comparison | revisions
openpkg/rc.8 file | annotate | diff | comparison | revisions
openpkg/rc.conf file | annotate | diff | comparison | revisions
openpkg/rc.func file | annotate | diff | comparison | revisions
openpkg/rc.openpkg file | annotate | diff | comparison | revisions
openpkg/rc.pod file | annotate | diff | comparison | revisions
openpkg/release.8 file | annotate | diff | comparison | revisions
openpkg/release.pod file | annotate | diff | comparison | revisions
openpkg/release.sh file | annotate | diff | comparison | revisions
openpkg/root.README file | annotate | diff | comparison | revisions
openpkg/rpm-config.8 file | annotate | diff | comparison | revisions
openpkg/rpm-config.pod file | annotate | diff | comparison | revisions
openpkg/rpm-config.sh file | annotate | diff | comparison | revisions
openpkg/rpm.patch.bugfix file | annotate | diff | comparison | revisions
openpkg/rpm.patch.feature file | annotate | diff | comparison | revisions
openpkg/rpm.patch.porting file | annotate | diff | comparison | revisions
openpkg/rpm.patch.regen file | annotate | diff | comparison | revisions
openpkg/rpmdb file | annotate | diff | comparison | revisions
openpkg/rpmmacros file | annotate | diff | comparison | revisions
openpkg/rpmpopt file | annotate | diff | comparison | revisions
openpkg/rpmrc file | annotate | diff | comparison | revisions
openpkg/rpmtool file | annotate | diff | comparison | revisions
openpkg/rpmtool.8 file | annotate | diff | comparison | revisions
openpkg/rpmtool.pod file | annotate | diff | comparison | revisions
openpkg/shtool file | annotate | diff | comparison | revisions
openpkg/tar.patch file | annotate | diff | comparison | revisions
openpkg/uuid.8 file | annotate | diff | comparison | revisions
openpkg/uuid.pod file | annotate | diff | comparison | revisions
openpkg/uuid.sh file | annotate | diff | comparison | revisions
radiusclient/radiusclient.patch file | annotate | diff | comparison | revisions
radiusclient/radiusclient.spec file | annotate | diff | comparison | revisions
shtool/shtool.spec file | annotate | diff | comparison | revisions
sox/sox.spec file | annotate | diff | comparison | revisions
tightvnc/tightvnc.spec file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dhcpd/dhcpd.conf	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +##
     1.5 +##  dhcpd.conf -- ISC DHCP Daemon Configuration
     1.6 +##
     1.7 +
     1.8 +#   Options applicable to all subnets
     1.9 +option domain-name "example.com";
    1.10 +authoritative;
    1.11 +default-lease-time 600;
    1.12 +max-lease-time 7200;
    1.13 +ddns-update-style none;
    1.14 +use-host-decl-names on;
    1.15 +
    1.16 +#   Define some non-standard options
    1.17 +option freebsd-swappath code 128 = text;
    1.18 +option freebsd-rootopts code 130 = text;
    1.19 +option freebsd-swapopts code 131 = text;
    1.20 +
    1.21 +#   Test drive using loopback
    1.22 +subnet 127.0.0.0 netmask 255.0.0.0 {
    1.23 +}
    1.24 +
    1.25 +#   Define a particular sample subnet
    1.26 +subnet 192.168.1.0 netmask 255.255.255.0 {
    1.27 +
    1.28 +    #   Options applicable to this particular subnet
    1.29 +    option broadcast-address 192.168.1.255;
    1.30 +    option subnet-mask 255.255.255.0;
    1.31 +    option routers 192.168.1.1;
    1.32 +    option domain-name-servers 192.168.1.2;
    1.33 +
    1.34 +    #   Dynamic DNS (DDNS) Updating
    1.35 +    ddns-updates off;
    1.36 +    ddns-domainname "example.com";
    1.37 +    ddns-rev-domainname "in-addr.arpa";
    1.38 +
    1.39 +    #   Pool of known clients (i.e. MAC known but IP not specified)
    1.40 +    pool {
    1.41 +        range 192.168.1.100 192.168.1.149;
    1.42 +        min-lease-time      600;   # 10min
    1.43 +        default-lease-time  43200; # 12hour
    1.44 +        max-lease-time      86400; # 24hour
    1.45 +        deny unknown clients;
    1.46 +    }
    1.47 +
    1.48 +    #   Pool of unknown clients (i.e. MAC not known)
    1.49 +    pool {
    1.50 +        range 192.168.1.150 192.168.1.199;
    1.51 +        min-lease-time      300;   # 5min
    1.52 +        default-lease-time  3600;  # 1hour
    1.53 +        max-lease-time      10800; # 3hour
    1.54 +        allow unknown clients;
    1.55 +    }
    1.56 +}
    1.57 +
    1.58 +#   The list of clients we explicitly configure
    1.59 +group {
    1.60 +    #   Just assign a fixed IP address for machine "quux1"
    1.61 +    host quux1 {
    1.62 +        hardware ethernet 01:02:03:00:00:01;
    1.63 +        fixed-address 192.168.1.3;
    1.64 +    }
    1.65 +
    1.66 +    #   Provide full boot information for a FreeBSD diskless client "quux2":
    1.67 +    #   On the server, create a 32MB swapfile /dlc/fs/swap/swap.192.168.1.4
    1.68 +    #   with `dd if=/dev/zero of=swap.192.168.1.4 bs=1m count=32' and the
    1.69 +    #   filesystem /dlc/fs/quux2 with `cd /usr/src; make buildworld; make
    1.70 +    #   installworld DESTDIR=/dlc/fs/quux2'. Then use Etherboot for booting.
    1.71 +    host quux2 {
    1.72 +        hardware ethernet 01:02:03:00:00:02;
    1.73 +        fixed-address 192.168.1.4;
    1.74 +        next-server 192.168.1.2;
    1.75 +        option tftp-server-name "192.168.1.2";
    1.76 +        filename "kernel.quux";
    1.77 +        always-reply-rfc1048 on;
    1.78 +        option root-path "192.168.1.2:/dlc/fs/quux2";
    1.79 +        option freebsd-rootopts "rw,noatime";
    1.80 +        option swap-server 192.168.1.2;
    1.81 +        option freebsd-swappath "192.168.1.2:/dlc/fs/swap";
    1.82 +        option freebsd-swapopts "sw";
    1.83 +    }
    1.84 +}
    1.85 +
    1.86 +#   The list of clients we know, but which get IP addresses from pool
    1.87 +group {
    1.88 +    host quux3 { hardware ethernet 01:02:03:00:00:03; }
    1.89 +    host quux4 { hardware ethernet 01:02:03:00:00:04; }
    1.90 +}
    1.91 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/dhcpd/dhcpd.spec	Tue Jan 06 23:40:39 2009 +0100
     2.3 @@ -0,0 +1,164 @@
     2.4 +##
     2.5 +##  dhcpd.spec -- OpenPKG RPM Package Specification
     2.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
     2.7 +##
     2.8 +##  Permission to use, copy, modify, and distribute this software for
     2.9 +##  any purpose with or without fee is hereby granted, provided that
    2.10 +##  the above copyright notice and this permission notice appear in all
    2.11 +##  copies.
    2.12 +##
    2.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    2.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    2.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    2.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    2.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    2.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    2.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    2.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    2.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    2.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    2.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    2.24 +##  SUCH DAMAGE.
    2.25 +##
    2.26 +
    2.27 +#   package information
    2.28 +Name:         dhcpd
    2.29 +Summary:      DHCP Daemon
    2.30 +URL:          http://www.isc.org/products/DHCP/
    2.31 +Vendor:       Internet Software Consortium
    2.32 +Packager:     OpenPKG Foundation e.V.
    2.33 +Distribution: OpenPKG Community
    2.34 +Class:        BASE
    2.35 +Group:        DHCP
    2.36 +License:      ISC/BSD
    2.37 +Version:      4.1.0
    2.38 +Release:      20081220
    2.39 +
    2.40 +#   package options
    2.41 +%option       with_fsl  yes
    2.42 +
    2.43 +#   list of sources
    2.44 +Source0:      ftp://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz
    2.45 +Source1:      dhcpd.conf
    2.46 +Source2:      rc.dhcpd
    2.47 +Source3:      fsl.dhcpd
    2.48 +
    2.49 +#   build information
    2.50 +Prefix:       %{l_prefix}
    2.51 +BuildRoot:    %{l_buildroot}
    2.52 +BuildPreReq:  OpenPKG, openpkg >= 20060823
    2.53 +PreReq:       OpenPKG, openpkg >= 20060823
    2.54 +%if "%{with_fsl}" == "yes"
    2.55 +BuildPreReq:  fsl
    2.56 +PreReq:       fsl
    2.57 +%endif
    2.58 +AutoReq:      no
    2.59 +AutoReqProv:  no
    2.60 +
    2.61 +%description
    2.62 +    This is the ISC DHCP daemon reference implementation.
    2.63 +
    2.64 +%track
    2.65 +    prog dhcpd = {
    2.66 +        version   = %{version}
    2.67 +        url       = ftp://ftp.isc.org/isc/dhcp/
    2.68 +        regex     = dhcp-(\d+\.\d+\.\d+)\.tar\.gz
    2.69 +    }
    2.70 +
    2.71 +%prep
    2.72 +    %setup -q -n dhcp-%{version}
    2.73 +
    2.74 +%build
    2.75 +    #   configure program
    2.76 +    %{l_shtool} subst \
    2.77 +        -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \
    2.78 +        -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \
    2.79 +        -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \
    2.80 +        includes/site.h
    2.81 +    CC="%{l_cc}" \
    2.82 +    CFLAGS="%{l_cflags -O}" \
    2.83 +    CPPFLAGS="%{l_cppflags} -DNOMINUM" \
    2.84 +    LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
    2.85 +    LIBS="%{l_fsl_libs}" \
    2.86 +    ./configure \
    2.87 +        --prefix=%{l_prefix} \
    2.88 +        --mandir=%{l_prefix}/man \
    2.89 +        --sysconfdir=%{l_prefix}/etc/dhcpd \
    2.90 +        --localstatedir=%{l_prefix}/var/dhcpd \
    2.91 +        --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \
    2.92 +        --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \
    2.93 +        --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \
    2.94 +        --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \
    2.95 +        --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid
    2.96 +
    2.97 +    #   build program
    2.98 +    %{l_make} %{l_mflags}
    2.99 +
   2.100 +%install
   2.101 +    #   install program
   2.102 +    rm -rf $RPM_BUILD_ROOT
   2.103 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   2.104 +
   2.105 +    #   install default configuration
   2.106 +    %{l_shtool} install -c -m 644 \
   2.107 +        %{SOURCE dhcpd.conf} \
   2.108 +        $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf
   2.109 +
   2.110 +    #   post-adjust and strip down installation
   2.111 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script
   2.112 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8
   2.113 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/*  2>/dev/null || true
   2.114 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   2.115 +
   2.116 +    #   install run-command script
   2.117 +    %{l_shtool} mkdir -f -p -m 755 \
   2.118 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   2.119 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   2.120 +        %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   2.121 +
   2.122 +    #   install OSSP fsl configuration
   2.123 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   2.124 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   2.125 +        %{SOURCE fsl.dhcpd} \
   2.126 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   2.127 +
   2.128 +    #   create run-time directories
   2.129 +    %{l_shtool} mkdir -f -p -m 755 \
   2.130 +        $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \
   2.131 +        $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \
   2.132 +        $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log
   2.133 +
   2.134 +    #   determine installation files
   2.135 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   2.136 +        %{l_files_std} \
   2.137 +        '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \
   2.138 +        '%config %{l_prefix}/etc/dhcpd/*'
   2.139 +
   2.140 +%files -f files
   2.141 +
   2.142 +%clean
   2.143 +    rm -rf $RPM_BUILD_ROOT
   2.144 +
   2.145 +%post
   2.146 +    if [ $1 -eq 1 ]; then
   2.147 +        #   display final hints on initial installation
   2.148 +        ( echo "Before starting DHCP daemon, please set the configuration variable"
   2.149 +          echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
   2.150 +          echo "used network interface."
   2.151 +        ) | %{l_rpmtool} msg -b -t notice
   2.152 +    fi
   2.153 +
   2.154 +    #   after upgrade, restart service
   2.155 +    [ $1 -eq 2 ] || exit 0
   2.156 +    eval `%{l_rc} dhcpd status 2>/dev/null`
   2.157 +    [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart
   2.158 +    exit 0
   2.159 +
   2.160 +%preun
   2.161 +    #   before erase, stop service and remove log files
   2.162 +    [ $1 -eq 0 ] || exit 0
   2.163 +    %{l_rc} dhcpd stop 2>/dev/null
   2.164 +    rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/*  >/dev/null 2>&1 || true
   2.165 +    rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true
   2.166 +    exit 0
   2.167 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/dhcpd/fsl.dhcpd	Tue Jan 06 23:40:39 2009 +0100
     3.3 @@ -0,0 +1,52 @@
     3.4 +##
     3.5 +##  fsl.dhcpd -- OSSP fsl configuration
     3.6 +##
     3.7 +
     3.8 +ident (dhcpd.*)/.+ q{
     3.9 +    prefix(
    3.10 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    3.11 +    )
    3.12 +    -> {
    3.13 +        debug: file(
    3.14 +            path="@l_prefix@/var/dhcpd/log/dhcpd.log",
    3.15 +            perm=0644
    3.16 +        )
    3.17 +    }
    3.18 +};
    3.19 +
    3.20 +ident (dhclient.*)/.+ q{
    3.21 +    prefix(
    3.22 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    3.23 +    )
    3.24 +    -> {
    3.25 +        debug: file(
    3.26 +            path="@l_prefix@/var/dhcpd/log/dhclient.log",
    3.27 +            perm=0644
    3.28 +        )
    3.29 +    }
    3.30 +};
    3.31 +
    3.32 +ident (dhrelay.*)/.+ q{
    3.33 +    prefix(
    3.34 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    3.35 +    )
    3.36 +    -> {
    3.37 +        debug: file(
    3.38 +            path="@l_prefix@/var/dhcpd/log/dhrelay.log",
    3.39 +            perm=0644
    3.40 +        )
    3.41 +    }
    3.42 +};
    3.43 +
    3.44 +ident (omshell.*)/.+ q{
    3.45 +    prefix(
    3.46 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    3.47 +    )
    3.48 +    -> {
    3.49 +        debug: file(
    3.50 +            path="@l_prefix@/var/dhcpd/log/omshell.log",
    3.51 +            perm=0644
    3.52 +        )
    3.53 +    }
    3.54 +};
    3.55 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/dhcpd/rc.dhcpd	Tue Jan 06 23:40:39 2009 +0100
     4.3 @@ -0,0 +1,91 @@
     4.4 +#!@l_prefix@/bin/openpkg rc
     4.5 +##
     4.6 +##  rc.dhcpd -- Run-Commands
     4.7 +##
     4.8 +
     4.9 +%config
    4.10 +    dhcpd_enable="$openpkg_rc_def"
    4.11 +    dhcpd_flags="-q"
    4.12 +    dhcpd_if=""
    4.13 +    dhcpd_port="67"
    4.14 +    dhcpd_log_prolog="true"
    4.15 +    dhcpd_log_epilog="true"
    4.16 +    dhcpd_log_numfiles="10"
    4.17 +    dhcpd_log_minsize="1M"
    4.18 +    dhcpd_log_complevel="9"
    4.19 +
    4.20 +%common
    4.21 +    dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid"
    4.22 +    dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases"
    4.23 +    dhcpd_signal () {
    4.24 +        [ -f $dhcpd_pidfile ] && kill -$1 `cat $dhcpd_pidfile`
    4.25 +    }
    4.26 +    dhcpd_start () {
    4.27 +        if [ ! -f $dhcpd_leases ]; then
    4.28 +            touch $dhcpd_leases
    4.29 +            chmod 644 $dhcpd_leases
    4.30 +            chown @l_susr@:@l_mgrp@ $dhcpd_leases
    4.31 +        fi
    4.32 +        local cmd="@l_prefix@/sbin/dhcpd"
    4.33 +        cmd="$cmd $dhcpd_flags"
    4.34 +        echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1
    4.35 +        if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then
    4.36 +            cmd="$cmd -p $dhcpd_port"
    4.37 +        fi
    4.38 +        if [ $# -gt 0 ]; then
    4.39 +            cmd="$cmd $@"
    4.40 +        fi
    4.41 +        cmd="$cmd >/dev/null 2>&1"
    4.42 +        eval $cmd
    4.43 +    }
    4.44 +
    4.45 +%status -u @l_susr@ -o
    4.46 +    dhcpd_usable="unknown"
    4.47 +    dhcpd_active="no"
    4.48 +    dhcpd_start -q -t || dhcpd_usable="no"
    4.49 +    [ ".$dhcpd_if" = . ] && dhcpd_usable="no"
    4.50 +    rcService dhcpd enable yes && \
    4.51 +        dhcpd_signal 0 && dhcpd_active="yes"
    4.52 +    echo "dhcpd_enable=\"$dhcpd_enable\""
    4.53 +    echo "dhcpd_usable=\"$dhcpd_usable\""
    4.54 +    echo "dhcpd_active=\"$dhcpd_active\""
    4.55 +
    4.56 +%start -u @l_susr@
    4.57 +    rcService dhcpd enable yes || exit 0
    4.58 +    rcService dhcpd usable no  && exit 0
    4.59 +    rcService dhcpd active yes && exit 0
    4.60 +    dhcpd_start $dhcpd_if
    4.61 +
    4.62 +%stop -u @l_susr@
    4.63 +    rcService dhcpd enable yes || exit 0
    4.64 +    rcService dhcpd active no  && exit 0
    4.65 +    dhcpd_signal TERM
    4.66 +    sleep 2
    4.67 +    rm -f $dhcpd_pidfile 2>/dev/null || true
    4.68 +
    4.69 +%restart -u @l_susr@
    4.70 +    rcService dhcpd enable yes || exit 0
    4.71 +    rcService dhcpd active no  && exit 0
    4.72 +    rc dhcpd stop start
    4.73 +
    4.74 +%reload -u @l_susr@
    4.75 +    rcService dhcpd enable yes || exit 0
    4.76 +    dhcpd_signal HUP
    4.77 +
    4.78 +%daily -u @l_susr@
    4.79 +    rcService dhcpd enable yes || exit 0
    4.80 +    rcTmp -i
    4.81 +    hintfile=`rcTmp -f -n hint`
    4.82 +    for tool in dhcpd dhclient dhrelay omshell; do
    4.83 +        shtool rotate -f \
    4.84 +            -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \
    4.85 +            -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \
    4.86 +            -P "$dhcpd_log_prolog" \
    4.87 +            -E "$dhcpd_log_epilog; echo 1 >$hintfile" \
    4.88 +            @l_prefix@/var/dhcpd/log/$tool.log
    4.89 +    done
    4.90 +    if [ -s $hintfile ]; then
    4.91 +        rc dhcpd restart
    4.92 +    fi
    4.93 +    rcTmp -k
    4.94 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/openpkg/HISTORY	Tue Jan 06 23:40:39 2009 +0100
     5.3 @@ -0,0 +1,692 @@
     5.4 +
     5.5 +2007
     5.6 +====
     5.7 +
     5.8 +20071227 remove support for ancient FreeBSD 4
     5.9 +20071222 upgrade to Perl 5.10.0
    5.10 +20071030 upgrade to cURL 7.17.1
    5.11 +20071019 upgrade to OpenSSL 0.9.8g
    5.12 +20071018 upgrade to latest Tar patch
    5.13 +20071017 try to port Tar and OpenSSL to AIX 5 and Solaris 8 again
    5.14 +20071015 avoid calling of autoconf while building GNU bash
    5.15 +20071014 fix OpenSSL patch (some important portability related hunks were lost)
    5.16 +20071011 upgrade to OpenSSL 0.9.8f
    5.17 +20071011 add support for FreeBSD 8.0-CURRENT
    5.18 +20071010 upgrade to GNU tar 1.19
    5.19 +20070914 upgrade to cURL 7.17.0
    5.20 +20070909 print entire list of all %NoSource files instead of bailing out on the first missing file encountered
    5.21 +20070321 upgrade to openpkg-registry 1.1.3 remove legacy code which had the side effect of the REGISTRY_UUID file being touched hourly
    5.22 +20070718 "diff reduction" to RPM 5 development version (no functional change)
    5.23 +20070717 fix a very long-standing cruel implementation bug in the platform detection
    5.24 +20070711 upgrade to cURL 7.16.4
    5.25 +20070630 upgrade to GNU tar 1.18
    5.26 +20070625 upgrade to cURL 7.16.3
    5.27 +20070624 upgrade to openpkg-tools 1.4.5
    5.28 +20070623 apply a workaround to GNU gzip for resolving potential futimens() conflict (fixes built under Fedora 7)
    5.29 +20070620 more consistently use "shtool platform" for building OpenSSL
    5.30 +20070616 teach OpenSSL config to identify cc being a disguised gcc (pass -gcc to Configure but run cc)
    5.31 +20070614 synchronize 64bit -fPIC option and ./config usage from "openssl" package
    5.32 +20070608 upgrade to GNU tar 1.17
    5.33 +20070608 fix tracking of gzip
    5.34 +20070607 use path /etc/rc.d/init.d/ instead of non-standard /etc/init.d/ under AIX
    5.35 +20070606 under MacOS X do not add -Wl,-search_paths_first if -c or -E is present on the cc command line
    5.36 +20070605 upgrade to GNU gzip 1.3.12
    5.37 +20070605 upgrade to latest GNU shtool snapshot for final Mac OS X identification and some small improvements for CentOS
    5.38 +20070604 improve Mac OS X support by providing gcc/cc/ld override scripts to pass option "-search_paths_first" to ld(1)
    5.39 +20070604 improve Mac OS X support by upgrading to an improved GNU shtool snapshot
    5.40 +20070603 disable shared library building in Perl for better supporting Mac OS X
    5.41 +20070603 synchronize openssl.patch with latest version from "openssl" package
    5.42 +20070520 fix building Perl under GCC 4.2 world order
    5.43 +20070519 upgrade to OSSP uuid 1.6.0
    5.44 +20070519 upgrade to official GNU shtool 2.0.7
    5.45 +20070514 upgrade to newer GNU shtool snapshot which fixes "shtool mkln" and "shtool install" commands
    5.46 +20070511 upgrade to "openpkg" executable version 2.0.1-C, do not rise privileges for "openpkg rpm" when given -[bt]* options
    5.47 +20070507 workaround PIC/DSO related problems under FreeBSD on sparc64 by enforcing -fPIC
    5.48 +20070419 meticulously obey order when creating user, group, login shell relationships
    5.49 +20070418 use bootstrapped bash to prevent problems when /bin/sh is not a bourne shell
    5.50 +20070417 support %l_as macro and --use_as bootstrap option to complement ar, ld, strip handling
    5.51 +20070411 upgrade to cURL 7.16.2
    5.52 +20070329 add variables to expand uuid(8) information in the "openpkg release" format
    5.53 +20070322 cosmetic: align code variable name with documentation
    5.54 +20070321 upgrade to openpkg-registry 1.1.2 replace HOSTNAME with FQDN when creating OPENPKG_DESC default
    5.55 +20070320 automatic (re-)registration if previous registration, community series or release set to openpkg URLs
    5.56 +20070320 improve generation of UUID_PLATFORM by using a better (no longer IP based) "discriminator" value
    5.57 +20070320 remove old support for never finished rcng
    5.58 +20070320 remove old backward compatibility from rc.func for OpenPKG 1.2's opXXX functions
    5.59 +20070319 change "rc" to not check permissions for --print operations
    5.60 +20070319 fix eval "rc" in rc.func which relies on PATH and conflicts with Plan 9 shell
    5.61 +
    5.62 +20070319 **** RELEASE AS PART OF OPENPKG 2.20070319 ****
    5.63 +20070305 invalidate passwd and group tables from Name Service Cache Daemon after pwconv
    5.64 +20070305 upgrade to rpmtool 1.1.0 remove dormant code for system user/group addition/removal
    5.65 +
    5.66 +20070303 **** RELEASE AS PART OF OPENPKG 2.20070303 ****
    5.67 +20070302 upgrade to openpkg-registry 1.1.1 upgrade safety
    5.68 +20070302 upgrade to openpkg-tools 1.4.3 direct access relative path names (identified by leading "./"); minor re fix in 1.4.4
    5.69 +20070226 upgrade to openpkg-tools 1.4.2 direct access absolut path names (identified by leading "/"), download from URLs (including "file://")
    5.70 +20070223 upgrade to OpenSSL 0.9.8e
    5.71 +20070222 upgrade to openpkg-tools 1.4.1 avoid "openpkg curl" to emit confusing "error trying read config" messages
    5.72 +
    5.73 +20070221 **** RELEASE AS PART OF OPENPKG 2.20070221 ****
    5.74 +20070221 autoregister for community series; always reregister
    5.75 +20070221 backout capability to seed registry user/link information to avoid register.conf file conflict
    5.76 +20070221 upgrade to openpkg-tools 1.4.0 ("openpkg curl"), upgrade to openpkg-registry 1.1.0 (autoregister)
    5.77 +20070207 upgrade to openpkg-tools 1.3.2
    5.78 +20070206 upgrade to GNU gzip 1.3.11
    5.79 +20070204 rpmtool cflags tool detection must handle relative pathes (no gcc) and absolute pathes (with gcc)
    5.80 +20070204 unbreak rpmtool cflags tool detection
    5.81 +20070130 minor fixes in rpmtool and the corresponding man page
    5.82 +20070130 upgrade to cURL 7.16.1
    5.83 +
    5.84 +20070105 **** RELEASE AS PART OF OPENPKG 2.20070105 ****
    5.85 +20070105 upgrade to GNU bzip2 1.0.4
    5.86 +20070102 upgrade to openpkg-tools 1.3.1
    5.87 +20070101 upgrade to GNU gzip 1.3.10
    5.88 +20070101 adjust copyright year in all messages to cover new year 2007
    5.89 +
    5.90 +2006
    5.91 +====
    5.92 +
    5.93 +20061223 upgrade to openpkg-tools 1.3.0
    5.94 +20061210 upgrade to GNU tar 1.16.1
    5.95 +20061210 upgrade to GNU gzip 1.3.8
    5.96 +20061208 upgrade to GNU gzip 1.3.7
    5.97 +
    5.98 +20061207 **** RELEASE AS PART OF OPENPKG 2.20061207 ****
    5.99 +20061207 remove obsolete references to openpkg-bugdb@openpkg.org and rt.openpkg.org
   5.100 +20061207 fix incorrect double-import of OpenPGP keys by first fixating the RPM DB
   5.101 +20061207 fix Solaris build issues with the newer GNU gzip 1.3.6
   5.102 +20061207 upgrade to "openpkg" executable version 2.0.0-C
   5.103 +20061206 apply the GNU Bash 3.2 upstream patches 001-005
   5.104 +20061206 switch GNU gzip from pre-patched OpenPKG tarball to pristine upstream tarball plus OpenPKG "update" tarball
   5.105 +20061206 enhance "openpkg release" robustness when config file defines same value repeatedly
   5.106 +20061205 skip build of irrelevant parts of the GNU tar distribution
   5.107 +20061129 upgrade to GNU gzip 1.3.6
   5.108 +20061129 adjust wordings in package class hints according to current classification
   5.109 +20061114 upgrade to openpkg-tools 1.1.1
   5.110 +20061114 provide %{l_miniperl} and %{l_openssl} macros
   5.111 +20061112 install zlib's zconf.h header as it is required by zlib.h
   5.112 +20061030 upgrade to cURL 7.16.0
   5.113 +
   5.114 +20061030 **** RELEASE AS PART OF OPENPKG 2.20061030 ****
   5.115 +20061030 upgrade to openpkg-tools 1.1.0
   5.116 +20061030 switch from a single OpenPGP key openpkg.pgp (.org) to three openpkg.{org,com,net}.pgp keys
   5.117 +20061026 fix number of CPU detection in rpmtool to support recent FreeBSDs & NetBSDs
   5.118 +
   5.119 +20061024 **** RELEASE AS PART OF OPENPKG 2.20061024 ****
   5.120 +20061024 try to workaround GNU tar build problems
   5.121 +
   5.122 +20061023 **** RELEASE AS PART OF OPENPKG 2.20061023 ****
   5.123 +20061023 upgrade to openpkg-tools 1.0.1
   5.124 +20061022 upgrade to openpkg-registry 1.0.1
   5.125 +20061022 upgrade to GNU tar 1.16
   5.126 +20061022 fix License header of "openpkg" package
   5.127 +
   5.128 +20061018 **** RELEASE AS PART OF OPENPKG 2.20061018 ****
   5.129 +20061016 upgrade to openpkg-tools 1.0.0 with no functional change to 0.8.80
   5.130 +20061008 upgrade to openpkg-registry 1.0.0 with no functional change to 0.7.2
   5.131 +20061016 upgrade to openpkg-tools 0.8.80
   5.132 +20061013 allow %{l_cc} and %{l_cxx} to be set in ~/.rpmmacros to values containing spaces
   5.133 +20061013 new world order for "Packager" and "Distribution" headers
   5.134 +20061012 remove Alpha and add PPC and AMD64 to rpmrc
   5.135 +20061011 upgrade to GNU Bash 3.2.0
   5.136 +20060930 upgrade to openpkg-tools 0.8.76
   5.137 +20060929 fix error message in openpkg setuid wrapper
   5.138 +20060929 make passwd/group lookups more efficient by performing key-based lookups instead of full dumps when possible
   5.139 +20060929 upgrade to openpkg-tools 0.8.75
   5.140 +20060928 upgrade to OpenSSL 0.9.8d
   5.141 +20060926 upgrade to openpkg-tools 0.8.74
   5.142 +20060923 upgrade to GNU config 20060923
   5.143 +20060923 upgrade to openpkg-tools 0.8.73
   5.144 +
   5.145 +20060913 **** RELEASE AS PART OF OPENPKG 2.20060913 ****
   5.146 +20060913 if CWD is NO LONGER accessible, try to switch to home of target identity to prevent failures in e.g. GNU bash
   5.147 +20060913 unpack source RPM package files as management user if called by super user ("openpkg rpm -Uvh *.src.rpm")
   5.148 +20060913 do not rise privileges for "openpkg rc" when given --eval or --print options
   5.149 +20060910 OpenPKG supports all major Unix platforms - remove explicit and unmaintained platform support determination
   5.150 +20060905 upgrade to OpenSSL 0.9.8c
   5.151 +20060826 try to allow Perl to build under RHEL4/amd64 (attempt 2)
   5.152 +20060826 upgrade to openpkg-tools 0.8.71
   5.153 +20060825 cleanup build procedure of Perl to allow it to build under RHEL4/amd64 (attempt 1)
   5.154 +20060825 cleanup and bring up-to-date the source tree documentation
   5.155 +
   5.156 +20060824 **** RELEASE AS PART OF OPENPKG 2.20060824 ****
   5.157 +20060823 upgrade to openpkg-tools 0.8.70
   5.158 +20060823 create fallback/override directories with owner/group musr/mgrp
   5.159 +20060823 make <prefix>/bin/openpkg "set-uid" for allowing it to downgrade/upgrade privileges automatically
   5.160 +20060823 upgrade to openpkg-tools 0.8.69 (no longer uses "curl -q" in "openpkg build")
   5.161 +20060823 fix "openpkg release" with workaround for Solaris sed(1) which ignores lines without trailing newlines
   5.162 +
   5.163 +20060818 **** RELEASE AS PART OF OPENPKG 2.20060818 ****
   5.164 +20060818 upgrade to openpkg-tools 0.8.68
   5.165 +20060818 try to workaround "grep -e" Autoconf issues on Solaris with OSSP uuid.
   5.166 +
   5.167 +20060815 **** RELEASE AS PART OF OPENPKG 2.20060815 ****
   5.168 +20060815 upgrade to openpkg-tools 0.8.67 (finally allows "openpkg build" to really run under miniperl)
   5.169 +
   5.170 +20060812 **** RELEASE AS PART OF OPENPKG 2.20060812 ****
   5.171 +20060811 let old "openpkg install" command use the "openpkg build" command
   5.172 +20060811 replace "openpkg build" wrapper with a copy of the real "openpkg build" command
   5.173 +20060808 make "openpkg uuid update" processing more robust by detecting empty UUID_REGISTRY
   5.174 +20060808 upgrade to openpkg-registry 0.7.2 improve user visible error handling
   5.175 +20060808 upgrade to openpkg-registry 0.7.1 (server changes only)
   5.176 +20060808 upgrade to openpkg-registry 0.7.0 link feature
   5.177 +20060807 upgrade to cURL 7.15.5
   5.178 +20060803 upgrade to openpkg-registry 0.6.4, 0.6.5 (server changes only)
   5.179 +20060801 upgrade to OSSP uuid 1.5.1
   5.180 +20060728 upgrade to OSSP uuid 1.5.0
   5.181 +
   5.182 +20060726 **** RELEASE AS PART OF OPENPKG 2.20060726 ****
   5.183 +20060725 upgrade to openpkg-registry 0.6.3 which comes with prerendered manual page
   5.184 +20060725 upgrade to openpkg-registry 0.6.2 fixes broken URL rewriting code and
   5.185 +20060725 upgrade to openpkg-registry 0.6.1 remove gpg-pubkey and similar improper data from preparation step
   5.186 +20060714 upgrade to openpkg-registry 0.6.0 to capture package and provides data
   5.187 +20060710 upgrade to openpkg-registry 0.5.2 which comes with embedded manual page
   5.188 +20060628 allow "openpkg build" emulation script to gracefully handle platform changes
   5.189 +20060625 align configure call of GNU make with the "make" package
   5.190 +20060625 upgrade to cURL 7.15.4 by using the GREP=grep workaround.
   5.191 +
   5.192 +20060622 **** RELEASE AS PART OF OPENPKG 2.20060622 ****
   5.193 +20060622 replace release tag fiddling in openpkg.boot with "openpkg release" functionality, too.
   5.194 +20060622 do not rely on RPM's smartness to not expand "%x" when we actually meant "%%x"
   5.195 +20060621 use new "openpkg release" for "openpkg install" and "openpkg build" commands
   5.196 +20060621 use new "openpkg release" for %{l_openpkg_release} macro
   5.197 +20060621 added "openpkg release" command for more precise OpenPKG distribution tag and URL determination
   5.198 +20060621 complain also about .rpmsave/.rpmnew files if it is a symbolic link (usually created manually)
   5.199 +20060619 downgrade to cURL 7.15.3 til a suitable solution for long line-capable 'grep -e' is found
   5.200 +20060619 backout SMF and revert to classic System V init style on Solaris 10 due to complete brokenness
   5.201 +20060618 support bootstrap "Release:" tags for N-STABLE branches ("N.YYYMMDD")
   5.202 +20060618 support bootstrap "Release:" tags like YYYYMMDDxxxx for variants of external parties
   5.203 +20060612 upgrade to cURL 7.15.4
   5.204 +20060523 force OpenSSL to build with just platform "cc" for maximum portability
   5.205 +20060517 make "openpkg uuid update" processing more robust to prevent problems
   5.206 +20060517 fix output of "openpkg build" wrapper script
   5.207 +20060515 fix building of OpenSSL by reducing used Perl features (integer.pm, Cwd.pm)
   5.208 +20060514 fix building of OpenSSL by reducing used Perl features (find.pl, strict.pm)
   5.209 +20060513 build cURL with SSL support to allow it to fetch from HTTPS URLs
   5.210 +20060513 major change: build and install OpenSSL 0.9.8b (for adding SSL support to cURL)
   5.211 +20060513 major change: build and install Perl 5.8.8 miniperl (for building OpenSSL, rpmtool files, etc)
   5.212 +
   5.213 +20060512 **** RELEASE AS PART OF OPENPKG 2.5.2 ****
   5.214 +20060512 upgrade to OpenPKG Registry 0.4.0
   5.215 +20060512 add a bootstrap wrapper for "openpkg build" command similar to "openpkg install"
   5.216 +20060512 fix "openpkg install" command under OpenPKG Registry world order by using RDF index files
   5.217 +20060512 include a copy of the OpenPKG Registry client ("openpkg register")
   5.218 +20060419 upgrade to GNU shtool 2.0.6
   5.219 +20060417 increase Solaris SMF timeout from 60 to 180 seconds
   5.220 +20060417 upgrade to GNU make 3.81 (excluded in 2.5.2)
   5.221 +20060320 upgrade to cURL 7.15.3
   5.222 +20060313 upgrade to OSSP uuid 1.4.2
   5.223 +20060311 upgrade to GNU config 20060310 (excluded in 2.5.2)
   5.224 +20060307 fixed Solaris 10 svc manifest
   5.225 +20060307 cleanup building of GNU Bash
   5.226 +20060306 fixed building of GNU Bash by reducing dependency to Bison/Yacc
   5.227 +20060227 upgrade to cURL 7.15.2
   5.228 +20060207 upgrade to OSSP uuid 1.4.1
   5.229 +20060207 upgrade to GNU shtool 2.0.5
   5.230 +20060206 upgrade to GNU config 20060206
   5.231 +20060204 upgrade to GNU shtool 2.0.4
   5.232 +20060204 apply Bash 3.1 vendor patches 001 to 007
   5.233 +20060115 upgrade to OSSP uuid 1.4.0
   5.234 +20060101 upgrade to GNU config 20051231
   5.235 +20060101 adjust copyright year in all messages to cover new year 2005
   5.236 +
   5.237 +2005
   5.238 +====
   5.239 +
   5.240 +20051210 **** RELEASE AS PART OF OPENPKG 2.5.1 ****
   5.241 +20051209 upgrade to GNU Bash 3.1 (excluded in 2.5.2)
   5.242 +20051207 upgrade to cURL 7.15.1
   5.243 +20051206 upgrade to OSSP uuid 1.3.2
   5.244 +20051017 cleanup the source tree by removing trailing blanks from HISTORY
   5.245 +
   5.246 +20051016 **** RELEASE AS PART OF OPENPKG 2.5.0 ****
   5.247 +20051016 adjust aux.prereq.sh for the official set of platforms in OpenPKG 2.5
   5.248 +20051016 be pendantic and add /lib also to LD_LIBRARY_PATH under NetBSD & FreeBSD
   5.249 +20051014 upgrade to cURL 7.15.0
   5.250 +20051007 on Solaris 10 switch from legacy rcX.d init scripts to SMF manifest
   5.251 +20051002 upgrade to GNU shtool 2.0.3
   5.252 +20051002 upgrade to GNU config.* scripts as of 20050102
   5.253 +20050924 more IRIX 6.x support
   5.254 +20050924 upgrade to OSSP uuid 1.3.1
   5.255 +20050923 fix rpm/configure not detecting inet_aton, causing rpmio.c fail with gcc4
   5.256 +20050920 fix init script for Gentoo Linux to ensure startup as very last service
   5.257 +20050902 upgrade to OSSP uuid 1.3.0
   5.258 +20050902 upgrade to cURL 7.14.1
   5.259 +20050830 upgrade to OSSP uuid 1.2.1
   5.260 +20050815 move tool determination back into .spec to unbreak upgrades
   5.261 +20050815 backout --fallback option (has to be replaced by a more general solution)
   5.262 +20050815 unbreak *.sh --help command (was broken by cut & paste bugs)
   5.263 +20050815 fix Fedora Core 4 compile problems with a more clean and permanent patch
   5.264 +20050813 add --fallback and related options, enabling use of "foreign" dev tools
   5.265 +20050812 use ls(1) as a better strip(1) replacement as both fail when a file is missing
   5.266 +20050812 store l_ar, l_ld and l_strip in .buildenv, reorder rpmmacros and introduce l_strip
   5.267 +20050808 make sure strip(1) logic does not break shell script execution
   5.268 +20050804 temporary workaround defeating problems with Fedora Core 4 vendor compiler
   5.269 +20050727 remove dependency to binutils tools size(1) and strip(1)
   5.270 +20050727 added to rpmtool the detection for "number of CPUs" under AIX for "make -j"
   5.271 +
   5.272 +20050726 **** RELEASE AS PART OF OPENPKG 2.4.2 ****
   5.273 +20050726 Cosmetics in "openpkg rpm --help" output
   5.274 +20050726 Add %{l_ar} and %{l_ld} macros for easier bootstrapping
   5.275 +20050724 "better" patch for GNU gzip, OpenPKG-SA-2005.009 (CAN-2005-1228)
   5.276 +20050722 Upgraded to Zlib 1.2.3
   5.277 +
   5.278 +20050706 **** RELEASE AS PART OF OPENPKG 2.4.1 ****
   5.279 +20050706 Fixed zlib security issue (OpenPKG-SA-2005.013, CAN-2005-2096)
   5.280 +20050706 upgrade to latest version 20050606 of GNU config.* scripts
   5.281 +20050706 upgrade to latest CVS snapshot of GNU shtool to correctly detect FreeBSD/amd64 on ix86+EM64T
   5.282 +
   5.283 +20050615 **** RELEASE AS PART OF OPENPKG 2.4.0 ****
   5.284 +20050615 update the platform support list (aux.prereq.sh) for OpenPKG 2.4
   5.285 +20050615 upgrade to GNU shtool 2.0.2 (fixing CAN-2005-1751 and CAN-2005-1759)
   5.286 +20050613 part 4 of AIX port: cleanups and fixes for system hooks
   5.287 +20050611 upgrade to latest CVS snapshot of GNU shtool to correctly detect Mandriva Linux
   5.288 +20050610 patch GNU gzip, OpenPKG-SA-2005.009 (CAN-2005-1228)
   5.289 +20050609 part 3 of AIX port: cleanups and fixes for system hooks
   5.290 +20050608 part 2 of AIX port: RPM patches, system hooks
   5.291 +20050607 part 1 of AIX port: RPM patches
   5.292 +20050606 fix and enhance various vendor file trackings
   5.293 +20050606 upgrade to latest version 20050606 of GNU config.* scripts
   5.294 +20050606 upgrade to GNU bzip2, OpenPKG-SA-2005.008 (CAN-2005-0953, CAN-2005-1260)
   5.295 +20050527 upgrade to latest CVS snapshot of GNU shtool to correctly support IBM AIX
   5.296 +20050523 search 'rpmmacros' file (not hidden) in '.openpkg' directory
   5.297 +20050521 upgrade to latest version 20050521 of GNU config.* scripts
   5.298 +20050518 add feature to search '.rpmmacros' file in '.openpkg' directory
   5.299 +20050516 upgrade to cURL 7.14.0
   5.300 +20050513 upgrade to latest CVS snapshot of GNU shtool to support IBM OS/400 PASE
   5.301 +20050513 upgrade to latest version 20050513 of GNU config.* scripts
   5.302 +20050405 upgrade to cURL 7.13.2
   5.303 +
   5.304 +20050323 **** RELEASE AS PART OF OPENPKG 2.3.1 ****
   5.305 +20050323 give a more precise hint at the end of the .src.sh bootstrap procedure
   5.306 +20050314 fix rc env processing: do not assign to the variable "_" (which is read-only in some shells like zsh)
   5.307 +20050308 remove GNU gcc specific and unused stuff from <beecrypt/gnu.h>, because it breaks under non-GCC
   5.308 +20050305 upgrade to latest version of GNU config.* scripts
   5.309 +20050304 upgrade to cURL 7.13.1
   5.310 +20050224 upgrade to GNU shtool 2.0.1
   5.311 +20050224 update aux.prereq.sh for OpenPKG 2.3's list of platforms
   5.312 +
   5.313 +20050223 **** RELEASE AS PART OF OPENPKG 2.3.0 ****
   5.314 +20050223 fix %clean procedure to correctly remove build area
   5.315 +20050223 apply cURL 7.13.0 security fixes
   5.316 +20050221 upgrade to ZLib 1.2.2 (excluded in 2.2.3)
   5.317 +20050209 workaround PIC/DSO related problems under FreeBSD on amd64/ia64 by enforcing -fPIC (excluded in 2.2.3)
   5.318 +20050203 fix the basename(3) issues the correct way by including <libgen.h>
   5.319 +20050202 fix DESTDIR not being passed to subdir make
   5.320 +20050202 update platform support to match current state of buildfarm
   5.321 +20050201 remove cast in RPM source to workaround FreeBSD/ia64 segfault
   5.322 +20050201 upgrade to cURL 7.13.0 (excluded in 2.2.3)
   5.323 +20050131 apply three vendor bugfixes for GNU tar 1.15.1 (excluded in 2.2.3)
   5.324 +20050124 upgrade from old config.guess/config.sub to newer versioned ones (excluded in 2.2.3)
   5.325 +20050123 upgrade to OSSP uuid 1.2.0 (excluded in 2.2.3)
   5.326 +20050120 add support for Slackware 10.0 (excluded in 2.2.3)
   5.327 +20050120 adjust copyright year in all messages to cover new year 2005
   5.328 +20050113 add %{l_nil} macro (excluded in 2.2.3)
   5.329 +20050113 upgrade to OSSP uuid 1.1.2 (excluded in 2.2.3)
   5.330 +
   5.331 +2004
   5.332 +====
   5.333 +
   5.334 +20041225 upgrade to BeeCrypt 4.1.2 (excluded in 2.2.3)
   5.335 +20041222 upgrade to GNU tar 1.15.1 (excluded in 2.2.3)
   5.336 +20041220 upgrade to cURL 7.12.3 (excluded in 2.2.3)
   5.337 +20041220 add "tool override" support for Debian-based Ubuntu Linux distribution
   5.338 +
   5.339 +20041211 **** RELEASE AS PART OF OPENPKG 2.2.2 ****
   5.340 +20041211 fix system start/stop transfer script for FreeBSD 5 (II)
   5.341 +20041210 fix system start/stop transfer script for FreeBSD 5
   5.342 +20041125 port RPM to NetBSD 2.0 (pre-release)
   5.343 +20041119 upgrade to BeeCrypt 4.1.1 (excluded in 2.2.2)
   5.344 +20041118 upgrade to BeeCrypt 4.1.0 (excluded in 2.2.2)
   5.345 +20041118 upgrade to OSSP uuid 1.1.1 (excluded in 2.2.2)
   5.346 +20041118 fix rc(1) command processing for "%cmd -u foo" situations under umask 027 and similar
   5.347 +20041008 port to MacOS X 10.3.6 by disabling assembly code in gzip
   5.348 +
   5.349 +20041004 **** RELEASE AS PART OF OPENPKG 2.2.1 ****
   5.350 +20041104 apply GNU bash patch for brain-dead Linux platforms with broken WCONTINUE
   5.351 +20041103 upgrade to OSSP uuid 1.1.0 (excluded in 2.2.1)
   5.352 +20041024 synchronize GNU bash patches with OpenPKG "bash" package
   5.353 +20041018 upgrade to cURL 1.12.2 (excluded in 2.2.1)
   5.354 +20041018 upgrade to OSSP uuid 1.0.4 (excluded in 2.2.1)
   5.355 +20041015 upgrade to OSSP uuid 1.0.3 (excluded in 2.2.1)
   5.356 +
   5.357 +20041002 **** RELEASE AS PART OF OPENPKG 2.2.0 ****
   5.358 +20041002 cleanup more shtool usages
   5.359 +20040928 fix broken shtool usage introduced in 20040924
   5.360 +20040924 remove the beecrypt C++ preprocessor configure test
   5.361 +20040923 fix building of cURL under at least FreeBSD 5.3.
   5.362 +20040922 correct usage text of openpkg.boot (matching aux.wrapsrc.sh exactly)
   5.363 +20040920 use the older "test -h" instead of the modern "test -L" in "rpm --setperms" for portability reasons
   5.364 +20040920 remove <prefix>/lib/openpkg/override directory and its files on deinstallation
   5.365 +20040912 upgrade to OSSP uuid 1.0.2
   5.366 +
   5.367 +20040825 **** RELEASE AS PART OF OPENPKG 2.1.2 ****
   5.368 +20040825 applied security bugfixes for ZLIB 1.2.1
   5.369 +
   5.370 +20040811 **** RELEASE AS PART OF OPENPKG 2.1.1 ****
   5.371 +20040811 upgrade to cURL 7.12.1
   5.372 +20040811 apply more fixes for GNU Bash 3.0
   5.373 +20040810 fix uid/gid determination loops by not being confused by multiple query results
   5.374 +20040804 upgrade to BeeCrypt 4.0.0 and GNU Bash 3.0
   5.375 +20040725 fix a few typos in rc(8) manual page
   5.376 +20040725 remove useless "Provides" for the corresponding RELEASE version
   5.377 +20040721 disable special RedHat NPTL handling for portability reasons
   5.378 +20040721 fixed paths in manual pages
   5.379 +20040716 upgrade to OSSP uuid 1.0.1
   5.380 +
   5.381 +20040712 **** RELEASE AS PART OF OPENPKG 2.1.0 ****
   5.382 +20040712 make --prefix optional in aux.wrapsrc.sh and default to /openpkg
   5.383 +20040712 let the --susr/--sgrp default to "root" only if --user/--group was specified
   5.384 +20040712 emulate GNU libtool environment for bzip2 to make sure RPM picks it up before a vendor version
   5.385 +20040712 fix final install detection in "openpkg install" command
   5.386 +20040702 reorder and split building of tools in order to already unpack problematic cURL tarball with GNU tar
   5.387 +20040702 make sure $PATH contains at least "/bin:/sbin:/usr/bin:/usr/sbin" for bootstrapping
   5.388 +20040702 upgrade to GNU shtool 2.0.0
   5.389 +20040702 update platform prerequisite checks for OpenPKG 2.1 platform set
   5.390 +20040701 add support for openpkg-audit package
   5.391 +20040609 add support for recognizing package class in old 1.3 Distribution headers during building
   5.392 +20040609 start rc.openpkg jobs in background and as soon as possible (priority 0)
   5.393 +20040607 workaround NetBSD gcc 2.95 optimization problems by not using -O2 there
   5.394 +20040607 upgrade to latest GNU shtool snapshot to fix platform detection under NetBSD 1.6.2-STABLE
   5.395 +20040604 revise the stderr processing of run-command processor in case of -d/--debug
   5.396 +20040604 add -k/--keep option to run-command processor for debug purposes
   5.397 +20040604 add GNU bash 2.05b vendor patches 001-007
   5.398 +20040604 port to HP-UX 11.11 platform
   5.399 +20040602 upgrade to cURL 7.12.0
   5.400 +20040602 add evil hack to workaround Debian 3.1 install-info(8) conflicts
   5.401 +20040602 remove unused code from run-command processor
   5.402 +20040602 prevent gcc 2.95 from optimizing RPM DB's sha1.c and run into a virtual memory exhaustion situation
   5.403 +20040601 fixate path to GnuPG, because RPM 4.2 passes argument directly to execve(2)
   5.404 +20040601 enable pure-C builds by patching out useless C++ checks from cURL configure
   5.405 +20040601 finally disable ulimits for FreeBSD, Solaris and Linux
   5.406 +20040601 add path defaults for HP/UX, Tru64/OSF1 and UnixWare
   5.407 +20040601 removed OS compatibility mapping list in rpmrc to avoid any magic
   5.408 +20040515 initial port to Tru64/OSF1 4.0F and IRIX 6.5.21m
   5.409 +20040512 remove RPM's "lib64" hack to port to NetBSD/sparc64
   5.410 +20040510 fix GNU tar patch
   5.411 +20040508 upgraded to GNU shtool 2.0b3
   5.412 +
   5.413 +20040507 **** RELEASE AS PART OF OPENPKG 2.0.3 ****
   5.414 +20040507 synchronize aux.prereq.sh platform checks with official list as of OpenPKG 2.0
   5.415 +20040507 fix disk space detection in aux.prereq.sh script
   5.416 +20040506 finally remove <prefix>/bin/{rpm,rpm2cpio} wrappers in preparation to OpenPKG 2.1 (excluded in 2.0.3)
   5.417 +20040505 rc: skip .snap (FreeBSD 5) and .snapshot (NetApp) directories in *.rpmxxx checking
   5.418 +20040501 use better GCC detection in "rpmtool cflags" (taken over from "gcc" package)
   5.419 +20040429 make sure <prefix>/etc/rc does not complain in cronjobs of non-privileged setups
   5.420 +20040429 port to NetBSD 1.6.2 (excluded in 2.0.3)
   5.421 +20040428 fix "openpkg man" command now that OPENPKG_TOOLS_CMDPATH is not provided
   5.422 +20040428 let rc point out that it searches subdirectories for unresolved file conflicts
   5.423 +20040427 fixed rpmpopt: replace hard-coded bash path and do not use reserved shell keywords
   5.424 +20040426 upgrade to cURL 7.11.2 (excluded in 2.0.3)
   5.425 +20040422 backout added hack to "rpmtool cflags -O" processing because it was incorrect (excluded in 2.0.3)
   5.426 +20040421 add hack to "rpmtool cflags -O" processing because Tru64 doesn't know plain "-O" option (excluded in 2.0.3)
   5.427 +20040421 POSIX compliance: replace "head -1" with "sed -e 'q'" and "tail -1" with "sed -n -e '$p'"
   5.428 +
   5.429 +20040418 **** RELEASE AS PART OF OPENPKG 2.0.2 ****
   5.430 +20040418 port RPM to Tru64 5.1 (again) (excluded in 2.0.2)
   5.431 +20040418 remove left-over object files from RPM distribution tarball before building
   5.432 +20040418 use "openpkg lsync" consistently in lsync manual page (excluded in 2.0.2)
   5.433 +20040414 fix "rpm --help" output related to option "--with"
   5.434 +20040414 fix building of GNU tar by applying more "no iconv here" enforcement (excluded in 2.0.2)
   5.435 +20040409 removed old RPM extensions (now part of "openpkg-tools") (excluded in 2.0.2)
   5.436 +20040409 worked-off <prefix>/bin/openpkg frontend in order to provide better tool chain processing
   5.437 +20040408 fixed internal OPENPKG_TOOLS variable processing in <prefix>/bin/openpkg frontend
   5.438 +20040408 added workaround to BeeCrypt build to make sure /dev/audio and /dev/dsp are not used
   5.439 +20040407 upgraded to GNU shtool 2.0b2
   5.440 +20040406 upgraded to GNU tar 1.13.94 (excluded in 2.0.2)
   5.441 +
   5.442 +20040405 **** RELEASE AS PART OF OPENPKG 2.0.1 ****
   5.443 +20040405 fix "openpkg man" command for embedded POD manual page rendering
   5.444 +20040403 fix tracking of GNU tar
   5.445 +20040401 fix "openpkg install openpkg-tool" bootstrapping command
   5.446 +20040324 fix %l_check_nosource: the output went directly into the shell scripts
   5.447 +20040320 upgrade to cURL 7.11.1 (excluded in 2.0.1)
   5.448 +20040320 bump provide for 2.0.0-2.0.0
   5.449 +
   5.450 +20040224 **** RELEASE AS PART OF OPENPKG 2.0.0 ****
   5.451 +20040224 use ~/.openpkg/warning instead of ~/.openpkg/timestamp for warning timestamp file
   5.452 +20040223 change BeeCrypt building to use no assembly code at all
   5.453 +20040223 use a more smart rpm/rpm2cpio execution wrapper warning
   5.454 +20040221 written manual page for "openpkg uuid"
   5.455 +20040221 implemented "openpkg man" command for reading tool chain command manual pages
   5.456 +20040220 fix "openpkg rpm-config --version" output
   5.457 +20040220 cleanup displayed messages and do not display error message on failed commands
   5.458 +20040218 upgraded to GNU shtool 2.0b1
   5.459 +20040217 added -t|--tar option to *.sh scripts for convenient extracting embedded tarball
   5.460 +20040217 provide <prefix>/bin/rpm2cpio for convenience reasons
   5.461 +20040216 change filesystem layout for final OpenPKG 2.0 namespace clean layout
   5.462 +20040216 config.{guess,sub} scripts are no longer installed
   5.463 +20040216 fixed --tag processing in bootstrapping situation
   5.464 +20040216 upgraded to OSSP uuid 1.0.0
   5.465 +20040214 use sane build environment already in pre-expanded sanity checking macros
   5.466 +20040213 upgraded to OSSP uuid 0.9.7
   5.467 +20040212 added support to RPM's %patch macro for passing through patch(1) "-d" option
   5.468 +20040212 upgraded to the latest GNU shtool 2.0b0 snapshot version
   5.469 +20040211 upgraded to OSSP uuid 0.9.6
   5.470 +20040210 use "<compat>" for "%l_tag_fmt" on upgrades to be more OpenPKG 1.3 compatible
   5.471 +20040210 we more smart and accept not-existing "Class:" headers for compatibility.
   5.472 +20040209 cleanup "rpmmacros" for consistent "%l_prefix" usage and fix "rpmtool not found" issue
   5.473 +20040208 added version tracking for OSSP uuid
   5.474 +20040206 upgraded to OSSP uuid 0.9.5
   5.475 +20040206 disable %prep checks under --track-dump and cleanup its output
   5.476 +20040205 activate only the %env of "openpkg" in the "musr" run-time environment
   5.477 +20040205 add --tack-dump and make sure --track/-bt do not require dependencies and sources
   5.478 +20040205 make sure -bs no longer requires dependencies
   5.479 +20040204 fix class checking macro l_check_class.
   5.480 +20040203 actually use new Class: header and %track section
   5.481 +20040130 add support to RPM for new "%track" section which will become the new vcheck(1) source
   5.482 +20040130 add support to RPM for new "%test" section which will allow run-time testing
   5.483 +20040130 add support to RPM for new "Class" header which will become the new package class source
   5.484 +20040127 fix typos and remove trailing whitespaces from source files
   5.485 +20040124 add parallel build support in %{l_mflags} for HP/UX
   5.486 +20040123 adjust copyright year in all messages to cover new year 2004
   5.487 +20040123 upgrade to cURL 7.11.0
   5.488 +20040122 add "rpm --tag <string>" support for tagging binary RPMs with arbitrary strings
   5.489 +20040122 upgrade to latest GNU shtool snapshot for better RHL/RHEL detection and naming
   5.490 +20040121 cleanup openpkg.spec by sorting SourceX headers
   5.491 +20040120 add OSSP uuid and companion uuid.sh frontend to provide new <prefix>/etc/openpkg/uuid
   5.492 +20040120 embed %post section from openpkg.spec into bootstrap script *.src.sh
   5.493 +20040120 adjust widths in "rpm -qplv" output to allow longer owner/group
   5.494 +20040120 regenerate rpm.patch.* files with latest CVS 1.12.x
   5.495 +20040113 add %status to rc.openpkg; this prevents warnings when no package provides a status
   5.496 +20040112 settings from [smrn]gid options get lost; fix by introducing a temporary variable
   5.497 +20040112 fix RPM internal handling of %_excludedocs macro
   5.498 +20040107 fix config.cache file handling in building of GNU tar and GNU patch
   5.499 +20040107 downgrade to GNU tar 1.13.25 again because --no-recursion is broken in <= 1.13.92
   5.500 +20040105 exclude %doc flagged files by default.
   5.501 +20040102 make sure rpmtool exists (important on bootstrapping with openpkg.boot)
   5.502 +20040101 start using the global file /etc/openpkg to register all OpenPKG instances on a system
   5.503 +
   5.504 +2003
   5.505 +====
   5.506 +
   5.507 +20031212 upgrade to GNU tar 1.13.92 (second attempt)
   5.508 +20031213 replaced unreleased OSSP platform script with latest GNU shtool (which includes OSSP platform)
   5.509 +20031211 add support for RedHat WS/ES/AS and Fedora to %{l_platform} via latest OSSP platform
   5.510 +20031211 uprade to GNU tar 1.13.91 (backed out again, because 1.13.91 is partly broken)
   5.511 +20031205 fix rpmtool run-time under openpkg.boot environment
   5.512 +20031129 do not enforce uudecode availability as raw tarballs introduced a month ago do no longer require it
   5.513 +20031127 only allow exact section command matches in rc
   5.514 +20031124 upgrade to zlib 1.2.1
   5.515 +20031121 rc manual page additions
   5.516 +20031117 automatically check for %NoSource/%NoPatch integrity and package class in %prep
   5.517 +20031113 stop processing if we cannot create the necessary user accounts
   5.518 +20031107 fix usage of %pre in aux.wrapbin.sh -- was broken after recent work-offs
   5.519 +20031102 upgrade to cURL 7.10.8
   5.520 +20031031 upgrade to latest OSSP platform script version
   5.521 +20031031 work-off aux.wrap{src,bin}.sh scripts and internal documentation in README
   5.522 +20031029 switch from uncompressed binary tarball to compressed tarball in tarball encapsulation
   5.523 +20031029 switch from uuencoded to raw tarballs for source/binary .sh files (30% space reduction)
   5.524 +20031028 remove problematic INCPATH stuff in RPM configure which picks up external stuff
   5.525 +20031028 upgrade to latest OSSP platform script for Darwin 6.6 and Solaris 10 support
   5.526 +20031027 port RPM to OpenDarwin 6.6.2
   5.527 +20031027 try to cleanup glob(3) replacement hacks in RPM
   5.528 +20031021 fix RPM GCC building on Unixware by using Linux i386 assembly specific stuff on Linux only.
   5.529 +20031020 include "trigger argument passing patch" from RPM BugDB
   5.530 +20031020 make "rpm --setperms" and "rpm --setugids" more portable by using Bash
   5.531 +20031020 finish porting to SCO UnixWare 7.1.3
   5.532 +20031019 port mostly to SCO UnixWare 7.1.3 (only some libtool issues remaining)
   5.533 +20031019 provide %{l_cppflags -i} for platform identification defines
   5.534 +20031019 use <prefix>/lib/openpkg/bash for rpmtool and lsync for better portability
   5.535 +20031015 fix RPM for building without GCC again
   5.536 +20031014 port to Solaris 8 with Forte C compiler
   5.537 +20031014 fix filesystem space checking (aux.prereq.sh)
   5.538 +20031014 get rid of TEMPDIR (we use more canonical TMPDIR now only)
   5.539 +20031010 provide %{_rpmdb_private} macro and --db-private for operating the RPM DB in DB_PRIVATE mode.
   5.540 +20031010 working off the aux.prereq.sh script for adjusted platform checks and additional disk space checks
   5.541 +20031008 make sure RPM does not pick up headers of a vendor BeeCrypt package under RedHat Linux
   5.542 +20031008 fix --makeproxy command after recent OpenPKG branding in "rpm --version" output
   5.543 +20031006 add 'Provides: openpkg = 1.3.1-1.3.1' for easier mixing with OpenPKG 1.3 release packages
   5.544 +20031006 add OpenPKG branding to "rpm --version" output
   5.545 +20031005 check availability of unpacking tools in .src.sh script
   5.546 +20030929 upgrade to latest OSSP platform script to recognize even more platforms
   5.547 +20030928 add partial UnixWare 7.1.x support to bootstrap; add IRIX, UnixWare and QNX support to "platform"
   5.548 +20030927 make %{error:<msg>} really stop SPEC processing
   5.549 +20030927 add new macro %{l_openpkg_release} for expanding the release id
   5.550 +20030922 remove stale temporary files in /etc
   5.551 +20030918 use assembly code in BeeCrypt only for platform where it is known to work
   5.552 +20030918 add RPM internal %{_force_oldpackage} option for enforcing --oldpackage on upgrades
   5.553 +20030918 introduce new rpmdb utility for administrating the RPM database on the lower level
   5.554 +20030916 RPM database mutex workaround for Solaris plus the passing of option -b to patch(1)
   5.555 +20030915 remove the librpmmisc.a library because its contents RPM includes in librpmio.a
   5.556 +20030915 Berkeley-DB fixes for fcntl(2) usage and Linux O_DIRECT issue
   5.557 +20030913 update to latest OSSP platform for even more accurate Linux product recognition
   5.558 +20030913 fix ordering of libraries in "rpm-config --libs"
   5.559 +20030912 add -pipe to %{l_cflags} only if %{l_cc} is GCC and as(1) is GNU as
   5.560 +20030912 remove per-package %{_sourcedir} and %{_specdir} directories on --rebuild
   5.561 +20030912 allow "-bb --short-circuit" for continuing building a binary package
   5.562 +20030912 unconditionally remove temporary files of generated/executed scripts
   5.563 +20030912 do not remove the builded sources in %clean to be consistent with other OpenPKG packages
   5.564 +20030912 include all essential RPM C API headers in <prefix>/include/rpm/
   5.565 +20030912 add file(1) magic* files to <prefix>/lib/openpkg/
   5.566 +20030911 disable RPM internal support for unzip(1)'ing .zip files
   5.567 +20030911 improve Linux detection in "platform" script
   5.568 +20030909 remove one more GCC extensional feature (in RPM's file/file.h)
   5.569 +20030908 upgrade "platform" script to new "OSSP platform" implementation and provide %{l_platform}
   5.570 +20030907 add rpm-config(8) utility and add librpmbeecrypt.a to installation tree
   5.571 +20030904 apply new BeeCrypt and Bash patch files
   5.572 +20030904 remove obsoleted patch files from CVS
   5.573 +20030904 fix cut & paste typo in openpkg.spec related to VERBOSE function
   5.574 +20030904 fix logic in previous owner/group patch
   5.575 +20030903 patch RPM 4.2.1 so it does again (as 4.0.2) ignore file owner/group on .src.rpm installation.
   5.576 +20030901 port RPM 4.2.1 to Solaris 2.6 (no "uintX_t") and non-GCC platforms (no "inline")
   5.577 +20030901 port RPM 4.2.1 to OpenBSD/NetBSD, too.
   5.578 +20030830 replace Bash variable exporting constructs with compatible Bourne-Shell constructs
   5.579 +20030828 fix unpacking of non-compressed tarballs
   5.580 +20030827 enhance and fix %post script to correctly rebuild RPM DB and import OpenPGP public key
   5.581 +
   5.582 +20030826 **** MAJOR UPGRADE FROM RPM 4.0.2 TO RPM 4.2.1 ****
   5.583 +20030820 name internal bootstrapping tarball just .tar instead of .tar.Z -- it is no longer compressed.
   5.584 +20030806 fix "rcTmp -f" functionality
   5.585 +20030805 trick cURL to skip some useless F77 autoconf checks to get it working under NetBSD again
   5.586 +20030805 allow variables with other characters than A-Z (e.g. LD_LIBRARY_PATH) to be set in %env, too.
   5.587 +
   5.588 +20030802 **** RELEASE AS PART OF OPENPKG 1.3.0 ****
   5.589 +20030730 add entry to /etc/shells only if /etc/shells already exists at all
   5.590 +20030729 aux.wrap{src,bin}.sh: exit immediately if uudecode cannot be found
   5.591 +20030729 rc: fixed processing of $openpkg_rc_def (requires pre-inclusion of rc.conf)
   5.592 +20030729 fixed nasty filedescriptor leakage in RPM on script execution
   5.593 +20030728 upgraded to cURL 7.10.6
   5.594 +20030728 rc: stop processing 'start' and 'restart' scripts if .rpmsave files exists
   5.595 +20030727 rc: do not export TMPDIR at all, it causes problems for applications once the directory is gone
   5.596 +20030721 rc: do not use TMPDIR -- instead use hard-coded /tmp
   5.597 +20030719 openpkg.boot: try to make build environment more sane by setting umask and unsetting some strange aliases
   5.598 +20030718 rc.func: opXXX replaced by rcXXX; add rc(8) manual page; add pod2man.sh; fix perl/ warnings under building
   5.599 +20030717 rc.func: add opService, switch to Bash; rc: rewrite --eval to use Bash; rpmmacros: add l_tmp{dir,file}
   5.600 +20030716 cleaned and enhanced "rc" again; added %{l_value} killer macro
   5.601 +20030715 work-off "rc" again: add -o/--output options, better cleanup, global return code
   5.602 +20030715 add to "rc" the -v/--verbose option again and provide terminal-detection
   5.603 +20030714 reduce run-time of "rc" --eval/--print operations by parsing %config sections just once
   5.604 +20030714 add convenience macros %l_rc and %l_rpm; resolve conflict with openpkg-rc package
   5.605 +20030714 bugfix verbose output; add "rc" command to search path for run-command sections
   5.606 +20030710 rename openpkg_runall to openpkg_rc_all, support new openpkg_rc_def.
   5.607 +20030709 fully work-off rc script
   5.608 +20030709 make sure l_fsl_{ldflags,libs} do not produce an error if fsl-config is not existing
   5.609 +20030709 change syntax of append/prepend feature for %{l_cppflags} and %{l_ldflags} macros; fix DB autoconf checks
   5.610 +20030708 provide append/prepend feature for %{l_cppflags} and %{l_ldflags} macros
   5.611 +20030707 remove now officially deprecated usage of %{name} macro
   5.612 +20030606 correctly support "use_cxx" for setting the "c++" path
   5.613 +20030604 fix "{s,m,r,r}{u,g}id" handling on initial bootstrapping via .src.sh.
   5.614 +20030604 better support SuSE
   5.615 +20030603 make sure 'shtool install -e ...' does not fail if file is not writeable due to permissions
   5.616 +20030530 add HISTORY file to package
   5.617 +20030519 upgrade to cURL 7.10.5
   5.618 +20030516 make sure 'shtool subst' does not fail if file is not writeable due to permissions
   5.619 +20030509 fix 'shtool mkln' command
   5.620 +20030429 Gentoo Linux support
   5.621 +20030429 RedHat 8 support (avoid problems due to alias rm='rm -i'), clean up temp dir
   5.622 +20030429 some cosmetics
   5.623 +20030429 switch to new shtool which now has a working 'shtool rotate' for SuSE
   5.624 +20030428 add bzip2 library/header to package because it is references by librpmio
   5.625 +20030425 allow only 'use_<toolname>' instead of 'with_<toolname>' for overriding 'l_<toolname>' to reduce conflict with regular package options
   5.626 +20030422 teach --fetch to honor proxy settings
   5.627 +20030417 force RPM to no longer build itself statically
   5.628 +20030416 Fix dev ticket 23 by finally implementing {m,r,n,s}uid and {m,r,n,s}gid params
   5.629 +20030416 Fix removal of group entries, which never worked from day one?!?!
   5.630 +20030415 Add l_fsl_ldflags and l_fsl_libs macros
   5.631 +20030414 fix cache file usage
   5.632 +20030410 do not leave dot files on deinstallation
   5.633 +20030404 upgrade to latest shtool snapshot in order to fix rotate command if a filename contains whitespaces
   5.634 +20030403 (unknown change)
   5.635 +20030324 speclint police
   5.636 +20030319 fix shell syntax error
   5.637 +20030317 Support for MacOS X (at least 10.0.4)
   5.638 +20030310 fix substitution of noreplace attribute
   5.639 +20030305 mega-commit: speclint police changes which were not picked up by openpkg-dev before
   5.640 +20030305 speclint police
   5.641 +20030223 add more 'getent' support
   5.642 +20030222 add Solaris/Linux 'getent' based support for passwd/group fiddling, too.
   5.643 +20030221 enhance user/group name/id fiddling in all bootstrap places to favorize POSIX id
   5.644 +20030211 Aaaaannnd risk: GNU shtool 2.0b0 (developer snapshot)
   5.645 +20030205 move bash environment setup into .bash_login; use %config(noreplace) for them plus rc.conf
   5.646 +20030204 make sure that the prefix/root directory has correct permissions and owner/group
   5.647 +20030203 try to fix temporary filename issues
   5.648 +20030202 workaround problem of missing PATH for scripts executed under different users
   5.649 +20030130 fix rpmtool PATH fiddling
   5.650 +20030128 fix typo
   5.651 +
   5.652 +20030121 **** RELEASE AS PART OF OPENPKG 1.2.0 ****
   5.653 +20030114 upgrade to cURL 7.10.3
   5.654 +20030113 make sure we stop on errors
   5.655 +20030110 some vendor tar complain about setuid bits and other flags, but work fine
   5.656 +20030109 ops, not needed actually, was my fault in not cleaning up the system
   5.657 +20030109 add FreeBSD 5.0-CURRENT support
   5.658 +20030108 add no-source support
   5.659 +20030103 switch to new %option implementation
   5.660 +20030103 remove '%options' hack, it will be replaced soon with a more elegant solution based on RPM 'Provides' headers
   5.661 +
   5.662 +2002
   5.663 +====
   5.664 +
   5.665 +20021230 bump of Copyright messages for forthcoming years 2003
   5.666 +20021230 switch to %option(s), but intentionally WITHOUT dep increase and WITHOUT FTP server updates
   5.667 +20021230 provide brand-new extensions: %option and %options macros
   5.668 +20021220 consistently use 'Options: none' to indicate no options to 'openpkg build'
   5.669 +20021218 finally fix the mkdir issues
   5.670 +20021217 make sure RPM does not hard-code an absolute path to 'mkdir'
   5.671 +20021204 add l_cxxflags for consistency; support gcc 3.2.x
   5.672 +20021127 and also the bigger hammer for bash included in the bootstrap package
   5.673 +20021122 provide a more convenient definition for cppflags and ldflags
   5.674 +20021120 make all %config sections visible for any package
   5.675 +20021119 upgrade to cURL 7.10.2 (required zlib)
   5.676 +20021118 add 'rpm --makeproxy --prefix=<master>' feature
   5.677 +20021030 get rid of unneccessary semicolon
   5.678 +20021028 fix building under NetBSD
   5.679 +20021023 try to fix cURL building
   5.680 +20021011 upgrade to cURL 7.10.1
   5.681 +20021009 fix unpacking
   5.682 +20021005 upgrading package: openpkg 20021004 -> 20021005
   5.683 +20021004 upgrading package: openpkg 20021002 -> 20021004
   5.684 +20021002 Added support for IRIX.
   5.685 +20021001 upgrade to cURL 7.10
   5.686 +20021001 upgrading package: openpkg 20020926 -> 20021001
   5.687 +20020926 upgrade to gzip 1.3.4
   5.688 +20020909 Fixed a subtle login name bug by rearranging user name assignment in rc.
   5.689 +20020904 Add unofficial support for Darwin OS.
   5.690 +20020829 fix for more modern SuSE
   5.691 +20020826 also add sbin directory to $PATH
   5.692 +
   5.693 +20020826 **** RELEASE AS PART OF OPENPKG 1.1.0 ****
   5.694 +...
   5.695 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/openpkg/README	Tue Jan 06 23:40:39 2009 +0100
     6.3 @@ -0,0 +1,189 @@
     6.4 +
     6.5 +  OpenPKG Boostrap Package Source Tree
     6.6 +  ====================================
     6.7 +
     6.8 +  This is the source code tree for the OpenPKG bootstrap package. What
     6.9 +  you find here is rather complex and tricky stuff, so don't be confused
    6.10 +  if you don't understand everything immediately.
    6.11 +
    6.12 +  The Files
    6.13 +  ---------
    6.14 +
    6.15 +  README .................. this file ;-)
    6.16 +  HISTORY ................. change history tracking of this package
    6.17 +
    6.18 +  openpkg.spec ............ the regular build procedure
    6.19 +  openpkg.boot ............ the bootstrapping procedure
    6.20 +
    6.21 +  gzip-*.tar .............. untouched distribution tarball of the GNU gzip tool
    6.22 +  make-*.tar.gz ........... untouched distribution tarball of the GNU make tool
    6.23 +  patch-*.tar.gz .......... untouched distribution tarball of the GNU patch tool
    6.24 +  bash-*.tar.gz ........... untouched distribution tarball of the GNU bash tool
    6.25 +  tar-*.tar.gz ............ untouched distribution tarball of the GNU tar tool
    6.26 +  uuid-*.tar.gz ........... untouched distribution tarball of the OSSP uuid tool
    6.27 +  curl-*.tar.gz ........... untouched distribution tarball of the cURL tool
    6.28 +  bzip2-*.tar.gz .......... untouched distribution tarball of the BZIP2 library
    6.29 +  zlib-*.tar.gz ........... untouched distribution tarball of the ZLIB library
    6.30 +  beecrypt-*.tar.gz ....... untouched distribution tarball of the BeeCrypt library
    6.31 +  rpm-*.tar.gz ............ untouched distribution tarball of the RPM tool
    6.32 +  config-*.tar.gz ......... untouched distribution tarball of the GNU config scripts
    6.33 +  openpkg-registry-*.tar.gz untouched distribution tarball of the OpenPKG Registry
    6.34 +  openpkg-tools-*.tar.gz .. untouched distribution tarball of the OpenPKG Tool Chain
    6.35 +  openssl-*.tar.gz ........ untouched distribution tarball of the OpenSSL toolkit
    6.36 +  perl-*-mini.tar.gz ...... stripped down distribution tarball of the Perl tool
    6.37 +
    6.38 +  make.patch .............. patch for GNU make
    6.39 +  bash.patch .............. patch for GNU bash
    6.40 +  tar.patch ............... patch for GNU tar
    6.41 +  beecrypt.patch .......... patch for BeeCrypt
    6.42 +  openssl.patch ........... patch for OpenSSL
    6.43 +  perl.patch .............. patch for Perl
    6.44 +  gzip.c .................. replacement file for GNU gzip
    6.45 +  rpm.patch.bugfix ........ patch for RPM (bugfixing parts)
    6.46 +  rpm.patch.feature ....... patch for RPM (new features parts)
    6.47 +  rpm.patch.porting ....... patch for RPM (portability enhancement parts)
    6.48 +  rpm.patch.regen ......... patch for RPM (re-generated files parts)
    6.49 +
    6.50 +  rpmpopt ................. replacements/extensions for RPM's POPT configuration
    6.51 +  rpmmacros ............... replacements/extensions for RPM's macros
    6.52 +  rpmrc ................... replacements for RPM's run-command configuration
    6.53 +
    6.54 +  root.README ............. the source for installed <prefix>/README
    6.55 +  local.README ............ the source for installed <prefix>/local/README
    6.56 +  dot.bashrc .............. the source for installed <prefix>/.bashrc
    6.57 +  dot.bash_login .......... the source for installed <prefix>/.bash_login
    6.58 +  dot.lsyncrc ............. the source for installed <prefix>/local/.lsyncrc
    6.59 +
    6.60 +  openpkg.c ............... the OpenPKG frontend (set-uid wrapper)
    6.61 +  openpkg.sh .............. the OpenPKG frontend (main script)
    6.62 +  openpkg.pod ............. the OpenPKG frontend manual page (source)
    6.63 +  openpkg.1 ............... the OpenPKG frontend manual page (pre-generated output)
    6.64 +
    6.65 +  rc ...................... the OpenPKG run-command handling script
    6.66 +  rc.func ................. the OpenPKG run-command function definitions
    6.67 +  rc.conf ................. the OpenPKG run-command configuration template
    6.68 +  rc.openpkg .............. the OpenPKG run-command script for the bootstrap package
    6.69 +  rc.pod .................. the OpenPKG run-command script manual page (source)
    6.70 +  rc.8 .................... the OpenPKG run-command script manual page (pre-generated output)
    6.71 +
    6.72 +  release.sh .............. the OpenPKG release information utility script
    6.73 +  release.pod ............. the OpenPKG release information utility manual page (source)
    6.74 +  release.8 ............... the OpenPKG release information utility manual page (pre-generated output)
    6.75 +
    6.76 +  uuid.sh ................. the OpenPKG UUID management utility script
    6.77 +  uuid.pod ................ the OpenPKG UUID management utility manual page (source)
    6.78 +  uuid.8 .................. the OpenPKG UUID management utility manual page (pre-generated output)
    6.79 +
    6.80 +  rpmdb ................... the OpenPKG RPM database management utility
    6.81 +
    6.82 +  rpmtool ................. the rpmtool tool (program source)
    6.83 +  rpmtool.8 ............... the rpmtool tool (manual page)
    6.84 +  rpmtool.pod ............. the rpmtool tool (manual page source)
    6.85 +  shtool .................. the portable shell tool (GNU shtool)
    6.86 +
    6.87 +  rpm-config.sh ........... the RPM C API helper script
    6.88 +  rpm-config.pod .......... the RPM C API helper manual page (source)
    6.89 +  rpm-config.8 ............ the RPM C API helper manual page (pre-generated output)
    6.90 +
    6.91 +  lsync ................... the lsync tool (program source)
    6.92 +  lsync.8 ................. the lsync tool (manual page)
    6.93 +  lsync.pod ............... the lsync tool (manual page source)
    6.94 +
    6.95 +  aux.usrgrp.sh ........... user/group name/id determination script
    6.96 +  aux.prereq.sh ........... prerequisite checking script
    6.97 +  aux.wrapsrc.sh .......... wrapper script for generating openpkg-V-R.src.sh
    6.98 +  aux.wrapbin.sh .......... wrapper script for generating openpkg-V-R.P-L.sh
    6.99 +
   6.100 +  pod2man.sh .............. helper script for pre-generating manual page outputs
   6.101 +  man.sh .................. helper script for "openpkg man" command
   6.102 +  install.sh .............. helper script for "openpkg install" command
   6.103 +
   6.104 +  openpkg.org.pgp ......... the OpenPGP public key "OpenPKG <openpkg@openpkg.org>"
   6.105 +  openpkg.com.pgp ......... the OpenPGP public key "OpenPKG GmbH <openpkg@openpkg.com>"
   6.106 +  openpkg.net.pgp ......... the OpenPGP public key "OpenPKG Foundation e.V. <openpkg@openpkg.net>"
   6.107 +
   6.108 +  The Bootstrapping Procedure
   6.109 +  ---------------------------
   6.110 +
   6.111 +  The complexity of this OpenPKG RPM package results from the fact that
   6.112 +  we force us to treat this bootstrapping package equal to every other
   6.113 +  regular OpenPKG RPM package. First, this implies that the packaging
   6.114 +  tool RPM is packaged with itself as an OpenPKG RPM package (means: its
   6.115 +  build procedure is a real RPM .spec file and it can be installed and
   6.116 +  upgraded through a binary or source RPM). Second, RPM is installed
   6.117 +  into the same filesystem hierarchy as all other packages. Third, RPM
   6.118 +  manages its own files. The reason for this approach should be obvious:
   6.119 +  100% consistency for the whole OpenPKG software packaging facility!
   6.120 +
   6.121 +  The drawback is that this package requires a very tricky bootstrapping
   6.122 +  procedure which had cost a lot of time to figure out and establish. If
   6.123 +  you ever wanted to know the gory details, here they are...
   6.124 +
   6.125 +  The first step was that we wrote the regular openpkg.spec file for
   6.126 +  building the bootstrap package with OpenPKG RPM under the assumption
   6.127 +  that OpenPKG RPM is already available. This way we can provide OpenPKG
   6.128 +  RPM as an RPM package. Just remains the problem how we actually
   6.129 +  bootstrap in case where OpenPKG RPM is still not available, i.e.,
   6.130 +  when we reach a new platform and have to build the package from
   6.131 +  scratch. Here the "openpkg.boot" script comes into play. It executes
   6.132 +  the "openpkg.spec" build procedure very similar to the way the real
   6.133 +  OpenPKG RPM would do ("openpkg rpm -bb"). That is, "openpkg.boot"
   6.134 +  partly emulates OpenPKG RPM -- just enough that "openpkg.spec" works.
   6.135 +  As a result, "openpkg.spec" cannot use any fancy OpenPKG RPM features
   6.136 +  or other things before "openpkg.boot" is able to emulate it, of
   6.137 +  course.
   6.138 +
   6.139 +  After "openpkg.boot" executed the "%prep", "%build" and "%install"
   6.140 +  scripts of "openpkg.spec", there is a fresh version of the target
   6.141 +  filesystem hierarchy staying under a temporary "build root". The
   6.142 +  "openpkg.boot" script then creates a very special temporary "openpkg
   6.143 +  rpm" command which allows the installed "openpkg rpm" command inside
   6.144 +  the "build root" to work (although it is built for the final target
   6.145 +  filesystem path). Then the $RPM_BOOT variable is set and the package
   6.146 +  is _again_ build via "openpkg.spec" -- but this time with the real
   6.147 +  OpenPKG RPM. To avoid unneccessary re-compilation, the "openpkg.spec"
   6.148 +  skips "%prep", "%build" and "%install" sections if $RPM_BOOT is
   6.149 +  defined. So, on this second build phase, only the "%files" section is
   6.150 +  executed, i.e., a binary OpenPKG RPM package "openpkg-V-R.P-T.rpm"
   6.151 +  is rolled from the files in the "build root". Additionally, a source
   6.152 +  OpenPKG RPM package "openpkg-V-R.src.rpm" is rolled for consistency
   6.153 +  reasons.
   6.154 +
   6.155 +  Finally, we override the installation in the "build root"
   6.156 +  again by installing the now rolled binary OpenPKG RPM package
   6.157 +  "openpkg-V-R.P-T.rpm" by using the real OpenPKG RPM. This way
   6.158 +  we achieve that OpenPKG RPM is remembered as a real OpenPKG RPM
   6.159 +  package in the RPM database. We just have to make sure the package
   6.160 +  is still relocated to the "build root" while installing. For this
   6.161 +  we could use "--prefix=$RPM_BUILD_ROOT%{l_prefix}", but this would
   6.162 +  create an incorrect file list for the package "openpkg" in the RPM
   6.163 +  database. Instead we use the tricky "--justdb" option for "openpkg
   6.164 +  rpm" which means "openpkg rpm" behaves as it would install into the
   6.165 +  real location, but does not actually install anything. But as a
   6.166 +  side-effect, the database inside the "build root" is now correct.
   6.167 +
   6.168 +  After this procedure, the "build root" contains the target filesystem
   6.169 +  hierarchy with OpenPKG RPM installed with itself. What is now just
   6.170 +  remaining is to roll a bootstrap package "openpkg" with this stuff for
   6.171 +  initial installation without OpenPKG RPM. For this the "build root"
   6.172 +  is packed into a "tarball", compressed, again wrapped into another
   6.173 +  tarball together with the uncompression tools ("bzip2" and "tar"),
   6.174 +  and finally wrapped into a self-extracting shell script by appending
   6.175 +  "aux.wrapbin.sh" (padded to 64KB for easier unpacking of the attached
   6.176 +  tarball) to its front.
   6.177 +
   6.178 +  The result is the binary bootstrap script "openpkg-V-R.P-T.sh" which
   6.179 +  can be used to install the target hierarchy from scratch without any
   6.180 +  pre-installed OpenPKG RPM. Nevetheless, the installed target hierarchy
   6.181 +  looks _exactly_ as it would have been installed with OpenPKG RPM.
   6.182 +  If one later wants to upgrade this hierarchy one can just use the
   6.183 +  generated (or a newer) "openpkg-V-R.P-T.rpm".
   6.184 +
   6.185 +  To allow one to easily repeat this from-source bootstrapping procedure
   6.186 +  on other machines, one can run "./openpkg.boot -s" which rolls
   6.187 +  a "openpkg-V-R.src.sh" script which is a self-extracting script
   6.188 +  containing an attached tarball of the sources of this directory. This
   6.189 +  script contains the same contents like "openpkg-V-R.src.rpm", but
   6.190 +  is intended for running the described bootstrapping procedure from
   6.191 +  scratch without any OpenPKG RPM.
   6.192 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/openpkg/aux.prereq.sh	Tue Jan 06 23:40:39 2009 +0100
     7.3 @@ -0,0 +1,87 @@
     7.4 +#!/bin/sh
     7.5 +##
     7.6 +##  aux.prereq.sh -- Platform Pre-Requisite Checks
     7.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     7.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     7.9 +##
    7.10 +##  Permission to use, copy, modify, and distribute this software for
    7.11 +##  any purpose with or without fee is hereby granted, provided that
    7.12 +##  the above copyright notice and this permission notice appear in all
    7.13 +##  copies.
    7.14 +##
    7.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    7.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    7.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    7.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    7.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    7.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    7.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    7.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    7.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    7.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    7.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    7.26 +##  SUCH DAMAGE.
    7.27 +##
    7.28 +##  Usage: aux.prereq.sh source|binary
    7.29 +##
    7.30 +
    7.31 +mode="$1"
    7.32 +
    7.33 +#   CHECK: determine platform ids
    7.34 +platform_prod=`sh ./shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"`
    7.35 +platform_tech=`sh ./shtool platform -n -L -S "" -C "+" -F "%<at>-%<st>"`
    7.36 +echo "++ platform product:    $platform_prod"
    7.37 +echo "++ platform technology: $platform_tech"
    7.38 +
    7.39 +#
    7.40 +#   CHECK: diskspace requirement
    7.41 +#
    7.42 +if [ ".$mode" = .source ]; then
    7.43 +    fs_path="${TMPDIR-/tmp}"
    7.44 +    fs_need=150000
    7.45 +else
    7.46 +    fs_path="" # FIXME
    7.47 +    fs_need=0  # FIXME
    7.48 +fi
    7.49 +fs_free=""
    7.50 +case "$platform_tech" in
    7.51 +    *-freebsd* | *-linux* | *-sunos* )
    7.52 +       fs_free=`cd $fs_path && /bin/df -k . | sed -n -e '$p' | sed -e 's;^[^ ]*;;' -e 's; *;;' | awk '{ print $3; }'`
    7.53 +       ;;
    7.54 +esac
    7.55 +if [ ".$fs_free" != . ]; then
    7.56 +    if [ $fs_free -lt $fs_need ]; then
    7.57 +        if [ ".$mode" = .source ]; then
    7.58 +            echo "ERROR: temporary directory \"$fs_path\" has to reside on a partition" 1>&2
    7.59 +            echo "       with at least $fs_need KB of free disk space. Set \$TMPDIR to" 1>&2
    7.60 +            echo "       a directory on a partition with enough free disk space, please." 1>&2
    7.61 +        else
    7.62 +            echo "ERROR: installation directory \"$fs_path\" has to reside on a partition" 1>&2
    7.63 +            echo "       with at least $fs_need KB of free disk space. Make \"$fs_path\" a" 1>&2
    7.64 +            echo "       symbolic link to a directory on a partition with enough free" 1>&2
    7.65 +            echo "       disk space, please." 1>&2
    7.66 +        fi
    7.67 +        exit 1
    7.68 +    fi
    7.69 +fi
    7.70 +
    7.71 +#
    7.72 +#   CHECK: available vendor packages
    7.73 +#
    7.74 +#   ...FIXME...
    7.75 +
    7.76 +#
    7.77 +#   CHECK: available tools in $PATH
    7.78 +#
    7.79 +#   ...FIXME...
    7.80 +
    7.81 +#
    7.82 +#   CHECK: available devices /dev/random, etc.
    7.83 +#
    7.84 +#   ...FIXME...
    7.85 +
    7.86 +#
    7.87 +#   CHECK: consistency check for /prefix (symlink!)
    7.88 +#
    7.89 +#   ...FIXME...
    7.90 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/openpkg/aux.usrgrp.sh	Tue Jan 06 23:40:39 2009 +0100
     8.3 @@ -0,0 +1,222 @@
     8.4 +#!/bin/sh
     8.5 +##
     8.6 +##  usrgrp.sh -- user/group name/id determination
     8.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     8.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     8.9 +##
    8.10 +##  Permission to use, copy, modify, and distribute this software for
    8.11 +##  any purpose with or without fee is hereby granted, provided that
    8.12 +##  the above copyright notice and this permission notice appear in all
    8.13 +##  copies.
    8.14 +##
    8.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    8.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    8.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    8.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    8.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    8.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    8.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    8.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    8.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    8.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    8.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    8.26 +##  SUCH DAMAGE.
    8.27 +##
    8.28 +
    8.29 +#   command line parameters (defaults)
    8.30 +help=0
    8.31 +usr='';  grp=''
    8.32 +susr=''; sgrp=''
    8.33 +musr=''; mgrp=''
    8.34 +rusr=''; rgrp=''
    8.35 +nusr=''; ngrp=''
    8.36 +suid=''; sgid=''
    8.37 +muid=''; mgid=''
    8.38 +ruid=''; rgid=''
    8.39 +nuid=''; ngid=''
    8.40 +
    8.41 +#   parse command line options
    8.42 +for opt
    8.43 +do
    8.44 +    case $opt in
    8.45 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
    8.46 +           *) arg='' ;;
    8.47 +    esac
    8.48 +    case $opt in
    8.49 +        -h | --help          ) help=1      ;;
    8.50 +        --usr=* | --user=*   ) usr=$arg    ;;
    8.51 +        --grp=* | --group=*  ) grp=$arg    ;;
    8.52 +        --susr=*             ) susr=$arg   ;;
    8.53 +        --sgrp=*             ) sgrp=$arg   ;;
    8.54 +        --musr=*             ) musr=$arg   ;;
    8.55 +        --mgrp=*             ) mgrp=$arg   ;;
    8.56 +        --rusr=*             ) rusr=$arg   ;;
    8.57 +        --rgrp=*             ) rgrp=$arg   ;;
    8.58 +        --nusr=*             ) nusr=$arg   ;;
    8.59 +        --ngrp=*             ) ngrp=$arg   ;;
    8.60 +        --suid=*             ) suid=$arg   ;;
    8.61 +        --sgid=*             ) sgid=$arg   ;;
    8.62 +        --muid=*             ) muid=$arg   ;;
    8.63 +        --mgid=*             ) mgid=$arg   ;;
    8.64 +        --ruid=*             ) ruid=$arg   ;;
    8.65 +        --rgid=*             ) rgid=$arg   ;;
    8.66 +        --nuid=*             ) nuid=$arg   ;;
    8.67 +        --ngid=*             ) ngid=$arg   ;;
    8.68 +        *                    ) help=1      ;;
    8.69 +    esac
    8.70 +done
    8.71 +if [ ".$help" = .1 ]; then
    8.72 +    echo "Usage: sh $0 [-h|--help]" 2>&1
    8.73 +    echo "             [--[smrn]?usr=<usr>] [--[smrn]?grp=<usr>]" 2>&1
    8.74 +    echo "             [--[smrn]uid=<uid>] [--[smrn]gid=<gid>]" 2>&1
    8.75 +    exit 1
    8.76 +fi
    8.77 +
    8.78 +#   determine cusr/cgrp
    8.79 +cusr=`(id -un) 2>/dev/null ||\
    8.80 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
    8.81 +      (whoami) 2>/dev/null ||\
    8.82 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
    8.83 +      echo $LOGNAME`
    8.84 +cgid=`(id -g $cusr) 2>/dev/null ||\
    8.85 +      ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\
    8.86 +       sed -n -e '1p' | awk -F: '{ print $4; }')`
    8.87 +cgrp=`(id -gn $cusr) 2>/dev/null ||\
    8.88 +      ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\
    8.89 +       sed -n -e '1p' | awk -F: '{ print $1; }')`
    8.90 +[ ".$cgrp" = . ] && cgrp="$cusr"
    8.91 +
    8.92 +#   determine OpenPKG susr/sgrp
    8.93 +if [ ".$susr" = . ]; then
    8.94 +    if [ ".$usr" = . ]; then
    8.95 +        susr="$cusr"
    8.96 +    else
    8.97 +        susr="root"
    8.98 +    fi
    8.99 +fi
   8.100 +if [ ".$sgrp" = . ]; then
   8.101 +    sgrp=`(id -gn $susr) 2>/dev/null`
   8.102 +    if [ ".$sgrp" = . ]; then
   8.103 +        tgid=`(getent passwd "${susr}"; grep "^${susr}:" /etc/passwd; ypmatch "${susr}" passwd; nismatch "${susr}" passwd; nidump passwd . | grep "^${susr}:") 2>/dev/null |\
   8.104 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
   8.105 +        if [ ".$tgid" != . ]; then
   8.106 +            sgid="${tgid}"
   8.107 +            sgrp=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
   8.108 +                  grep "^[^:]*:[^:]*:${sgid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
   8.109 +        fi
   8.110 +        if [ ".$sgrp" = . ]; then
   8.111 +            sgrp="wheel"
   8.112 +        fi
   8.113 +    fi
   8.114 +fi
   8.115 +
   8.116 +#   determine OpenPKG musr/mgrp
   8.117 +if [ ".$musr" = . ]; then
   8.118 +    musr="$usr"
   8.119 +fi
   8.120 +if [ ".$musr" = . ]; then
   8.121 +    musr="$cusr"
   8.122 +fi
   8.123 +if [ ".$mgrp" = . ]; then
   8.124 +    mgrp=`(id -gn $musr) 2>/dev/null`
   8.125 +    if [ ".$mgrp" = . ]; then
   8.126 +        tgid=`(getent passwd "${musr}"; grep "^${musr}:" /etc/passwd; ypmatch "${musr}" passwd; nismatch "${musr}" passwd; nidump passwd . | grep "^${musr}:") 2>/dev/null |\
   8.127 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
   8.128 +        if [ ".$tgid" != . ]; then
   8.129 +            mgid="${tgid}"
   8.130 +            mgrp=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
   8.131 +                  grep "^[^:]*:[^:]*:${mgid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
   8.132 +        fi
   8.133 +        if [ ".$mgrp" = . ]; then
   8.134 +            mgrp="$grp"
   8.135 +        fi
   8.136 +        if [ ".$mgrp" = . ]; then
   8.137 +            mgrp="$cgrp"
   8.138 +        fi
   8.139 +    fi
   8.140 +fi
   8.141 +
   8.142 +#   determine OpenPKG rusr/rgrp
   8.143 +if [ ".$rusr" = . ]; then
   8.144 +    rusr="${usr}-r"
   8.145 +fi
   8.146 +if [ ".$rusr" = ".-r" ]; then
   8.147 +    rusr="$cusr"
   8.148 +fi
   8.149 +if [ ".$rgrp" = . ]; then
   8.150 +    rgrp=`(id -gn $rusr) 2>/dev/null`
   8.151 +    if [ ".$rgrp" = . ]; then
   8.152 +        tgid=`(getent passwd "${rusr}"; grep "^${rusr}:" /etc/passwd; ypmatch "${rusr}" passwd; nismatch "${rusr}" passwd; nidump passwd . | grep "^${rusr}:") 2>/dev/null |\
   8.153 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
   8.154 +        if [ ".$tgid" != . ]; then
   8.155 +            rgid="${tgid}"
   8.156 +            rgrp=`(getent group; cat /etc/group; ypcat group; nismatch group; nidump group .) 2>/dev/null |\
   8.157 +                  grep "^[^:]*:[^:]*:${rgid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
   8.158 +        fi
   8.159 +        if [ ".$rgrp" = . ]; then
   8.160 +            rgrp="${grp}-r"
   8.161 +        fi
   8.162 +        if [ ".$rgrp" = ".-r" ]; then
   8.163 +            rgrp="$cgrp"
   8.164 +        fi
   8.165 +    fi
   8.166 +fi
   8.167 +
   8.168 +#   determine OpenPKG nusr/ngrp
   8.169 +if [ ".$nusr" = . ]; then
   8.170 +    nusr="${usr}-n"
   8.171 +fi
   8.172 +if [ ".$nusr" = ".-n" ]; then
   8.173 +    nusr="$cusr"
   8.174 +fi
   8.175 +if [ ".$ngrp" = . ]; then
   8.176 +    ngrp=`(id -gn $nusr) 2>/dev/null`
   8.177 +    if [ ".$ngrp" = . ]; then
   8.178 +        tgid=`(getent passwd "${nusr}"; grep "^${nusr}:" /etc/passwd; ypmatch "${nusr}" passwd; nismatch "${nusr}" passwd; nidump passwd . | grep "^${nusr}:") 2>/dev/null |\
   8.179 +              sed -n -e '1p' | awk -F: '{ print $4; }'`
   8.180 +        if [ ".$tgid" != . ]; then
   8.181 +            ngid="${tgid}"
   8.182 +            ngrp=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
   8.183 +                  grep "^[^:]*:[^:]*:${ngid}:" | sed -n -e '1p' | awk -F: '{ print $1; }'`
   8.184 +        fi
   8.185 +        if [ ".$ngrp" = . ]; then
   8.186 +            ngrp="${grp}-n"
   8.187 +        fi
   8.188 +        if [ ".$ngrp" = ".-n" ]; then
   8.189 +            ngrp="$cgrp"
   8.190 +        fi
   8.191 +    fi
   8.192 +fi
   8.193 +
   8.194 +#   determine OpenPKG suid/sgid
   8.195 +#   (currently not necessary)
   8.196 +
   8.197 +#   determine OpenPKG muid/mgid
   8.198 +#   (currently not necessary)
   8.199 +
   8.200 +#   determine OpenPKG ruid/rgid
   8.201 +#   (currently not necessary)
   8.202 +
   8.203 +#   determine OpenPKG nuid/ngid
   8.204 +#   (currently not necessary)
   8.205 +
   8.206 +#   print results
   8.207 +output=""
   8.208 +for var in \
   8.209 +    susr sgrp \
   8.210 +    musr mgrp \
   8.211 +    rusr rgrp \
   8.212 +    nusr ngrp \
   8.213 +    suid sgid \
   8.214 +    muid mgid \
   8.215 +    ruid rgid \
   8.216 +    nuid ngid; do
   8.217 +    eval "val=\"\$$var\""
   8.218 +    if [ ".$output" = . ]; then
   8.219 +        output="$var=\"$val\""
   8.220 +    else
   8.221 +        output="$output; $var=\"$val\""
   8.222 +    fi
   8.223 +done
   8.224 +echo $output
   8.225 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/openpkg/aux.wrapbin.sh	Tue Jan 06 23:40:39 2009 +0100
     9.3 @@ -0,0 +1,252 @@
     9.4 +#!/bin/sh
     9.5 +##
     9.6 +##  OpenPKG Binary Bootstrap Package (self-extracting shell script)
     9.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     9.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     9.9 +##
    9.10 +##  Permission to use, copy, modify, and distribute this software for
    9.11 +##  any purpose with or without fee is hereby granted, provided that
    9.12 +##  the above copyright notice and this permission notice appear in all
    9.13 +##  copies.
    9.14 +##
    9.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    9.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    9.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    9.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    9.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    9.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    9.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    9.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    9.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    9.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    9.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    9.26 +##  SUCH DAMAGE.
    9.27 +##
    9.28 +
    9.29 +#   configuration
    9.30 +l_me="$0"
    9.31 +o_help=no
    9.32 +o_version=no
    9.33 +o_tar=no
    9.34 +l_prefix='@l_prefix@'
    9.35 +l_musr='@MUSR@'
    9.36 +l_mgrp='@MGRP@'
    9.37 +l_platform="@l_platform@"
    9.38 +l_release="@l_release@"
    9.39 +l_version="@l_version@"
    9.40 +
    9.41 +#   establish standard environment
    9.42 +PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
    9.43 +LC_CTYPE=C
    9.44 +export LC_CTYPE
    9.45 +umask 022
    9.46 +
    9.47 +#   parse command line options
    9.48 +for opt
    9.49 +do
    9.50 +    case $opt in
    9.51 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
    9.52 +           *) arg='' ;;
    9.53 +    esac
    9.54 +    case $opt in
    9.55 +        -h | --help    ) o_help=yes     ;;
    9.56 +        -v | --version ) o_version=yes  ;;
    9.57 +        -t | --tar     ) o_tar=yes      ;;
    9.58 +        --prefix=*     ) l_prefix=$arg  ;;
    9.59 +        *              ) o_help=yes     ;;
    9.60 +    esac
    9.61 +done
    9.62 +if [ ".$o_version" = .no -a ".$l_prefix" = . ]; then
    9.63 +    o_help=yes
    9.64 +fi
    9.65 +if [ ".$o_help" = .yes ]; then
    9.66 +    echo "Usage: sh $l_me" 2>&1
    9.67 +    echo "       [--prefix=<prefix>] [-t|--tar]" 2>&1
    9.68 +    echo "       [-h|--help] [-v|--version]" 2>&1
    9.69 +    exit 1
    9.70 +fi
    9.71 +
    9.72 +#   make sure all essential installation tools are available
    9.73 +for tool in sed mkdir dd tar chown chgrp; do
    9.74 +    found=no
    9.75 +    case $tool in
    9.76 +        /* )
    9.77 +            if [ -f $tool ]; then
    9.78 +                found=yes
    9.79 +            fi
    9.80 +            ;;
    9.81 +        * )
    9.82 +            for p in `IFS=:; echo $PATH`; do
    9.83 +                if [ -f "$p/$tool" ]; then
    9.84 +                    found=yes
    9.85 +                    break
    9.86 +                fi
    9.87 +            done
    9.88 +            ;;
    9.89 +    esac
    9.90 +    if [ ".$found" = .no ]; then
    9.91 +        echo "$l_me:ERROR: unable to find installation tool \"$tool\"" 1>&2
    9.92 +        exit 1
    9.93 +    fi
    9.94 +done
    9.95 +
    9.96 +#   optionally extract the embedded tarball only
    9.97 +if [ ".$o_tar" = .yes ]; then
    9.98 +    tmpdir="${TMPDIR-/tmp}/openpkg.$$"
    9.99 +    ( umask 077 && mkdir $tmpdir) || exit 1
   9.100 +    dd if=$l_me bs=8192 skip=8 2>/dev/null |\
   9.101 +    ( cd $tmpdir || exit 1
   9.102 +      tar xf - 2>/dev/null || exit 1
   9.103 +      ./openpkg.bzip2 -d -c openpkg.tar.bz2
   9.104 +    ) || exit 1
   9.105 +    rm -rf $tmpdir
   9.106 +    exit 0
   9.107 +fi
   9.108 +
   9.109 +#   display version and copyright header
   9.110 +echo "OpenPKG ${l_release} Binary Bootstrap Package, version ${l_version}"
   9.111 +echo "Built for prefix ${l_prefix} on target platform ${l_platform}"
   9.112 +if [ ".$o_version" = .yes ]; then
   9.113 +    exit 0
   9.114 +fi
   9.115 +
   9.116 +#   determine current username
   9.117 +cusr=`(id -un) 2>/dev/null ||\
   9.118 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
   9.119 +      (whoami) 2>/dev/null ||\
   9.120 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
   9.121 +      echo ${LOGNAME-"NN"}`
   9.122 +
   9.123 +#   running the embedded %pre script for hooking into the system environment
   9.124 +echo "++ hooking OpenPKG instance into system environment"
   9.125 +prefix="$l_prefix"
   9.126 +susr='@SUSR@'; sgrp='@SGRP@'
   9.127 +musr='@MUSR@'; mgrp='@MGRP@'
   9.128 +rusr='@RUSR@'; rgrp='@RGRP@'
   9.129 +nusr='@NUSR@'; ngrp='@NGRP@'
   9.130 +suid='@SUID@'; sgid='@SGID@'
   9.131 +muid='@MUID@'; mgid='@MGID@'
   9.132 +ruid='@RUID@'; rgid='@RGID@'
   9.133 +nuid='@NUID@'; ngid='@NGID@'
   9.134 +set -- 1 # emulate RPM's $1 when executing scripts
   9.135 +#   ---- BEGIN EMBEDDED %pre SCRIPT ----
   9.136 +@PRE@
   9.137 +#   ---- END EMBEDDED %pre SCRIPT ----
   9.138 +
   9.139 +#   make sure prefix/root directory exists
   9.140 +#   and has correct permissions and owner/group
   9.141 +if [ ! -d $l_prefix ]; then
   9.142 +    #   create prefix/root directory from scratch
   9.143 +    echo "++ creating OpenPKG instance root directory \"$l_prefix\""
   9.144 +    d=''
   9.145 +    for c in `IFS=/; echo $l_prefix`; do
   9.146 +        d="$d/$c"
   9.147 +        if [ ! -d $d ]; then
   9.148 +            mkdir $d || exit 1
   9.149 +            chmod 755 $d || exit 1
   9.150 +            if [ ".$cusr" = .root ]; then
   9.151 +                chown $musr $d >/dev/null 2>&1 || true
   9.152 +                chgrp $mgrp $d >/dev/null 2>&1 || true
   9.153 +            fi
   9.154 +        fi
   9.155 +    done
   9.156 +else
   9.157 +    #   adjust already existing prefix/root directory
   9.158 +    echo "++ fixating OpenPKG instance root directory \"$l_prefix\""
   9.159 +    ( cd $l_prefix || exit 1
   9.160 +      chmod 755 . || exit 1
   9.161 +      if [ ".$cusr" = .root ]; then
   9.162 +          chown $musr . >/dev/null 2>&1 || true
   9.163 +          chgrp $mgrp . >/dev/null 2>&1 || true
   9.164 +      fi
   9.165 +    ) || exit 1
   9.166 +fi
   9.167 +
   9.168 +#   extract and install binary distribution files
   9.169 +echo "++ extracting OpenPKG binary distribution"
   9.170 +dd if=$l_me bs=8192 skip=8 2>/dev/null |\
   9.171 +    (cd $l_prefix; tar xf - 2>/dev/null)
   9.172 +echo "++ installing OpenPKG binary distribution"
   9.173 +( cd $l_prefix || exit 1
   9.174 +  ./openpkg.bzip2 -d -c openpkg.tar.bz2 | ./openpkg.tar xf - 2>/dev/null
   9.175 +  rm -f openpkg.tar openpkg.bzip2 openpkg.tar.bz2 >/dev/null 2>&1 || true
   9.176 +) || exit 1
   9.177 +
   9.178 +#   fixate installation files
   9.179 +#   (ATTENTION: order of chgrp/chown and chmod is important because of "set-UID" bits)
   9.180 +echo "++ fixating OpenPKG instance filesystem hierarchy"
   9.181 +( echo 'fixate () {'
   9.182 +  echo '    chgrp "$3" "$4"'
   9.183 +  echo '    chown "$2" "$4"'
   9.184 +  echo '    chmod "$1" "$4"'
   9.185 +  echo '}'
   9.186 +  $l_prefix/bin/openpkg --keep-privileges rpm -q openpkg \
   9.187 +      --qf '[fixate %7.7{FILEMODES:octal} %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} ::%{FILENAMES:shescape}\n]' |\
   9.188 +      grep -v '(none)' | sed 's/^fixate .../fixate /' | sed -e "s; ::\\(.\\)@l_prefix@; \\1$l_prefix;"
   9.189 +) | sh 2>/dev/null || true
   9.190 +
   9.191 +#   running the embedded %post script
   9.192 +echo "++ post-processing OpenPKG bootstrap installation"
   9.193 +prefix="$l_prefix"
   9.194 +susr='@SUSR@'; sgrp='@SGRP@'
   9.195 +musr='@MUSR@'; mgrp='@MGRP@'
   9.196 +rusr='@RUSR@'; rgrp='@RGRP@'
   9.197 +nusr='@NUSR@'; ngrp='@NGRP@'
   9.198 +suid='@SUID@'; sgid='@SGID@'
   9.199 +muid='@MUID@'; mgid='@MGID@'
   9.200 +ruid='@RUID@'; rgid='@RGID@'
   9.201 +nuid='@NUID@'; ngid='@NGID@'
   9.202 +set -- 1 # emulate RPM's $1 when executing scripts
   9.203 +#   ---- BEGIN EMBEDDED %post SCRIPT ----
   9.204 +@POST@
   9.205 +#   ---- END EMBEDDED %post SCRIPT ----
   9.206 +
   9.207 +#   display final information
   9.208 +( echo "Congratulations!"
   9.209 +  echo ""
   9.210 +  echo "You have successfully installed an OpenPKG ${l_release} instance"
   9.211 +  echo "under prefix ${l_prefix} on target platform ${l_platform}."
   9.212 +  echo ""
   9.213 +  echo "For details about this OpenPKG instance, run any of the"
   9.214 +  echo "following typical OpenPKG RPM query commands:"
   9.215 +  echo ""
   9.216 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -qa"
   9.217 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -qi  openpkg"
   9.218 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -qlv openpkg"
   9.219 +  echo ""
   9.220 +  echo "To check the integrity of the entire OpenPKG instance,"
   9.221 +  echo "run the following OpenPKG RPM verify command:"
   9.222 +  echo ""
   9.223 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -Va"
   9.224 +  echo ""
   9.225 +  echo "To install software packages into this OpenPKG instance, run"
   9.226 +  echo "the following two OpenPKG RPM build commands for each package:"
   9.227 +  echo ""
   9.228 +  echo "    \$ ${l_prefix}/bin/openpkg rpm --rebuild /path/to/foo-*.src.rpm"
   9.229 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -Uvh ${l_prefix}/RPM/PKG/foo-*.rpm"
   9.230 +  echo ""
   9.231 +  echo "To remove a software package later, just run:"
   9.232 +  echo ""
   9.233 +  echo "    \$ ${l_prefix}/bin/openpkg rpm -e foo"
   9.234 +  echo ""
   9.235 +  echo "To remove the whole OpenPKG instance under prefix ${l_prefix},"
   9.236 +  echo "just remove every package as shown above. As you finally"
   9.237 +  echo "remove the package \"openpkg\", the OpenPKG instance itself"
   9.238 +  echo "will be unlinked from the system and removed as well."
   9.239 +  echo ""
   9.240 +  echo "Thank you for flying OpenPKG..."
   9.241 +  echo "                                        Ralf S. Engelschall"
   9.242 +  echo "                                        The OpenPKG Project"
   9.243 +  echo "                                        openpkg@openpkg.org"
   9.244 +) | $l_prefix/lib/openpkg/rpmtool msg -b -t info
   9.245 +
   9.246 +#   die explicitly just before the shell would discover
   9.247 +#   that we carry mega-bytes of data with us... ;-)
   9.248 +exit 0
   9.249 +
   9.250 +#   the distribution tarball is appended in raw format directly to the
   9.251 +#   end of this script, just leaded by padding whitespaces which make
   9.252 +#   sure that the tarball data starts at the pre-defined offset of 64KB.
   9.253 +#   This allows us to unpack the tarball by just skipping the leading
   9.254 +#   64KB (= 8192*8, see above).
   9.255 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/openpkg/aux.wrapsrc.sh	Tue Jan 06 23:40:39 2009 +0100
    10.3 @@ -0,0 +1,156 @@
    10.4 +#!/bin/sh
    10.5 +##
    10.6 +##  OpenPKG Source Bootstrap Package (self-extracting shell script)
    10.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    10.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    10.9 +##
   10.10 +##  Permission to use, copy, modify, and distribute this software for
   10.11 +##  any purpose with or without fee is hereby granted, provided that
   10.12 +##  the above copyright notice and this permission notice appear in all
   10.13 +##  copies.
   10.14 +##
   10.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   10.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   10.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   10.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   10.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   10.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   10.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   10.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   10.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   10.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   10.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   10.26 +##  SUCH DAMAGE.
   10.27 +##
   10.28 +
   10.29 +#   configuration
   10.30 +l_me="$0"
   10.31 +o_help=no
   10.32 +o_version=no
   10.33 +o_tar=no
   10.34 +l_prefix='/openpkg'
   10.35 +l_dir='@l_dir@'
   10.36 +l_release="@l_release@"
   10.37 +l_version="@l_version@"
   10.38 +
   10.39 +#   establish standard environment
   10.40 +PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
   10.41 +LC_CTYPE=C
   10.42 +export LC_CTYPE
   10.43 +umask 022
   10.44 +
   10.45 +#   pre-parse command line options
   10.46 +for opt
   10.47 +do
   10.48 +    case $opt in
   10.49 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   10.50 +           *) arg='' ;;
   10.51 +    esac
   10.52 +    case $opt in
   10.53 +        -h | --help     ) o_help=yes    ;;
   10.54 +        -v | --version  ) o_version=yes ;;
   10.55 +        -t | --tar      ) o_tar=yes     ;;
   10.56 +        --prefix=*      ) l_prefix=$arg ;;
   10.57 +    esac
   10.58 +done
   10.59 +if [ ".$o_help" = .yes ]; then
   10.60 +    echo "Usage: sh $l_me" 2>&1
   10.61 +    echo "       [--prefix=<prefix>] [--tag=<str>]" 2>&1
   10.62 +    echo "       [--user=<usr>] [--group=<grp>]" 2>&1
   10.63 +    echo "       [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1
   10.64 +    echo "       [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1
   10.65 +    echo "       [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1
   10.66 +    echo "       [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1
   10.67 +    echo "       [-t|--tar] [-h|--help] [-v|--version]" 2>&1
   10.68 +    exit 1
   10.69 +fi
   10.70 +
   10.71 +#   make sure all essential unpacking tools are available
   10.72 +#   (the build tools are checked later from within openpkg.spec)
   10.73 +for tool in /bin/sh mkdir cat tar rm chown chgrp sed dd; do
   10.74 +    found=no
   10.75 +    case $tool in
   10.76 +        /* )
   10.77 +            if [ -f $tool ]; then
   10.78 +                found=yes
   10.79 +            fi
   10.80 +            ;;
   10.81 +        * )
   10.82 +            for p in `IFS=:; echo $PATH`; do
   10.83 +                if [ -f "$p/$tool" ]; then
   10.84 +                    found=yes
   10.85 +                    break
   10.86 +                fi
   10.87 +            done
   10.88 +            ;;
   10.89 +    esac
   10.90 +    if [ ".$found" = .no ]; then
   10.91 +        echo "$l_me:ERROR: unable to find bootstrap tool \"$tool\"" 1>&2
   10.92 +        exit 1
   10.93 +    fi
   10.94 +done
   10.95 +
   10.96 +#   optionally extract the embedded tarball only
   10.97 +if [ ".$o_tar" = .yes ]; then
   10.98 +    dd if=$l_me bs=8192 skip=8 2>/dev/null
   10.99 +    exit 0
  10.100 +fi
  10.101 +
  10.102 +#   display version and copyright header
  10.103 +echo "OpenPKG ${l_release} Source Bootstrap Package, version ${l_version}"
  10.104 +if [ ".$o_version" = .yes ]; then
  10.105 +    exit 0
  10.106 +fi
  10.107 +echo "Building for prefix ${l_prefix} on current platform"
  10.108 +
  10.109 +#   determine current user/group
  10.110 +cusr=`(id -un) 2>/dev/null ||\
  10.111 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  10.112 +      (whoami) 2>/dev/null ||\
  10.113 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
  10.114 +      echo $LOGNAME`
  10.115 +cgid=`(id -g $cusr) 2>/dev/null ||\
  10.116 +      ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\
  10.117 +      sed -e 'q' | awk -F: '{ print $4; }')`
  10.118 +cgrp=`(id -gn $cusr) 2>/dev/null ||\
  10.119 +      ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\
  10.120 +      sed -e 'q' | awk -F: '{ print $1; }')`
  10.121 +if [ ".$cgrp" = . ]; then
  10.122 +    cgrp="$cusr"
  10.123 +fi
  10.124 +
  10.125 +#   extract the source distribution files
  10.126 +echo "++ extracting OpenPKG source distribution"
  10.127 +rm -rf $l_dir >/dev/null 2>&1
  10.128 +mkdir $l_dir || exit 1
  10.129 +dd if=$l_me bs=8192 skip=8 2>/dev/null | (cd $l_dir; tar xf - 2>/dev/null)
  10.130 +if [ ".$cusr" = .root ]; then
  10.131 +    ( cd $l_dir || exit 1
  10.132 +      chown -R -h $cusr . >/dev/null 2>&1 || true
  10.133 +      chgrp -R -h $cgrp . >/dev/null 2>&1 || true
  10.134 +    ) || exit 1
  10.135 +fi
  10.136 +if [ ! -f $l_dir/openpkg.boot ]; then
  10.137 +    echo "$l_me:ERROR: failed to unpack into directory \"$l_dir\"" 1>&2
  10.138 +    exit 1
  10.139 +fi
  10.140 +
  10.141 +#   perform bootstrap procedure
  10.142 +echo "++ building OpenPKG binary distribution"
  10.143 +( cd $l_dir || exit 1
  10.144 +  ./openpkg.boot ${1+"$@"} || exit 1
  10.145 +) || exit 1
  10.146 +
  10.147 +#   cleanup
  10.148 +rm -rf $l_dir >/dev/null 2>&1
  10.149 +
  10.150 +#   die explicitly just before the shell would discover
  10.151 +#   that we carry mega-bytes of data with us...
  10.152 +exit 0
  10.153 +
  10.154 +#   the distribution tarball is appended in raw format directly to the
  10.155 +#   end of this script, just leaded by padding whitespaces which make
  10.156 +#   sure that the tarball data starts at the pre-defined offset of 64KB.
  10.157 +#   This allows us to unpack the tarball by just skipping the leading
  10.158 +#   64KB (= 8192*8, see above).
  10.159 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/openpkg/bash.patch	Tue Jan 06 23:40:39 2009 +0100
    11.3 @@ -0,0 +1,362 @@
    11.4 +This patch documents two implemented and classical command
    11.5 +line options "-v" and "-x". It is derived from Debian GNU/Linux.
    11.6 +
    11.7 +Index: doc/bash.1
    11.8 +--- doc/bash.1.orig	2004-07-12 17:27:08 +0200
    11.9 ++++ doc/bash.1	2004-07-27 19:47:10 +0200
   11.10 +@@ -116,6 +116,12 @@
   11.11 + This option allows the positional parameters to be set
   11.12 + when invoking an interactive shell.
   11.13 + .TP
   11.14 ++.B \-v
   11.15 ++Print shell input lines as they are read.
   11.16 ++.TP
   11.17 ++.B \-x
   11.18 ++Print commands and their arguments as they are executed.
   11.19 ++.TP
   11.20 + .B \-D
   11.21 + A list of all double-quoted strings preceded by \fB$\fP
   11.22 + is printed on the standard ouput.
   11.23 +
   11.24 +-----------------------------------------------------------------------------
   11.25 +
   11.26 +Port to HP-UX 11i and similar less smart platforms.
   11.27 +
   11.28 +Index: configure
   11.29 +--- configure.orig	2004-07-21 22:18:56 +0200
   11.30 ++++ configure	2004-07-27 19:47:10 +0200
   11.31 +@@ -1517,6 +1517,7 @@
   11.32 + *-beos*)	opt_bash_malloc=no ;;	# they say it's suitable
   11.33 + *-cygwin*)	opt_bash_malloc=no ;;	# Cygnus's CYGWIN environment
   11.34 + *-opennt*|*-interix*)	opt_bash_malloc=no ;;	# Interix, now owned by Microsoft
   11.35 ++*-hpux*)	opt_bash_malloc=no ;;	# HP HP-UX
   11.36 + esac
   11.37 + 
   11.38 + # memory scrambling on free()
   11.39 +@@ -1662,7 +1663,7 @@
   11.40 + 
   11.41 + else
   11.42 + 	MALLOC_LIB=
   11.43 +-	MALLOC_LIBRARY=
   11.44 ++	MALLOC_LIBRARY=dummy
   11.45 + 	MALLOC_LDFLAGS=
   11.46 + 	MALLOC_DEP=
   11.47 + fi
   11.48 +Index: syntax.h
   11.49 +--- syntax.h.orig	2004-04-15 05:19:36 +0200
   11.50 ++++ syntax.h	2004-07-27 19:47:10 +0200
   11.51 +@@ -21,6 +21,8 @@
   11.52 + #ifndef _SYNTAX_H_
   11.53 + #define _SYNTAX_H_
   11.54 + 
   11.55 ++#include "config.h"
   11.56 ++
   11.57 + /* Defines for use by mksyntax.c */
   11.58 + 
   11.59 + #define slashify_in_quotes "\\`$\"\n"
   11.60 +
   11.61 +-----------------------------------------------------------------------------
   11.62 +
   11.63 +This adds the OpenPKG packaging brand.
   11.64 +
   11.65 +Index: version.c
   11.66 +--- version.c.orig	2003-12-19 22:34:02 +0100
   11.67 ++++ version.c	2004-07-27 19:47:10 +0200
   11.68 +@@ -77,7 +77,7 @@
   11.69 + show_shell_version (extended)
   11.70 +      int extended;
   11.71 + {
   11.72 +-  printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
   11.73 ++  printf ("GNU bash, version %s (%s) [@l_openpkg_release@]\n", shell_version_string (), MACHTYPE);
   11.74 +   if (extended)
   11.75 +     printf (_("Copyright (C) 2004 Free Software Foundation, Inc.\n"));
   11.76 + }
   11.77 +
   11.78 +-----------------------------------------------------------------------------
   11.79 +
   11.80 +Accumulated vendor patches Bash 3.2 001-005
   11.81 +
   11.82 +Generated via:
   11.83 +
   11.84 +$ gunzip <bash-3.2.tar.gz | tar xf -
   11.85 +$ pushd bash-3.2
   11.86 +$ cat bash32-[0-9]* | patch -p0 -Vt -b
   11.87 +$ shtool move -e '*.~1~' '%1.orig'
   11.88 +$ pushd /tmp
   11.89 +$ curl -O ftp://ftp.gnu.org/gnu/bison/bison-1.28.tar.gz
   11.90 +$ cd bison-1.28
   11.91 +$ ./configure --prefix=/tmp/bison
   11.92 +$ make
   11.93 +$ make install
   11.94 +$ popd
   11.95 +$ mv y.tab.c y.tab.c.orig
   11.96 +$ mv y.tab.h y.tab.h.orig
   11.97 +$ /tmp/bison/bin/bison -y -d parse.y
   11.98 +$ rm -rf /tmp/bison /tmp/bison-1.28 /tmp/bison-1.28.tar.gz
   11.99 +$ shtool subst -b.dummy \
  11.100 +  -e 's;parse\.y;/Users/chet/src/bash/src/parse.y;g' \
  11.101 +  -e 's;/tmp/bison/share/bison\.simple;/usr/share/bison.simple;g' y.tab.c
  11.102 +$ svs diff >/tmp/bash.patch
  11.103 +$ popd
  11.104 +$ rm -rf bash-3.2
  11.105 +
  11.106 +Index: parse.y
  11.107 +--- parse.y.orig	2006-09-19 22:37:21 +0200
  11.108 ++++ parse.y	2006-12-06 13:32:45 +0100
  11.109 +@@ -1029,6 +1029,7 @@
  11.110 + #define PST_CMDTOKEN	0x1000		/* command token OK - unused */
  11.111 + #define PST_COMPASSIGN	0x2000		/* parsing x=(...) compound assignment */
  11.112 + #define PST_ASSIGNOK	0x4000		/* assignment statement ok in this context */
  11.113 ++#define PST_REGEXP	0x8000		/* parsing an ERE/BRE as a single word */
  11.114 + 
  11.115 + /* Initial size to allocate for tokens, and the
  11.116 +    amount to grow them by. */
  11.117 +@@ -2591,6 +2592,9 @@
  11.118 +       return (character);
  11.119 +     }
  11.120 + 
  11.121 ++  if (parser_state & PST_REGEXP)
  11.122 ++    goto tokword;
  11.123 ++
  11.124 +   /* Shell meta-characters. */
  11.125 +   if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
  11.126 +     {
  11.127 +@@ -2698,6 +2702,7 @@
  11.128 +   if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
  11.129 +     return (character);
  11.130 + 
  11.131 ++tokword:
  11.132 +   /* Okay, if we got this far, we have to read a word.  Read one,
  11.133 +      and then check it against the known ones. */
  11.134 +   result = read_token_word (character);
  11.135 +@@ -2735,7 +2740,7 @@
  11.136 + /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
  11.137 +   count = 1;
  11.138 +   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
  11.139 +-  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
  11.140 ++  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
  11.141 + 
  11.142 +   /* RFLAGS is the set of flags we want to pass to recursive calls. */
  11.143 +   rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
  11.144 +@@ -3202,8 +3207,11 @@
  11.145 +       if (tok == WORD && test_binop (yylval.word->word))
  11.146 + 	op = yylval.word;
  11.147 + #if defined (COND_REGEXP)
  11.148 +-      else if (tok == WORD && STREQ (yylval.word->word,"=~"))
  11.149 +-	op = yylval.word;
  11.150 ++      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
  11.151 ++	{
  11.152 ++	  op = yylval.word;
  11.153 ++	  parser_state |= PST_REGEXP;
  11.154 ++	}
  11.155 + #endif
  11.156 +       else if (tok == '<' || tok == '>')
  11.157 + 	op = make_word_from_token (tok);  /* ( */
  11.158 +@@ -3234,6 +3242,7 @@
  11.159 + 
  11.160 +       /* rhs */
  11.161 +       tok = read_token (READ);
  11.162 ++      parser_state &= ~PST_REGEXP;
  11.163 +       if (tok == WORD)
  11.164 + 	{
  11.165 + 	  tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
  11.166 +@@ -3419,9 +3428,34 @@
  11.167 + 	  goto next_character;
  11.168 + 	}
  11.169 + 
  11.170 ++#ifdef COND_REGEXP
  11.171 ++      /* When parsing a regexp as a single word inside a conditional command,
  11.172 ++	 we need to special-case characters special to both the shell and
  11.173 ++	 regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
  11.174 ++      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))		/*)*/
  11.175 ++        {
  11.176 ++          if (character == '|')
  11.177 ++            goto got_character;
  11.178 ++
  11.179 ++	  push_delimiter (dstack, character);
  11.180 ++	  ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
  11.181 ++	  pop_delimiter (dstack);
  11.182 ++	  if (ttok == &matched_pair_error)
  11.183 ++	    return -1;		/* Bail immediately. */
  11.184 ++	  RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
  11.185 ++				  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
  11.186 ++	  token[token_index++] = character;
  11.187 ++	  strcpy (token + token_index, ttok);
  11.188 ++	  token_index += ttoklen;
  11.189 ++	  FREE (ttok);
  11.190 ++	  dollar_present = all_digit_token = 0;
  11.191 ++	  goto next_character;
  11.192 ++        }
  11.193 ++#endif /* COND_REGEXP */
  11.194 ++
  11.195 + #ifdef EXTENDED_GLOB
  11.196 +       /* Parse a ksh-style extended pattern matching specification. */
  11.197 +-      if (extended_glob && PATTERN_CHAR (character))
  11.198 ++      if MBTEST(extended_glob && PATTERN_CHAR (character))
  11.199 + 	{
  11.200 + 	  peek_char = shell_getc (1);
  11.201 + 	  if MBTEST(peek_char == '(')		/* ) */
  11.202 +Index: patchlevel.h
  11.203 +--- patchlevel.h.orig	2006-04-13 14:31:04 +0200
  11.204 ++++ patchlevel.h	2006-12-06 13:32:45 +0100
  11.205 +@@ -25,6 +25,6 @@
  11.206 +    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
  11.207 +    looks for to find the patch level (for the sccs version string). */
  11.208 + 
  11.209 +-#define PATCHLEVEL 0
  11.210 ++#define PATCHLEVEL 5
  11.211 + 
  11.212 + #endif /* _PATCHLEVEL_H_ */
  11.213 +Index: subst.c
  11.214 +--- subst.c.orig	2006-09-19 14:35:09 +0200
  11.215 ++++ subst.c	2006-12-06 13:32:45 +0100
  11.216 +@@ -5707,6 +5707,11 @@
  11.217 +   vtype &= ~VT_STARSUB;
  11.218 + 
  11.219 +   mflags = 0;
  11.220 ++  if (patsub && *patsub == '/')
  11.221 ++    {
  11.222 ++      mflags |= MATCH_GLOBREP;
  11.223 ++      patsub++;
  11.224 ++    }
  11.225 + 
  11.226 +   /* Malloc this because expand_string_if_necessary or one of the expansion
  11.227 +      functions in its call chain may free it on a substitution error. */
  11.228 +@@ -5741,13 +5746,12 @@
  11.229 +     }
  11.230 + 
  11.231 +   /* ksh93 doesn't allow the match specifier to be a part of the expanded
  11.232 +-     pattern.  This is an extension. */
  11.233 ++     pattern.  This is an extension.  Make sure we don't anchor the pattern
  11.234 ++     at the beginning or end of the string if we're doing global replacement,
  11.235 ++     though. */
  11.236 +   p = pat;
  11.237 +-  if (pat && pat[0] == '/')
  11.238 +-    {
  11.239 +-      mflags |= MATCH_GLOBREP|MATCH_ANY;
  11.240 +-      p++;
  11.241 +-    }
  11.242 ++  if (mflags & MATCH_GLOBREP)
  11.243 ++    mflags |= MATCH_ANY;
  11.244 +   else if (pat && pat[0] == '#')
  11.245 +     {
  11.246 +       mflags |= MATCH_BEG;
  11.247 +Index: y.tab.c
  11.248 +--- y.tab.c.orig	2006-09-25 14:15:16 +0200
  11.249 ++++ y.tab.c	2006-12-06 13:39:36 +0100
  11.250 +@@ -2359,6 +2359,7 @@
  11.251 + #define PST_CMDTOKEN	0x1000		/* command token OK - unused */
  11.252 + #define PST_COMPASSIGN	0x2000		/* parsing x=(...) compound assignment */
  11.253 + #define PST_ASSIGNOK	0x4000		/* assignment statement ok in this context */
  11.254 ++#define PST_REGEXP	0x8000		/* parsing an ERE/BRE as a single word */
  11.255 + 
  11.256 + /* Initial size to allocate for tokens, and the
  11.257 +    amount to grow them by. */
  11.258 +@@ -3921,6 +3922,9 @@
  11.259 +       return (character);
  11.260 +     }
  11.261 + 
  11.262 ++  if (parser_state & PST_REGEXP)
  11.263 ++    goto tokword;
  11.264 ++
  11.265 +   /* Shell meta-characters. */
  11.266 +   if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
  11.267 +     {
  11.268 +@@ -4028,6 +4032,7 @@
  11.269 +   if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
  11.270 +     return (character);
  11.271 + 
  11.272 ++tokword:
  11.273 +   /* Okay, if we got this far, we have to read a word.  Read one,
  11.274 +      and then check it against the known ones. */
  11.275 +   result = read_token_word (character);
  11.276 +@@ -4065,7 +4070,7 @@
  11.277 + /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
  11.278 +   count = 1;
  11.279 +   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
  11.280 +-  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
  11.281 ++  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
  11.282 + 
  11.283 +   /* RFLAGS is the set of flags we want to pass to recursive calls. */
  11.284 +   rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
  11.285 +@@ -4532,8 +4537,11 @@
  11.286 +       if (tok == WORD && test_binop (yylval.word->word))
  11.287 + 	op = yylval.word;
  11.288 + #if defined (COND_REGEXP)
  11.289 +-      else if (tok == WORD && STREQ (yylval.word->word,"=~"))
  11.290 +-	op = yylval.word;
  11.291 ++      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
  11.292 ++	{
  11.293 ++	  op = yylval.word;
  11.294 ++	  parser_state |= PST_REGEXP;
  11.295 ++	}
  11.296 + #endif
  11.297 +       else if (tok == '<' || tok == '>')
  11.298 + 	op = make_word_from_token (tok);  /* ( */
  11.299 +@@ -4564,6 +4572,7 @@
  11.300 + 
  11.301 +       /* rhs */
  11.302 +       tok = read_token (READ);
  11.303 ++      parser_state &= ~PST_REGEXP;
  11.304 +       if (tok == WORD)
  11.305 + 	{
  11.306 + 	  tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
  11.307 +@@ -4749,9 +4758,34 @@
  11.308 + 	  goto next_character;
  11.309 + 	}
  11.310 + 
  11.311 ++#ifdef COND_REGEXP
  11.312 ++      /* When parsing a regexp as a single word inside a conditional command,
  11.313 ++	 we need to special-case characters special to both the shell and
  11.314 ++	 regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
  11.315 ++      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))		/*)*/
  11.316 ++        {
  11.317 ++          if (character == '|')
  11.318 ++            goto got_character;
  11.319 ++
  11.320 ++	  push_delimiter (dstack, character);
  11.321 ++	  ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
  11.322 ++	  pop_delimiter (dstack);
  11.323 ++	  if (ttok == &matched_pair_error)
  11.324 ++	    return -1;		/* Bail immediately. */
  11.325 ++	  RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
  11.326 ++				  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
  11.327 ++	  token[token_index++] = character;
  11.328 ++	  strcpy (token + token_index, ttok);
  11.329 ++	  token_index += ttoklen;
  11.330 ++	  FREE (ttok);
  11.331 ++	  dollar_present = all_digit_token = 0;
  11.332 ++	  goto next_character;
  11.333 ++        }
  11.334 ++#endif /* COND_REGEXP */
  11.335 ++
  11.336 + #ifdef EXTENDED_GLOB
  11.337 +       /* Parse a ksh-style extended pattern matching specification. */
  11.338 +-      if (extended_glob && PATTERN_CHAR (character))
  11.339 ++      if MBTEST(extended_glob && PATTERN_CHAR (character))
  11.340 + 	{
  11.341 + 	  peek_char = shell_getc (1);
  11.342 + 	  if MBTEST(peek_char == '(')		/* ) */
  11.343 +
  11.344 +-----------------------------------------------------------------------------
  11.345 +
  11.346 +Do not require autoconf. Fixes build on Solaris 10 8/07 u4 on sparc64
  11.347 +
  11.348 +Index: Makefile.in
  11.349 +--- Makefile.in.orig	2006-08-17 20:03:35 +0200
  11.350 ++++ Makefile.in	2007-10-15 13:00:34 +0200
  11.351 +@@ -682,13 +682,9 @@
  11.352 + stamp-h:	config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
  11.353 + 	CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
  11.354 + 
  11.355 +-config.status:	$(srcdir)/configure
  11.356 ++config.status:
  11.357 + 	$(SHELL) ./config.status --recheck
  11.358 + 
  11.359 +-# comment out for distribution
  11.360 +-$(srcdir)/configure:	$(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
  11.361 +-	cd $(srcdir) && autoconf
  11.362 +-
  11.363 + # for chet
  11.364 + reconfig: force
  11.365 + 	sh $(srcdir)/configure -C
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/openpkg/beecrypt.patch	Tue Jan 06 23:40:39 2009 +0100
    12.3 @@ -0,0 +1,62 @@
    12.4 +Index: gas/aesopt.x86.m4
    12.5 +--- gas/aesopt.x86.m4.orig	2004-06-13 13:37:23 +0200
    12.6 ++++ gas/aesopt.x86.m4	2004-07-28 20:02:07 +0200
    12.7 +@@ -134,6 +134,9 @@
    12.8 + 	pxor 6144(%esi,%edx,8),s0
    12.9 + ')
   12.10 + 
   12.11 ++')
   12.12 ++ifdef(`USE_MMX',`
   12.13 ++
   12.14 + define(`elr',`
   12.15 + 	movd  0(%ebp),s0
   12.16 + 	movd t0,%eax
   12.17 +@@ -253,6 +256,9 @@
   12.18 + ')
   12.19 + 
   12.20 + 
   12.21 ++')
   12.22 ++ifdef(`USE_MMX',`
   12.23 ++
   12.24 + C_FUNCTION_BEGIN(aesEncrypt)
   12.25 + 	pushl %edi
   12.26 + 	pushl %esi
   12.27 +@@ -364,6 +370,9 @@
   12.28 + 	pxor 6144(%esi,%edx,8),t2
   12.29 + ')
   12.30 + 
   12.31 ++')
   12.32 ++ifdef(`USE_MMX',`
   12.33 ++
   12.34 + define(`dsft',`
   12.35 + 	movd $1+ 0(%ebp),s0
   12.36 + 	movd t0,%eax
   12.37 +@@ -490,6 +499,9 @@
   12.38 + 	pxor t3,s2
   12.39 + ')
   12.40 + 
   12.41 ++')
   12.42 ++ifdef(`USE_MMX',`
   12.43 ++
   12.44 + define(`dblock',`
   12.45 + 	sxrk
   12.46 + 
   12.47 +Index: gnu.h.in
   12.48 +--- gnu.h.in.orig	2004-12-19 21:18:48 +0100
   12.49 ++++ gnu.h.in	2005-03-08 19:34:03 +0100
   12.50 +@@ -48,15 +48,6 @@
   12.51 + @TYPEDEF_UINT32_T@
   12.52 + @TYPEDEF_UINT64_T@
   12.53 + 
   12.54 +-#if defined(__GNUC__)
   12.55 +-# if !defined(__GNUC_PREREQ__)
   12.56 +-#  define __GNUC_PREREQ__(maj, min) (__GNUC__ > (maj) || __GNUC__ == (maj) && __GNUC_MINOR__ >= (min))
   12.57 +-# endif
   12.58 +-#else
   12.59 +-# define __GNUC__ 0
   12.60 +-# define __GNUC_PREREQ__(maj, min) 0
   12.61 +-#endif
   12.62 +-
   12.63 + /* WARNING: overriding this value is dangerous; some assembler routines
   12.64 +  * make assumptions about the size set by the configure script
   12.65 +  */
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/openpkg/dot.bash_login	Tue Jan 06 23:40:39 2009 +0100
    13.3 @@ -0,0 +1,38 @@
    13.4 +##
    13.5 +##  @l_prefix@/.bash_login -- Local Bash Login Script
    13.6 +##
    13.7 +
    13.8 +#   provide user and host information in default prompt
    13.9 +PS1="\u@\h\$ "
   13.10 +
   13.11 +#   environment permissions
   13.12 +umask 022
   13.13 +ulimit -c 16384
   13.14 +
   13.15 +#   history functionality
   13.16 +shopt -s histappend
   13.17 +HISTSIZE=100
   13.18 +HISTFILESIZE=100
   13.19 +
   13.20 +#   various additional variables
   13.21 +export TMPDIR=/tmp
   13.22 +export BLOCKSIZE=1024
   13.23 +
   13.24 +#   activate the bootstrapping Bourne-Shell
   13.25 +#   environment of the OpenPKG hierarchy
   13.26 +eval `@l_prefix@/bin/openpkg rc --eval openpkg env`
   13.27 +
   13.28 +#   make sure some non-standard but usually
   13.29 +#   important executable directories are active
   13.30 +test -d /usr/ccs/bin   && PATH="$PATH:/usr/ccs/bin"
   13.31 +test -d /usr/local/bin && PATH="$PATH:/usr/local/bin"
   13.32 +
   13.33 +#   initially adjust $PWD to symbolic path
   13.34 +cd $HOME
   13.35 +
   13.36 +#   path to bash environment init script
   13.37 +BASH_ENV=$HOME/.bashrc
   13.38 +
   13.39 +#   source the standard environment script
   13.40 +. $BASH_ENV
   13.41 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/openpkg/dot.bashrc	Tue Jan 06 23:40:39 2009 +0100
    14.3 @@ -0,0 +1,4 @@
    14.4 +##
    14.5 +##  @l_prefix@/.bashrc -- Local Bash Profile
    14.6 +##
    14.7 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/openpkg/dot.lsyncrc	Tue Jan 06 23:40:39 2009 +0100
    15.3 @@ -0,0 +1,1 @@
    15.4 +--root=@l_prefix@/local
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/openpkg/install.sh	Tue Jan 06 23:40:39 2009 +0100
    16.3 @@ -0,0 +1,45 @@
    16.4 +#!@l_prefix@/lib/openpkg/bash
    16.5 +##
    16.6 +##  install -- OpenPKG Tool Chain "install" command (BOOSTRAP VERSION ONLY)
    16.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    16.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    16.9 +##
   16.10 +##  Permission to use, copy, modify, and distribute this software for
   16.11 +##  any purpose with or without fee is hereby granted, provided that
   16.12 +##  the above copyright notice and this permission notice appear in all
   16.13 +##  copies.
   16.14 +##
   16.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   16.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   16.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   16.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   16.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   16.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   16.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   16.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   16.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   16.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   16.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   16.26 +##  SUCH DAMAGE.
   16.27 +##
   16.28 +
   16.29 +##
   16.30 +##  This command emulates the "openpkg install openpkg-tools" command
   16.31 +##  in order to bootstrap the installation of the OpenPKG Tool Chain.
   16.32 +##
   16.33 +
   16.34 +#   sanity check usage
   16.35 +if [ $# -eq 1 -a ".$1" = ".openpkg-tools" ]; then
   16.36 +    :
   16.37 +else
   16.38 +    echo "openpkg:ERROR: still not available functionality \"install $*\""                        1>&2
   16.39 +    echo "openpkg:INFO: This functionality is provided by the \"openpkg-tools\" package only!"    1>&2
   16.40 +    echo "openpkg:INFO: Run the command \"$OPENPKG_PREFIX/bin/openpkg install openpkg-tools\" to" 1>&2
   16.41 +    echo "openpkg:INFO: bootstrap the \"openpkg-tools\" package for additional functionality."    1>&2
   16.42 +    echo "openpkg:INFO: This bootstrap version only supports this particular install command."    1>&2
   16.43 +    exit 1
   16.44 +fi
   16.45 +
   16.46 +#   pass-through operation to "openpkg build" tool
   16.47 +$OPENPKG_PREFIX/bin/openpkg build openpkg-tools | sh
   16.48 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/openpkg/local.README	Tue Jan 06 23:40:39 2009 +0100
    17.3 @@ -0,0 +1,16 @@
    17.4 +
    17.5 +  This is @l_prefix@/local/, the manually-managed software package hierarchy
    17.6 +  inside the OpenPKG software hierarchy @l_prefix@. This filesystem area
    17.7 +  contains software which was manually installed under @l_prefix@/local/PKG/
    17.8 +  and activated under @l_prefix@/local/ by running:
    17.9 +
   17.10 +  $ @l_prefix@/bin/openpkg lsync
   17.11 +
   17.12 +  Use "eval `@l_prefix@/etc/rc --eval all env`" from within a user's
   17.13 +  Bourne (Again) Shell startup script (.profile or .bashrc) in
   17.14 +  order to activate this hierarchy and all of its packages.
   17.15 +
   17.16 +  In case of any questions or problems post to the OpenPKG project
   17.17 +  user support mailing list <openpkg-users@openpkg.org>. For more
   17.18 +  details about OpenPKG visit http://www.openpkg.org/.
   17.19 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/openpkg/lsync	Tue Jan 06 23:40:39 2009 +0100
    18.3 @@ -0,0 +1,339 @@
    18.4 +#!@l_prefix@/lib/openpkg/bash
    18.5 +##
    18.6 +##  lsync -- Access Layer Synchronization Tool
    18.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    18.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    18.9 +##
   18.10 +##  Permission to use, copy, modify, and distribute this software for
   18.11 +##  any purpose with or without fee is hereby granted, provided that
   18.12 +##  the above copyright notice and this permission notice appear in all
   18.13 +##  copies.
   18.14 +##
   18.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   18.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   18.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   18.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   18.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   18.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   18.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   18.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   18.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   18.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   18.26 +##  SUCH DAMAGE.
   18.27 +##
   18.28 +
   18.29 +##
   18.30 +##  filesystem hierarchy configuration
   18.31 +##
   18.32 +
   18.33 +#   program name and version/date
   18.34 +progname="lsync"
   18.35 +progvers="1.0.4"
   18.36 +progdate="04-Aug-2001"
   18.37 +
   18.38 +#   root directory
   18.39 +#   (if empty, .lsyncrc files provide default)
   18.40 +root=""
   18.41 +
   18.42 +#   subdirectory where packages are physically installed
   18.43 +pkgdir="PKG"
   18.44 +
   18.45 +#   subdirectories which are synchronized between physically
   18.46 +#   installed package areas and access layer
   18.47 +subdirs="bin,sbin,man,info,include,lib"
   18.48 +
   18.49 +##
   18.50 +##  command line option parsing
   18.51 +##
   18.52 +
   18.53 +#   default run-time modes
   18.54 +nop=0
   18.55 +quiet=0
   18.56 +trace=0
   18.57 +help=''
   18.58 +init=0
   18.59 +uninstall=0
   18.60 +local=0
   18.61 +
   18.62 +#   be aware of .lsyncrc files
   18.63 +cwd=`pwd`
   18.64 +while [ 1 ]; do
   18.65 +    if [ -f "$cwd/.lsyncrc" ]; then
   18.66 +        set -- `cat $cwd/.lsyncrc` "$@"
   18.67 +    fi
   18.68 +    [ ".$cwd" = ./ ] && break
   18.69 +    cwd=`echo $cwd | sed -e 's;/[^/]*$;;' -e 's;^$;/;'`
   18.70 +done
   18.71 +if [ ".$HOME" != . -a -f "$HOME/.lsyncrc" ]; then
   18.72 +    set -- `cat $HOME/.lsyncrc` "$@"
   18.73 +fi
   18.74 +
   18.75 +#   iterate over argument line
   18.76 +for opt
   18.77 +do
   18.78 +    case $opt in
   18.79 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   18.80 +           *) arg='' ;;
   18.81 +    esac
   18.82 +    case $opt in
   18.83 +        -n|--nop       ) nop=1         ;;
   18.84 +        -q|--quiet     ) quiet=1       ;;
   18.85 +        -t|--trace     ) trace=1       ;;
   18.86 +        -v|--version   ) version=1     ;;
   18.87 +        -h|--help      ) help="Usage"  ;;
   18.88 +        -i|--init      ) init=1        ;;
   18.89 +        -u|--uninstall ) uninstall=1   ;;
   18.90 +        -l|--local     ) local=1       ;;
   18.91 +        --root=*       ) root=$arg     ;;
   18.92 +        --pkgdir=*     ) pkgdir=$arg   ;;
   18.93 +        --subdirs=*    ) subdirs=$arg  ;;
   18.94 +        *              ) help="Invalid option \`$opt'"; break ;;
   18.95 +    esac
   18.96 +done
   18.97 +
   18.98 +#   error or usage message
   18.99 +if [ ".$help" != . ]; then
  18.100 +    if [ ".$help" != ".Usage" ]; then
  18.101 +        echo "$progname:ERROR: $help" 1>&2
  18.102 +    fi
  18.103 +    cat 1>&2 <<EOT
  18.104 +Usage: $progname [options]
  18.105 +
  18.106 +Global options:
  18.107 +  --version,   -v   display tool version information
  18.108 +  --help,      -h   display usage information
  18.109 +  --init,      -i   create an initial directory hierarchy
  18.110 +
  18.111 +Run-time options:
  18.112 +  --nop,       -n   perform no filesystem operations
  18.113 +  --quiet,     -q   display no verbose messages
  18.114 +  --trace,     -t   display performed filesystem operations
  18.115 +  --local,     -l   process a local package area only
  18.116 +  --uninstall, -u   uninstall all files
  18.117 +
  18.118 +Filesystem options:
  18.119 +  --root=DIR        override root directory
  18.120 +  --pkgdir=DIR      override package sub-directory
  18.121 +  --subdirs=DIR     override synchronized sub-directories
  18.122 +
  18.123 +Current configuration:
  18.124 +  root directory:       $root
  18.125 +  package root subdir:  $pkgdir
  18.126 +  synchronized subdirs: $subdirs
  18.127 +EOT
  18.128 +    if [ ".$help" != ".Usage" ]; then
  18.129 +        exit 2
  18.130 +    else
  18.131 +        exit 0
  18.132 +    fi
  18.133 +fi
  18.134 +
  18.135 +#   version information
  18.136 +if [ ".$version" = .1 ]; then
  18.137 +    echo "$progname $progvers ($progdate)"
  18.138 +    exit 0
  18.139 +fi
  18.140 +
  18.141 +#   make sure a root directory was found or specified
  18.142 +if [ ".$root" = . ]; then
  18.143 +    echo "$progname:ERROR: no root directory specified!" 1>&2
  18.144 +    echo "$progname:HINT: use --root=DIR option explicitly on command line" 1>&2
  18.145 +    echo "$progname:HINT: or implicitly inside an .lsyncrc file in your home" 1>&2
  18.146 +    echo "$progname:HINT: directory or in any parent directory." 1>&2
  18.147 +    exit 3
  18.148 +fi
  18.149 +
  18.150 +##
  18.151 +##  helper functions
  18.152 +##
  18.153 +
  18.154 +display_hd () {
  18.155 +    if [ ".$headline" != . ]; then
  18.156 +        if [ ".$quiet" = .0 ]; then
  18.157 +            echo "$headline"
  18.158 +        fi
  18.159 +        headline=''
  18.160 +    fi
  18.161 +}
  18.162 +
  18.163 +display_op () {
  18.164 +    if [ ".$quiet" = .0 ]; then
  18.165 +        echo "  $@"
  18.166 +    fi
  18.167 +}
  18.168 +
  18.169 +display_warning () {
  18.170 +    echo "$progname:WARNING: $*" 1>&2
  18.171 +}
  18.172 +
  18.173 +display_error () {
  18.174 +    echo "$progname:ERROR: $*" 1>&2
  18.175 +}
  18.176 +
  18.177 +perform_op () {
  18.178 +    if [ ".$trace" = .1 ]; then
  18.179 +        echo "  \$ $@"
  18.180 +    fi
  18.181 +    if [ ".$nop" = .0 ]; then
  18.182 +        eval "$@"
  18.183 +    fi
  18.184 +}
  18.185 +
  18.186 +##
  18.187 +##  main processing
  18.188 +##
  18.189 +
  18.190 +#   extend a "man" subdir to a complete list with subdirs
  18.191 +#   in order to avoid special cases in the loop processing
  18.192 +manex=''
  18.193 +if [ ".$init" = .1 ]; then
  18.194 +    manex='man'
  18.195 +fi
  18.196 +for i in 1 2 3 4 5 6 7 8; do
  18.197 +    manex="$manex,man/man$i"
  18.198 +done
  18.199 +manex=`echo $manex | sed -e 's;^,;;'`
  18.200 +subdirs=`echo $subdirs | sed -e "s;man;$manex;"`
  18.201 +
  18.202 +#   special processing: create initial hierarchy
  18.203 +if [ ".$init" = .1 ]; then
  18.204 +    if [ ! -d $root ]; then
  18.205 +        echo "creating $root"
  18.206 +        perform_op "mkdir $root" || exit 1
  18.207 +    fi
  18.208 +    for subdir in $pkgdir `IFS=,; echo $subdirs`; do
  18.209 +        if [ ! -d "$root/$subdir" ]; then
  18.210 +            echo "creating $root/$subdir"
  18.211 +            perform_op "mkdir $root/$subdir" || exit 1
  18.212 +        fi
  18.213 +    done
  18.214 +    exit 0
  18.215 +fi
  18.216 +
  18.217 +#   make sure the root directory actually exists
  18.218 +if [ ! -d "$root" ]; then
  18.219 +    display_warning "root directory \`$root' does not exist"
  18.220 +    exit 3
  18.221 +fi
  18.222 +
  18.223 +#   if processing is restricted to a local package area, pre-determine its name
  18.224 +if [ ".$local" = .1 ]; then
  18.225 +   realroot=`cd $root; pwd`
  18.226 +   realthis=`pwd`
  18.227 +   pkgname=`expr "$realthis" : "^$realroot/$pkgdir/\\([^/]*\\).*"`
  18.228 +   if [ ".$pkgname" = . ]; then
  18.229 +       display_error "you are not staying under a local package sub-directory"
  18.230 +       exit 3
  18.231 +   fi
  18.232 +fi
  18.233 +
  18.234 +#   now perform the synchronization for each sub-directory...
  18.235 +for subdir in `IFS=,; echo $subdirs`; do
  18.236 +    headline="$root/$subdir:"
  18.237 +
  18.238 +    #   make sure the subdir actually exists in the access layer
  18.239 +    if [ ! -d "$root/$subdir" ]; then
  18.240 +        display_warning "access layer directory \`$root/$subdir' does not exist"
  18.241 +        continue
  18.242 +    fi
  18.243 +
  18.244 +    #
  18.245 +    #   PASS 1: remove dangling symbolic links in access layer
  18.246 +    #
  18.247 +
  18.248 +    #   iterate over all symlinks in the access layer subdir
  18.249 +    for link in . `ls "$root/$subdir/" | sed -e "s;^$root/$subdir/*;;g"`; do
  18.250 +        test ".$link" = ".." && continue
  18.251 +
  18.252 +        #   determine the target file of the symlink
  18.253 +        target=`ls -l "$root/$subdir/$link" 2>/dev/null | sed -e 's;.*-> *;;'`
  18.254 +        if [ ".$target" = . ]; then
  18.255 +            display_warning "$root/$subdir/$link seems to be not a symbolic link"
  18.256 +            continue
  18.257 +        fi
  18.258 +
  18.259 +        #   (optionally) make sure that link target points into local package area
  18.260 +        if [ ".$local" = .1 -a .`expr $target : "../$pkgdir/$pkgname/.*"` = .0 ]; then
  18.261 +            continue
  18.262 +        fi
  18.263 +
  18.264 +        #   check whether link is valid, i.e., points to
  18.265 +        #   an existing target file or directory
  18.266 +        if [ ".$uninstall" = .1 ] ||\
  18.267 +           [ ! -f "$root/$subdir/$target" -a \
  18.268 +             ! -d "$root/$subdir/$target"      ]; then
  18.269 +            #   target no longer exists, so remove dangling symlink
  18.270 +            display_hd
  18.271 +            display_op "remove: $link -> $target"
  18.272 +            perform_op "rm -f $root/$subdir/$link"
  18.273 +        fi
  18.274 +    done
  18.275 +
  18.276 +    #   if we are uninstalling only, our work is now done
  18.277 +    if [ ".$uninstall" = ".1" ]; then
  18.278 +        continue
  18.279 +    fi
  18.280 +
  18.281 +    #
  18.282 +    #   PASS 2: create new symbolic links in access layer
  18.283 +    #
  18.284 +
  18.285 +    #   calculate the corresponding reverse directory for the current subdir
  18.286 +    revdir=`echo $subdir | sed -e 's;[^/][^/]*;..;g'`
  18.287 +
  18.288 +    #   iterate over all package directories
  18.289 +    for dir in . `ls "$root/$pkgdir/" | sed -e "s;^$root/$pkgdir/*;;g"`; do
  18.290 +        test ".$dir" = ".." && continue
  18.291 +
  18.292 +        #   (optionally) make sure that we operate only for the local package area
  18.293 +        if [ ".$local" = .1 -a ".$dir" != ".$pkgname" ]; then
  18.294 +            continue
  18.295 +        fi
  18.296 +
  18.297 +        #   skip all directories with appended version numbers
  18.298 +        #   in order to support manual versioning of packages
  18.299 +        case $dir in
  18.300 +            *-[0-9]* ) continue ;;
  18.301 +        esac
  18.302 +
  18.303 +        #   skip if package directory or package sub-directories has sticky bit set
  18.304 +        if [ ".`ls -l -d $root/$pkgdir/$dir 2>/dev/null | cut -c10`" = .t ] ||\
  18.305 +           [ ".`ls -l -d $root/$pkgdir/$dir/$subdir 2>/dev/null | cut -c10`" = .t ]; then
  18.306 +            continue
  18.307 +        fi
  18.308 +
  18.309 +        #   check whether the processed subdir exists in package area
  18.310 +        if [ -d "$root/$pkgdir/$dir/$subdir" ]; then
  18.311 +
  18.312 +            #   iterate over all files/directories in package's subdir
  18.313 +            for file in . `ls "$root/$pkgdir/$dir/$subdir/" |\
  18.314 +                           sed -e "s;^$root/$pkgdir/$dir/$subdir/*;;g"`; do
  18.315 +                test ".$file" = ".." && continue
  18.316 +
  18.317 +                #   calculate the access layer symlink target
  18.318 +                target="$revdir/$pkgdir/$dir/$subdir/$file"
  18.319 +
  18.320 +                #   check whether a possibly conflicting symlink exists
  18.321 +                exlink=`ls -l $root/$subdir/$file 2>/dev/null`
  18.322 +                if [ ".$exlink" != . ]; then
  18.323 +                    extarget=`echo $exlink | sed -e 's;.*-> *;;'`
  18.324 +                    if [ ".$extarget" = . ]; then
  18.325 +                        display_warning "$root/$subdir/$file exits, but seems to be not a symbolic link"
  18.326 +                    elif [ ".$extarget" != ".$target" ]; then
  18.327 +                        display_hd
  18.328 +                        display_op "conflict: $file -> $extarget [existing]"
  18.329 +                        display_op "          $file -> $target [alternative]"
  18.330 +                    fi
  18.331 +                    continue
  18.332 +                fi
  18.333 +
  18.334 +                #   create new symlink in access layer
  18.335 +                display_hd
  18.336 +                display_op "create: $file -> $target"
  18.337 +                perform_op "cd $root/$subdir && ln -s $target $file"
  18.338 +            done
  18.339 +        fi
  18.340 +    done
  18.341 +done
  18.342 +
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/openpkg/lsync.8	Tue Jan 06 23:40:39 2009 +0100
    19.3 @@ -0,0 +1,340 @@
    19.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    19.5 +.\"
    19.6 +.\" Standard preamble:
    19.7 +.\" ========================================================================
    19.8 +.de Sh \" Subsection heading
    19.9 +.br
   19.10 +.if t .Sp
   19.11 +.ne 5
   19.12 +.PP
   19.13 +\fB\\$1\fR
   19.14 +.PP
   19.15 +..
   19.16 +.de Sp \" Vertical space (when we can't use .PP)
   19.17 +.if t .sp .5v
   19.18 +.if n .sp
   19.19 +..
   19.20 +.de Vb \" Begin verbatim text
   19.21 +.ft CW
   19.22 +.nf
   19.23 +.ne \\$1
   19.24 +..
   19.25 +.de Ve \" End verbatim text
   19.26 +.ft R
   19.27 +.fi
   19.28 +..
   19.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   19.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   19.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   19.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   19.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   19.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   19.35 +.tr \(*W-|\(bv\*(Tr
   19.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   19.37 +.ie n \{\
   19.38 +.    ds -- \(*W-
   19.39 +.    ds PI pi
   19.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   19.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   19.42 +.    ds L" ""
   19.43 +.    ds R" ""
   19.44 +.    ds C` 
   19.45 +.    ds C' 
   19.46 +'br\}
   19.47 +.el\{\
   19.48 +.    ds -- \|\(em\|
   19.49 +.    ds PI \(*p
   19.50 +.    ds L" ``
   19.51 +.    ds R" ''
   19.52 +'br\}
   19.53 +.\"
   19.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   19.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   19.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   19.57 +.\" output yourself in some meaningful fashion.
   19.58 +.if \nF \{\
   19.59 +.    de IX
   19.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   19.61 +..
   19.62 +.    nr % 0
   19.63 +.    rr F
   19.64 +.\}
   19.65 +.\"
   19.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   19.67 +.\" way too many mistakes in technical documents.
   19.68 +.hy 0
   19.69 +.if n .na
   19.70 +.\"
   19.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   19.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   19.73 +.    \" fudge factors for nroff and troff
   19.74 +.if n \{\
   19.75 +.    ds #H 0
   19.76 +.    ds #V .8m
   19.77 +.    ds #F .3m
   19.78 +.    ds #[ \f1
   19.79 +.    ds #] \fP
   19.80 +.\}
   19.81 +.if t \{\
   19.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   19.83 +.    ds #V .6m
   19.84 +.    ds #F 0
   19.85 +.    ds #[ \&
   19.86 +.    ds #] \&
   19.87 +.\}
   19.88 +.    \" simple accents for nroff and troff
   19.89 +.if n \{\
   19.90 +.    ds ' \&
   19.91 +.    ds ` \&
   19.92 +.    ds ^ \&
   19.93 +.    ds , \&
   19.94 +.    ds ~ ~
   19.95 +.    ds /
   19.96 +.\}
   19.97 +.if t \{\
   19.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   19.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  19.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  19.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  19.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  19.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  19.104 +.\}
  19.105 +.    \" troff and (daisy-wheel) nroff accents
  19.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  19.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  19.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  19.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  19.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  19.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  19.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  19.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  19.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  19.115 +.    \" corrections for vroff
  19.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  19.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  19.118 +.    \" for low resolution devices (crt and lpr)
  19.119 +.if \n(.H>23 .if \n(.V>19 \
  19.120 +\{\
  19.121 +.    ds : e
  19.122 +.    ds 8 ss
  19.123 +.    ds o a
  19.124 +.    ds d- d\h'-1'\(ga
  19.125 +.    ds D- D\h'-1'\(hy
  19.126 +.    ds th \o'bp'
  19.127 +.    ds Th \o'LP'
  19.128 +.    ds ae ae
  19.129 +.    ds Ae AE
  19.130 +.\}
  19.131 +.rm #[ #] #H #V #F C
  19.132 +.\" ========================================================================
  19.133 +.\"
  19.134 +.IX Title "LSYNC 8"
  19.135 +.TH LSYNC 8 "OpenPKG" "LSYNC(8)" "OpenPKG"
  19.136 +.SH "NAME"
  19.137 +\&\fBopenpkg lsync\fR \- Access Layer Synchronization Tool
  19.138 +.SH "SYNOPSIS"
  19.139 +.IX Header "SYNOPSIS"
  19.140 +\&\fBopenpkg lsync\fR
  19.141 +[\fB\-\-version\fR|\fB\-v\fR]
  19.142 +[\fB\-\-help\fR|\fB\-h\fR]
  19.143 +[\fB\-\-init\fR|\fB\-i\fR]
  19.144 +[\fB\-\-nop\fR|\fB\-n\fR]
  19.145 +[\fB\-\-quiet\fR|\fB\-q\fR]
  19.146 +[\fB\-\-trace\fR|\fB\-t\fR]
  19.147 +[\fB\-\-local\fR|\fB\-l\fR]
  19.148 +[\fB\-\-uninstall\fR|\fB\-u\fR]
  19.149 +[\fB\-\-root=\fR\fIroot\fR]
  19.150 +[\fB\-\-pkgdir=\fR\fIpkgdir\fR]
  19.151 +[\fB\-\-subdirs=\fR\fIsubdir\fR[,\fIsubdir\fR,...]]
  19.152 +.SH "DESCRIPTION"
  19.153 +.IX Header "DESCRIPTION"
  19.154 +This program activates software packages which were locally
  19.155 +installed in a sub-directory of a package hierarchy (located under
  19.156 +\&\fIroot\fR/\fIpkgdir\fR/) by managing symbolic links in an access layer
  19.157 +(located under \fIroot\fR/) corresponding to package installation
  19.158 +files (found in \fIroot\fR/\fIpkgdir\fR/pkgname/subdir/) which need to be
  19.159 +collected in global directories (located under \fIroot\fR/subdir/).
  19.160 +.PP
  19.161 +The purpose of this is that individual packages can be installed and
  19.162 +deinstalled seperately without interfering with other packages while
  19.163 +all packages as a whole still can be treated like a single package
  19.164 +(installed into the access layer).
  19.165 +.PP
  19.166 +The
  19.167 +actual creation of symbolic links is as following (\*(L"foo\*(R" indicating an
  19.168 +arbitrary file; \*(L"bar\*(R" indicating an arbitrary package name):
  19.169 +.IP "\fIroot\fR\fB/bin/\fRfoo \-> \fB../\fR\fIpkgdir\fR\fB/\fRbar\fB/bin/\fRfoo" 4
  19.170 +.IX Item "root/bin/foo -> ../pkgdir/bar/bin/foo"
  19.171 +This activates the user executeable
  19.172 +\&\fIroot\fR\fB/\fR\fIpkgdir\fR\fB/\fRbar\fB/bin\fR/foo as \fIroot\fR\fB/bin/\fRfoo. It can
  19.173 +be found by the shell by placing \fIroot\fR\fB/bin\fR into the environment
  19.174 +variable \f(CW\*(C`PATH\*(C'\fR (\fBPATH="..:\fR\fIroot\fR\fB/bin:.."\fR).
  19.175 +.IP "\fIroot\fR\fB/sbin/\fRfoo \-> \fB../\fR\fIpkgdir\fR\fB/\fRbar\fB/sbin/\fRfoo" 4
  19.176 +.IX Item "root/sbin/foo -> ../pkgdir/bar/sbin/foo"
  19.177 +This activates the system executeable
  19.178 +\&\fIroot\fR\fB/\fR\fIpkgdir\fR\fB/\fRbar\fB/sbin\fR/foo as \fIroot\fR\fB/sbin/\fRfoo. It can
  19.179 +be found by the shell by placing \fIroot\fR\fB/sbin\fR into the environment
  19.180 +variable \f(CW\*(C`PATH\*(C'\fR (\fBPATH="..:\fR\fIroot\fR\fB/sbin:.."\fR).
  19.181 +.IP "\fIroot\fR\fB/man/man\fR\fIN\fR\fB/\fRfoo \-> \fB../\fR\fIpkgdir\fR\fB/\fRbar\fB/man/man\fR\fIN\fR\fB/\fRfoo" 4
  19.182 +.IX Item "root/man/manN/foo -> ../pkgdir/bar/man/manN/foo"
  19.183 +This activates the Unix manual page
  19.184 +\&\fIroot\fR\fB/\fR\fIpkgdir\fR\fB/\fRbar\fB/man/man\fR\fIN\fR\fB/\fRfoo as
  19.185 +\&\fIroot\fR\fB/man/man\fR\fIN\fR\fB/\fRfoo. It can be found by the \fIman\fR\|(1) tool
  19.186 +by placing \fIroot\fR\fB/man\fR into the environment variable \f(CW\*(C`MANPATH\*(C'\fR
  19.187 +(\fBMANPATH="..:\fR\fIroot\fR\fB/man:.."\fR). Keep in mind that \fBopenpkg lsync\fR
  19.188 +activates any files found in the \fBman/man\f(BIN\fB\fR sub-directory of the
  19.189 +package, but the \fIman\fR\|(1) tool usually requires the filename scheme
  19.190 +foo\fB.\fR\fIN\fR before it can find the file.
  19.191 +.IP "\fIroot\fR\fB/info/\fRfoo \-> \fB../\fR\fIpkgdir\fR\fB/\fRbar\fB/info/\fRfoo" 4
  19.192 +.IX Item "root/info/foo -> ../pkgdir/bar/info/foo"
  19.193 +This activates the \s-1GNU\s0 info page \fIroot\fR\fB/\fR\fIpkgdir\fR\fB/\fRbar\fB/info/\fRfoo
  19.194 +as \fIroot\fR\fB/info/\fRfoo. It can be found by the \fIinfo\fR\|(1) and \fIpinfo\fR\|(1)
  19.195 +tools by placing \fIroot\fR\fB/info\fR into the environment variable
  19.196 +\&\f(CW\*(C`INFOPATH\*(C'\fR (\fBINFOPATH="..:\fR\fIroot\fR\fB/info:.."\fR). Keep in mind that
  19.197 +\&\fBopenpkg lsync\fR activates any files found in the \fBinfo/\fR sub-directory of the
  19.198 +package, but the \fIinfo\fR\|(1) and \fIpinfo\fR\|(1) tools usually require the filename
  19.199 +scheme foo\fB.info\fR before it can find the file.
  19.200 +.IP "\fIroot\fR\fB/include/\fRfoo \-> \fB../\fR\fIpkgdir\fR\fB/\fRbar\fB/include/\fRfoo" 4
  19.201 +.IX Item "root/include/foo -> ../pkgdir/bar/include/foo"
  19.202 +This activates the C header \fIroot\fR\fB/\fR\fIpkgdir\fR\fB/\fRbar\fB/include\fR/foo
  19.203 +as \fIroot\fR\fB/include/\fRfoo. It can be found by the C/\*(C+ compilers
  19.204 +by adding \fIroot\fR\fB/include\fR to their include search path (\fBcc ..
  19.205 +\&\-I\fR\fIroot\fR\fB/include\fR \fB...\fR). Keep in mind that \fBopenpkg lsync\fR activates any
  19.206 +files found in the \fBinclude/\fR sub-directory of the package, but the
  19.207 +C/\*(C+ compiler usually by convention use the filename scheme foo\fB.h\fR.
  19.208 +.IP "\fIroot\fR\fB/lib/\fRfoo \-> \fB../\fR\fIpkgdir\fR\fB/\fRbar\fB/lib/\fRfoo" 4
  19.209 +.IX Item "root/lib/foo -> ../pkgdir/bar/lib/foo"
  19.210 +This activates the C library \fIroot\fR\fB/\fR\fIpkgdir\fR\fB/\fRbar\fB/lib\fR/foo
  19.211 +as \fIroot\fR\fB/lib/\fRfoo. It can be found by the C/\*(C+ compilers (and
  19.212 +the linker they use) by adding \fIroot\fR\fB/lib\fR to their library search
  19.213 +path (\fBcc .. \-L\fR\fIroot\fR\fB/lib\fR \fB...\fR). It can be found by the Unix
  19.214 +Dynamic Loader by adding \fIroot\fR\fB/lib\fR to the environment variable
  19.215 +\&\f(CW\*(C`LD_LIBRARY_PATH\*(C'\fR (\fBLD_LIBRARY_PATH="..:\fR\fIroot\fR\fB/lib:.."\fR).
  19.216 +Keep in mind that \fBopenpkg lsync\fR activates any files found in the \fBlib/\fR
  19.217 +sub-directory of the package, but the C/\*(C+ compiler usually require the
  19.218 +filename scheme \fBlib\fRfoo\fB.a\fR and the Unix Dynamic Loader the filename
  19.219 +scheme \fBlib\fRfoo\fB.so\fR before they actually can use the file.
  19.220 +.PP
  19.221 +It is obvious that more sub-directories in a package installation
  19.222 +might exist \*(-- for instance \fBshare/\fR, \fBvar/\fR, \fBlibexec/\fR, etc. But
  19.223 +\&\fBopenpkg lsync\fR intentionally does not link files in those directories into
  19.224 +corresponding directories of the access layer, because those files do
  19.225 +not require that they are located in a global area in order to be used.
  19.226 +So \fBopenpkg lsync\fR only creates the access layer for files where a common area
  19.227 +is required for (easy) use.
  19.228 +.SH "SPECIAL FEATURES"
  19.229 +.IX Header "SPECIAL FEATURES"
  19.230 +There are two special features supported by \fBopenpkg lsync\fR:
  19.231 +.IP "\fBRun-Command Files\fR" 4
  19.232 +.IX Item "Run-Command Files"
  19.233 +\&\fBopenpkg lsync\fR on startup implicitly reads command line options from
  19.234 +\&\f(CW\*(C`.lsyncrc\*(C'\fR files. They are searched in all parent directories and in
  19.235 +the callers home directory. Their contents is prepended to the list of
  19.236 +given command line options.
  19.237 +.IP "\fBMultiple Package Versions\fR" 4
  19.238 +.IX Item "Multiple Package Versions"
  19.239 +\&\fBopenpkg lsync\fR skips all directories under \fIroot\fR/\fIpkgdir\fR/ which contain
  19.240 +the pattern \*(L"\-[0\-9]\*(R" in their directory name. On the other hand,
  19.241 +\&\fBopenpkg lsync\fR follows also symbolic links under \fIroot\fR/\fIpkgdir\fR/.
  19.242 +This can be used for installing multiple versions of a package and
  19.243 +switching between them. For instance, if version 1.0 of package
  19.244 +\&\*(L"foo\*(R" is installed into directory \fIroot\fR/\fIpkgdir\fR/foo\-1.0,
  19.245 +version 1.1 into \fIroot\fR/\fIpkgdir\fR/foo\-1.1 and version 1.2 into
  19.246 +\&\fIroot\fR/\fIpkgdir\fR/foo\-1.2, \fBopenpkg lsync\fR does skip all three. To enable
  19.247 +version 1.1 one just creates a symbolic link \fIroot\fR/\fIpkgdir\fR/foo
  19.248 +pointing to foo\-1.1. Then \fBopenpkg lsync\fR picks up the files in
  19.249 +\&\fIroot\fR/\fIpkgdir\fR/foo\-1.1. If you want to temporarily upgrade to
  19.250 +foo\-1.2, all you have to do is to change the symlink pointing from
  19.251 +foo\-1.1 to foo\-1.2.
  19.252 +.IP "\fBTemporarily Deactivated Package\fR" 4
  19.253 +.IX Item "Temporarily Deactivated Package"
  19.254 +One can deactivate a package \*(L"foo\*(R" by going to \fIroot\fR/\fIpkgdir\fR/foo/
  19.255 +and running \*(L"openpkg lsync \-\-local \-\-uninstall\*(R", of course. Alternatively
  19.256 +one can set the sticky bit on the directory \fIroot\fR/\fIpkgdir\fR/foo.
  19.257 +Then \fBopenpkg lsync\fR also skips the package. Alternatively, assume
  19.258 +package \*(L"foo\*(R" as a whole should not be deactivated, but its
  19.259 +\&\fIroot\fR/\fIpkgdir\fR/foo/lib directory (usually because this directory
  19.260 +unfortunately contains non-library files), one just sets the sticky bit
  19.261 +on \fIroot\fR/\fIpkgdir\fR/foo/lib.
  19.262 +.SH "OPTIONS"
  19.263 +.IX Header "OPTIONS"
  19.264 +.IP "\fB\-\-version\fR, \fB\-v\fR" 4
  19.265 +.IX Item "--version, -v"
  19.266 +Display program version information only.
  19.267 +.IP "\fB\-\-help\fR, \fB\-h\fR" 4
  19.268 +.IX Item "--help, -h"
  19.269 +Display program usage information only.
  19.270 +.IP "\fB\-\-init\fR, \fB\-i\fR" 4
  19.271 +.IX Item "--init, -i"
  19.272 +Create an initial access layer hierarchy under \fIroot\fR.
  19.273 +.IP "\fB\-\-nop\fR, \fB\-n\fR" 4
  19.274 +.IX Item "--nop, -n"
  19.275 +No Operation \*(-- causes \fBopenpkg lsync\fR to not perform any filesystem
  19.276 +operations. In conjunction with \fB\-\-trace\fR you can at least see what
  19.277 +would be executed.
  19.278 +.IP "\fB\-\-quiet\fR, \fB\-q\fR" 4
  19.279 +.IX Item "--quiet, -q"
  19.280 +Forces \fBopenpkg lsync\fR to perform the operations quietly, i.e., without any
  19.281 +verbose messages.
  19.282 +.IP "\fB\-\-trace\fR, \fB\-t\fR" 4
  19.283 +.IX Item "--trace, -t"
  19.284 +Forces \fBopenpkg lsync\fR to show what filesystem operations are performed.
  19.285 +.IP "\fB\-\-local\fR, \fB\-l\fR" 4
  19.286 +.IX Item "--local, -l"
  19.287 +This restricts the operations to a local package area. This option can
  19.288 +only be used if you are physically staying below a package sub-directory
  19.289 +under \fIroot\fR/\fIpkgdir\fR/. For instance, when you are staying in
  19.290 +\&\fIroot\fR/\fIpkgdir\fR/bar or \fIroot\fR/\fIpkgdir\fR/bar/bin and use \fB\-\-local\fR,
  19.291 +all operations are restricted to the package \*(L"bar\*(R".
  19.292 +.IP "\fB\-\-uninstall\fR, \fB\-u\fR" 4
  19.293 +.IX Item "--uninstall, -u"
  19.294 +This performs only package uninstallation operations, i.e., only
  19.295 +symbolic links are removed. This can be used to completely empty the
  19.296 +access layer. Additionally it is very useful in combination with
  19.297 +\&\fB\-\-local\fR in order to uninstall a particular package without having to
  19.298 +remove its files.
  19.299 +.IP "\fB\-\-root=\fR\fIroot\fR" 4
  19.300 +.IX Item "--root=root"
  19.301 +Sets the root directory where the access layer and package subdirectory
  19.302 +is located. The default can be determined by running \f(CW\*(C`openpkg lsync \-\-help\*(C'\fR
  19.303 +(see section \*(L"Current configuration\*(R").
  19.304 +.IP "\fB\-\-pkgdir=\fR\fIpkgdir\fR" 4
  19.305 +.IX Item "--pkgdir=pkgdir"
  19.306 +Sets the sub-directory under the root directory where packages are
  19.307 +located. The default can be determined by running \f(CW\*(C`openpkg lsync \-\-help\*(C'\fR (see
  19.308 +section \*(L"Current configuration\*(R").
  19.309 +.IP "\fB\-\-subdirs=\fR\fIsubdirs\fR[,\fIsubdir\fR,...]" 4
  19.310 +.IX Item "--subdirs=subdirs[,subdir,...]"
  19.311 +Sets one or more sub-directories of the access layer on which \fBopenpkg lsync\fR
  19.312 +should act. The default can be determined by running \f(CW\*(C`openpkg lsync \-\-help\*(C'\fR
  19.313 +(see section \*(L"Current configuration\*(R").
  19.314 +.SH "RESULTS"
  19.315 +.IX Header "RESULTS"
  19.316 +This program uses the following return codes on exit: 0 (operation
  19.317 +successful), 1 (system error), 2 (command line error) and 3 (other user
  19.318 +error).
  19.319 +.SH "HISTORY"
  19.320 +.IX Header "HISTORY"
  19.321 +The idea of filesystem access layers consisting of symbolic links
  19.322 +pointing to actual package installation areas is a rather old one. It
  19.323 +dates back to the early days of Unix and was implemented many times over
  19.324 +the last decades. One of many implementation was \fBGenOPT\fR, written by
  19.325 +Ralf S. Engelschall for sd&m GmbH & Co \s-1KG\s0, Munich in 1992. The name
  19.326 +indicates the programs purpose: to generate symbolic links in an access
  19.327 +layer which was located under \f(CW\*(C`/opt\*(C'\fR. \fBGenOPT\fR was very flexible, but
  19.328 +hence also very complex. Because of lack of documentation it was never
  19.329 +released and so only used at sd&m and on all machines which were under
  19.330 +control of Ralf S. Engelschall.
  19.331 +.PP
  19.332 +For Cable & Wireless, Munich, the old \fBGenOPT\fR principle was again
  19.333 +needed to manage the \f(CW\*(C`/cw/local\*(C'\fR area on their servers. For this in
  19.334 +November 2000 the functionality of \fBGenOPT\fR was revised, heavily
  19.335 +stripped down and finally implemented from scratch. The result is the
  19.336 +current \fBopenpkg lsync\fR.
  19.337 +.SH "AUTHOR"
  19.338 +.IX Header "AUTHOR"
  19.339 +.Vb 3
  19.340 +\& Ralf S. Engelschall
  19.341 +\& rse@engelschall.com
  19.342 +\& www.engelschall.com
  19.343 +.Ve
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/openpkg/lsync.pod	Tue Jan 06 23:40:39 2009 +0100
    20.3 @@ -0,0 +1,274 @@
    20.4 +##
    20.5 +##  lsync.pod -- Access Layer Synchronization Tool (Manual Page)
    20.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    20.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    20.8 +##
    20.9 +##  Permission to use, copy, modify, and distribute this software for
   20.10 +##  any purpose with or without fee is hereby granted, provided that
   20.11 +##  the above copyright notice and this permission notice appear in all
   20.12 +##  copies.
   20.13 +##
   20.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   20.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   20.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   20.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   20.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   20.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   20.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   20.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   20.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   20.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   20.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   20.25 +##  SUCH DAMAGE.
   20.26 +##
   20.27 +
   20.28 +=pod
   20.29 +
   20.30 +=head1 NAME
   20.31 +
   20.32 +B<openpkg lsync> - Access Layer Synchronization Tool
   20.33 +
   20.34 +=head1 SYNOPSIS
   20.35 +
   20.36 +B<openpkg lsync>
   20.37 +[B<--version>|B<-v>]
   20.38 +[B<--help>|B<-h>]
   20.39 +[B<--init>|B<-i>]
   20.40 +[B<--nop>|B<-n>]
   20.41 +[B<--quiet>|B<-q>]
   20.42 +[B<--trace>|B<-t>]
   20.43 +[B<--local>|B<-l>]
   20.44 +[B<--uninstall>|B<-u>]
   20.45 +[B<--root=>I<root>]
   20.46 +[B<--pkgdir=>I<pkgdir>]
   20.47 +[B<--subdirs=>I<subdir>[,I<subdir>,...]]
   20.48 +
   20.49 +=head1 DESCRIPTION
   20.50 +
   20.51 +This program activates software packages which were locally
   20.52 +installed in a sub-directory of a package hierarchy (located under
   20.53 +I<root>/I<pkgdir>/) by managing symbolic links in an access layer
   20.54 +(located under I<root>/) corresponding to package installation
   20.55 +files (found in I<root>/I<pkgdir>/pkgname/subdir/) which need to be
   20.56 +collected in global directories (located under I<root>/subdir/).
   20.57 +
   20.58 +The purpose of this is that individual packages can be installed and
   20.59 +deinstalled seperately without interfering with other packages while
   20.60 +all packages as a whole still can be treated like a single package
   20.61 +(installed into the access layer).
   20.62 +
   20.63 +The
   20.64 +actual creation of symbolic links is as following ("foo" indicating an
   20.65 +arbitrary file; "bar" indicating an arbitrary package name):
   20.66 +
   20.67 +=over 4
   20.68 +
   20.69 +=item I<root>B</bin/>foo -> B<../>I<pkgdir>B</>barB</bin/>foo
   20.70 +
   20.71 +This activates the user executeable
   20.72 +I<root>B</>I<pkgdir>B</>barB</bin>/foo as I<root>B</bin/>foo. It can
   20.73 +be found by the shell by placing I<root>B</bin> into the environment
   20.74 +variable C<PATH> (B<PATH="..:>I<root>B</bin:..">).
   20.75 +
   20.76 +=item I<root>B</sbin/>foo -> B<../>I<pkgdir>B</>barB</sbin/>foo
   20.77 +
   20.78 +This activates the system executeable
   20.79 +I<root>B</>I<pkgdir>B</>barB</sbin>/foo as I<root>B</sbin/>foo. It can
   20.80 +be found by the shell by placing I<root>B</sbin> into the environment
   20.81 +variable C<PATH> (B<PATH="..:>I<root>B</sbin:..">).
   20.82 +
   20.83 +=item I<root>B</man/man>I<N>B</>foo -> B<../>I<pkgdir>B</>barB</man/man>I<N>B</>foo
   20.84 +
   20.85 +This activates the Unix manual page
   20.86 +I<root>B</>I<pkgdir>B</>barB</man/man>I<N>B</>foo as
   20.87 +I<root>B</man/man>I<N>B</>foo. It can be found by the man(1) tool
   20.88 +by placing I<root>B</man> into the environment variable C<MANPATH>
   20.89 +(B<MANPATH="..:>I<root>B</man:..">). Keep in mind that B<openpkg lsync>
   20.90 +activates any files found in the B<man/manI<N>> sub-directory of the
   20.91 +package, but the man(1) tool usually requires the filename scheme
   20.92 +fooB<.>I<N> before it can find the file.
   20.93 +
   20.94 +=item I<root>B</info/>foo -> B<../>I<pkgdir>B</>barB</info/>foo
   20.95 +
   20.96 +This activates the GNU info page I<root>B</>I<pkgdir>B</>barB</info/>foo
   20.97 +as I<root>B</info/>foo. It can be found by the info(1) and pinfo(1)
   20.98 +tools by placing I<root>B</info> into the environment variable
   20.99 +C<INFOPATH> (B<INFOPATH="..:>I<root>B</info:..">). Keep in mind that
  20.100 +B<openpkg lsync> activates any files found in the B<info/> sub-directory of the
  20.101 +package, but the info(1) and pinfo(1) tools usually require the filename
  20.102 +scheme fooB<.info> before it can find the file.
  20.103 +
  20.104 +=item I<root>B</include/>foo -> B<../>I<pkgdir>B</>barB</include/>foo
  20.105 +
  20.106 +This activates the C header I<root>B</>I<pkgdir>B</>barB</include>/foo
  20.107 +as I<root>B</include/>foo. It can be found by the C/C++ compilers
  20.108 +by adding I<root>B</include> to their include search path (B<cc ..
  20.109 +-I>I<root>B</include> B<...>). Keep in mind that B<openpkg lsync> activates any
  20.110 +files found in the B<include/> sub-directory of the package, but the
  20.111 +C/C++ compiler usually by convention use the filename scheme fooB<.h>.
  20.112 +
  20.113 +=item I<root>B</lib/>foo -> B<../>I<pkgdir>B</>barB</lib/>foo
  20.114 +
  20.115 +This activates the C library I<root>B</>I<pkgdir>B</>barB</lib>/foo
  20.116 +as I<root>B</lib/>foo. It can be found by the C/C++ compilers (and
  20.117 +the linker they use) by adding I<root>B</lib> to their library search
  20.118 +path (B<cc .. -L>I<root>B</lib> B<...>). It can be found by the Unix
  20.119 +Dynamic Loader by adding I<root>B</lib> to the environment variable
  20.120 +C<LD_LIBRARY_PATH> (B<LD_LIBRARY_PATH="..:>I<root>B</lib:..">).
  20.121 +Keep in mind that B<openpkg lsync> activates any files found in the B<lib/>
  20.122 +sub-directory of the package, but the C/C++ compiler usually require the
  20.123 +filename scheme B<lib>fooB<.a> and the Unix Dynamic Loader the filename
  20.124 +scheme B<lib>fooB<.so> before they actually can use the file.
  20.125 +
  20.126 +=back
  20.127 +
  20.128 +It is obvious that more sub-directories in a package installation
  20.129 +might exist -- for instance B<share/>, B<var/>, B<libexec/>, etc. But
  20.130 +B<openpkg lsync> intentionally does not link files in those directories into
  20.131 +corresponding directories of the access layer, because those files do
  20.132 +not require that they are located in a global area in order to be used.
  20.133 +So B<openpkg lsync> only creates the access layer for files where a common area
  20.134 +is required for (easy) use.
  20.135 +
  20.136 +=head1 SPECIAL FEATURES
  20.137 +
  20.138 +There are two special features supported by B<openpkg lsync>:
  20.139 +
  20.140 +=over 4
  20.141 +
  20.142 +=item B<Run-Command Files>
  20.143 +
  20.144 +B<openpkg lsync> on startup implicitly reads command line options from
  20.145 +C<.lsyncrc> files. They are searched in all parent directories and in
  20.146 +the callers home directory. Their contents is prepended to the list of
  20.147 +given command line options.
  20.148 +
  20.149 +=item B<Multiple Package Versions>
  20.150 +
  20.151 +B<openpkg lsync> skips all directories under I<root>/I<pkgdir>/ which contain
  20.152 +the pattern "-[0-9]" in their directory name. On the other hand,
  20.153 +B<openpkg lsync> follows also symbolic links under I<root>/I<pkgdir>/.
  20.154 +This can be used for installing multiple versions of a package and
  20.155 +switching between them. For instance, if version 1.0 of package
  20.156 +"foo" is installed into directory I<root>/I<pkgdir>/foo-1.0,
  20.157 +version 1.1 into I<root>/I<pkgdir>/foo-1.1 and version 1.2 into
  20.158 +I<root>/I<pkgdir>/foo-1.2, B<openpkg lsync> does skip all three. To enable
  20.159 +version 1.1 one just creates a symbolic link I<root>/I<pkgdir>/foo
  20.160 +pointing to foo-1.1. Then B<openpkg lsync> picks up the files in
  20.161 +I<root>/I<pkgdir>/foo-1.1. If you want to temporarily upgrade to
  20.162 +foo-1.2, all you have to do is to change the symlink pointing from
  20.163 +foo-1.1 to foo-1.2.
  20.164 +
  20.165 +=item B<Temporarily Deactivated Package>
  20.166 +
  20.167 +One can deactivate a package "foo" by going to I<root>/I<pkgdir>/foo/
  20.168 +and running "openpkg lsync --local --uninstall", of course. Alternatively
  20.169 +one can set the sticky bit on the directory I<root>/I<pkgdir>/foo.
  20.170 +Then B<openpkg lsync> also skips the package. Alternatively, assume
  20.171 +package "foo" as a whole should not be deactivated, but its
  20.172 +I<root>/I<pkgdir>/foo/lib directory (usually because this directory
  20.173 +unfortunately contains non-library files), one just sets the sticky bit
  20.174 +on I<root>/I<pkgdir>/foo/lib.
  20.175 +
  20.176 +=back
  20.177 +
  20.178 +=head1 OPTIONS
  20.179 +
  20.180 +=over 4
  20.181 +
  20.182 +=item B<--version>, B<-v>
  20.183 +
  20.184 +Display program version information only.
  20.185 +
  20.186 +=item B<--help>, B<-h>
  20.187 +
  20.188 +Display program usage information only.
  20.189 +
  20.190 +=item B<--init>, B<-i>
  20.191 +
  20.192 +Create an initial access layer hierarchy under I<root>.
  20.193 +
  20.194 +=item B<--nop>, B<-n>
  20.195 +
  20.196 +No Operation -- causes B<openpkg lsync> to not perform any filesystem
  20.197 +operations. In conjunction with B<--trace> you can at least see what
  20.198 +would be executed.
  20.199 +
  20.200 +=item B<--quiet>, B<-q>
  20.201 +
  20.202 +Forces B<openpkg lsync> to perform the operations quietly, i.e., without any
  20.203 +verbose messages.
  20.204 +
  20.205 +=item B<--trace>, B<-t>
  20.206 +
  20.207 +Forces B<openpkg lsync> to show what filesystem operations are performed.
  20.208 +
  20.209 +=item B<--local>, B<-l>
  20.210 +
  20.211 +This restricts the operations to a local package area. This option can
  20.212 +only be used if you are physically staying below a package sub-directory
  20.213 +under I<root>/I<pkgdir>/. For instance, when you are staying in
  20.214 +I<root>/I<pkgdir>/bar or I<root>/I<pkgdir>/bar/bin and use B<--local>,
  20.215 +all operations are restricted to the package "bar".
  20.216 +
  20.217 +=item B<--uninstall>, B<-u>
  20.218 +
  20.219 +This performs only package uninstallation operations, i.e., only
  20.220 +symbolic links are removed. This can be used to completely empty the
  20.221 +access layer. Additionally it is very useful in combination with
  20.222 +B<--local> in order to uninstall a particular package without having to
  20.223 +remove its files.
  20.224 +
  20.225 +=item B<--root=>I<root>
  20.226 +
  20.227 +Sets the root directory where the access layer and package subdirectory
  20.228 +is located. The default can be determined by running C<openpkg lsync --help>
  20.229 +(see section "Current configuration").
  20.230 +
  20.231 +=item B<--pkgdir=>I<pkgdir>
  20.232 +
  20.233 +Sets the sub-directory under the root directory where packages are
  20.234 +located. The default can be determined by running C<openpkg lsync --help> (see
  20.235 +section "Current configuration").
  20.236 +
  20.237 +=item B<--subdirs=>I<subdirs>[,I<subdir>,...]
  20.238 +
  20.239 +Sets one or more sub-directories of the access layer on which B<openpkg lsync>
  20.240 +should act. The default can be determined by running C<openpkg lsync --help>
  20.241 +(see section "Current configuration").
  20.242 +
  20.243 +=back
  20.244 +
  20.245 +=head1 RESULTS
  20.246 +
  20.247 +This program uses the following return codes on exit: 0 (operation
  20.248 +successful), 1 (system error), 2 (command line error) and 3 (other user
  20.249 +error).
  20.250 +
  20.251 +=head1 HISTORY
  20.252 +
  20.253 +The idea of filesystem access layers consisting of symbolic links
  20.254 +pointing to actual package installation areas is a rather old one. It
  20.255 +dates back to the early days of Unix and was implemented many times over
  20.256 +the last decades. One of many implementation was B<GenOPT>, written by
  20.257 +Ralf S. Engelschall for sd&m GmbH & Co KG, Munich in 1992. The name
  20.258 +indicates the programs purpose: to generate symbolic links in an access
  20.259 +layer which was located under C</opt>. B<GenOPT> was very flexible, but
  20.260 +hence also very complex. Because of lack of documentation it was never
  20.261 +released and so only used at sd&m and on all machines which were under
  20.262 +control of Ralf S. Engelschall.
  20.263 +
  20.264 +For Cable & Wireless, Munich, the old B<GenOPT> principle was again
  20.265 +needed to manage the C</cw/local> area on their servers. For this in
  20.266 +November 2000 the functionality of B<GenOPT> was revised, heavily
  20.267 +stripped down and finally implemented from scratch. The result is the
  20.268 +current B<openpkg lsync>.
  20.269 +
  20.270 +=head1 AUTHOR
  20.271 +
  20.272 + Ralf S. Engelschall
  20.273 + rse@engelschall.com
  20.274 + www.engelschall.com
  20.275 +
  20.276 +=cut
  20.277 +
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/openpkg/make.patch	Tue Jan 06 23:40:39 2009 +0100
    21.3 @@ -0,0 +1,31 @@
    21.4 +Index: glob/glob.c
    21.5 +--- glob/glob.c.orig	2006-03-10 03:20:45 +0100
    21.6 ++++ glob/glob.c	2006-04-01 19:09:18 +0200
    21.7 +@@ -216,13 +216,13 @@
    21.8 + #  ifdef HAVE_ALLOCA_H
    21.9 + #   include <alloca.h>
   21.10 + #  else	/* Not HAVE_ALLOCA_H.  */
   21.11 +-#   ifndef _AIX
   21.12 ++#   if !defined (_AIX) && !defined (__FreeBSD__)
   21.13 + #    ifdef WINDOWS32
   21.14 + #     include <malloc.h>
   21.15 + #    else
   21.16 + extern char *alloca ();
   21.17 + #    endif /* WINDOWS32 */
   21.18 +-#   endif /* Not _AIX.  */
   21.19 ++#   endif /* Not _AIX && not __FreeBSD__.  */
   21.20 + #  endif /* sparc or HAVE_ALLOCA_H.  */
   21.21 + # endif	/* GCC.  */
   21.22 + 
   21.23 +Index: make.h
   21.24 +--- make.h.orig	2006-02-16 00:54:43 +0100
   21.25 ++++ make.h	2006-04-01 19:09:18 +0200
   21.26 +@@ -31,7 +31,7 @@
   21.27 + #  ifdef _AIX
   21.28 +  #pragma alloca
   21.29 + #  else
   21.30 +-#   ifndef alloca /* predefined by HP cc +Olibcalls */
   21.31 ++#   if !defined (alloca) && !defined (__FreeBSD__) /* predefined by HP cc +Olibcalls, part of stdlib.h on FreeBSD */
   21.32 + char *alloca ();
   21.33 + #   endif
   21.34 + #  endif
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/openpkg/man.sh	Tue Jan 06 23:40:39 2009 +0100
    22.3 @@ -0,0 +1,154 @@
    22.4 +#!@l_prefix@/lib/openpkg/bash
    22.5 +##
    22.6 +##  man -- OpenPKG Tool Chain "man" command
    22.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    22.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    22.9 +##
   22.10 +##  Permission to use, copy, modify, and distribute this software for
   22.11 +##  any purpose with or without fee is hereby granted, provided that
   22.12 +##  the above copyright notice and this permission notice appear in all
   22.13 +##  copies.
   22.14 +##
   22.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   22.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   22.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   22.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   22.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   22.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   22.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   22.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   22.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   22.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   22.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   22.26 +##  SUCH DAMAGE.
   22.27 +##
   22.28 +
   22.29 +#   configuration
   22.30 +prefix="@l_prefix@"
   22.31 +
   22.32 +#   minimum command line parsing
   22.33 +opt_h=no
   22.34 +while [ 1 ]; do
   22.35 +    case "$1" in
   22.36 +        -h | --help ) opt_h=yes; shift ;;
   22.37 +        * ) break ;;
   22.38 +    esac
   22.39 +done
   22.40 +if [ ".$opt_h" = .yes ]; then
   22.41 +    echo "openpkg:man:USAGE: openpkg man [--help] [<section>] <command>"
   22.42 +    exit 0
   22.43 +fi
   22.44 +if [ $# -eq 1 ]; then
   22.45 +    man_page="$1"
   22.46 +elif [ $# -eq 2 ]; then
   22.47 +    man_sect="$1"
   22.48 +    man_page="$2"
   22.49 +else
   22.50 +    echo "openpkg:man:ERROR: invalid number of arguments" 1>&2
   22.51 +    exit 1
   22.52 +fi
   22.53 +
   22.54 +#   determine path to commands
   22.55 +openpkg_tools="${OPENPKG_TOOLS}"
   22.56 +openpkg_tools_cmdpath="${OPENPKG_TOOLS_CMDPATH}"
   22.57 +if [ ".${openpkg_tools}" != . -a ".${openpkg_tools_cmdpath}" = . ]; then
   22.58 +    openpkg_tools_cmdpath="${openpkg_tools}/cmd:@"
   22.59 +fi
   22.60 +cmdpath="${prefix}/libexec/openpkg"
   22.61 +if [ -d "${prefix}/libexec/openpkg-tools" ]; then
   22.62 +    cmdpath="${prefix}/libexec/openpkg-tools:${cmdpath}"
   22.63 +fi
   22.64 +if [ -d "${prefix}/libexec/openpkg-audit" ]; then
   22.65 +    cmdpath="${prefix}/libexec/openpkg-audit:${cmdpath}"
   22.66 +fi
   22.67 +if [ ".${openpkg_tools_cmdpath}" != . ]; then
   22.68 +    cmdpath=`echo "${openpkg_tools_cmdpath}" | sed -e "s;@;${cmdpath};"`
   22.69 +fi
   22.70 +openpkg_tools_cmdpath=`echo "${cmdpath}" | sed -e 's/::/:/g' -e 's/^://' -e 's/:$//'`
   22.71 +
   22.72 +#   search for manual page in OpenPKG Tool Chain
   22.73 +man_file=""
   22.74 +man_type=""
   22.75 +OIFS="$IFS"; IFS=":"
   22.76 +for dir in ${openpkg_tools_cmdpath}; do
   22.77 +    IFS="$OIFS"
   22.78 +    for file in $dir/$man_page.${man_sect-"1"} $dir/$man_page.[1-9]; do
   22.79 +        if [ -f "$file" ]; then
   22.80 +            man_file="$file"
   22.81 +            man_type="roff"
   22.82 +            if [ ".$man_sect" = . ]; then
   22.83 +                man_sect=`echo "$man_file" |\
   22.84 +                    sed -e 's;^;X;' -e 's;^X.*\.\([1-9]\)$;\1;' -e 's;^X.*;;'`
   22.85 +            fi
   22.86 +            break
   22.87 +        fi
   22.88 +    done
   22.89 +    if [ ".$man_type" = . ]; then
   22.90 +        for file in $dir/$man_page.pod $dir/$man_page.pl $dir/$man_page.sh; do
   22.91 +            if [ -f "$file" ]; then
   22.92 +                if [ ".`grep '^=pod' $file`" != . ]; then
   22.93 +                    man_file="$file"
   22.94 +                    man_type="pod"
   22.95 +                    break
   22.96 +                fi
   22.97 +            fi
   22.98 +        done
   22.99 +    fi
  22.100 +    if [ ".$man_type" != . ]; then
  22.101 +        break
  22.102 +    fi
  22.103 +done
  22.104 +IFS="$OIFS"
  22.105 +if [ ".$man_type" != . ]; then
  22.106 +    #   determine POD to Roff converter
  22.107 +    pod2roff=""
  22.108 +    if [ ".$man_type" = .pod ]; then
  22.109 +        pod2roff=`$prefix/lib/openpkg/shtool path -p "$prefix/bin:$PATH" pod2man`
  22.110 +        if [ ".$pod2roff" = . ]; then
  22.111 +            echo "openpkg:man:ERROR: unable to find POD to Roff converter (pod2man)" 1>&2
  22.112 +            exit 1
  22.113 +        fi
  22.114 +        if [ ".$man_sect" = . ]; then
  22.115 +            man_sect=1
  22.116 +        fi
  22.117 +        pod2roff="$pod2roff --section=${man_sect}"
  22.118 +        pod2roff="$pod2roff --release=\"$man_page(${man_sect})\""
  22.119 +        pod2roff="$pod2roff --center=OpenPKG --date=OpenPKG"
  22.120 +        pod2roff="$pod2roff --quotes=none"
  22.121 +    fi
  22.122 +
  22.123 +    #   determine Roff to ASCII converter
  22.124 +    roff2ascii=`$prefix/lib/openpkg/shtool path -p "$prefix/bin:$PATH" nroff groff`
  22.125 +    if [ ".$roff2ascii" = . ]; then
  22.126 +        echo "openpkg:man:ERROR: unable to find Roff to ASCII converter (nroff, groff)" 1>&2
  22.127 +        exit 1
  22.128 +    fi
  22.129 +    roff2ascii="$roff2ascii -man"
  22.130 +    case "$roff2ascii" in
  22.131 +        */groff ) roff2ascii="$roff2ascii -Tascii" ;;
  22.132 +    esac
  22.133 +
  22.134 +    #   determine pager
  22.135 +    pager="$PAGER"
  22.136 +    if [ ".$pager" = . ]; then
  22.137 +        pager=`$prefix/lib/openpkg/shtool path -p "$prefix/bin:$PATH" less more cat`
  22.138 +    fi
  22.139 +    if [ ".$pager" = . ]; then
  22.140 +        echo "openpkg:man:ERROR: unable to find text viewer ($PAGER, less, more, cat)" 1>&2
  22.141 +        exit 1
  22.142 +    fi
  22.143 +
  22.144 +    #   render the manual page to the TTY
  22.145 +    if [ ".$man_type" = .roff ]; then
  22.146 +        eval "$roff2ascii $man_file | $pager"
  22.147 +    elif [ ".$man_type" = .pod ]; then
  22.148 +        eval "$pod2roff $man_file | $roff2ascii | $pager"
  22.149 +    fi
  22.150 +    exit 0
  22.151 +fi
  22.152 +
  22.153 +#   fallback to the man(1) command
  22.154 +MANPATH="$prefix/man:$prefix/local/man:${MANPATH-/usr/man}:/usr/man:/usr/share/man"
  22.155 +export MANPATH
  22.156 +eval "exec man $man_sect $man_page"
  22.157 +
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/openpkg/openpkg.1	Tue Jan 06 23:40:39 2009 +0100
    23.3 @@ -0,0 +1,183 @@
    23.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    23.5 +.\"
    23.6 +.\" Standard preamble:
    23.7 +.\" ========================================================================
    23.8 +.de Sh \" Subsection heading
    23.9 +.br
   23.10 +.if t .Sp
   23.11 +.ne 5
   23.12 +.PP
   23.13 +\fB\\$1\fR
   23.14 +.PP
   23.15 +..
   23.16 +.de Sp \" Vertical space (when we can't use .PP)
   23.17 +.if t .sp .5v
   23.18 +.if n .sp
   23.19 +..
   23.20 +.de Vb \" Begin verbatim text
   23.21 +.ft CW
   23.22 +.nf
   23.23 +.ne \\$1
   23.24 +..
   23.25 +.de Ve \" End verbatim text
   23.26 +.ft R
   23.27 +.fi
   23.28 +..
   23.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   23.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   23.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   23.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   23.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   23.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   23.35 +.tr \(*W-|\(bv\*(Tr
   23.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   23.37 +.ie n \{\
   23.38 +.    ds -- \(*W-
   23.39 +.    ds PI pi
   23.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   23.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   23.42 +.    ds L" ""
   23.43 +.    ds R" ""
   23.44 +.    ds C` 
   23.45 +.    ds C' 
   23.46 +'br\}
   23.47 +.el\{\
   23.48 +.    ds -- \|\(em\|
   23.49 +.    ds PI \(*p
   23.50 +.    ds L" ``
   23.51 +.    ds R" ''
   23.52 +'br\}
   23.53 +.\"
   23.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   23.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   23.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   23.57 +.\" output yourself in some meaningful fashion.
   23.58 +.if \nF \{\
   23.59 +.    de IX
   23.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   23.61 +..
   23.62 +.    nr % 0
   23.63 +.    rr F
   23.64 +.\}
   23.65 +.\"
   23.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   23.67 +.\" way too many mistakes in technical documents.
   23.68 +.hy 0
   23.69 +.if n .na
   23.70 +.\"
   23.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   23.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   23.73 +.    \" fudge factors for nroff and troff
   23.74 +.if n \{\
   23.75 +.    ds #H 0
   23.76 +.    ds #V .8m
   23.77 +.    ds #F .3m
   23.78 +.    ds #[ \f1
   23.79 +.    ds #] \fP
   23.80 +.\}
   23.81 +.if t \{\
   23.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   23.83 +.    ds #V .6m
   23.84 +.    ds #F 0
   23.85 +.    ds #[ \&
   23.86 +.    ds #] \&
   23.87 +.\}
   23.88 +.    \" simple accents for nroff and troff
   23.89 +.if n \{\
   23.90 +.    ds ' \&
   23.91 +.    ds ` \&
   23.92 +.    ds ^ \&
   23.93 +.    ds , \&
   23.94 +.    ds ~ ~
   23.95 +.    ds /
   23.96 +.\}
   23.97 +.if t \{\
   23.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   23.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  23.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  23.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  23.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  23.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  23.104 +.\}
  23.105 +.    \" troff and (daisy-wheel) nroff accents
  23.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  23.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  23.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  23.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  23.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  23.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  23.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  23.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  23.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  23.115 +.    \" corrections for vroff
  23.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  23.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  23.118 +.    \" for low resolution devices (crt and lpr)
  23.119 +.if \n(.H>23 .if \n(.V>19 \
  23.120 +\{\
  23.121 +.    ds : e
  23.122 +.    ds 8 ss
  23.123 +.    ds o a
  23.124 +.    ds d- d\h'-1'\(ga
  23.125 +.    ds D- D\h'-1'\(hy
  23.126 +.    ds th \o'bp'
  23.127 +.    ds Th \o'LP'
  23.128 +.    ds ae ae
  23.129 +.    ds Ae AE
  23.130 +.\}
  23.131 +.rm #[ #] #H #V #F C
  23.132 +.\" ========================================================================
  23.133 +.\"
  23.134 +.IX Title "OPENPKG 1"
  23.135 +.TH OPENPKG 1 "OpenPKG" "OPENPKG(8)" "OpenPKG"
  23.136 +.SH "NAME"
  23.137 +\&\fBOpenPKG\fR \-\- Cross\-Platform Unix Software Packaging Facility
  23.138 +.SH "SYNOPSIS"
  23.139 +.IX Header "SYNOPSIS"
  23.140 +.IP "Command Line Interface" 4
  23.141 +.IX Item "Command Line Interface"
  23.142 +$ \fBopenpkg\fR [\fIopt\fR ...] \fIcmd\fR [\fIcmd_opt\fR ...] [\fIcmd_arg\fR ...]
  23.143 +.Sp
  23.144 +$ \fBopenpkg\fR \fBman\fR \fIcmd\fR
  23.145 +.IP "Project Locations" 4
  23.146 +.IX Item "Project Locations"
  23.147 +.Vb 4
  23.148 +\& http://www.openpkg.org/       web service
  23.149 +\& http://cvs.openpkg.org/       repository service
  23.150 +\& http://pgp.openpkg.org/       OpenPGP service
  23.151 +\& ftp://ftp.openpkg.org/        download service
  23.152 +.Ve
  23.153 +.IP "Project Forums" 4
  23.154 +.IX Item "Project Forums"
  23.155 +.Vb 4
  23.156 +\& petidomo@openpkg.org          mailing-list manager
  23.157 +\& openpkg-announce@openpkg.org  project announcements
  23.158 +\& openpkg-dev@openpkg.org       developer forum
  23.159 +\& openpkg-users@openpkg.org     users forum
  23.160 +.Ve
  23.161 +.IP "Local Documentation" 4
  23.162 +.IX Item "Local Documentation"
  23.163 +.Vb 6
  23.164 +\& openpkg-rpm(1)                RPM package manager
  23.165 +\& openpkg-rpmbuild(1)           RPM package manager (build only)
  23.166 +\& openpkg-rpm2cpio(1)           RPM payload utility
  23.167 +\& openpkg-rpm-config(1)         RPM C API utility
  23.168 +\& openpkg-lsync(1)              local area synchronization
  23.169 +\& openpkg-rc(1)                 run-command facility
  23.170 +.Ve
  23.171 +.SH "DESCRIPTION"
  23.172 +.IX Header "DESCRIPTION"
  23.173 +OpenPKG is the world leading instrument for deployment and maintenance
  23.174 +of Open Source software when administration crosses Unix platform
  23.175 +boundaries. The OpenPKG project is a collaboration effort with the
  23.176 +goal of creating and maintaining portable and easy to install software
  23.177 +packages for use on the major Unix server platforms.
  23.178 +.PP
  23.179 +The unique OpenPKG architecture leverages proven technologies like
  23.180 +Red Hat Package Manager (\s-1RPM\s0) to establish a unified administration
  23.181 +environment, independent of the underlying operating system. OpenPKG
  23.182 +is completely self-contained and does not even need a preinstallation
  23.183 +of \s-1RPM\s0. Instead, \s-1RPM\s0 is provided as an OpenPKG \s-1RPM\s0 package itself plus
  23.184 +a tricky bootstrapping procedure in order to allow one to create from
  23.185 +scratch the initial state of the whole OpenPKG software packaging
  23.186 +system.
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/openpkg/openpkg.boot	Tue Jan 06 23:40:39 2009 +0100
    24.3 @@ -0,0 +1,621 @@
    24.4 +#!/bin/sh
    24.5 +##
    24.6 +##  openpkg.boot -- OpenPKG bootstrap procedure (look Ma, without hands ;)
    24.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    24.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    24.9 +##
   24.10 +##  Permission to use, copy, modify, and distribute this software for
   24.11 +##  any purpose with or without fee is hereby granted, provided that
   24.12 +##  the above copyright notice and this permission notice appear in all
   24.13 +##  copies.
   24.14 +##
   24.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   24.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   24.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   24.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   24.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   24.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   24.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   24.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   24.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   24.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   24.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24.26 +##  SUCH DAMAGE.
   24.27 +##
   24.28 +
   24.29 +#   This is a very tricky procedure for building the OpenPKG bootstrap
   24.30 +#   package via the RPM specification openpkg.spec, but without
   24.31 +#   requiring that OpenPKG's RPM already exists. For this the
   24.32 +#   openpkg.spec file is manually executed here in order to build
   24.33 +#   OpenPKG RPM the first time (that is, we emulate a sufficient
   24.34 +#   subset of the RPM functionality), followed by a second round over
   24.35 +#   openpkg.spec with the real (and then existing) OpenPKG RPM tool.
   24.36 +#   Also keep in mind that lots of tricks are played here in order to
   24.37 +#   perform all the steps without having to touch the real installation
   24.38 +#   location. That is the whole procedure can (and should) be performed
   24.39 +#   by a non-privileged user and no access to the real installation
   24.40 +#   location filesystem location.
   24.41 +
   24.42 +me="openpkg.boot"
   24.43 +
   24.44 +##
   24.45 +##  command line handling
   24.46 +##
   24.47 +
   24.48 +#   command line parameters (defaults)
   24.49 +help=0
   24.50 +verbose=''
   24.51 +prefix=''
   24.52 +tag=''
   24.53 +usr='';  grp=''
   24.54 +susr=''; sgrp=''
   24.55 +musr=''; mgrp=''
   24.56 +rusr=''; rgrp=''
   24.57 +nusr=''; ngrp=''
   24.58 +suid=''; sgid=''
   24.59 +muid=''; mgid=''
   24.60 +ruid=''; rgid=''
   24.61 +nuid=''; ngid=''
   24.62 +use_tar=''; use_make=''; use_cc=''; use_ar=''; use_ld=''; use_as=''; use_strip=''
   24.63 +bs=0
   24.64 +
   24.65 +#   parse command line options
   24.66 +for opt
   24.67 +do
   24.68 +    case $opt in
   24.69 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   24.70 +           *) arg='' ;;
   24.71 +    esac
   24.72 +    case $opt in
   24.73 +        -h | --help          ) help=1      ;;
   24.74 +        -v | --verbose       ) verbose=v   ;;
   24.75 +        --prefix=*           ) prefix=$arg ;;
   24.76 +        --tag=*              ) tag=$arg    ;;
   24.77 +        --usr=* | --user=*   ) usr=$arg    ;;
   24.78 +        --grp=* | --group=*  ) grp=$arg    ;;
   24.79 +        --susr=*             ) susr=$arg   ;;
   24.80 +        --sgrp=*             ) sgrp=$arg   ;;
   24.81 +        --musr=*             ) musr=$arg   ;;
   24.82 +        --mgrp=*             ) mgrp=$arg   ;;
   24.83 +        --rusr=*             ) rusr=$arg   ;;
   24.84 +        --rgrp=*             ) rgrp=$arg   ;;
   24.85 +        --nusr=*             ) nusr=$arg   ;;
   24.86 +        --ngrp=*             ) ngrp=$arg   ;;
   24.87 +        --suid=*             ) suid=$arg   ;;
   24.88 +        --sgid=*             ) sgid=$arg   ;;
   24.89 +        --muid=*             ) muid=$arg   ;;
   24.90 +        --mgid=*             ) mgid=$arg   ;;
   24.91 +        --ruid=*             ) ruid=$arg   ;;
   24.92 +        --rgid=*             ) rgid=$arg   ;;
   24.93 +        --nuid=*             ) nuid=$arg   ;;
   24.94 +        --ngid=*             ) ngid=$arg   ;;
   24.95 +        --use_tar=*          ) use_tar=$arg   ;;
   24.96 +        --use_make=*         ) use_make=$arg  ;;
   24.97 +        --use_cc=*           ) use_cc=$arg    ;;
   24.98 +        --use_ar=*           ) use_ar=$arg    ;;
   24.99 +        --use_ld=*           ) use_ld=$arg    ;;
  24.100 +        --use_as=*           ) use_as=$arg    ;;
  24.101 +        --use_strip=*        ) use_strip=$arg ;;
  24.102 +        -bs | -s             ) bs=1        ;;
  24.103 +        *                    ) help=1      ;;
  24.104 +    esac
  24.105 +done
  24.106 +if [ ".$bs" = .0 -a ".$prefix" = . ]; then
  24.107 +    help=1
  24.108 +fi
  24.109 +if [ ".$help" = .1 ]; then
  24.110 +    echo "Usage: sh $me" 2>&1
  24.111 +    echo "       [--prefix=<prefix>] [--tag=<str>]" 2>&1
  24.112 +    echo "       [--user=<usr>] [--group=<grp>]" 2>&1
  24.113 +    echo "       [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1
  24.114 +    echo "       [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1
  24.115 +    echo "       [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1
  24.116 +    echo "       [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1
  24.117 +    echo "       [-t|--tar] [-h|--help] [-v|--version]" 2>&1
  24.118 +    exit 1
  24.119 +fi
  24.120 +
  24.121 +#   determine missing parameters
  24.122 +eval `sh aux.usrgrp.sh \
  24.123 +      --usr="$usr" --grp="$grp" \
  24.124 +      --susr="$susr" --sgrp="$sgrp" \
  24.125 +      --musr="$musr" --mgrp="$mgrp" \
  24.126 +      --rusr="$rusr" --rgrp="$rgrp" \
  24.127 +      --nusr="$nusr" --ngrp="$ngrp" \
  24.128 +      --suid="$suid" --sgid="$sgid" \
  24.129 +      --muid="$muid" --mgid="$mgid" \
  24.130 +      --ruid="$ruid" --rgid="$rgid" \
  24.131 +      --nuid="$nuid" --ngid="$ngid"`
  24.132 +
  24.133 +#   canonicalize prefix
  24.134 +prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  24.135 +
  24.136 +#   provide default package tag
  24.137 +if [ ".$tag" = . ]; then
  24.138 +    tag="<loc>"
  24.139 +fi
  24.140 +
  24.141 +##
  24.142 +##  determine package information
  24.143 +##
  24.144 +
  24.145 +name="openpkg"
  24.146 +spec="$name.spec"
  24.147 +version=`grep V_openpkg $spec | sed -e 'q' | awk '{ printf("%s", $3); }'`
  24.148 +release="$version"
  24.149 +
  24.150 +##
  24.151 +##  display headline
  24.152 +##
  24.153 +
  24.154 +sh ./shtool echo -e "%BOpenPKG Bootstrap Procedure%b"
  24.155 +echo "++ bootstrap version: $version-$release"
  24.156 +echo "++ user/group pairs: $susr/$sgrp $musr/$mgrp $rusr/$rgrp $nusr/$ngrp"
  24.157 +
  24.158 +##
  24.159 +##   optionally roll just a bootstrap source package
  24.160 +##
  24.161 +
  24.162 +if [ ".$bs" = .1 ]; then
  24.163 +    srcdir=.
  24.164 +    if [ -d ../../dst ]; then
  24.165 +       dstdir=../../dst/openpkg
  24.166 +    else
  24.167 +       dstdir=.
  24.168 +    fi
  24.169 +    tmpdir="/tmp/$me.$$.d"
  24.170 +    if [ -d ../PKG/SRC ]; then
  24.171 +       pkgdir=../PKG/SRC
  24.172 +    elif [ -d ../PKG ]; then
  24.173 +       pkgdir=../PKG
  24.174 +    elif [ -d ../../PKG/SRC ]; then
  24.175 +       pkgdir=../../PKG/SRC
  24.176 +    elif [ -d ../../PKG ]; then
  24.177 +       pkgdir=../../PKG
  24.178 +    elif [ -d ../../pkg/src ]; then
  24.179 +       pkgdir=../../pkg/src
  24.180 +    elif [ -d ../../pkg ]; then
  24.181 +       pkgdir=../../pkg
  24.182 +    else
  24.183 +       pkgdir=..
  24.184 +    fi
  24.185 +    echo "** rolling source bootstrap package:"
  24.186 +    echo "   $pkgdir/$name-$version-$release.src.sh"
  24.187 +    rm -rf $tmpdir
  24.188 +    mkdir $tmpdir
  24.189 +    ( echo "dstdir=$dstdir"
  24.190 +      echo "srcdir=$srcdir"
  24.191 +      echo "tmpdir=$tmpdir"
  24.192 +      grep '^%define' $spec | sed -e 's:^%define *\([^ ]*\) *\(.*\):\1="\2":'
  24.193 +      grep '^Source' $spec  | sed -e 's;^Source[0-9]*: *;;' -e 's;^.*/;$dstdir/;' \
  24.194 +                                  -e 's;^\([^/]*\)$;$srcdir/\1;' -e 's;%;$;g' \
  24.195 +                                  -e 's;^\(.*\)$;cp \1 $tmpdir/;'
  24.196 +      echo "cp -p $spec $tmpdir/"
  24.197 +    ) >$tmpdir/.sh
  24.198 +    sh $tmpdir/.sh
  24.199 +    rm -f $tmpdir/.sh
  24.200 +    l_version="$release"
  24.201 +    l_release=`sh ./release.sh -r "${l_version}" -F "%t"`
  24.202 +    sed <$srcdir/aux.wrapsrc.sh >$tmpdir/openpkg.boot.tmp \
  24.203 +        -e "s;@l_dir@;$name-$version-$release.src;" \
  24.204 +        -e "s;@l_release@;$l_release;" \
  24.205 +        -e "s;@l_version@;$l_version;"
  24.206 +    echo . | awk '{
  24.207 +        for (i = 0; i < 8192; i++) {
  24.208 +            printf("        ");
  24.209 +        }
  24.210 +    }' >>$tmpdir/openpkg.boot.tmp
  24.211 +    dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \
  24.212 +        of=$pkgdir/$name-$version-$release.src.sh 2>/dev/null
  24.213 +    rm -f $tmpdir/openpkg.boot.tmp
  24.214 +    (cd $tmpdir && tar cf - *) >>$pkgdir/$name-$version-$release.src.sh
  24.215 +    rm -rf $tmpdir
  24.216 +    exit 0
  24.217 +fi
  24.218 +
  24.219 +##
  24.220 +##  determine distribution directory
  24.221 +##
  24.222 +
  24.223 +V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'`
  24.224 +if [ -f "../../dst/openpkg/rpm-${V_rpm}.tar.gz" ]; then
  24.225 +    distdir="`cd ../../dst/openpkg; pwd`" # developer only
  24.226 +else
  24.227 +    distdir="`pwd`"
  24.228 +fi
  24.229 +echo "++ distribution directory: $distdir"
  24.230 +
  24.231 +##
  24.232 +##  perform prerequisite checks
  24.233 +##
  24.234 +
  24.235 +sh ./aux.prereq.sh source || exit $?
  24.236 +
  24.237 +##
  24.238 +##  find reasonable run-time paths and tools
  24.239 +##
  24.240 +
  24.241 +#   find reasonable temporary directory
  24.242 +tmpdir="${TMPDIR-/tmp}"
  24.243 +
  24.244 +#   find reasonable safe program path
  24.245 +test ".$PATH" = . && PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"
  24.246 +for dir in /usr/ccs/bin /usr/xpg4/bin; do
  24.247 +    test -d $dir && PATH="$PATH:$dir"
  24.248 +done
  24.249 +export PATH
  24.250 +
  24.251 +#   make environment at least partly sane
  24.252 +umask 022
  24.253 +unset ls rm mv cp sed grep awk >/dev/null 2>&1 || true
  24.254 +
  24.255 +##
  24.256 +##  execute the spec file manually by emulating
  24.257 +##  the behaviour of the OpenPKG RPM tool.
  24.258 +##
  24.259 +
  24.260 +#   create script prolog
  24.261 +prolog="$tmpdir/openpkg.boot.prolog.sh"
  24.262 +cp /dev/null $prolog
  24.263 +(
  24.264 +  echo "_specdir=`pwd`"
  24.265 +  echo "_sourcedir=$distdir"
  24.266 +  echo "_tmppath=$tmpdir"
  24.267 +  echo "_builddir=$tmpdir"
  24.268 +  echo "l_prefix=$prefix"
  24.269 +  echo "l_tag_fmt=\"$tag\""
  24.270 +  echo "l_buildroot=$tmpdir/$name-$version-root"
  24.271 +  echo "l_susr=$susr"
  24.272 +  echo "l_sgrp=$sgrp"
  24.273 +  echo "l_musr=$musr"
  24.274 +  echo "l_mgrp=$mgrp"
  24.275 +  echo "l_rusr=$rusr"
  24.276 +  echo "l_rgrp=$rgrp"
  24.277 +  echo "l_nusr=$nusr"
  24.278 +  echo "l_ngrp=$ngrp"
  24.279 +  echo "l_suid=$suid"
  24.280 +  echo "l_sgid=$sgid"
  24.281 +  echo "l_muid=$muid"
  24.282 +  echo "l_mgid=$mgid"
  24.283 +  echo "l_ruid=$ruid"
  24.284 +  echo "l_rgid=$rgid"
  24.285 +  echo "l_nuid=$nuid"
  24.286 +  echo "l_ngid=$ngid"
  24.287 +  echo "use_tar=$use_tar"
  24.288 +  echo "use_make=$use_make"
  24.289 +  echo "use_cc=$use_cc"
  24.290 +  echo "use_ar=$use_ar"
  24.291 +  echo "use_ld=$use_ld"
  24.292 +  echo "use_as=$use_as"
  24.293 +  echo "use_strip=$use_strip"
  24.294 +  grep '%define' $spec | \
  24.295 +  sed \
  24.296 +    -e 's:^%define *\([^ ]*\) *\(.*\):\1="\2":'
  24.297 +  grep "^[A-Za-z0-9]*: *" $spec | \
  24.298 +  sed \
  24.299 +    -e 's;^\([A-Za-z0-9]*\): *\(.*\)$;\1="\2";' \
  24.300 +    -e 's;^A;a;' -e 's;^B;b;' -e 's;^C;c;' -e 's;^D;d;' -e 's;^E;e;' \
  24.301 +    -e 's;^F;f;' -e 's;^G;g;' -e 's;^H;h;' -e 's;^I;i;' -e 's;^J;j;' \
  24.302 +    -e 's;^K;k;' -e 's;^L;l;' -e 's;^M;m;' -e 's;^N;n;' -e 's;^O;o;' \
  24.303 +    -e 's;^P;p;' -e 's;^Q;q;' -e 's;^R;r;' -e 's;^S;s;' -e 's;^T;t;' \
  24.304 +    -e 's;^U;u;' -e 's;^V;v;' -e 's;^W;w;' -e 's;^X;x;' -e 's;^Y;y;' \
  24.305 +    -e 's;^Z;z;' -e 's;^buildRoot;buildroot;'
  24.306 +  echo "RPM_BUILD_ROOT=\"%{buildroot}\""
  24.307 +  echo "RPM_BUILD_DIR=\"%{_builddir}\""
  24.308 +  echo "RPM_SOURCE_DIR=\"$distdir\""
  24.309 +  echo "export RPM_BUILD_ROOT"
  24.310 +  echo "export RPM_BUILD_DIR"
  24.311 +  echo "export RPM_SOURCE_DIR"
  24.312 +  echo "set -x"
  24.313 +  echo "umask 022"
  24.314 +  echo "cd \$RPM_BUILD_DIR"
  24.315 +) | sed -e 's;%{\([^}]*\)};${\1};g' >$prolog
  24.316 +
  24.317 +#   install package via RPM spec file by faking a
  24.318 +#   sufficiently enough RPM run-time environment
  24.319 +runscript () {
  24.320 +    step=$1
  24.321 +    script="$tmpdir/openpkg.boot.$step.sh"
  24.322 +    echo ". $prolog" >$script
  24.323 +    sed -e "/^%$step/,/^%/ p" -e 'd' <$spec | \
  24.324 +    sed -e '/^%/d' | \
  24.325 +    sed -e 's;%{SOURCE \([^ ]*\.tar[^ ]*\)};${RPM_DIST_DIR}/\1;g' \
  24.326 +        -e 's;%{SOURCE \([^ ]*\)};${RPM_SOURCE_DIR}/\1;g' | \
  24.327 +    sed -e 's;%{[?]\([^:}]*\):\([^}]*\)};${\1+\2};g' \
  24.328 +        -e 's;%{![?]\([^:}]*\):\([^}]*\)};${\1-\2};g' \
  24.329 +        -e 's;%{[?]\([^:}]*\)};${\1+""};g' \
  24.330 +        -e 's;%{![?]\([^:}]*\)};${\1-""};g' \
  24.331 +        -e 's;%{\([^}]*\)};${\1};g' >>$script
  24.332 +    echo "++ executing(%$step): sh $script"
  24.333 +    sh $script
  24.334 +    if [ $? -ne 0 ]; then
  24.335 +        rm -f $script
  24.336 +        echo "$0:ERROR: script returned non-null value"
  24.337 +        exit 1
  24.338 +    fi
  24.339 +    rm -f $script
  24.340 +}
  24.341 +runscript prep
  24.342 +runscript build
  24.343 +runscript install
  24.344 +
  24.345 +##
  24.346 +##  adjust build environment so that the installed
  24.347 +##  "rpm" is actually useable, although it still resides in
  24.348 +##  the temporary location instead of the real location.
  24.349 +##
  24.350 +
  24.351 +#   suck in prolog in order to get variables from the spec file
  24.352 +cwd=`pwd`
  24.353 +. $prolog
  24.354 +cd $cwd
  24.355 +
  24.356 +#   suck in buildenv script in order to get musr/mgrp
  24.357 +. $tmpdir/openpkg-*/.buildenv
  24.358 +
  24.359 +#   create a custom "rpm" command
  24.360 +echo "++ creating custom RPM command"
  24.361 +rm -f $tmpdir/rpm >/dev/null 2>&1
  24.362 +rmdir $tmpdir/rpm >/dev/null 2>&1
  24.363 +if [ -d "$tmpdir/rpm" ]; then
  24.364 +    echo "$0:ERROR: directory $tmpdir/rpm exists, cannot create file with same name"
  24.365 +    exit 1
  24.366 +fi
  24.367 +if [ -f "$tmpdir/rpm" ]; then
  24.368 +    echo "$0:ERROR: file $tmpdir/rpm exists, cannot override"
  24.369 +    exit 1
  24.370 +fi
  24.371 +( echo "#!/bin/sh"
  24.372 +  echo "exec $RPM_BUILD_ROOT$prefix/lib/openpkg/rpm \\"
  24.373 +  echo "    --rcfile \"$tmpdir/rpm.1\" \\"
  24.374 +  echo "    --define \"__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform\" \\"
  24.375 +  echo "    \"\$@\""
  24.376 +) >$tmpdir/rpm
  24.377 +chmod a+x $tmpdir/rpm
  24.378 +
  24.379 +#   direct our own "rpm" tool to adjusted macro sets
  24.380 +sed <`SOURCE rpmrc` >$tmpdir/rpm.1 \
  24.381 +    -e "s;^\\(macrofiles:\\) .*;\\1 $tmpdir/rpm.2:$tmpdir/rpm.3;"
  24.382 +
  24.383 +#   use an adjusted vendor macro set
  24.384 +sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/macros >$tmpdir/rpm.2 \
  24.385 +    -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g"
  24.386 +
  24.387 +#   override the vendor macro set
  24.388 +sed <`SOURCE rpmmacros` >$tmpdir/rpm.3 \
  24.389 +    -e "s;@SUSR@;$susr;" \
  24.390 +    -e "s;@SGRP@;$sgrp;" \
  24.391 +    -e "s;@MUSR@;$musr;" \
  24.392 +    -e "s;@MGRP@;$mgrp;" \
  24.393 +    -e "s;@RUSR@;$rusr;" \
  24.394 +    -e "s;@RGRP@;$rgrp;" \
  24.395 +    -e "s;@NUSR@;$nusr;" \
  24.396 +    -e "s;@NGRP@;$ngrp;" \
  24.397 +    -e "s;@TAG@;$tag;" \
  24.398 +    -e "s;\\(%{l_prefix}/lib/openpkg/rpmtool\\);%{l_bash} \\1;g" \
  24.399 +    -e "s;@l_prefix_static@;$prefix;g" \
  24.400 +    -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" \
  24.401 +    -e "s;%l_prefix\\([^_]\\);%l_prefix_INTERNAL\\1;g" \
  24.402 +    -e "s;%{l_prefix};%{l_prefix_INTERNAL};g" \
  24.403 +    -e "s;^\\(%_specdir *\\).*;\\1 `pwd`;" \
  24.404 +    -e "s;^\\(%_sourcedir *\\).*;\\1 $distdir;" \
  24.405 +    -e "s;^\\(%_builddir *\\).*;\\1 $tmpdir;" \
  24.406 +    -e "s;^\\(%_tmppath *\\).*;\\1 $tmpdir;" \
  24.407 +    -e "s;^\\(%_buildshell *\\).*;\\1 env -i OPENPKG_BOOT=1 %{l_build_shell_cmd} %{l_build_shell_opt};" \
  24.408 +    -e "s;@l_build_path@;/bin:/sbin:/usr/bin:/usr/sbin;g" \
  24.409 +    -e "s;@l_build_ldlp@;/usr/lib;g" \
  24.410 +    -e "s;@l_build_ulim@;:;g"
  24.411 +echo "%l_prefix $prefix" >>$tmpdir/rpm.3
  24.412 +
  24.413 +#   use an own $HOME/.popt in order to make sure the "rpm"
  24.414 +#   tool is able to execute its sub-tools "rpm<x>".
  24.415 +V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'`
  24.416 +sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/.popt \
  24.417 +    -e "s;^\\(rpm.*exec.*\\)\\(rpm[bdieukvq]*\\);\\1$RPM_BUILD_ROOT$prefix/lib/openpkg/\\2;"
  24.418 +
  24.419 +#   activate the .popt file
  24.420 +HOME=$tmpdir
  24.421 +export HOME
  24.422 +
  24.423 +##
  24.424 +##   now initialize the RPM database under the temporary install location
  24.425 +##
  24.426 +
  24.427 +echo "++ initializing RPM database"
  24.428 +$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \
  24.429 +$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \
  24.430 +    --prefix=$RPM_BUILD_ROOT$prefix \
  24.431 +    --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \
  24.432 +    --rpm=$tmpdir/rpm \
  24.433 +    --build --quiet
  24.434 +
  24.435 +##
  24.436 +##   now turn over and re-iterate over the RPM spec, but this time
  24.437 +##   with the real RPM tool.
  24.438 +##
  24.439 +
  24.440 +echo "++ re-iterating over RPM specification procedures"
  24.441 +$tmpdir/rpm -bb $spec
  24.442 +
  24.443 +##
  24.444 +##   and finally overwrite the installation again, but this time by
  24.445 +##   installing officially through the "rpm" tool. This way we achieve
  24.446 +##   that RPM is remembered as an RPM package in its own database. We
  24.447 +##   just have to make sure the package is relocated while installing.
  24.448 +##   For this we could use --prefix=$RPM_BUILD_ROOT$prefix, but this
  24.449 +##   would create an incorrect filelist for "rpm" in the database.
  24.450 +##   Instead we use the --justdb option which means "rpm" behaves as it
  24.451 +##   would install into the real location, but does not actually install
  24.452 +##   anything. But as a side-effect, the database is now correct.
  24.453 +##
  24.454 +
  24.455 +echo "++ overwriting RPM installation by installing via RPM itself"
  24.456 +$tmpdir/rpm --install --justdb --force --noscripts --notriggers --ignoresize \
  24.457 +    $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm
  24.458 +
  24.459 +##  Puhhhh!!! what a tricky bootstrapping procedure. But now we are
  24.460 +##  mostly finished. All we finally have to do is to roll a bootstrap
  24.461 +##  tarball in addition to the binary RPM and save the stuff in a
  24.462 +##  permanent location.
  24.463 +
  24.464 +v="$version-$release"
  24.465 +t="`$tmpdir/rpm --eval '%{l_platform -p}-%{l_tag}'`"
  24.466 +
  24.467 +#   find a reasonable destination directory for packages
  24.468 +if [ -d ../PKG/BIN ]; then
  24.469 +   dstdir=../PKG/BIN
  24.470 +elif [ -d ../PKG ]; then
  24.471 +   dstdir=../PKG
  24.472 +elif [ -d ../../PKG/BIN ]; then
  24.473 +   dstdir=../../PKG/BIN
  24.474 +elif [ -d ../../PKG ]; then
  24.475 +   dstdir=../../PKG
  24.476 +else
  24.477 +   dstdir=..
  24.478 +fi
  24.479 +
  24.480 +#   create Source-RPM file
  24.481 +echo "++ creating bootstrap source RPM file"
  24.482 +$tmpdir/rpm -bs --nodeps $spec
  24.483 +cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm $dstdir/
  24.484 +rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm
  24.485 +
  24.486 +#   create Binary-RPM file
  24.487 +echo "++ creating bootstrap binary RPM file"
  24.488 +cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm $dstdir/
  24.489 +rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm
  24.490 +
  24.491 +#   create Binary-Bootstrap file
  24.492 +echo "++ creating bootstrap binary shell script"
  24.493 +files=`cat $spec |\
  24.494 +       sed -e '1,/%files/d' -e '/%clean/,$d' |\
  24.495 +       grep -v '^ *$' | grep -v '%defattr' |\
  24.496 +       sed -e 's;%config(noreplace) *;;' -e 's;%config *;;' -e 's;%ghost *;;' -e 's;%attr([^)]*) *;;' \
  24.497 +           -e 's;%dir *;;' -e 's;%{l_prefix}/;;' -e 's;^ *;;' -e "s;%{V_rpm};${V_rpm};"`
  24.498 +db_files=""
  24.499 +for db_file in \
  24.500 +    `$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \
  24.501 +     $RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \
  24.502 +         --prefix=$RPM_BUILD_ROOT$prefix \
  24.503 +         --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \
  24.504 +         --list --quiet`; do
  24.505 +    db_files="$db_files RPM/DB/$db_file"
  24.506 +done
  24.507 +chmod 644 $RPM_BUILD_ROOT$prefix/RPM/DB/*
  24.508 +files="$files $db_files"
  24.509 +( cd $RPM_BUILD_ROOT$prefix
  24.510 +  $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - $files
  24.511 +) | $RPM_BUILD_ROOT$prefix/lib/openpkg/bzip2 -9 \
  24.512 +    >$RPM_BUILD_ROOT$prefix/openpkg.tar.bz2
  24.513 +cp -p $RPM_BUILD_ROOT$prefix/lib/openpkg/tar \
  24.514 +    $RPM_BUILD_ROOT$prefix/openpkg.tar
  24.515 +cp -p $RPM_BUILD_ROOT$prefix/lib/openpkg/bzip2 \
  24.516 +    $RPM_BUILD_ROOT$prefix/openpkg.bzip2
  24.517 +l_platform=`$tmpdir/rpm --eval '%{l_platform -p}'`
  24.518 +l_version=`$tmpdir/rpm -q --qf '%{version}' openpkg`
  24.519 +release_sh=`SOURCE release.sh`
  24.520 +l_release=`sh $release_sh -r "$l_version" -F "%t"`
  24.521 +cat $spec |\
  24.522 +    sed -e "/^%pre$/,/^%/ p" -e 'd' |\
  24.523 +    sed -e '/^%/d' -e 's/^ 	//' |\
  24.524 +    sed -e 's;%{[?]l_\([^:}]*\):\([^}]*\)};${\1+\2};g' \
  24.525 +        -e 's;%{![?]l_\([^:}]*\):\([^}]*\)};${\1-\2};g' \
  24.526 +        -e 's;%{[?]l_\([^:}]*\)};${\1+""};g' \
  24.527 +        -e 's;%{![?]l_\([^:}]*\)};${\1-""};g' \
  24.528 +        -e 's;%{l_\([^}]*\)};${\1};g' \
  24.529 +    >$tmpdir/rpm.pre
  24.530 +cat $spec |\
  24.531 +    sed -e "/^%post$/,/^%/ p" -e 'd' |\
  24.532 +    sed -e '/^%/d' -e 's/^ 	//' |\
  24.533 +    sed -e 's;%{[?]l_\([^:}]*\):\([^}]*\)};${\1+\2};g' \
  24.534 +        -e 's;%{![?]l_\([^:}]*\):\([^}]*\)};${\1-\2};g' \
  24.535 +        -e 's;%{[?]l_\([^:}]*\)};${\1+""};g' \
  24.536 +        -e 's;%{![?]l_\([^:}]*\)};${\1-""};g' \
  24.537 +        -e 's;%{l_\([^}]*\)};${\1};g' \
  24.538 +    >$tmpdir/rpm.post
  24.539 +sed <`SOURCE aux.wrapbin.sh` \
  24.540 +    -e "s;@SUSR@;$susr;" -e "s;@SGRP@;$sgrp;" \
  24.541 +    -e "s;@MUSR@;$musr;" -e "s;@MGRP@;$mgrp;" \
  24.542 +    -e "s;@RUSR@;$rusr;" -e "s;@RGRP@;$rgrp;" \
  24.543 +    -e "s;@NUSR@;$nusr;" -e "s;@NGRP@;$ngrp;" \
  24.544 +    -e "s;@SUID@;$suid;" -e "s;@SGID@;$sgid;" \
  24.545 +    -e "s;@MUID@;$muid;" -e "s;@MGID@;$mgid;" \
  24.546 +    -e "s;@RUID@;$ruid;" -e "s;@RGID@;$rgid;" \
  24.547 +    -e "s;@NUID@;$nuid;" -e "s;@NGID@;$ngid;" \
  24.548 +    -e "s;@l_prefix@;$prefix;" \
  24.549 +    -e "s;@l_platform@;$l_platform;" \
  24.550 +    -e "s;@l_release@;$l_release;" \
  24.551 +    -e "s;@l_version@;$l_version;" \
  24.552 +    -e "/^@PRE@/r $tmpdir/rpm.pre" \
  24.553 +    -e "/^@POST@/r $tmpdir/rpm.post" |\
  24.554 +    sed -e '/^@PRE@/d' -e '/^@POST@/d' >$tmpdir/openpkg.boot.tmp
  24.555 +echo . | awk '{
  24.556 +    for (i = 0; i < 8192; i++) {
  24.557 +        printf("        ");
  24.558 +    }
  24.559 +}' >>$tmpdir/openpkg.boot.tmp
  24.560 +rm -f $dstdir/openpkg-$v.$t.sh
  24.561 +dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \
  24.562 +   of=$dstdir/openpkg-$v.$t.sh 2>/dev/null
  24.563 +rm -f $tmpdir/openpkg.boot.tmp
  24.564 +( cd $RPM_BUILD_ROOT$prefix
  24.565 +  $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - \
  24.566 +      openpkg.tar openpkg.bzip2 openpkg.tar.bz2
  24.567 +) >>$dstdir/openpkg-$v.$t.sh
  24.568 +
  24.569 +#   cleanup
  24.570 +echo "++ cleaning up"
  24.571 +cp `SOURCE rpmtool` $tmpdir/rpmtool
  24.572 +rm -rf $RPM_BUILD_ROOT
  24.573 +rm -rf $tmpdir/$name-$version
  24.574 +rm -f $tmpdir/rpm $tmpdir/rpm.[123] $tmpdir/.popt $tmpdir/rpm.pre $tmpdir/rpm.post
  24.575 +rm -f $prolog
  24.576 +
  24.577 +#   final hint about results
  24.578 +echo "++ resulting OpenPKG bootstrap package files:"
  24.579 +(cd $dstdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm)
  24.580 +set +x
  24.581 +( echo "You have successfully built the OpenPKG Package from scratch"
  24.582 +  echo "for prefix $prefix on target platform $l_platform. The input"
  24.583 +  echo "was the OpenPKG Source Bootstrap Package in file:"
  24.584 +  echo ""
  24.585 +  echo "    openpkg-$v.src.sh"
  24.586 +  echo ""
  24.587 +  echo "The results are the following three files:"
  24.588 +  echo ""
  24.589 +  echo "    openpkg-$v.src.rpm"
  24.590 +  echo "    openpkg-$v.$t.rpm"
  24.591 +  echo "    openpkg-$v.$t.sh"
  24.592 +  echo ""
  24.593 +  echo "The first result file is the OpenPKG Source RPM Package,"
  24.594 +  echo "containing just the same contents than the OpenPKG Source"
  24.595 +  echo "Bootstrap Package, but now in RPM format. Optionally use this"
  24.596 +  echo "after the installation of the OpenPKG Binary Bootstrap Package"
  24.597 +  echo "if you want to rebuild from source again (but then with RPM"
  24.598 +  echo "available)."
  24.599 +  echo ""
  24.600 +  echo "The second result file is the OpenPKG Binary RPM Package,"
  24.601 +  echo "containing the installation files in RPM format for the OpenPKG"
  24.602 +  echo "instance $prefix. Optionally use this after the installation of"
  24.603 +  echo "the OpenPKG Binary Bootstrap Package if you want (usually for"
  24.604 +  echo "fixing something) to reinstall (but then with RPM available)."
  24.605 +  echo ""
  24.606 +  echo "The third result file is the OpenPKG Binary Bootstrap Package,"
  24.607 +  echo "containing the installation files as a self-extracting shell"
  24.608 +  echo "script for the OpenPKG instance $prefix. Use this in YOUR NEXT"
  24.609 +  echo "STEP to initially create the OpenPKG instance from scratch."
  24.610 +  echo "Hence, proceed now by running the following command:"
  24.611 +  echo ""
  24.612 +  cusr=`(id -un) 2>/dev/null ||\
  24.613 +        (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  24.614 +        (whoami) 2>/dev/null ||\
  24.615 +        (who am i | cut "-d " -f1) 2>/dev/null ||\
  24.616 +        echo $LOGNAME`
  24.617 +  if [ ".$musr.$rusr.$nusr" = ".$cusr.$cusr.$cusr" -o ".$cusr" = ".root" ]; then
  24.618 +      echo "    \$ sh openpkg-$v.$t.sh"
  24.619 +  else
  24.620 +      echo "    \$ su root -c \"sh openpkg-$v.$t.sh\""
  24.621 +  fi
  24.622 +) | sh $tmpdir/rpmtool msg -b -t info
  24.623 +rm -f $tmpdir/rpmtool
  24.624 +
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/openpkg/openpkg.com.pgp	Tue Jan 06 23:40:39 2009 +0100
    25.3 @@ -0,0 +1,33 @@
    25.4 +-----BEGIN PGP PUBLIC KEY BLOCK-----
    25.5 +Comment: OpenPKG GmbH <openpkg@openpkg.com>
    25.6 +Comment: http://openpkg.com/openpkg.com.pgp
    25.7 +Comment: gpg-pubkey-61b7ae34-4544a6af
    25.8 +Comment: 7D12 1A8F C05D C18A 4329 E9EF 6704 2EC9 61B7 AE34
    25.9 +
   25.10 +mQGiBEVEpq8RBAD0cBTeK8ukoS5/GlbKbBgs7SkZBMXBvUZkh/qKYqqVtciw9tfj
   25.11 +ifbRmY/ug8AU+BDgFQdoJN5HcM5c0YyQjs1RhstNGm0qQITfF6byh78F/pqdxjOd
   25.12 +MKDMjgYHRPojjH2dElqtH5gFhpuyp12Ueg/wN9g9pk8EjTp9/qvTtv3ZpwCg29Hu
   25.13 +I7CLKuwiXfpTbZTqWerL+ikD/ixPat8L5lnVpz3UFV0Mk8tkDg9odnKtdyRd11WK
   25.14 +PyZ3VL01XTb3E1NQS6jbOycDi8GUwN92QCZ4NRrk7lA0mRtSjtxOhrhdSPgbDIli
   25.15 +s5lHtZzeUKWMSfz8GY5mRs0eCz7zV0VscUW5GpJUKtWiHiOddoNQdcBP5L8JN888
   25.16 +wd3yA/9PGzwK752HMTELlpUExaQoc7HiCkhRNJ8271NknkyrWjVAgLNWvQ/7hTiM
   25.17 +Ns6Pmk7Nlla9hRkorxQ6MB/h7ZmQmLmqJlVcoXe2nAADdD30/p+o9BL15FEei0Ci
   25.18 +o7349iKh1qlieeSM0vmHL5Y2drshZEWSggCPHQHtd5rxWrkXUrQiT3BlblBLRyBH
   25.19 +bWJIIDxvcGVucGtnQG9wZW5wa2cuY29tPohhBBMRAgAhBQJFRKavAhsDBwsJCAcD
   25.20 +AgEEFQIIAwQWAgMBAh4BAheAAAoJEGcELslht640NYcAoL0yn8Ofk+B8cRFTY2CL
   25.21 +j1uIDiM8AKCQieJH/AX1UuQ505cKFGwGtYbVAbkCDQRFRKa3EAgAgXE7Gx0q+OH1
   25.22 +6U2ZDDPsLRe1WwSVaXvS3Ra1ee2Jq4Tu/uja36r8IR/7JfBiG+qGvcrKdIsdNFhh
   25.23 +OL0Dd8O8BwMPAAvzUT35VC29lHzewPHnquSF7X7Q8Xsr+mwGLHPS8brX56XWmWtf
   25.24 +1L1Ulx+KbcM/d/B+vssxSB3FsIvK+C666wiX4oZWbxcA3sC66Jxs1tuo1jWDxcGD
   25.25 +hb63FMdWsZODBNOqlKrOCfT/PMaKVftG5lpKFd6H60pIbx0OagqnFML6FeHGy1O7
   25.26 +PkghOgbX+NfuH30dJKFYdwpZEcsaSTI9vedcjg2SL9frQyW8QIrK5zbCZFD9lPXP
   25.27 +Cl+XM0APGwADBgf/Yjj0IUSNJ4kYq1/Ofa+TvC4hVRpvQAHq+81LoN+XDXerAtmc
   25.28 +okr3fgHqMJypVfnGt5p+q9LvyCyKThOIOcvRfPeN49vnbdgIgJADmOmGQ35naF4Y
   25.29 +6LIuqgugVr16hMJqJn3vZXdJptt0am2oZyy0lpOGOlm5A7nwpJcD08ywOfcWXPrX
   25.30 +ybv08mjl8WMAZZdwdP/WStw3sDmsBl8dMPoAGnbTzzu2TeNC1W0373lonj6cdkgl
   25.31 +G3q6OnePsCah7GCyO8qDzyJbXvKD99i8/Uowuo4hi14Mj6fvyQbIUvJ5+djSAeqb
   25.32 +WNgBsmm9u3NlF0aFU799viLKo4dRYdhMLcLJx4hJBBgRAgAJBQJFRKa3AhsMAAoJ
   25.33 +EGcELslht640GDcAn3r5Zyaey8Gd/X3/9ZoZ3KfTIt0nAKC/E5yRwNfdwBWvEN4h
   25.34 +iGriXwS53Q==
   25.35 +=txp0
   25.36 +-----END PGP PUBLIC KEY BLOCK-----
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/openpkg/openpkg.net.pgp	Tue Jan 06 23:40:39 2009 +0100
    26.3 @@ -0,0 +1,33 @@
    26.4 +-----BEGIN PGP PUBLIC KEY BLOCK-----
    26.5 +Comment: OpenPKG Foundation e.V. <openpkg@openpkg.net>
    26.6 +Comment: http://openpkg.net/openpkg.net.pgp
    26.7 +Comment: gpg-pubkey-52197903-4544a74d
    26.8 +Comment: 3BD1 0E11 71B2 2598 D770 8C48 AEBE 7645 5219 7903
    26.9 +
   26.10 +mQGiBEVEp00RBACdhq0jQoj4k1oOVCvWAT8frZYQ0GNOFeTyFeSZOq44nd0igYSr
   26.11 +G53mRYW35BjNoR3MRS1gP97bzQdxIIM6N/zmAAgWA6lxLYiNeguaXoen2IEQMEPe
   26.12 +zSn/TtBezh5J05eHwaPdaWBRbSQL0DCJzRSkM42OrWqWElVHepWZRgeztwCgthii
   26.13 +quz+EfoHMBADvl+ddA9BZt8D/Ao9cRMZyoyBbFZ570bxffbXuhT/Wkm/kabXJGbN
   26.14 +EiW5XnIU9djbsSsOO3zkVzAcQc/cCRu8QXXsiOGIVTt2aWPtWoNaqR4wJ7opAPjs
   26.15 +l1CQSFhY6cRy8AfaMWON1y/7mUPKgUJJp/3lrA0CocNTAV4t0uFdE6kiC5SgZBvt
   26.16 +QGz7A/wPt+VBcVQcnMCfEoTEOOOADMPKgtgVXbcpu50jLo/4VLqq8o+yu9Co5Lhg
   26.17 +pMhYZCRLDpfz/CUxqoeGz0ueRbcJTn5Q10IqU3V29xPp2ggJ9+e+UW1kb3O1Xq1e
   26.18 +q+/YtuaHkYFy013W1PJtBIMB4gzAhPwc4rmSvdgrEk3Bfzdcl7QtT3BlblBLRyBG
   26.19 +b3VuZGF0aW9uIGUuVi4gPG9wZW5wa2dAb3BlbnBrZy5uZXQ+iGEEExECACEFAkVE
   26.20 +p00CGwMHCwkIBwMCAQQVAggDBBYCAwECHgECF4AACgkQrr52RVIZeQOHwACeNKFH
   26.21 +CvxATT5o+j7Nwurp7N5y5QoAn0tR7/ArhfESFf8szFRF55TITYk2uQINBEVEp18Q
   26.22 +CADkoUfhKNEe1CAoCXSkjmxX6zvKuqmSDBapd6Op5N01NcKQR8m4hn82LA0XAvmY
   26.23 +JXBmx5pvfK3qsOisZ5JxXsNFTZ07FVOqPqyVijrzturEc104Vbf675IjDfkBNqkv
   26.24 +r6AwIMrx/G6BrnUtAZQq9bjGFc7UX4blYw42QznvRM7cWqbsk/8qJ6AtmPVdLzsO
   26.25 +TGh4qFqqlxdD+K1fNsK7OZYoy8jjbsGNYDHRLeCSSvdKUVf1M8CO3Z3jlmzCYqPx
   26.26 +RMvzWjneC5cOGUpyPBIsWtsSic2tF7d/WW7CZtzdbOTCKj2pyZUtcBWFPgRFDaCr
   26.27 +l4ROZ83otv18aTCN7gqjoWH3AAMFB/9grTw4qLVntC115aFFwUks+IQ2DgNbAWK0
   26.28 +Hxb3GmV21STbKPu+C98JB1ubCuT65LiqkELt/ZopgxXLKRhsSJkT2fJ/UtLINs+p
   26.29 +3kS+O+NcGcp8TWnQTM+8UfNv6cL/px9AivpfvAJW+6CFmWACOJymZQ1Nfym7rgpD
   26.30 +t/p/nMlU2w9BdYeF2E3vgdH0GLVdJnS5IV7gb4nFXn9yTNcFnKivbCI3zUP0c7dW
   26.31 +7sm6nuwg0erZvXgkw9Rwf9qYTARzYGIBxrjoPqc8zvhKcKmKo8tAGw+tVkqqFnlw
   26.32 +M53Fhyla+jA+Ck2do3qCzLz55p6xTIn5Dd6zhjP8nmiRyOh8RWjmiEkEGBECAAkF
   26.33 +AkVEp18CGwwACgkQrr52RVIZeQNX0ACfRZrb8BrnwFD0IBAaeDVxH22HNx4An0Wc
   26.34 +tcWorS8jCruV8lP/4tfKEJoT
   26.35 +=WOpb
   26.36 +-----END PGP PUBLIC KEY BLOCK-----
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/openpkg/openpkg.org.pgp	Tue Jan 06 23:40:39 2009 +0100
    27.3 @@ -0,0 +1,32 @@
    27.4 +-----BEGIN PGP PUBLIC KEY BLOCK-----
    27.5 +Comment: OpenPKG <openpkg@openpkg.org>
    27.6 +Comment: http://openpkg.org/openpkg.org.pgp
    27.7 +Comment: gpg-pubkey-63c4cb9f-3c591eda
    27.8 +Comment: 6D96 EFCF CF75 3288 10DB 40C2 8075 93E0 63C4 CB9F
    27.9 +
   27.10 +mQGiBDxZHtoRBADCER9+ncfA7yi5ZyCrgmQwbPjvdAPFnVrUVIiFcvBH5qWpoVOG
   27.11 +l3BG+fI2DZEO07Lz9Z/IHTE9iTgrV9Dh278oZuK+UW7jBovByjHCJd875diSU7Od
   27.12 +SaujLBnvDRbAfcgG/kRJI5G8Pmfd39RViQBdw1MZ5ZnHoM810peUv3RLawCg+msN
   27.13 +ORnJ7JHnEpnrhxOQ1S1cBSMD/0skJcwYn4ORXBCUSpBqzk2Haoch7Eko//H3fQqT
   27.14 +gA/SVGxcMteFCtoqHbowsfHdeNOyEkjf4umcdJo9Yiwk65oHGwBuvqhsTpQ7mzRq
   27.15 +dLVAFlpU8pecMfT3ZWCnB+7UfFIzZYemu1RbX5Hn9/kmK9kvu1djmqL+XMlhtS66
   27.16 +4XH5A/4q7EdCHgrskxViW2MYfINkfWxwYaHv/9UsnmFQXb6Lm6FfU9icNaYieRv1
   27.17 +yJTAOo+G7m+JEXnXJPv2wiVs0xzI0Ni0WWJo/ILihFGxwma7+auICUYmncnimWkl
   27.18 +cWAMEspKb439f1j6X3ABQNXsf1li+w3ro7yjpaI2gr5fGX1UU7QdT3BlblBLRyA8
   27.19 +b3BlbnBrZ0BvcGVucGtnLm9yZz6IVwQTEQIAFwUCPFke2gULBwoDBAMVAwIDFgIB
   27.20 +AheAAAoJEIB1k+BjxMufXz8An0zGGFWZlQWMumfQ9GX16GNRh5MoAKCqw7xmuDN5
   27.21 +jWVoSUiDOJlRf3LVL7kCDQQ8WR7iEAgApQrOX0sAWmlKNAwyxUyNbmgBnyqSIcI+
   27.22 +d8u81kuuOEPpEsiPOG5YI/Bc5osrTGT2q4hdTX9nETqXXRGe+Hu0czHADMS5stPJ
   27.23 +bSlBVg4VaiKkSTElssiNLNMWPb51UTP/mPYOa7zOhkhXrg49WnvizNBZdurGoLpr
   27.24 +YDBIo7XW1k8QwJe43xn/GWO8pwTMDr/UUfEPZcSOqdWpkXB9OzPNiq3S+Armnv81
   27.25 +FakrGCmRWDq4AWtmy2AVpQlcrkG0tQVq0QhFvz8yZ1lKbilrwEIYIEp56wF4k7D9
   27.26 +t0Vpbi2RhbD/dcfgDN7E+DmEL4VHXBXIz63fnH4duebLTRLV7Qj+ewADBQf/Us7j
   27.27 +pY8n6jidAE3PtSy3rB+pN2+tzMtov6A+Zx2GHRefM9AwDLe6PRgJTVVQE9WTreuY
   27.28 +N33y3hf1PvYVBqhxAr031QqCHh1QdvrCJS0qUZk90it3EXUgAyRkD6vJobnsTkqH
   27.29 +aO1Ndqx8hQFYjpC5Fh3QVNKz4uACwjWPKTkRdihR5clfqIcZ9Mor8A3FBlYA7C8w
   27.30 ++O08uA+OTOmz9CrQlpwRUqaOKRepatv+MMYC4L/CtZEYUvc+fzm3XUYjolZGQiJQ
   27.31 +T4Kr1XC4sIy22V/oB3dWaJtAbHiTnEmuccn0Q8cOO+K1pZPlTjRjx0E9ZEoy4AXc
   27.32 +ataTO6Zyzcp2OkHyAYhGBBgRAgAGBQI8WR7iAAoJEIB1k+BjxMufQCwAoMk2qYPz
   27.33 +k/zbdWHw3BNDlsgo3iUCAJ9uDTvjgw87W5VP02WcgqtZzfLPhQ==
   27.34 +=vXJp
   27.35 +-----END PGP PUBLIC KEY BLOCK-----
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/openpkg/openpkg.pod	Tue Jan 06 23:40:39 2009 +0100
    28.3 @@ -0,0 +1,86 @@
    28.4 +##
    28.5 +##  openpkg -- OpenPKG Tool Chain
    28.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    28.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    28.8 +##
    28.9 +##  Permission to use, copy, modify, and distribute this software for
   28.10 +##  any purpose with or without fee is hereby granted, provided that
   28.11 +##  the above copyright notice and this permission notice appear in all
   28.12 +##  copies.
   28.13 +##
   28.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   28.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   28.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   28.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   28.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   28.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   28.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   28.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   28.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   28.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   28.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28.25 +##  SUCH DAMAGE.
   28.26 +##
   28.27 +##  openpkg.pod: Minimum Execution Frontend (Language: Perl POD)
   28.28 +##
   28.29 +
   28.30 +=pod
   28.31 +
   28.32 +=head1 NAME
   28.33 +
   28.34 +B<OpenPKG> -- Cross-Platform Unix Software Packaging Facility
   28.35 +
   28.36 +=head1 SYNOPSIS
   28.37 +
   28.38 +=over 4
   28.39 +
   28.40 +=item Command Line Interface
   28.41 +
   28.42 +$ B<openpkg> [I<opt> ...] I<cmd> [I<cmd_opt> ...] [I<cmd_arg> ...]
   28.43 +
   28.44 +$ B<openpkg> B<man> I<cmd>
   28.45 +
   28.46 +=item Project Locations
   28.47 +
   28.48 + http://www.openpkg.org/       web service
   28.49 + http://cvs.openpkg.org/       repository service
   28.50 + http://pgp.openpkg.org/       OpenPGP service
   28.51 + ftp://ftp.openpkg.org/        download service
   28.52 +
   28.53 +=item Project Forums
   28.54 +
   28.55 + petidomo@openpkg.org          mailing-list manager
   28.56 + openpkg-announce@openpkg.org  project announcements
   28.57 + openpkg-dev@openpkg.org       developer forum
   28.58 + openpkg-users@openpkg.org     users forum
   28.59 +
   28.60 +=item Local Documentation
   28.61 +
   28.62 + openpkg-rpm(1)                RPM package manager
   28.63 + openpkg-rpmbuild(1)           RPM package manager (build only)
   28.64 + openpkg-rpm2cpio(1)           RPM payload utility
   28.65 + openpkg-rpm-config(1)         RPM C API utility
   28.66 + openpkg-lsync(1)              local area synchronization
   28.67 + openpkg-rc(1)                 run-command facility
   28.68 +
   28.69 +=back
   28.70 +
   28.71 +=head1 DESCRIPTION
   28.72 +  
   28.73 +OpenPKG is the world leading instrument for deployment and maintenance
   28.74 +of Open Source software when administration crosses Unix platform
   28.75 +boundaries. The OpenPKG project is a collaboration effort with the
   28.76 +goal of creating and maintaining portable and easy to install software
   28.77 +packages for use on the major Unix server platforms.
   28.78 +
   28.79 +The unique OpenPKG architecture leverages proven technologies like
   28.80 +Red Hat Package Manager (RPM) to establish a unified administration
   28.81 +environment, independent of the underlying operating system. OpenPKG
   28.82 +is completely self-contained and does not even need a preinstallation
   28.83 +of RPM. Instead, RPM is provided as an OpenPKG RPM package itself plus
   28.84 +a tricky bootstrapping procedure in order to allow one to create from
   28.85 +scratch the initial state of the whole OpenPKG software packaging
   28.86 +system.
   28.87 +
   28.88 +=cut
   28.89 +
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/openpkg/openpkg.sh	Tue Jan 06 23:40:39 2009 +0100
    29.3 @@ -0,0 +1,299 @@
    29.4 +#!@l_prefix@/lib/openpkg/bash
    29.5 +##
    29.6 +##  openpkg -- OpenPKG Tool Chain
    29.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    29.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    29.9 +##
   29.10 +##  Permission to use, copy, modify, and distribute this software for
   29.11 +##  any purpose with or without fee is hereby granted, provided that
   29.12 +##  the above copyright notice and this permission notice appear in all
   29.13 +##  copies.
   29.14 +##
   29.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   29.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   29.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   29.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   29.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   29.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   29.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   29.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   29.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   29.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   29.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29.26 +##  SUCH DAMAGE.
   29.27 +##
   29.28 +##  openpkg.sh: Execution Frontend (Language: Bourne-Shell)
   29.29 +##
   29.30 +
   29.31 +##
   29.32 +##  command line parsing
   29.33 +##
   29.34 +
   29.35 +#   command line options defaults
   29.36 +opt_prefix=""
   29.37 +opt_tools=""
   29.38 +opt_version=no
   29.39 +opt_help=no
   29.40 +
   29.41 +#   process command line options by iterating over arguments
   29.42 +for opt
   29.43 +do
   29.44 +    case "${opt}" in
   29.45 +        -*=*) arg=`echo "${opt}" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   29.46 +           *) arg='' ;;
   29.47 +    esac
   29.48 +    case "${opt}" in
   29.49 +        -v|--version ) opt_version=yes;     shift ;;
   29.50 +        -h|--help    ) opt_help=yes;        shift ;;
   29.51 +        --prefix=*   ) opt_prefix="${arg}"; shift ;;
   29.52 +        --tools=*    ) opt_tools="${arg}";  shift ;;
   29.53 +        -* ) echo "openpkg:ERROR: Invalid command-line option \"${opt}\"." 1>&2
   29.54 +             echo "openpkg:ERROR: Run \"${0} --help\" for list of valid options" 1>&2; exit 1 ;;
   29.55 +        *  ) break ;;
   29.56 +    esac
   29.57 +done
   29.58 +
   29.59 +##
   29.60 +##  determine OpenPKG locations
   29.61 +##
   29.62 +
   29.63 +#   determine path to OpenPKG instance
   29.64 +openpkg_prefix="@l_prefix@"
   29.65 +if [ ".${OPENPKG_PREFIX}" != . ]; then
   29.66 +    openpkg_prefix="${OPENPKG_PREFIX}"
   29.67 +fi
   29.68 +if [ ".${opt_prefix}" != . ]; then
   29.69 +    openpkg_prefix="${opt_prefix}"
   29.70 +fi
   29.71 +if [ -x "${openpkg_prefix}/bin/openpkg" -a -x "${openpkg_prefix}/libexec/openpkg/rpm" ]; then
   29.72 +    #   OpenPKG 2.0 and higher
   29.73 +    true
   29.74 +elif [ -f "${openpkg_prefix}/bin/rpm" -a -x "${openpkg_prefix}/lib/openpkg/rpm" ]; then
   29.75 +    #   OpenPKG 1.x
   29.76 +    echo "openpkg:ERROR: OpenPKG 1.x instance found under \"${openpkg_prefix}\" (not supported)" 1>&2
   29.77 +    exit 1
   29.78 +else
   29.79 +    echo "openpkg:ERROR: no OpenPKG instance found under \"${openpkg_prefix}\"" 1>&2
   29.80 +    exit 1
   29.81 +fi
   29.82 +
   29.83 +#   allow convenient all-in-one specification of OpenPKG Tool Chain locations
   29.84 +#   (assuming the filesystem layout of an uninstalled OpenPKG Tool Chain)
   29.85 +openpkg_tools="${OPENPKG_TOOLS}"
   29.86 +openpkg_tools_cmdpath="${OPENPKG_TOOLS_CMDPATH}"
   29.87 +openpkg_tools_apipath="${OPENPKG_TOOLS_APIPATH}"
   29.88 +if [ ".${opt_tool}" != . ]; then
   29.89 +    openpkg_tools="${opt_tools}"
   29.90 +fi
   29.91 +if [ ".${openpkg_tools}" != . -a ".${openpkg_tools_cmdpath}" = . ]; then
   29.92 +    openpkg_tools_cmdpath="${openpkg_tools}/cmd:@"
   29.93 +fi
   29.94 +if [ ".${openpkg_tools}" != . -a ".${openpkg_tools_apipath}" = . ]; then
   29.95 +    openpkg_tools_apipath="${openpkg_tools}/api:@"
   29.96 +fi
   29.97 +
   29.98 +#   determine path to OpenPKG Tool Chain commands
   29.99 +cmdpath="${openpkg_prefix}/libexec/openpkg"
  29.100 +if [ -d "${openpkg_prefix}/libexec/openpkg-tools" ]; then
  29.101 +    #   openpkg-tools package overrides
  29.102 +    cmdpath="${openpkg_prefix}/libexec/openpkg-tools:${cmdpath}"
  29.103 +fi
  29.104 +if [ -d "${openpkg_prefix}/libexec/openpkg-audit" ]; then
  29.105 +    #   openpkg-audit package overrides
  29.106 +    cmdpath="${openpkg_prefix}/libexec/openpkg-audit:${cmdpath}"
  29.107 +fi
  29.108 +if [ ".${openpkg_tools_cmdpath}" != . ]; then
  29.109 +    #   user supplied path overrides
  29.110 +    cmdpath=`echo "${openpkg_tools_cmdpath}" | sed -e "s;@;${cmdpath};"`
  29.111 +fi
  29.112 +openpkg_tools_cmdpath=`echo "${cmdpath}" | sed -e 's/::/:/g' -e 's/^://' -e 's/:$//'`
  29.113 +
  29.114 +#   determine path to OpenPKG Tool Chain API
  29.115 +apipath=""
  29.116 +if [ -d "${openpkg_prefix}/lib/openpkg-tools" ]; then
  29.117 +    #   openpkg-tools package overrides
  29.118 +    apipath="${openpkg_prefix}/lib/openpkg-tools:${apipath}"
  29.119 +fi
  29.120 +if [ ".${openpkg_tools_apipath}" != . ]; then
  29.121 +    #   user supplied path overrides
  29.122 +    apipath=`echo "${openpkg_tools_apipath}" | sed -e "s;@;${apipath};"`
  29.123 +fi
  29.124 +openpkg_tools_apipath=`echo "${apipath}" | sed -e 's/::/:/g' -e 's/^://' -e 's/:$//'`
  29.125 +
  29.126 +##
  29.127 +##  execute stand-alone option commands in advance
  29.128 +##
  29.129 +
  29.130 +#   implement stand-alone "--help" option
  29.131 +if [ ".${opt_help}" = .yes ]; then
  29.132 +    release=`${openpkg_prefix}/libexec/openpkg/rpm --eval '%{l_openpkg_release}'`
  29.133 +    echo ""
  29.134 +    echo "This is ${release} <http://www.openpkg.org/>"
  29.135 +    echo "Cross-Platform Unix Software Packaging Facility"
  29.136 +    echo ""
  29.137 +    echo "Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>"
  29.138 +    echo "Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>"
  29.139 +    echo ""
  29.140 +    echo "The command \"${openpkg_prefix}/bin/openpkg\" is the official command-line"
  29.141 +    echo "execution frontend of the OpenPKG tool chain. Its usage is:"
  29.142 +    echo ""
  29.143 +    echo "  \$ ${openpkg_prefix}/bin/openpkg [<option> ...] \\"
  29.144 +    echo "     <command> [<command-option> ...] [<command-argument> ...]"
  29.145 +    echo ""
  29.146 +    echo "where <option> is one of the following global options:"
  29.147 +    echo "  -p, --prefix    sets the OpenPKG instance prefix   (also: \${OPENPKG_PREFIX})"
  29.148 +    echo "  -t, --tools     sets the OpenPKG tool chain prefix (also: \${OPENPKG_TOOLS})"
  29.149 +    echo "  -v, --version   display OpenPKG version/release"
  29.150 +    echo "  -h, --help      display this usage help message"
  29.151 +    echo ""
  29.152 +    echo "where <command> is one of the following commands:"
  29.153 +    echo "  rpm             (provided by bootstrap package)"
  29.154 +    echo "  rpmbuild        (provided by bootstrap package)"
  29.155 +    echo "  rpm2cpio        (provided by bootstrap package)"
  29.156 +    echo "  rpm-config      (provided by bootstrap package)"
  29.157 +    echo "  uuid            (provided by bootstrap package)"
  29.158 +    echo "  rc              (provided by bootstrap package)"
  29.159 +    echo "  lsync           (provided by bootstrap package)"
  29.160 +    echo "  man             (provided by bootstrap package)"
  29.161 +    #   install command intentionally left out in above display!
  29.162 +
  29.163 +    #   dynamically figure out add-on commands
  29.164 +    for cmd in rpm rpmbuild rpm2cpio rpm-config uuid rc lsync man install; do
  29.165 +        id=`echo "${cmd}" | sed -e 's/-/_/g'`
  29.166 +        eval "__cmd_seen_${id}=yes"
  29.167 +    done
  29.168 +    OIFS="${IFS}"; IFS=":"
  29.169 +    for dir in ${openpkg_tools_cmdpath}; do
  29.170 +        IFS="${OIFS}"
  29.171 +        if [ ! -d ${dir} ]; then
  29.172 +            continue
  29.173 +        fi
  29.174 +        for cmd in `cd ${dir} 2>/dev/null && echo *`; do
  29.175 +            name=`echo "${cmd}" | sed -e 's/\.sh$//' -e 's/\.pl$//' \
  29.176 +                 -e 's/^/X/' -e 's/^X\([a-z][a-zA-Z0-9_-]*\)$/\1/' -e 's/^X.*$//'`
  29.177 +            if [ ".${name}" != . ]; then
  29.178 +                if [ -f ${dir}/${cmd} ]; then
  29.179 +                    id=`echo "${name}" | sed -e 's/-/_/g'`
  29.180 +                    eval "seen=\$__cmd_seen_${id}"
  29.181 +                    if [ ".${seen}" != .yes ]; then
  29.182 +                        echo "${name}" | awk '{ printf("  %-15s (provided by add-on package)\n", $0); }'
  29.183 +                        eval "__cmd_seen_${id}=yes"
  29.184 +                    fi
  29.185 +                fi
  29.186 +            fi
  29.187 +        done
  29.188 +    done
  29.189 +    IFS="${OIFS}"
  29.190 +    echo ""
  29.191 +    echo "where <command-option> and <command-argument> are <command> specific"
  29.192 +    echo "options and arguments. Run \"${openpkg_prefix}/bin/openpkg <command> --help\""
  29.193 +    echo "and \"${openpkg_prefix}/bin/openpkg man <command>\" for more details."
  29.194 +    echo ""
  29.195 +    exit 0
  29.196 +fi
  29.197 +
  29.198 +#   implement stand-alone "--version" option
  29.199 +if [ ".${opt_version}" = .yes ]; then
  29.200 +    release=`${openpkg_prefix}/libexec/openpkg/rpm --eval '%{l_openpkg_release}'`
  29.201 +    version=`${openpkg_prefix}/libexec/openpkg/rpm -q --qf '%{version}' openpkg`
  29.202 +    echo "${release} (${version})"
  29.203 +    exit 0
  29.204 +fi
  29.205 +
  29.206 +##
  29.207 +##  determine command details and execute command appropriately
  29.208 +##
  29.209 +
  29.210 +#   command line sanity check
  29.211 +if [ ${#} -eq 0 ]; then
  29.212 +    echo "openpkg:ERROR: Invalid command-line arguments." 1>&2
  29.213 +    echo "openpkg:ERROR: Run \"${openpkg_prefix}/bin/openpkg --help\" for list of valid arguments." 1>&2
  29.214 +    exit 1
  29.215 +fi
  29.216 +
  29.217 +#   search command by iterating over all command directories
  29.218 +cmd="${1}"
  29.219 +shift
  29.220 +cmd_path=""
  29.221 +cmd_shell=""
  29.222 +cmd_stack="${OPENPKG_TOOLS_CMDSTACK}"
  29.223 +OIFS="${IFS}"; IFS=":"
  29.224 +for dir in ${openpkg_tools_cmdpath}; do
  29.225 +    IFS="${OIFS}"
  29.226 +
  29.227 +    #   skip (currently) not existing directory
  29.228 +    if [ ! -d ${dir} ]; then
  29.229 +        continue
  29.230 +    fi
  29.231 +
  29.232 +    #   check for various command implementations
  29.233 +    if [ -x ${dir}/${cmd} ]; then
  29.234 +        #   found executable stand-alone binary
  29.235 +        cmd_path="${dir}/${cmd}"
  29.236 +        cmd_shell=""
  29.237 +    elif [ -f ${dir}/${cmd}.sh ]; then
  29.238 +        #   found non-executable Bourne-Shell script
  29.239 +        cmd_path="${dir}/${cmd}.sh"
  29.240 +        cmd_shell="${openpkg_prefix}/lib/openpkg/bash"
  29.241 +    elif [ -f ${dir}/${cmd}.pl ]; then
  29.242 +        #   found non-executable Perl script
  29.243 +        cmd_path="${dir}/${cmd}.pl"
  29.244 +        if [ -x ${openpkg_prefix}/bin/perl ]; then
  29.245 +            cmd_shell="${openpkg_prefix}/bin/perl"
  29.246 +        else
  29.247 +            cmd_shell=`${openpkg_prefix}/lib/openpkg/shtool path -p "$PATH:$openpkg_prefix/lib/openpkg" -m perl 2>&1`
  29.248 +            if [ ".${cmd_shell}" = . ]; then
  29.249 +                echo "openpkg:ERROR: No Perl interpreter found in \${PATH}" 1>&2
  29.250 +                exit 1
  29.251 +            fi
  29.252 +        fi
  29.253 +        #   provide Perl module include path(s) to API
  29.254 +        OIFS="${IFS}"; IFS=":"
  29.255 +        for dir2 in ${openpkg_tools_apipath}; do
  29.256 +            IFS="${OIFS}"
  29.257 +            if [ ! -d ${dir2} ]; then
  29.258 +                continue
  29.259 +            fi
  29.260 +            cmd_shell="${cmd_shell} -I${dir2}"
  29.261 +        done
  29.262 +        IFS="${OIFS}"
  29.263 +    else
  29.264 +        #   command not found, continue searching
  29.265 +        continue
  29.266 +    fi
  29.267 +
  29.268 +    #   check whether to use this found command or to continue searching
  29.269 +    #   for next command implementation in sequence (in order to support
  29.270 +    #   flexible nested command wrapping)
  29.271 +    cmd_last=`echo "${cmd_stack}" | sed -e 's;:.*$;;'`
  29.272 +    if [ ".${cmd_last}" = ".${cmd}" ]; then
  29.273 +        #   we were last command on stack, so pop us from call
  29.274 +        #   stack and continue searching for next implementation
  29.275 +        cmd_stack=`echo "${cmd_stack}" | sed -e 's;^[^:][^:]*:*;;'`
  29.276 +        continue
  29.277 +    else
  29.278 +        #   last command on stack was different, so stop
  29.279 +        #   searching because we found the implementation
  29.280 +        break
  29.281 +    fi
  29.282 +done
  29.283 +IFS="${OIFS}"
  29.284 +
  29.285 +#   sanity check search result
  29.286 +if [ ".${cmd_path}" = . ]; then
  29.287 +    echo "openpkg:ERROR: No such command \"${cmd}\" found in command path" 1>&2
  29.288 +    echo "openpkg:ERROR: (${openpkg_tools_cmdpath})." 1>&2
  29.289 +    echo "openpkg:ERROR: Set \${OPENPKG_TOOLS_CMDPATH} appropriately." 1>&2
  29.290 +    echo "openpkg:ERROR: Run \"${openpkg_prefix}/bin/openpkg --help\" for list of valid commands." 1>&2
  29.291 +    exit 1
  29.292 +fi
  29.293 +
  29.294 +#   export essential run-time information to command
  29.295 +export OPENPKG_PREFIX="$openpkg_prefix"
  29.296 +export OPENPKG_TOOLS_CMDPROG="${0}"
  29.297 +export OPENPKG_TOOLS_CMDNAME="${cmd}"
  29.298 +export OPENPKG_TOOLS_CMDSTACK=`echo "${OPENPKG_TOOLS_CMDSTACK}" | sed -e 's;^\(.\);:\1;' -e "s;^;${cmd};"`
  29.299 +
  29.300 +#   execute command
  29.301 +eval "exec ${cmd_shell} ${cmd_path} \${1+\"\$@\"}"
  29.302 +
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/openpkg/openpkg.spec	Tue Jan 06 23:40:39 2009 +0100
    30.3 @@ -0,0 +1,2827 @@
    30.4 +##
    30.5 +##  openpkg.spec -- OpenPKG RPM Package Specification
    30.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    30.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    30.8 +##
    30.9 +##  Permission to use, copy, modify, and distribute this software for
   30.10 +##  any purpose with or without fee is hereby granted, provided that
   30.11 +##  the above copyright notice and this permission notice appear in all
   30.12 +##  copies.
   30.13 +##
   30.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   30.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   30.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   30.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   30.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   30.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   30.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   30.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   30.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   30.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   30.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30.25 +##  SUCH DAMAGE.
   30.26 +##
   30.27 +
   30.28 +#   NOTICE: This OpenPKG RPM specification is _very_ special, because
   30.29 +#   it is used both for bootstrapping OpenPKG with its OpenPKG RPM and
   30.30 +#   for regular builds of OpenPKG RPM in order to upgrade an existing
   30.31 +#   installation. For this it has to interact correctly with the
   30.32 +#   "openpkg.boot" script. See the documentation in the file "README"
   30.33 +#   and the source of the companion script "openpkg.boot" for details,
   30.34 +#   but do not touch anything here until you are 100% sure about what
   30.35 +#   you are doing. In short: This script is allowed to use only a very
   30.36 +#   restricted subset of the OpenPKG RPM functionality!
   30.37 +
   30.38 +#   BUILD REQUIREMENTS:
   30.39 +#   o any sh(1)
   30.40 +#   o any tar(1)
   30.41 +#   o any make(1)
   30.42 +#   o any cc(1)
   30.43 +
   30.44 +#   the package version/release
   30.45 +%define       V_openpkg  20071227
   30.46 +
   30.47 +#   the used software versions
   30.48 +%define       V_rpm      4.2.1
   30.49 +%define       V_zlib     1.2.3
   30.50 +%define       V_bzip2    1.0.4
   30.51 +%define       V_beecrypt 4.1.2
   30.52 +%define       V_curl     7.17.1
   30.53 +%define       V_make     3.81
   30.54 +%define       V_gzip     1.3.12
   30.55 +%define       V_gzip_r   1.13
   30.56 +%define       V_patch    2.5.9
   30.57 +%define       V_tar      1.19
   30.58 +%define       V_bash     3.2
   30.59 +%define       V_uuid     1.6.0
   30.60 +%define       V_config   20060923
   30.61 +%define       V_registry 1.1.3
   30.62 +%define       V_perl     5.10.0
   30.63 +%define       V_openssl  0.9.8g
   30.64 +%define       V_tools    1.4.5
   30.65 +%define       V_exec     2.0.1-C
   30.66 +
   30.67 +#   package information
   30.68 +Name:         openpkg
   30.69 +Summary:      OpenPKG Bootstrap
   30.70 +URL:          http://www.openpkg.org/
   30.71 +Vendor:       OpenPKG
   30.72 +Packager:     OpenPKG Foundation e.V.
   30.73 +Distribution: OpenPKG Community
   30.74 +Class:        CORE
   30.75 +Group:        Bootstrapping
   30.76 +License:      MIT/BSD/LGPL/GPL
   30.77 +Version:      %{V_openpkg}
   30.78 +Release:      %{V_openpkg}
   30.79 +
   30.80 +#   list of sources
   30.81 +Source0:      ftp://alpha.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
   30.82 +Source1:      ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz
   30.83 +Source2:      ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
   30.84 +Source3:      ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
   30.85 +Source4:      ftp://ftp.openpkg.org/sources/CPY/config/config-%{V_config}.tar.gz
   30.86 +Source5:      ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/openpkg-registry-%{V_registry}.tar.gz
   30.87 +Source6:      ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/openpkg-tools-%{V_tools}.tar.gz
   30.88 +Source7:      ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar
   30.89 +Source8:      ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}.tar
   30.90 +Source9:      ftp://ftp.openpkg.org/sources/CPY/openpkg/openpkg-executable-%{V_exec}.tar.gz
   30.91 +Source10:     ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
   30.92 +Source11:     ftp://ftp.openpkg.org/sources/CPY/perl/perl-%{V_perl}-mini.tar.gz
   30.93 +Source12:     ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
   30.94 +Source13:     ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
   30.95 +Source14:     http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
   30.96 +Source15:     http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
   30.97 +Source16:     http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
   30.98 +Source17:     http://www.zlib.net/zlib-%{V_zlib}.tar.gz
   30.99 +Source100:    bash.patch
  30.100 +Source101:    beecrypt.patch
  30.101 +Source102:    make.patch
  30.102 +Source103:    openssl.patch
  30.103 +Source104:    perl.patch
  30.104 +Source105:    tar.patch
  30.105 +Source106:    rpm.patch.bugfix
  30.106 +Source107:    rpm.patch.feature
  30.107 +Source108:    rpm.patch.porting
  30.108 +Source109:    rpm.patch.regen
  30.109 +Source200:    HISTORY
  30.110 +Source201:    README
  30.111 +Source202:    aux.prereq.sh
  30.112 +Source203:    aux.usrgrp.sh
  30.113 +Source204:    aux.wrapbin.sh
  30.114 +Source205:    aux.wrapsrc.sh
  30.115 +Source206:    dot.bash_login
  30.116 +Source207:    dot.bashrc
  30.117 +Source208:    dot.lsyncrc
  30.118 +Source209:    install.sh
  30.119 +Source210:    local.README
  30.120 +Source211:    lsync
  30.121 +Source212:    lsync.8
  30.122 +Source213:    lsync.pod
  30.123 +Source214:    man.sh
  30.124 +Source215:    openpkg.1
  30.125 +Source216:    openpkg.boot
  30.126 +Source217:    openpkg.com.pgp
  30.127 +Source218:    openpkg.net.pgp
  30.128 +Source219:    openpkg.org.pgp
  30.129 +Source220:    openpkg.pod
  30.130 +Source221:    openpkg.sh
  30.131 +Source222:    pod2man.sh
  30.132 +Source223:    rc
  30.133 +Source224:    rc.8
  30.134 +Source225:    rc.conf
  30.135 +Source226:    rc.func
  30.136 +Source227:    rc.openpkg
  30.137 +Source228:    rc.pod
  30.138 +Source229:    release.8
  30.139 +Source230:    release.pod
  30.140 +Source231:    release.sh
  30.141 +Source232:    root.README
  30.142 +Source233:    rpm-config.8
  30.143 +Source234:    rpm-config.pod
  30.144 +Source235:    rpm-config.sh
  30.145 +Source236:    rpmdb
  30.146 +Source237:    rpmtool
  30.147 +Source238:    rpmtool.8
  30.148 +Source239:    rpmtool.pod
  30.149 +Source240:    shtool
  30.150 +Source241:    uuid.8
  30.151 +Source242:    uuid.pod
  30.152 +Source243:    uuid.sh
  30.153 +Source244:    rpmmacros
  30.154 +Source245:    rpmpopt
  30.155 +Source246:    rpmrc
  30.156 +
  30.157 +#   build information
  30.158 +Prefix:       %{l_prefix}
  30.159 +BuildRoot:    %{l_buildroot}
  30.160 +AutoReq:      no
  30.161 +AutoReqProv:  no
  30.162 +Provides:     OpenPKG
  30.163 +
  30.164 +%description
  30.165 +    This is the bootstrap package for the RPM-based Unix Software
  30.166 +    Package Hierarchy OpenPKG. The RPM Package Manager (RPM) is a
  30.167 +    sophisticated and portable package manager for Unix platforms,
  30.168 +    which supports automated building, installation, management and
  30.169 +    deinstallation of Unix software. RPM was originally designed and
  30.170 +    implemented for the RedHat Linux operating system where it manages
  30.171 +    every file on the whole system. OpenPKG uses RPM only for managing
  30.172 +    the files in a particular filesystem hierarchy dedicated to the
  30.173 +    installation of third-party software packages provided by the
  30.174 +    OpenPKG project.
  30.175 +
  30.176 +    The OpenPKG bootstrap package includes the following software:
  30.177 +        RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
  30.178 +        GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
  30.179 +        GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
  30.180 +        OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt},
  30.181 +        OpenSSL %{V_openssl}, Perl %{V_perl}
  30.182 +
  30.183 +%track
  30.184 +    prog openpkg:bash = {
  30.185 +        version   = %{V_bash}
  30.186 +        url       = ftp://ftp.cwru.edu/pub/bash/
  30.187 +        regex     = bash-(__VER__)\.tar\.gz
  30.188 +    }
  30.189 +    prog openpkg:bzip2 = {
  30.190 +        version   = %{V_bzip2}
  30.191 +        url       = http://www.bzip.org/downloads.html
  30.192 +        regex     = bzip2-(__VER__)\.tar\.gz
  30.193 +    }
  30.194 +    prog openpkg:curl = {
  30.195 +        version   = %{V_curl}
  30.196 +        url       = http://curl.haxx.se/download/
  30.197 +        regex     = curl-(__VER__)\.tar\.gz
  30.198 +    }
  30.199 +    prog openpkg:gzip = {
  30.200 +        comment   = "rse: intentionally tracked at gnu.org, although fetched from openpkg.org because of uncompression"
  30.201 +        version   = %{V_gzip}
  30.202 +        url       = ftp://ftp.gnu.org/gnu/gzip/
  30.203 +        regex     = gzip-(__VER__)\.tar(\.gz)?
  30.204 +    }
  30.205 +    prog openpkg:gzip_r = {
  30.206 +        version   = %{V_gzip_r}
  30.207 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg/
  30.208 +        regex     = gzip-%{V_gzip}-openpkg-r(__VER__)\.tar
  30.209 +    }
  30.210 +    prog openpkg:make = {
  30.211 +        version   = %{V_make}
  30.212 +        url       = ftp://ftp.gnu.org/gnu/make/
  30.213 +        regex     = make-(__VER__)\.tar\.gz
  30.214 +    }
  30.215 +    prog openpkg:patch = {
  30.216 +        disabled
  30.217 +        comment   = "rse: directory missing after GNU.org security issues"
  30.218 +        version   = %{V_patch}
  30.219 +        url       = ftp://alpha.gnu.org/gnu/patch/
  30.220 +        regex     = patch-(__VER__)\.tar\.gz
  30.221 +    }
  30.222 +    prog openpkg:rpm = {
  30.223 +        disabled
  30.224 +        comment   = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1"
  30.225 +        version   = %{V_rpm}
  30.226 +        url       = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/
  30.227 +        regex     = rpm-(4\.2\.\d+)\.tar\.gz
  30.228 +    }
  30.229 +    prog openpkg:tar = {
  30.230 +        version   = %{V_tar}
  30.231 +        url       = ftp://ftp.gnu.org/gnu/tar/
  30.232 +        regex     = tar-(__VER__)\.tar\.gz
  30.233 +    }
  30.234 +    prog openpkg:zlib = {
  30.235 +        version   = %{V_zlib}
  30.236 +        url       = http://www.zlib.net/
  30.237 +        regex     = zlib-(__VER__)\.tar\.gz
  30.238 +    }
  30.239 +    prog openpkg:uuid = {
  30.240 +        version   = %{V_uuid}
  30.241 +        url       = ftp://ftp.ossp.org/pkg/lib/uuid/
  30.242 +        regex     = uuid-(__VER__)\.tar\.gz
  30.243 +    }
  30.244 +    prog openpkg:config = {
  30.245 +        version   = %{V_config}
  30.246 +        url       = ftp://ftp.openpkg.org/sources/CPY/config/
  30.247 +        regex     = config-(__VER__)\.tar\.gz
  30.248 +    }
  30.249 +    prog openpkg:beecrypt = {
  30.250 +        version   = %{V_beecrypt}
  30.251 +        url       = http://prdownloads.sourceforge.net/beecrypt/
  30.252 +        regex     = beecrypt-(__VER__)\.tar\.gz
  30.253 +    }
  30.254 +    prog openpkg:registry = {
  30.255 +        version   = %{V_registry}
  30.256 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/
  30.257 +        regex     = openpkg-registry-(__VER__)\.tar\.gz
  30.258 +    }
  30.259 +    prog openpkg:perl = {
  30.260 +        version   = %{V_perl}
  30.261 +        url       = ftp://ftp.openpkg.org/sources/CPY/perl/
  30.262 +        regex     = perl-(__VER__)-mini\.tar\.gz
  30.263 +    }
  30.264 +    prog openpkg:openssl = {
  30.265 +        version   = %{V_openssl}
  30.266 +        url       = ftp://ftp.openssl.org/source/
  30.267 +        regex     = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
  30.268 +    }
  30.269 +    prog openpkg:openpkg-tools = {
  30.270 +        version   = %{V_tools}
  30.271 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/
  30.272 +        regex     = openpkg-tools-(__VER__)\.tar\.gz
  30.273 +    }
  30.274 +    prog openpkg:openpkg-executable = {
  30.275 +        version   = %{V_exec}
  30.276 +        url       = ftp://ftp.openpkg.org/sources/CPY/openpkg/
  30.277 +        regex     = openpkg-executable-(__VER__-C)\.tar\.gz
  30.278 +    }
  30.279 +
  30.280 +%prep
  30.281 +    #   skip in bootstrap phase 2 (see openpkg.boot)
  30.282 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  30.283 +
  30.284 +    #   switch into a temporary build area
  30.285 +    rm -rf openpkg-%{version}
  30.286 +    mkdir openpkg-%{version}
  30.287 +    cd openpkg-%{version}
  30.288 +    rm -f .buildenv
  30.289 +    touch .buildenv
  30.290 +
  30.291 +    #   provide a bootstrap alternative to %{SOURCE xxx} because else
  30.292 +    #   it is not possible to upgrade a newer OpenPKG RPM with an older
  30.293 +    #   OpenPKG RPM.
  30.294 +    echo >>.buildenv 'SOURCE () {'
  30.295 +    echo >>.buildenv '    if [ -f "%{_specdir}/$1" ]; then'
  30.296 +    echo >>.buildenv '        echo "%{_specdir}/$1"'
  30.297 +    echo >>.buildenv '    else'
  30.298 +    echo >>.buildenv '        echo "%{_sourcedir}/$1"'
  30.299 +    echo >>.buildenv '    fi'
  30.300 +    echo >>.buildenv '}'
  30.301 +    echo >>.buildenv 'VERBOSE () {'
  30.302 +    echo >>.buildenv '    if [ -f "%{_specdir}/rpmtool" ]; then'
  30.303 +    echo >>.buildenv '        echo "$*" | sh %{_specdir}/rpmtool msg'
  30.304 +    echo >>.buildenv '    else'
  30.305 +    echo >>.buildenv '        echo "$*" | sh %{_sourcedir}/rpmtool msg'
  30.306 +    echo >>.buildenv '    fi'
  30.307 +    echo >>.buildenv '}'
  30.308 +    . ./.buildenv
  30.309 +
  30.310 +    #   display verbosity header
  30.311 +    set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"; set -x
  30.312 +
  30.313 +    #   determine path to shtool
  30.314 +    shtool=`SOURCE shtool`
  30.315 +    echo "shtool=$shtool" >>./.buildenv
  30.316 +
  30.317 +    #   determine development tools
  30.318 +    #   - bootstrapping: %{l_xxx} is set via sed(1)
  30.319 +    #   - upgrading new: %{l_xxx} is set via rpmmacros
  30.320 +    #   - upgrading old: %{l_xxx} is not set at all
  30.321 +
  30.322 +    #   manually make sure tar(1) is available
  30.323 +    l_tar=""; export l_tar
  30.324 +    [ ".%{?l_tar:set}"   = .set ] && l_tar="%{l_tar}"
  30.325 +    [ ".%{?use_tar:set}" = .set ] && l_tar="%{use_tar}"
  30.326 +    if [ ".$l_tar" = . ]; then
  30.327 +        l_tar=`sh $shtool path gtar tar`
  30.328 +        if [ ".$l_tar" = . ]; then
  30.329 +            echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
  30.330 +            exit 1
  30.331 +        fi
  30.332 +    fi
  30.333 +    echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
  30.334 +
  30.335 +    #   manually make sure make(1) is available
  30.336 +    l_make=""; export l_make
  30.337 +    [ ".%{?l_make:set}"   = .set ] && l_make="%{l_make}"
  30.338 +    [ ".%{?use_make:set}" = .set ] && l_make="%{use_make}"
  30.339 +    if [ ".$l_make" = . ]; then
  30.340 +        l_make=`sh $shtool path gmake make`
  30.341 +        if [ ".$l_make" = . ]; then
  30.342 +            echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
  30.343 +            exit 1
  30.344 +        fi
  30.345 +    fi
  30.346 +    echo "l_make=\"$l_make\"; export l_make" >>.buildenv
  30.347 +
  30.348 +    #   manually make sure cc(1) is available
  30.349 +    l_cc=""; export l_cc
  30.350 +    [ ".%{?l_cc:set}"   = .set ] && l_cc="%{l_cc}"
  30.351 +    [ ".%{?use_cc:set}" = .set ] && l_cc="%{use_cc}"
  30.352 +    if [ ".$l_cc" = . ]; then
  30.353 +        l_cc=`sh $shtool path gcc cc`
  30.354 +        if [ ".$l_cc" = . ]; then
  30.355 +            echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
  30.356 +            exit 1
  30.357 +        fi
  30.358 +    fi
  30.359 +    echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
  30.360 +
  30.361 +    #   manually make sure ar(1) is available
  30.362 +    l_ar=""; export l_ar
  30.363 +    [ ".%{?l_ar:set}"   = .set ] && l_ar="%{l_ar}"
  30.364 +    [ ".%{?use_ar:set}" = .set ] && l_ar="%{use_ar}"
  30.365 +    if [ ".$l_ar" = . ]; then
  30.366 +        l_ar=`sh $shtool path ar`
  30.367 +        if [ ".$l_ar" = . ]; then
  30.368 +            echo "openpkg: prerequisite tool \`ar' not found"
  30.369 +            exit 1
  30.370 +        fi
  30.371 +    fi
  30.372 +    echo "l_ar=\"$l_ar\"; export l_ar" >>.buildenv
  30.373 +
  30.374 +    #   manually make sure ld(1) is available
  30.375 +    l_ld=""; export l_ld
  30.376 +    [ ".%{?l_ld:set}"   = .set ] && l_ld="%{l_ld}"
  30.377 +    [ ".%{?use_ld:set}" = .set ] && l_ld="%{use_ld}"
  30.378 +    if [ ".$l_ld" = . ]; then
  30.379 +        l_ld=`sh $shtool path ld`
  30.380 +        if [ ".$l_ld" = . ]; then
  30.381 +            echo "openpkg: prerequisite tool \`ld' not found"
  30.382 +            exit 1
  30.383 +        fi
  30.384 +    fi
  30.385 +    echo "l_ld=\"$l_ld\"; export l_ld" >>.buildenv
  30.386 +
  30.387 +    #   manually make sure as(1) is available
  30.388 +    l_as=""; export l_as
  30.389 +    [ ".%{?l_as:set}"   = .set ] && l_as="%{l_as}"
  30.390 +    [ ".%{?use_as:set}" = .set ] && l_as="%{use_as}"
  30.391 +    if [ ".$l_as" = . ]; then
  30.392 +        l_as=`sh $shtool path as`
  30.393 +        if [ ".$l_as" = . ]; then
  30.394 +            echo "openpkg: prerequisite tool \`as' not found"
  30.395 +            exit 1
  30.396 +        fi
  30.397 +    fi
  30.398 +    echo "l_as=\"$l_as\"; export l_as" >>.buildenv
  30.399 +
  30.400 +    #   manually make sure strip(1) is available or use a null replacement
  30.401 +    l_strip=""; export l_strip
  30.402 +    [ ".%{?l_strip:set}"   = .set ] && l_strip="%{l_strip}"
  30.403 +    [ ".%{?use_strip:set}" = .set ] && l_strip="%{use_strip}"
  30.404 +    if [ ".$l_strip" = . ]; then
  30.405 +        l_strip=`sh $shtool path strip ls`
  30.406 +        if [ ".$l_strip" = . ]; then
  30.407 +            echo "openpkg: prerequisite tool \`strip' not found"
  30.408 +            exit 1
  30.409 +        fi
  30.410 +    fi
  30.411 +    echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv
  30.412 +
  30.413 +    #   determine path to aux.usrgrp.sh script
  30.414 +    usrgrp=`SOURCE aux.usrgrp.sh`
  30.415 +    echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv
  30.416 +
  30.417 +    #   display verbosity header
  30.418 +    set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"; set -x
  30.419 +
  30.420 +    #   determine user/group name/id pairs
  30.421 +    #   - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
  30.422 +    #   - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
  30.423 +    #   - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
  30.424 +    susr=""; [ ".%{?l_susr:set}"  = .set ] && susr="%{l_susr}"
  30.425 +    sgrp=""; [ ".%{?l_sgrp:set}"  = .set ] && sgrp="%{l_sgrp}"
  30.426 +    musr=""; [ ".%{?l_musr:set}"  = .set ] && musr="%{l_musr}"
  30.427 +    mgrp=""; [ ".%{?l_mgrp:set}"  = .set ] && mgrp="%{l_mgrp}"
  30.428 +    rusr=""; [ ".%{?l_rusr:set}"  = .set ] && rusr="%{l_rusr}"
  30.429 +    rgrp=""; [ ".%{?l_rgrp:set}"  = .set ] && rgrp="%{l_rgrp}"
  30.430 +    nusr=""; [ ".%{?l_nusr:set}"  = .set ] && nusr="%{l_nusr}"
  30.431 +    ngrp=""; [ ".%{?l_ngrp:set}"  = .set ] && ngrp="%{l_ngrp}"
  30.432 +    #   corresponding ids
  30.433 +    suid=""; [ ".%{?l_suid:set}"  = .set ] && suid="%{l_suid}"
  30.434 +    sgid=""; [ ".%{?l_sgid:set}"  = .set ] && sgid="%{l_sgid}"
  30.435 +    muid=""; [ ".%{?l_muid:set}"  = .set ] && muid="%{l_muid}"
  30.436 +    mgid=""; [ ".%{?l_mgid:set}"  = .set ] && mgid="%{l_mgid}"
  30.437 +    ruid=""; [ ".%{?l_ruid:set}"  = .set ] && ruid="%{l_ruid}"
  30.438 +    rgid=""; [ ".%{?l_rgid:set}"  = .set ] && rgid="%{l_rgid}"
  30.439 +    nuid=""; [ ".%{?l_nuid:set}"  = .set ] && nuid="%{l_nuid}"
  30.440 +    ngid=""; [ ".%{?l_ngid:set}"  = .set ] && ngid="%{l_ngid}"
  30.441 +    #   compat:
  30.442 +    usr="";  [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
  30.443 +    grp="";  [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
  30.444 +    eval `sh $usrgrp \
  30.445 +          --usr="$usr" --grp="$grp" \
  30.446 +          --susr="$susr" --sgrp="$sgrp" \
  30.447 +          --musr="$musr" --mgrp="$mgrp" \
  30.448 +          --rusr="$rusr" --rgrp="$rgrp" \
  30.449 +          --nusr="$nusr" --ngrp="$ngrp" \
  30.450 +          --suid="$suid" --sgid="$sgid" \
  30.451 +          --muid="$muid" --mgid="$mgid" \
  30.452 +          --ruid="$ruid" --rgid="$rgid" \
  30.453 +          --nuid="$nuid" --ngid="$ngid"`
  30.454 +    echo "susr=\"$susr\"; export susr" >>.buildenv
  30.455 +    echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
  30.456 +    echo "musr=\"$musr\"; export musr" >>.buildenv
  30.457 +    echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
  30.458 +    echo "rusr=\"$rusr\"; export rusr" >>.buildenv
  30.459 +    echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
  30.460 +    echo "nusr=\"$nusr\"; export nusr" >>.buildenv
  30.461 +    echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
  30.462 +    echo "suid=\"$suid\"; export suid" >>.buildenv
  30.463 +    echo "sgid=\"$sgid\"; export sgid" >>.buildenv
  30.464 +    echo "muid=\"$muid\"; export muid" >>.buildenv
  30.465 +    echo "mgid=\"$mgid\"; export mgid" >>.buildenv
  30.466 +    echo "ruid=\"$ruid\"; export ruid" >>.buildenv
  30.467 +    echo "rgid=\"$rgid\"; export rgid" >>.buildenv
  30.468 +    echo "nuid=\"$nuid\"; export nuid" >>.buildenv
  30.469 +    echo "ngid=\"$ngid\"; export ngid" >>.buildenv
  30.470 +
  30.471 +    #   display verbosity header
  30.472 +    set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"; set -x
  30.473 +
  30.474 +    #   determine installation location id
  30.475 +    if [ ".%{?l_tag_fmt:set}" = .set ]; then
  30.476 +        tag="%{l_tag_fmt}"
  30.477 +    else
  30.478 +        tag="<compat>"
  30.479 +    fi
  30.480 +    echo "tag=\"$tag\"; export tag" >>.buildenv
  30.481 +
  30.482 +    #   determine platform id
  30.483 +    s=`(uname -s) 2>/dev/null` || s='Unknown'
  30.484 +    r=`(uname -r) 2>/dev/null` || r='0.0'
  30.485 +    plid="${s}/${r}"
  30.486 +    echo "plid=\"$plid\"; export plid" >>.buildenv
  30.487 +
  30.488 +    #   determine platform-specific build environment
  30.489 +    case $plid in
  30.490 +        FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.491 +        NetBSD/*  ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.492 +        Linux/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.493 +        SunOS/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
  30.494 +        UnixWare/*) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
  30.495 +        AIX/*     ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
  30.496 +        Darwin/*  ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.497 +        OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.498 +        HP-UX/*   ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.499 +        IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.500 +        *         ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  30.501 +    esac
  30.502 +    case $plid in
  30.503 +        FreeBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
  30.504 +        NetBSD/*  ) l_build_ldlp="/lib:/usr/lib" ;;
  30.505 +        Linux/*   ) l_build_ldlp="/lib:/usr/lib" ;;
  30.506 +        SunOS/*   ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
  30.507 +        UnixWare/*) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
  30.508 +        AIX/*     ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
  30.509 +        Darwin/*  ) l_build_ldlp="/usr/lib" ;;
  30.510 +        OSF1/V5.* ) l_build_ldlp="/usr/lib" ;;
  30.511 +        HP-UX/*   ) l_build_ldlp="/usr/lib" ;;
  30.512 +        IRIX*/6.* ) l_build_ldlp="/usr/lib" ;;
  30.513 +        *         ) l_build_ldlp="/usr/lib" ;;
  30.514 +    esac
  30.515 +    case $plid in
  30.516 +        *         ) l_build_ulim=":" ;;
  30.517 +    esac
  30.518 +    echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
  30.519 +    echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
  30.520 +    echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
  30.521 +
  30.522 +    #   display verbosity header
  30.523 +    set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x
  30.524 +
  30.525 +    #   bootstrap GNU zip tool
  30.526 +    ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
  30.527 +    ${l_tar} xf `SOURCE gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar` 2>/dev/null || true
  30.528 +    ( cd gzip-%{V_gzip}
  30.529 +      echo "ac_cv_prog_cc_g=no" >config.cache
  30.530 +      case $plid in
  30.531 +          Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;;
  30.532 +      esac
  30.533 +      sh $shtool subst -e 's/futimens/gzip_&/' gzip.c lib/utimens.[ch]
  30.534 +      CC="${l_cc}" \
  30.535 +      GREP="grep" \
  30.536 +      ./configure \
  30.537 +          --cache-file=./config.cache
  30.538 +      ${l_make} || exit $?
  30.539 +      ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $?
  30.540 +    ) || exit $?
  30.541 +    l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
  30.542 +    echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
  30.543 +
  30.544 +    #   display verbosity header
  30.545 +    set +x; VERBOSE "PREPARATION: Unpack GNU configuration guessing utilities"; set -x
  30.546 +
  30.547 +    #   unpack GNU config.guess
  30.548 +    ${l_gzip} -dc `SOURCE config-%{V_config}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  30.549 +
  30.550 +    #   display verbosity header
  30.551 +    set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"; set -x
  30.552 +
  30.553 +    #   bootstrap GNU patch tool
  30.554 +    ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  30.555 +    ( cd patch-%{V_patch}
  30.556 +      chmod u+w config.guess config.sub >/dev/null 2>&1 || true
  30.557 +      cp ../config/config.guess .
  30.558 +      cp ../config/config.sub   .
  30.559 +      ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
  30.560 +        echo 'ac_cv_prog_cc_g=no'
  30.561 +        false=`sh $shtool path false`
  30.562 +        echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
  30.563 +      ) >config.cache
  30.564 +      CC="${l_cc}" \
  30.565 +      ./configure \
  30.566 +          --cache-file=./config.cache \
  30.567 +          --disable-largefile
  30.568 +      ${l_make} || exit $?
  30.569 +      ( mv patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
  30.570 +    ) || exit $?
  30.571 +    l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
  30.572 +    echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
  30.573 +
  30.574 +    #   display verbosity header
  30.575 +    set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"; set -x
  30.576 +
  30.577 +    #   build GNU tar tool
  30.578 +    ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  30.579 +    ( cd tar-%{V_tar}
  30.580 +      ${l_patch} -p0 <`SOURCE tar.patch`
  30.581 +      ( echo 'am_cv_func_iconv=no'
  30.582 +        echo 'am_cv_lib_iconv=no'
  30.583 +        echo 'ac_cv_lib_iconv_iconv=no'
  30.584 +        echo 'ac_cv_header_iconv_h=no'
  30.585 +        echo 'ac_cv_type_iconv_t=no'
  30.586 +      ) >config.cache
  30.587 +      CC="${l_cc}" \
  30.588 +      MAKEINFO="true" \
  30.589 +      GREP="grep" \
  30.590 +      ./configure \
  30.591 +          --cache-file=./config.cache \
  30.592 +          --prefix=%{l_prefix} \
  30.593 +          --disable-nls
  30.594 +      ${l_make} || exit $?
  30.595 +      ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $?
  30.596 +    ) || exit $?
  30.597 +    l_tar="`pwd`/tar-%{V_tar}/tar"; export l_tar
  30.598 +    echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
  30.599 +
  30.600 +    #   display verbosity header
  30.601 +    set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x
  30.602 +
  30.603 +    #   unpack distribution tarballs
  30.604 +    ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz`                        | ${l_tar} xf - 2>/dev/null || true
  30.605 +    ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  30.606 +    ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz`                    | ${l_tar} xf - 2>/dev/null || true
  30.607 +    ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  30.608 +    ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  30.609 +    ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  30.610 +    ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz`                      | ${l_tar} xf - 2>/dev/null || true
  30.611 +    ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz`              | ${l_tar} xf - 2>/dev/null || true
  30.612 +    ${l_gzip} -dc `SOURCE openpkg-registry-%{V_registry}.tar.gz`      | ${l_tar} xf - 2>/dev/null || true
  30.613 +    ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz`                 | ${l_tar} xf - 2>/dev/null || true
  30.614 +    ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz`                | ${l_tar} xf - 2>/dev/null || true
  30.615 +    ${l_gzip} -dc `SOURCE openpkg-tools-%{V_tools}.tar.gz`            | ${l_tar} xf - 2>/dev/null || true
  30.616 +    ${l_gzip} -dc `SOURCE openpkg-executable-%{V_exec}.tar.gz`        | ${l_tar} xf - 2>/dev/null || true
  30.617 +
  30.618 +    #   update config.guess/config.sub
  30.619 +    for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
  30.620 +               curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
  30.621 +        chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
  30.622 +        cp config/config.guess $dir/
  30.623 +        cp config/config.sub   $dir/
  30.624 +    done
  30.625 +
  30.626 +    #   display verbosity header
  30.627 +    set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x
  30.628 +
  30.629 +    #   apply OpenPKG patches to distribution trees
  30.630 +    ( cd rpm-%{V_rpm}
  30.631 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix`  | ${l_patch} -p0
  30.632 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
  30.633 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
  30.634 +      sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen`   | ${l_patch} -p0
  30.635 +      rm -rf db/docs # just reduce disk size of source tree
  30.636 +    ) || exit $?
  30.637 +    ( cd make-%{V_make}
  30.638 +      ${l_patch} -p0 <`SOURCE make.patch`
  30.639 +    ) || exit $?
  30.640 +    ( cd bash-%{V_bash}
  30.641 +      ${l_patch} -p0 <`SOURCE bash.patch`
  30.642 +      sleep 1
  30.643 +      touch y.tab.[ch]
  30.644 +      touch configure config.h.in
  30.645 +    ) || exit $?
  30.646 +    ( cd beecrypt-%{V_beecrypt}
  30.647 +      ${l_patch} -p0 <`SOURCE beecrypt.patch`
  30.648 +    ) || exit $?
  30.649 +    ( cd perl-%{V_perl}
  30.650 +      ${l_patch} -p0 <`SOURCE perl.patch`
  30.651 +    ) || exit $?
  30.652 +    ( cd openssl-%{V_openssl}
  30.653 +      ${l_patch} -p0 <`SOURCE openssl.patch`
  30.654 +    ) || exit $?
  30.655 +
  30.656 +    #   display verbosity header
  30.657 +    set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x
  30.658 +
  30.659 +    #   bootstrap GNU make tool
  30.660 +    ( cd make-%{V_make}
  30.661 +      CC="${l_cc}" \
  30.662 +      ./configure \
  30.663 +          --without-libiconv-prefix \
  30.664 +          --without-libintl-prefix \
  30.665 +          --disable-nls \
  30.666 +          --disable-largefile
  30.667 +      ${l_make}
  30.668 +      ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
  30.669 +    ) || exit $?
  30.670 +    l_make="`pwd`/make-%{V_make}/make"; export l_make
  30.671 +    echo "l_make=\"$l_make\"; export l_make" >>.buildenv
  30.672 +
  30.673 +%build
  30.674 +    #   skip in bootstrap phase 2 (see openpkg.boot)
  30.675 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  30.676 +
  30.677 +    #   switch into a temporary build area
  30.678 +    cd openpkg-%{version}
  30.679 +    . ./.buildenv
  30.680 +
  30.681 +    #   display verbosity header
  30.682 +    set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"; set -x
  30.683 +
  30.684 +    #   build GNU bash tool
  30.685 +    ( cd bash-%{V_bash}
  30.686 +      sh $shtool subst \
  30.687 +          -e 's;@l_openpkg_release@;OpenPKG;' \
  30.688 +          version.c
  30.689 +      ( #   force disabled wide-character support
  30.690 +        echo "ac_cv_header_wchar_h=no"
  30.691 +        echo "ac_cv_header_wctype_h=no"
  30.692 +        echo "ac_cv_func_mbsrtowcs=no"
  30.693 +        #   force disabled internationalization support
  30.694 +        echo "ac_cv_header_libintl_h=no"
  30.695 +        echo "ac_cv_func_gettext=no"
  30.696 +        echo "ac_cv_func_textdomain=no"
  30.697 +        echo "ac_cv_func_bindtextdomain=no"
  30.698 +        echo "ac_cv_lib_intl_bindtextdomain=no"
  30.699 +        #   disable building with debug symbols
  30.700 +        echo "ac_cv_prog_cc_g=no"
  30.701 +      ) >config.cache
  30.702 +      AUTOCONF="true" \
  30.703 +      CC="${l_cc}"
  30.704 +      ./configure \
  30.705 +          --cache-file=./config.cache \
  30.706 +          --prefix=%{l_prefix} \
  30.707 +          --without-curses \
  30.708 +          --without-gnu-malloc \
  30.709 +          --disable-nls
  30.710 +      ${l_make} || exit $?
  30.711 +      ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
  30.712 +    ) || exit $?
  30.713 +
  30.714 +    #   display verbosity header
  30.715 +    set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"; set -x
  30.716 +
  30.717 +    #   build BZIP2 library
  30.718 +    ( cd bzip2-%{V_bzip2}
  30.719 +      ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
  30.720 +      ( echo "# libbz2.la - a libtool library file"
  30.721 +        echo "# Generated by ltmain.sh - GNU libtool x.x.x"
  30.722 +        echo "dlname=''"
  30.723 +        echo "library_names=''"
  30.724 +        echo "old_library='libbz2.a'"
  30.725 +        echo "dependency_libs=''"
  30.726 +        echo "current=0"
  30.727 +        echo "age=0"
  30.728 +        echo "revision=0"
  30.729 +        echo "installed=no"
  30.730 +        echo "dlopen=''"
  30.731 +        echo "dlpreopen=''"
  30.732 +        echo "libdir='%{l_prefix}'"
  30.733 +      ) >libbz2.la
  30.734 +      ln -s . .libs
  30.735 +    ) || exit $?
  30.736 +
  30.737 +    #   display verbosity header
  30.738 +    set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"; set -x
  30.739 +
  30.740 +    #   build ZLIB library
  30.741 +    ( cd zlib-%{V_zlib}
  30.742 +      CC="${l_cc}" CFLAGS="-O" ./configure
  30.743 +      ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here
  30.744 +    ) || exit $?
  30.745 +
  30.746 +    #   display verbosity header
  30.747 +    set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x
  30.748 +
  30.749 +    #   build OSSP uuid tool
  30.750 +    ( cd uuid-%{V_uuid}
  30.751 +      CC="${l_cc}" \
  30.752 +      CFLAGS="-O" \
  30.753 +      GREP="grep" \
  30.754 +      ./configure \
  30.755 +        --prefix=%{l_prefix} \
  30.756 +        --disable-shared
  30.757 +      ${l_make} || exit $?
  30.758 +      ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $?
  30.759 +    ) || exit $?
  30.760 +
  30.761 +    #   display verbosity header
  30.762 +    set +x; VERBOSE "BUILD: Build Perl (Programming Language)"; set -x
  30.763 +
  30.764 +    #   build Perl tool
  30.765 +    ( cd perl-%{V_perl}
  30.766 +      chmod -R u+w .
  30.767 +      sh $shtool subst \
  30.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;' \
  30.769 +          -e 's;package=perl5;package=perl;' \
  30.770 +          Configure
  30.771 +      sh $shtool subst \
  30.772 +          -e 's; */usr/local/lib;;' \
  30.773 +          hints/freebsd.sh hints/netbsd.sh
  30.774 +      libdirs=""
  30.775 +      for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
  30.776 +          [ -d $dir ] && libdirs="$libdirs $dir"
  30.777 +      done
  30.778 +      ./Configure \
  30.779 +          -d -e -s \
  30.780 +          -Dprefix=%{l_prefix} \
  30.781 +          -Dvendorprefix=%{l_prefix} \
  30.782 +          -Dinstallprefix=%{l_prefix} \
  30.783 +          -Dinstallstyle="lib/perl5" \
  30.784 +          -Dman1dir=%{l_prefix}/man/man1 \
  30.785 +          -Dman3dir=%{l_prefix}/man/man3 \
  30.786 +          -Dcc="${l_cc}" -Uoptimize \
  30.787 +          -Dlocincpth="%{l_prefix}/include" \
  30.788 +          -Dloclibpth="%{l_prefix}/lib" \
  30.789 +          -Dldflags="-L""%{l_prefix}/lib" \
  30.790 +          -Dlibpth="$libdirs" \
  30.791 +          -Dglibpth="$libdirs" \
  30.792 +          -Dscriptdir="%{l_prefix}/bin" \
  30.793 +          -Uinstallusrbinperl \
  30.794 +          -Adefine:useshrplib='false' \
  30.795 +          -Ui_malloc -Ui_iconv -Ui_db
  30.796 +      ${l_make} miniperl || exit $?
  30.797 +      rm -f *.o >/dev/null 2>&1 || true
  30.798 +    ) || exit $?
  30.799 +    l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl
  30.800 +    echo "l_perl=\"$l_perl\"; export l_perl" >>.buildenv
  30.801 +
  30.802 +    #   display verbosity header
  30.803 +    set +x; VERBOSE "BUILD: Build OpenSSL (Crypography and SSL/TLS Toolkit)"; set -x
  30.804 +
  30.805 +    #   build OpenSSL toolkit
  30.806 +    ( cd openssl-%{V_openssl}
  30.807 +      sh $shtool subst \
  30.808 +          -e 's;-m486;-march=i486;g' \
  30.809 +          -e 's;BN_LLONG *;;' \
  30.810 +          Configure
  30.811 +      sh $shtool subst \
  30.812 +          -e 's;test "$OSTYPE" = msdosdjgpp;true;' \
  30.813 +          util/point.sh
  30.814 +      sh $shtool subst \
  30.815 +          -e "1s;^.*\$;#!$l_perl;" \
  30.816 +          Configure `find . -name "*.pl" -print`
  30.817 +      opts=""
  30.818 +      case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
  30.819 +          *-solaris*       ) opts="-lnsl -lsocket" ;;
  30.820 +      esac
  30.821 +      case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in
  30.822 +          amd64-*          ) opts="$opts -fPIC" ;;
  30.823 +          ia64-*           ) opts="$opts -fPIC" ;;
  30.824 +          sparc64-freebsd* ) opts="$opts -fPIC" ;;
  30.825 +      esac
  30.826 +      CC="${l_cc}" \
  30.827 +      PERL="${l_perl}" \
  30.828 +      ./config \
  30.829 +          --prefix=%{l_prefix} \
  30.830 +          no-asm no-shared no-dso \
  30.831 +          no-zlib no-idea no-threads no-krb5 no-hw \
  30.832 +          $opts
  30.833 +      ${l_make} CC="${l_cc}" build_libs build_apps || exit $?
  30.834 +      ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $?
  30.835 +    ) || exit $?
  30.836 +
  30.837 +    #   display verbosity header
  30.838 +    set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x
  30.839 +
  30.840 +    #   build cURL tool
  30.841 +    ( cd curl-%{V_curl}
  30.842 +      sh $shtool subst \
  30.843 +          -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  30.844 +          configure
  30.845 +      ( echo 'ac_cv_header_openssl_engine_h=no'
  30.846 +        echo 'lt_cv_prog_compiler_c_o_F77=no'
  30.847 +        echo 'lt_cv_sys_max_cmd_len=100'
  30.848 +      ) >config.cache
  30.849 +      CC="${l_cc}" \
  30.850 +      CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
  30.851 +      CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
  30.852 +      LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
  30.853 +      GREP="grep" \
  30.854 +      ./configure \
  30.855 +          --cache-file=./config.cache \
  30.856 +          --without-libidn \
  30.857 +          --disable-shared \
  30.858 +          --disable-thread \
  30.859 +          --disable-ipv6 \
  30.860 +          --disable-ldap \
  30.861 +          --with-zlib=`pwd`/../zlib-%{V_zlib} \
  30.862 +          --with-ssl=`pwd`/../openssl-%{V_openssl} \
  30.863 +          --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509
  30.864 +      ${l_make} || exit $?
  30.865 +      ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
  30.866 +    ) || exit $?
  30.867 +
  30.868 +    #   display verbosity header
  30.869 +    set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"; set -x
  30.870 +
  30.871 +    #   build BeeCrypt library
  30.872 +    ( cd beecrypt-%{V_beecrypt}
  30.873 +      sh $shtool subst \
  30.874 +          -e 's;^[ 	][ 	]*#;#;' \
  30.875 +          aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \
  30.876 +          md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c
  30.877 +      sh $shtool subst \
  30.878 +         -e 's;cppglue\.lo;;g' \
  30.879 +         -e 's;cppglue\.cxx;;g' \
  30.880 +         -e '/^CXX = /s;@CXX@;@CC@;g' \
  30.881 +         Makefile.in
  30.882 +      sh $shtool subst \
  30.883 +          -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  30.884 +          configure
  30.885 +      ( echo 'ac_cv_have_dev_dsp=no'
  30.886 +        echo 'ac_cv_have_dev_audio=no'
  30.887 +        echo 'ac_cv_func_gettimeofday=yes'
  30.888 +        echo 'bc_cv_as_noexecstack=no'
  30.889 +      ) >config.cache
  30.890 +      CC="${l_cc}" \
  30.891 +      CFLAGS="-O" \
  30.892 +      ./configure \
  30.893 +        --cache-file=./config.cache \
  30.894 +        --prefix=%{l_prefix} \
  30.895 +        --without-cplusplus \
  30.896 +        --without-java \
  30.897 +        --without-python \
  30.898 +        --with-cpu=none \
  30.899 +        --with-arch=none \
  30.900 +        --disable-threads \
  30.901 +        --disable-shared
  30.902 +      ${l_make} || exit $?
  30.903 +      cp .libs/libbeecrypt.a .
  30.904 +    ) || exit $?
  30.905 +
  30.906 +    #   display verbosity header
  30.907 +    set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x
  30.908 +
  30.909 +    #   build RPM
  30.910 +    ( br=`pwd`
  30.911 +      cd rpm-%{V_rpm}
  30.912 +
  30.913 +      #   remove object files accidentally distributed with the RPM tarball
  30.914 +      rm -f db/build_unix/*.o
  30.915 +      rm -f db/build_unix/*.lo
  30.916 +
  30.917 +      #   remove embedded zlib (we are linking with an external one)
  30.918 +      rm -rf zlib
  30.919 +
  30.920 +      #   kill Linux-based preconfigured DB header, to allow the Makefiles to
  30.921 +      #   symlink to it the header that is configured for the current system.
  30.922 +      rm -f rpmdb/db.h
  30.923 +
  30.924 +      #   make sure we do not trigger Autoconf/Automake tools
  30.925 +      touch configure
  30.926 +      touch config.h.in
  30.927 +
  30.928 +      #   disable running of any Autoconf/Automake tools
  30.929 +      ACLOCAL=true
  30.930 +      AUTOCONF=true
  30.931 +      AUTOMAKE=true
  30.932 +      AUTOHEADER=true
  30.933 +      MAKEINFO=true
  30.934 +      AMTAR=true
  30.935 +      export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR
  30.936 +
  30.937 +      #   cheat GNU Autoconf
  30.938 +      ( echo 'ac_cv_path_MSGFMT=:'
  30.939 +        echo 'ac_cv_path_GMSGFMT=:'
  30.940 +        echo 'ac_cv_path_XGETTEXT=:'
  30.941 +        echo 'ac_cv_path_MSGMERGE=:'
  30.942 +        echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
  30.943 +        echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
  30.944 +        echo "ac_cv_path___PYTHON=true"
  30.945 +        echo "ac_cv_path___DOXYGEN=true"
  30.946 +        echo "acl_cv_rpath=no"
  30.947 +        echo "ac_cv_header_getopt_h=no"
  30.948 +      ) >config.cache
  30.949 +
  30.950 +      #   provide platform identification
  30.951 +      os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'
  30.952 +      os_name=`echo "${os_name}" |\
  30.953 +               sed -e 's;[^a-zA-Z0-9];;g' |\
  30.954 +               tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  30.955 +
  30.956 +      #   set build tool flags
  30.957 +      CC="${l_cc}"
  30.958 +      CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
  30.959 +      CFLAGS="$CPPFLAGS"
  30.960 +      LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
  30.961 +      LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
  30.962 +      case $os_name in
  30.963 +           SUNOS* ) LIBS="$LIBS -lresolv" ;;
  30.964 +           IRIX*  ) LIBS="$LIBS -lgen" ;;
  30.965 +      esac
  30.966 +      export CC CPPFLAGS CFLAGS LDFLAGS LIBS
  30.967 +
  30.968 +      #   adjust for BeeCrypt 4.0
  30.969 +      sh $shtool subst \
  30.970 +          -e 's;beecrypt\.api\.h;beecrypt.h;g' \
  30.971 +          rpmio/rpmio_internal.h
  30.972 +      sh $shtool subst \
  30.973 +          -e 's;\(rsavrfy(\)\(&dig->rsa_pk\);\1\2.n, \2.e;g' \
  30.974 +          lib/signature.c
  30.975 +
  30.976 +      #   configure the package
  30.977 +      sh ./configure \
  30.978 +          --cache-file=./config.cache \
  30.979 +          --prefix=%{l_prefix} \
  30.980 +          --with-db \
  30.981 +          --with-glob \
  30.982 +          --without-python \
  30.983 +          --without-apidocs \
  30.984 +          --disable-shared \
  30.985 +          --disable-rpath \
  30.986 +          --disable-nls
  30.987 +
  30.988 +      #   build the package
  30.989 +      ${l_make}
  30.990 +    ) || exit $?
  30.991 +
  30.992 +    #   display verbosity header
  30.993 +    set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
  30.994 +
  30.995 +    #   build "openpkg" executable
  30.996 +    ( cd openpkg-executable-%{V_exec}
  30.997 +      ${l_make} \
  30.998 +          CC="${l_cc}" \
  30.999 +          OPENPKG_PREFIX="%{l_prefix}" \
 30.1000 +          OPENPKG_SUSR="%{l_susr}" \
 30.1001 +          OPENPKG_MUSR="%{l_musr}"
 30.1002 +    ) || exit $?
 30.1003 +
 30.1004 +%install
 30.1005 +    #   skip in bootstrap phase 2 (see openpkg.boot)
 30.1006 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
 30.1007 +
 30.1008 +    #   switch into a temporary build area
 30.1009 +    cd openpkg-%{version}
 30.1010 +    . ./.buildenv
 30.1011 +
 30.1012 +    #   display verbosity header
 30.1013 +    set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
 30.1014 +
 30.1015 +    #   create installation hierarchy
 30.1016 +    rm -rf $RPM_BUILD_ROOT
 30.1017 +    sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
 30.1018 +    for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
 30.1019 +        test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
 30.1020 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
 30.1021 +    done
 30.1022 +    for i in 1 2 3 4 5 6 7 8 9; do
 30.1023 +        test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
 30.1024 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
 30.1025 +        test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
 30.1026 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
 30.1027 +    done
 30.1028 +    for dir in PKG bin etc include info lib man sbin; do
 30.1029 +        test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
 30.1030 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
 30.1031 +    done
 30.1032 +    for i in 1 2 3 4 5 6 7 8 9; do
 30.1033 +        test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
 30.1034 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
 30.1035 +        test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
 30.1036 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
 30.1037 +    done
 30.1038 +    test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
 30.1039 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
 30.1040 +    for dir in SRC PKG DB TMP; do
 30.1041 +        test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
 30.1042 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
 30.1043 +    done
 30.1044 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
 30.1045 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
 30.1046 +
 30.1047 +    #   display verbosity header
 30.1048 +    set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
 30.1049 +
 30.1050 +    #   install RPM into installation hierarchy
 30.1051 +    ( cd rpm-%{V_rpm}
 30.1052 +      DESTDIR="$RPM_BUILD_ROOT"
 30.1053 +      export DESTDIR
 30.1054 +      ${l_make} install
 30.1055 +    ) || exit $?
 30.1056 +
 30.1057 +    #   display verbosity header
 30.1058 +    set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
 30.1059 +
 30.1060 +    #   add additional development files
 30.1061 +    cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 30.1062 +    cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 30.1063 +    cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 30.1064 +    cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
 30.1065 +    cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 30.1066 +    cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
 30.1067 +    cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
 30.1068 +    cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
 30.1069 +
 30.1070 +    #   display verbosity header
 30.1071 +    set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
 30.1072 +
 30.1073 +    #   post-adjust RPM installation (namespace-clean POPT inclusion)
 30.1074 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
 30.1075 +       $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
 30.1076 +    mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
 30.1077 +       $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
 30.1078 +
 30.1079 +    #   move C API into custom locations
 30.1080 +    mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
 30.1081 +       $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
 30.1082 +    mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
 30.1083 +       $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
 30.1084 +
 30.1085 +    #   move rpm tool to custom location
 30.1086 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
 30.1087 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 30.1088 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
 30.1089 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
 30.1090 +
 30.1091 +    #   move rpm2cpio tool to custom location
 30.1092 +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
 30.1093 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
 30.1094 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
 30.1095 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
 30.1096 +
 30.1097 +    #   replace symlinks with hardlinks
 30.1098 +    for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
 30.1099 +        eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
 30.1100 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
 30.1101 +        ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
 30.1102 +           $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
 30.1103 +    done
 30.1104 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
 30.1105 +    ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
 30.1106 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
 30.1107 +    mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
 30.1108 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
 30.1109 +
 30.1110 +    #   display verbosity header
 30.1111 +    set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
 30.1112 +
 30.1113 +    #   strip RPM installation
 30.1114 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
 30.1115 +          $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
 30.1116 +    for dir in man/ja man/pl man/ru man/sk src; do
 30.1117 +        rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
 30.1118 +    done
 30.1119 +    rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true
 30.1120 +    for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
 30.1121 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
 30.1122 +    done
 30.1123 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
 30.1124 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
 30.1125 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
 30.1126 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
 30.1127 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
 30.1128 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
 30.1129 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
 30.1130 +    for file in \
 30.1131 +        u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
 30.1132 +        perl.prov perl.req mkinstalldirs magic.prov magic.req http.req \
 30.1133 +        getpo.sh get_magic.pl find-provides find-requires \
 30.1134 +        find-requires.perl find-req.pl find-provides.perl \
 30.1135 +        find-prov.pl find-lang.sh cpanflute convertrpmrc.sh check-prereqs \
 30.1136 +        rpmputtext rpmgettext brp-compress brp-redhat brp-sparc64-linux \
 30.1137 +        brp-strip brp-strip-shared brp-strip-comment-note rpmrc \
 30.1138 +        config.guess config.sub check-files; do
 30.1139 +        rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
 30.1140 +    done
 30.1141 +
 30.1142 +    #   display verbosity header
 30.1143 +    set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
 30.1144 +
 30.1145 +    #   install lsync tool
 30.1146 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1147 +        <`SOURCE lsync` \
 30.1148 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
 30.1149 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
 30.1150 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1151 +        <`SOURCE dot.lsyncrc` \
 30.1152 +        >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
 30.1153 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1154 +        <`SOURCE lsync.8` \
 30.1155 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
 30.1156 +
 30.1157 +    #   install rpm-config tool
 30.1158 +    ( l_prefix="%{l_prefix}"
 30.1159 +      l_cc="%{l_cc}"
 30.1160 +      l_cflags=""
 30.1161 +      l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
 30.1162 +      l_ldflags="-L${l_prefix}/lib/openpkg"
 30.1163 +      l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
 30.1164 +      sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1165 +          -e "s:@l_cc@:$l_cc:g" \
 30.1166 +          -e "s:@l_cflags@:$l_cflags:g" \
 30.1167 +          -e "s:@l_cppflags@:$l_cppflags:g" \
 30.1168 +          -e "s:@l_ldflags@:$l_ldflags:g" \
 30.1169 +          -e "s:@l_libs@:$l_libs:g" \
 30.1170 +          -e "s:@l_version@:%{V_rpm}:g" \
 30.1171 +          <`SOURCE rpm-config.sh` \
 30.1172 +          >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
 30.1173 +    ) || exit $?
 30.1174 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
 30.1175 +    sed -e "s:RPM_VERSION:%{V_rpm}:g" \
 30.1176 +        <`SOURCE rpm-config.8` \
 30.1177 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
 30.1178 +
 30.1179 +    #   install OpenPKG registry commands
 30.1180 +    ( cd openpkg-registry-%{V_registry}
 30.1181 +      mv  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
 30.1182 +          $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
 30.1183 +      sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1184 +          rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 30.1185 +      chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
 30.1186 +      sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1187 +          register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
 30.1188 +      chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
 30.1189 +      cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
 30.1190 +    ) || exit $?
 30.1191 +
 30.1192 +    #   install OpenPKG Tool Chain command subset
 30.1193 +    ( cd openpkg-tools-%{V_tools}
 30.1194 +      cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
 30.1195 +      cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
 30.1196 +      chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
 30.1197 +      cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
 30.1198 +    ) || exit $?
 30.1199 +
 30.1200 +    #   install RPM extension
 30.1201 +    ( cd rpm-%{V_rpm}
 30.1202 +      cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
 30.1203 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
 30.1204 +    ) || exit $?
 30.1205 +    ( cd perl-%{V_perl}
 30.1206 +      cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
 30.1207 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
 30.1208 +    ) || exit $?
 30.1209 +    ( cd openssl-%{V_openssl}
 30.1210 +      cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
 30.1211 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
 30.1212 +    ) || exit $?
 30.1213 +    ( cd curl-%{V_curl}
 30.1214 +      cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
 30.1215 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
 30.1216 +    ) || exit $?
 30.1217 +    ( cd bzip2-%{V_bzip2}
 30.1218 +      cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
 30.1219 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
 30.1220 +    ) || exit $?
 30.1221 +    ( cd gzip-%{V_gzip}
 30.1222 +      cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
 30.1223 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
 30.1224 +    ) || exit $?
 30.1225 +    ( cd patch-%{V_patch}
 30.1226 +      cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
 30.1227 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
 30.1228 +    ) || exit $?
 30.1229 +    ( cd tar-%{V_tar}
 30.1230 +      cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
 30.1231 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
 30.1232 +    ) || exit $?
 30.1233 +    ( cd bash-%{V_bash}
 30.1234 +      cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
 30.1235 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
 30.1236 +    ) || exit $?
 30.1237 +    ( cd uuid-%{V_uuid}
 30.1238 +      cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
 30.1239 +      ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
 30.1240 +    ) || exit $?
 30.1241 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1242 +        -e "s;@l_musr@;%{l_musr};g" \
 30.1243 +        -e "s;@l_mgrp@;%{l_mgrp};g" \
 30.1244 +        <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
 30.1245 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
 30.1246 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1247 +        <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
 30.1248 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1249 +        <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
 30.1250 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
 30.1251 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1252 +        <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
 30.1253 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1254 +        -e "s;@l_musr@;%{l_musr};g" \
 30.1255 +        -e "s;@l_mgrp@;%{l_mgrp};g" \
 30.1256 +        <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
 30.1257 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
 30.1258 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1259 +        <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
 30.1260 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
 30.1261 +
 30.1262 +    #   install OpenPKG tool chain execution frontend and execution wrapper
 30.1263 +    cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 30.1264 +    ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 30.1265 +    chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
 30.1266 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1267 +        <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
 30.1268 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
 30.1269 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1270 +        <`SOURCE openpkg.1` \
 30.1271 +        >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
 30.1272 +
 30.1273 +    #   install more OpenPKG tool chain commands
 30.1274 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1275 +        <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
 30.1276 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
 30.1277 +    sed -e "s;@l_prefix@;%{l_prefix};g" \
 30.1278 +        <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
 30.1279 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
 30.1280 +
 30.1281 +    #   install an own copy of shtool
 30.1282 +    cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
 30.1283 +    chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
 30.1284 +
 30.1285 +    #   display verbosity header
 30.1286 +    set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
 30.1287 +
 30.1288 +    #   install a few README files
 30.1289 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1290 +        <`SOURCE root.README` \
 30.1291 +        >$RPM_BUILD_ROOT%{l_prefix}/README
 30.1292 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1293 +        <`SOURCE local.README` \
 30.1294 +        >$RPM_BUILD_ROOT%{l_prefix}/local/README
 30.1295 +
 30.1296 +    #   install Bash environment
 30.1297 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1298 +        <`SOURCE dot.bashrc` \
 30.1299 +        >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
 30.1300 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1301 +        <`SOURCE dot.bash_login` \
 30.1302 +        >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
 30.1303 +
 30.1304 +    #   install Run-Command files
 30.1305 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1306 +        -e "s:@l_susr@:%{l_susr}:g" \
 30.1307 +        -e "s:@l_musr@:%{l_musr}:g" \
 30.1308 +        <`SOURCE rc` \
 30.1309 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
 30.1310 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
 30.1311 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1312 +        <`SOURCE rc.conf` \
 30.1313 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
 30.1314 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
 30.1315 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1316 +        <`SOURCE rc.func` \
 30.1317 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
 30.1318 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
 30.1319 +    mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
 30.1320 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1321 +        -e "s:@l_musr@:%{l_musr}:g" \
 30.1322 +        <`SOURCE rc.openpkg` \
 30.1323 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
 30.1324 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
 30.1325 +    ( echo "#!/bin/sh"
 30.1326 +      echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
 30.1327 +    ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
 30.1328 +    chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
 30.1329 +    ln  $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
 30.1330 +        $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
 30.1331 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1332 +        <`SOURCE rc.8` \
 30.1333 +        >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
 30.1334 +
 30.1335 +    #   create configuration directory
 30.1336 +    test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
 30.1337 +        mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
 30.1338 +
 30.1339 +    #   install platform identification file
 30.1340 +    sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
 30.1341 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
 30.1342 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
 30.1343 +
 30.1344 +    #   install UUID configuration file (ghost)
 30.1345 +    touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
 30.1346 +    chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
 30.1347 +
 30.1348 +    #   install registry configuration files (ghost)
 30.1349 +    touch \
 30.1350 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
 30.1351 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
 30.1352 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
 30.1353 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
 30.1354 +    chmod 644 \
 30.1355 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
 30.1356 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
 30.1357 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
 30.1358 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
 30.1359 +
 30.1360 +    #   install default managers configuration file
 30.1361 +    ( echo "##"
 30.1362 +      echo "##  managers -- OpenPKG Instance Managers"
 30.1363 +      echo "##"
 30.1364 +      echo ""
 30.1365 +      echo "%{l_susr}"
 30.1366 +      echo "%{l_musr}"
 30.1367 +      echo ""
 30.1368 +    ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
 30.1369 +
 30.1370 +    #   install overriding RPM configuration files
 30.1371 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1372 +        <`SOURCE rpmpopt` \
 30.1373 +        >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
 30.1374 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1375 +        <`SOURCE rpmrc` \
 30.1376 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
 30.1377 +    sed -e "s:@l_prefix@:%{l_prefix}:g" \
 30.1378 +        -e "s:@l_prefix_static@:%{l_prefix}:g" \
 30.1379 +        -e "s;@l_build_path@;$l_build_path;g" \
 30.1380 +        -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
 30.1381 +        -e "s;@l_build_ulim@;$l_build_ulim;g" \
 30.1382 +        -e "s:@TAG@:$tag:g" \
 30.1383 +        -e "s:@SUSR@:$susr:g" \
 30.1384 +        -e "s:@SGRP@:$sgrp:g" \
 30.1385 +        -e "s:@MUSR@:$musr:g" \
 30.1386 +        -e "s:@MGRP@:$mgrp:g" \
 30.1387 +        -e "s:@RUSR@:$rusr:g" \
 30.1388 +        -e "s:@RGRP@:$rgrp:g" \
 30.1389 +        -e "s:@NUSR@:$nusr:g" \
 30.1390 +        -e "s:@NGRP@:$ngrp:g" \
 30.1391 +        <`SOURCE rpmmacros` \
 30.1392 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
 30.1393 +    cp `SOURCE openpkg.org.pgp` \
 30.1394 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
 30.1395 +    cp `SOURCE openpkg.com.pgp` \
 30.1396 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
 30.1397 +    cp `SOURCE openpkg.net.pgp` \
 30.1398 +       $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
 30.1399 +
 30.1400 +    #   display verbosity header
 30.1401 +    set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
 30.1402 +
 30.1403 +%files
 30.1404 +    %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
 30.1405 +    %{l_prefix}/README
 30.1406 +    %config(noreplace) %{l_prefix}/.bashrc
 30.1407 +    %config(noreplace) %{l_prefix}/.bash_login
 30.1408 +    %dir %{l_prefix}/RPM
 30.1409 +    %dir %{l_prefix}/RPM/SRC
 30.1410 +    %dir %{l_prefix}/RPM/PKG
 30.1411 +    %dir %{l_prefix}/RPM/DB
 30.1412 +    %dir %{l_prefix}/RPM/TMP
 30.1413 +    %dir %{l_prefix}/cgi
 30.1414 +    %dir %{l_prefix}/bin
 30.1415 +    %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
 30.1416 +    %dir %{l_prefix}/etc
 30.1417 +    %{l_prefix}/etc/rc
 30.1418 +    %config(noreplace) %{l_prefix}/etc/rc.conf
 30.1419 +    %{l_prefix}/etc/rc.func
 30.1420 +    %dir %{l_prefix}/etc/rc.d
 30.1421 +    %{l_prefix}/etc/rc.d/rc.openpkg
 30.1422 +    %dir %{l_prefix}/etc/openpkg
 30.1423 +    %ghost %{l_prefix}/etc/openpkg/uuid
 30.1424 +    %config %{l_prefix}/etc/openpkg/platform
 30.1425 +    %config %{l_prefix}/etc/openpkg/rpmmacros
 30.1426 +    %config %{l_prefix}/etc/openpkg/rpmrc
 30.1427 +    %ghost %{l_prefix}/etc/openpkg/register.conf
 30.1428 +    %ghost %{l_prefix}/etc/openpkg/register.prep
 30.1429 +    %ghost %{l_prefix}/etc/openpkg/register.tran
 30.1430 +    %ghost %{l_prefix}/etc/openpkg/register.util
 30.1431 +    %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
 30.1432 +    %{l_prefix}/etc/openpkg/openpkg.org.pgp
 30.1433 +    %{l_prefix}/etc/openpkg/openpkg.com.pgp
 30.1434 +    %{l_prefix}/etc/openpkg/openpkg.net.pgp
 30.1435 +    %dir %{l_prefix}/include
 30.1436 +    %dir %{l_prefix}/include/openpkg
 30.1437 +    %dir %{l_prefix}/include/openpkg/rpm
 30.1438 +    %{l_prefix}/include/openpkg/rpm/argv.h
 30.1439 +    %{l_prefix}/include/openpkg/rpm/beecrypt.h
 30.1440 +    %{l_prefix}/include/openpkg/rpm/bzlib.h
 30.1441 +    %{l_prefix}/include/openpkg/rpm/db.h
 30.1442 +    %{l_prefix}/include/openpkg/rpm/fts.h
 30.1443 +    %{l_prefix}/include/openpkg/rpm/glob.h
 30.1444 +    %{l_prefix}/include/openpkg/rpm/hdrinline.h
 30.1445 +    %{l_prefix}/include/openpkg/rpm/header.h
 30.1446 +    %{l_prefix}/include/openpkg/rpm/misc.h
 30.1447 +    %{l_prefix}/include/openpkg/rpm/popt.h
 30.1448 +    %{l_prefix}/include/openpkg/rpm/rpmal.h
 30.1449 +    %{l_prefix}/include/openpkg/rpm/rpmbuild.h
 30.1450 +    %{l_prefix}/include/openpkg/rpm/rpmcli.h
 30.1451 +    %{l_prefix}/include/openpkg/rpm/rpmdb.h
 30.1452 +    %{l_prefix}/include/openpkg/rpm/rpmds.h
 30.1453 +    %{l_prefix}/include/openpkg/rpm/rpmerr.h
 30.1454 +    %{l_prefix}/include/openpkg/rpm/rpmfc.h
 30.1455 +    %{l_prefix}/include/openpkg/rpm/rpmfi.h
 30.1456 +    %{l_prefix}/include/openpkg/rpm/rpmfile.h
 30.1457 +    %{l_prefix}/include/openpkg/rpm/rpmhash.h
 30.1458 +    %{l_prefix}/include/openpkg/rpm/rpmio.h
 30.1459 +    %{l_prefix}/include/openpkg/rpm/rpmlib.h
 30.1460 +    %{l_prefix}/include/openpkg/rpm/rpmlog.h
 30.1461 +    %{l_prefix}/include/openpkg/rpm/rpmmacro.h
 30.1462 +    %{l_prefix}/include/openpkg/rpm/rpmmessages.h
 30.1463 +    %{l_prefix}/include/openpkg/rpm/rpmpgp.h
 30.1464 +    %{l_prefix}/include/openpkg/rpm/rpmps.h
 30.1465 +    %{l_prefix}/include/openpkg/rpm/rpmspec.h
 30.1466 +    %{l_prefix}/include/openpkg/rpm/rpmsw.h
 30.1467 +    %{l_prefix}/include/openpkg/rpm/rpmte.h
 30.1468 +    %{l_prefix}/include/openpkg/rpm/rpmts.h
 30.1469 +    %{l_prefix}/include/openpkg/rpm/rpmurl.h
 30.1470 +    %{l_prefix}/include/openpkg/rpm/stringbuf.h
 30.1471 +    %{l_prefix}/include/openpkg/rpm/ugid.h
 30.1472 +    %{l_prefix}/include/openpkg/rpm/zconf.h
 30.1473 +    %{l_prefix}/include/openpkg/rpm/zlib.h
 30.1474 +    %dir %{l_prefix}/info
 30.1475 +    %dir %{l_prefix}/lib
 30.1476 +    %dir %{l_prefix}/lib/openpkg
 30.1477 +    %{l_prefix}/lib/openpkg/bash
 30.1478 +    %{l_prefix}/lib/openpkg/bzip2
 30.1479 +    %{l_prefix}/lib/openpkg/curl
 30.1480 +    %{l_prefix}/lib/openpkg/file
 30.1481 +    %{l_prefix}/lib/openpkg/gzip
 30.1482 +    %{l_prefix}/lib/openpkg/librpm.a
 30.1483 +    %{l_prefix}/lib/openpkg/librpmbeecrypt.a
 30.1484 +    %{l_prefix}/lib/openpkg/librpmbuild.a
 30.1485 +    %{l_prefix}/lib/openpkg/librpmbz2.a
 30.1486 +    %{l_prefix}/lib/openpkg/librpmdb.a
 30.1487 +    %{l_prefix}/lib/openpkg/librpmio.a
 30.1488 +    %{l_prefix}/lib/openpkg/librpmpopt.a
 30.1489 +    %{l_prefix}/lib/openpkg/librpmz.a
 30.1490 +    %{l_prefix}/lib/openpkg/macros
 30.1491 +    %{l_prefix}/lib/openpkg/magic
 30.1492 +    %{l_prefix}/lib/openpkg/magic.mgc
 30.1493 +    %{l_prefix}/lib/openpkg/magic.mime
 30.1494 +    %{l_prefix}/lib/openpkg/magic.mime.mgc
 30.1495 +    %{l_prefix}/lib/openpkg/miniperl
 30.1496 +    %{l_prefix}/lib/openpkg/openpkg
 30.1497 +    %{l_prefix}/lib/openpkg/openssl
 30.1498 +    %{l_prefix}/lib/openpkg/patch
 30.1499 +    %{l_prefix}/lib/openpkg/rc
 30.1500 +    %{l_prefix}/lib/openpkg/rpm
 30.1501 +    %{l_prefix}/lib/openpkg/rpmb
 30.1502 +    %{l_prefix}/lib/openpkg/rpmd
 30.1503 +    %{l_prefix}/lib/openpkg/rpmdb
 30.1504 +    %{l_prefix}/lib/openpkg/rpmdb_dump
 30.1505 +    %{l_prefix}/lib/openpkg/rpmdb_load
 30.1506 +    %{l_prefix}/lib/openpkg/rpmdb_verify
 30.1507 +    %{l_prefix}/lib/openpkg/rpme
 30.1508 +    %{l_prefix}/lib/openpkg/rpmi
 30.1509 +    %{l_prefix}/lib/openpkg/rpmk
 30.1510 +    %{l_prefix}/lib/openpkg/rpmpopt
 30.1511 +    %{l_prefix}/lib/openpkg/rpmq
 30.1512 +    %{l_prefix}/lib/openpkg/rpmt
 30.1513 +    %{l_prefix}/lib/openpkg/rpmtool
 30.1514 +    %{l_prefix}/lib/openpkg/rpmu
 30.1515 +    %{l_prefix}/lib/openpkg/rpmv
 30.1516 +    %{l_prefix}/lib/openpkg/shtool
 30.1517 +    %{l_prefix}/lib/openpkg/tar
 30.1518 +    %{l_prefix}/lib/openpkg/uuid
 30.1519 +    %dir %{l_prefix}/libexec
 30.1520 +    %dir %{l_prefix}/libexec/openpkg
 30.1521 +    %{l_prefix}/libexec/openpkg/build.8
 30.1522 +    %{l_prefix}/libexec/openpkg/build.pl
 30.1523 +    %{l_prefix}/libexec/openpkg/curl.sh
 30.1524 +    %{l_prefix}/libexec/openpkg/install
 30.1525 +    %{l_prefix}/libexec/openpkg/lsync
 30.1526 +    %{l_prefix}/libexec/openpkg/lsync.8
 30.1527 +    %{l_prefix}/libexec/openpkg/man
 30.1528 +    %{l_prefix}/libexec/openpkg/rc
 30.1529 +    %{l_prefix}/libexec/openpkg/rc.8
 30.1530 +    %{l_prefix}/libexec/openpkg/register
 30.1531 +    %{l_prefix}/libexec/openpkg/register.8
 30.1532 +    %{l_prefix}/libexec/openpkg/release
 30.1533 +    %{l_prefix}/libexec/openpkg/release.8
 30.1534 +    %{l_prefix}/libexec/openpkg/rpm
 30.1535 +    %{l_prefix}/libexec/openpkg/rpm-config
 30.1536 +    %{l_prefix}/libexec/openpkg/rpm-config.8
 30.1537 +    %{l_prefix}/libexec/openpkg/rpm.8
 30.1538 +    %{l_prefix}/libexec/openpkg/rpm2cpio
 30.1539 +    %{l_prefix}/libexec/openpkg/rpm2cpio.8
 30.1540 +    %{l_prefix}/libexec/openpkg/rpmbuild
 30.1541 +    %{l_prefix}/libexec/openpkg/rpmbuild.8
 30.1542 +    %{l_prefix}/libexec/openpkg/uuid
 30.1543 +    %{l_prefix}/libexec/openpkg/uuid.8
 30.1544 +    %dir %{l_prefix}/man
 30.1545 +    %dir %{l_prefix}/man/man1
 30.1546 +    %dir %{l_prefix}/man/man2
 30.1547 +    %dir %{l_prefix}/man/man3
 30.1548 +    %dir %{l_prefix}/man/man4
 30.1549 +    %dir %{l_prefix}/man/man5
 30.1550 +    %dir %{l_prefix}/man/man6
 30.1551 +    %dir %{l_prefix}/man/man7
 30.1552 +    %dir %{l_prefix}/man/man8
 30.1553 +    %dir %{l_prefix}/man/man9
 30.1554 +    %dir %{l_prefix}/man/cat1
 30.1555 +    %dir %{l_prefix}/man/cat2
 30.1556 +    %dir %{l_prefix}/man/cat3
 30.1557 +    %dir %{l_prefix}/man/cat4
 30.1558 +    %dir %{l_prefix}/man/cat5
 30.1559 +    %dir %{l_prefix}/man/cat6
 30.1560 +    %dir %{l_prefix}/man/cat7
 30.1561 +    %dir %{l_prefix}/man/cat8
 30.1562 +    %dir %{l_prefix}/man/cat9
 30.1563 +    %{l_prefix}/man/man1/openpkg.1
 30.1564 +    %dir %{l_prefix}/sbin
 30.1565 +    %dir %{l_prefix}/pub
 30.1566 +    %dir %{l_prefix}/share
 30.1567 +    %dir %{l_prefix}/var
 30.1568 +    %dir %{l_prefix}/local
 30.1569 +    %{l_prefix}/local/README
 30.1570 +    %{l_prefix}/local/.lsyncrc
 30.1571 +    %dir %{l_prefix}/local/PKG
 30.1572 +    %dir %{l_prefix}/local/bin
 30.1573 +    %dir %{l_prefix}/local/etc
 30.1574 +    %dir %{l_prefix}/local/include
 30.1575 +    %dir %{l_prefix}/local/info
 30.1576 +    %dir %{l_prefix}/local/lib
 30.1577 +    %dir %{l_prefix}/local/man
 30.1578 +    %dir %{l_prefix}/local/man/man1
 30.1579 +    %dir %{l_prefix}/local/man/man2
 30.1580 +    %dir %{l_prefix}/local/man/man3
 30.1581 +    %dir %{l_prefix}/local/man/man4
 30.1582 +    %dir %{l_prefix}/local/man/man5
 30.1583 +    %dir %{l_prefix}/local/man/man6
 30.1584 +    %dir %{l_prefix}/local/man/man7
 30.1585 +    %dir %{l_prefix}/local/man/man8
 30.1586 +    %dir %{l_prefix}/local/man/man9
 30.1587 +    %dir %{l_prefix}/local/man/cat1
 30.1588 +    %dir %{l_prefix}/local/man/cat2
 30.1589 +    %dir %{l_prefix}/local/man/cat3
 30.1590 +    %dir %{l_prefix}/local/man/cat4
 30.1591 +    %dir %{l_prefix}/local/man/cat5
 30.1592 +    %dir %{l_prefix}/local/man/cat6
 30.1593 +    %dir %{l_prefix}/local/man/cat7
 30.1594 +    %dir %{l_prefix}/local/man/cat8
 30.1595 +    %dir %{l_prefix}/local/man/cat9
 30.1596 +    %dir %{l_prefix}/local/sbin
 30.1597 +
 30.1598 +%clean
 30.1599 +    #   skip in bootstrap phase 2 (see openpkg.boot)
 30.1600 +    [ ".$OPENPKG_BOOT" = .1 ] && exit 0
 30.1601 +
 30.1602 +    #   cleanup build area
 30.1603 +    rm -rf openpkg-%{version} >/dev/null 2>&1 || true
 30.1604 +
 30.1605 +    #   cleanup installation area
 30.1606 +    rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
 30.1607 +
 30.1608 +%pre
 30.1609 +    #   always performed for upgrades and because it doesn't harm!
 30.1610 +    #   [ ".$1" != .1 ] && exit 0
 30.1611 +
 30.1612 +    #   this procedure is only usable with root privileges
 30.1613 +    #   (for non-root installations it is not required at all)
 30.1614 +    cusr=`(id -un) 2>/dev/null ||\
 30.1615 +          (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
 30.1616 +          (whoami) 2>/dev/null ||\
 30.1617 +          (who am i | cut "-d " -f1) 2>/dev/null ||\
 30.1618 +          echo $LOGNAME`
 30.1619 +
 30.1620 +    #   determine runtime details (for both inside and outside RPM!!)
 30.1621 +    #   - bootstrapping: $xxx is set from aux.wrapbin.sh
 30.1622 +    #   - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
 30.1623 +    #   - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
 30.1624 +    [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
 30.1625 +    [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
 30.1626 +    [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
 30.1627 +    [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
 30.1628 +    [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
 30.1629 +    [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
 30.1630 +    [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
 30.1631 +    [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
 30.1632 +    [ ".$suid" = . ] && suid="%{?l_suid}"
 30.1633 +    [ ".$sgid" = . ] && sgid="%{?l_sgid}"
 30.1634 +    [ ".$muid" = . ] && muid="%{?l_muid}"
 30.1635 +    [ ".$mgid" = . ] && mgid="%{?l_mgid}"
 30.1636 +    [ ".$ruid" = . ] && ruid="%{?l_ruid}"
 30.1637 +    [ ".$rgid" = . ] && rgid="%{?l_rgid}"
 30.1638 +    [ ".$nuid" = . ] && nuid="%{?l_nuid}"
 30.1639 +    [ ".$ngid" = . ] && ngid="%{?l_ngid}"
 30.1640 +
 30.1641 +    #   if any of these optional params are not used we won't have a
 30.1642 +    #   corresponding macro either, so make use of one conditionally
 30.1643 +    [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
 30.1644 +    [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
 30.1645 +    [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
 30.1646 +    [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
 30.1647 +    [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
 30.1648 +    [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
 30.1649 +    [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
 30.1650 +    [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
 30.1651 +
 30.1652 +    #   determine prefix
 30.1653 +    [ ".$prefix" = . ] && prefix="%{l_prefix}"
 30.1654 +    prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
 30.1655 +
 30.1656 +    #   register instance in presence file
 30.1657 +    presence="/etc/openpkg"
 30.1658 +    exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
 30.1659 +    if [ ".$exists" = . ]; then
 30.1660 +        ( umask 022
 30.1661 +          echo "${prefix}" >>$presence
 30.1662 +        ) 2>/dev/null || true
 30.1663 +    fi
 30.1664 +
 30.1665 +    #   determine user/group ids
 30.1666 +    for class in s m r n; do
 30.1667 +        eval "xusr=\"\$${class}usr\""
 30.1668 +        eval "xgrp=\"\$${class}grp\""
 30.1669 +        eval "xuid=\"\$${class}uid\""
 30.1670 +        eval "xgid=\"\$${class}gid\""
 30.1671 +        if [ ".$xuid" = . ]; then
 30.1672 +            xuid=`(getent passwd "${xusr}"; \
 30.1673 +                   grep "^${xusr}:" /etc/passwd; \
 30.1674 +                   ypmatch "${xusr}" passwd; \
 30.1675 +                   nismatch "${xusr}" passwd; \
 30.1676 +                   nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
 30.1677 +                   sed -e 'q' | awk -F: '{ print $3; }'`
 30.1678 +            if [ ".$xuid" = . ]; then
 30.1679 +                #   seek for a reasonably uid/gid pair
 30.1680 +                xuid=1000
 30.1681 +                ok=0
 30.1682 +                while [ ".$ok" = .0 ]; do
 30.1683 +                    eval "u_exists=\$u_exists_$xuid"
 30.1684 +                    if [ ".$u_exists" = . ]; then
 30.1685 +                        u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
 30.1686 +                                  grep "^[^:]*:[^:]*:$xuid:"`
 30.1687 +                    fi
 30.1688 +                    eval "g_exists=\$g_exists_$xuid"
 30.1689 +                    if [ ".$g_exists" = . ]; then
 30.1690 +                        g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
 30.1691 +                                  grep "^[^:]*:[^:]*:$xuid:"`
 30.1692 +                    fi
 30.1693 +                    if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
 30.1694 +                        ok=1
 30.1695 +                        break
 30.1696 +                    fi
 30.1697 +                    xuid=`expr $xuid + 1`
 30.1698 +                done
 30.1699 +                eval "u_exists_$xuid=yes"
 30.1700 +                eval "g_exists_$xuid=yes"
 30.1701 +            fi
 30.1702 +        fi
 30.1703 +        if [ ".$xgid" = . ]; then
 30.1704 +            xgid=`(getent group "${xgrp}"; \
 30.1705 +                  grep "^${xgrp}:" /etc/group; \
 30.1706 +                  ypmatch "${xgrp}" group; \
 30.1707 +                  nismatch "${xgrp}" group; \
 30.1708 +                  nidump group . | grep "^${xgrp}:") 2>/dev/null | \
 30.1709 +                  sed -e 'q' | awk -F: '{ print $3; }'`
 30.1710 +            if [ ".$xgid" = . ]; then
 30.1711 +                xgid="$xuid"
 30.1712 +            fi
 30.1713 +        fi
 30.1714 +        eval "${class}uid=\"$xuid\""
 30.1715 +        eval "${class}gid=\"$xgid\""
 30.1716 +    done
 30.1717 +
 30.1718 +    #   determine platform id
 30.1719 +    s=`(uname -s) 2>/dev/null` || s='Unknown'
 30.1720 +    r=`(uname -r) 2>/dev/null` || r='0.0'
 30.1721 +    plid="${s}/${r}"
 30.1722 +
 30.1723 +    #   add entry to /etc/shells
 30.1724 +    shell="${prefix}/lib/openpkg/bash"
 30.1725 +    if [ -f /etc/shells ]; then
 30.1726 +        exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
 30.1727 +        if [ ".$exists" = . ]; then
 30.1728 +            if [ ".$cusr" != ".root" ]; then
 30.1729 +                echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
 30.1730 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.1731 +            else
 30.1732 +                echo "${shell}" >>/etc/shells
 30.1733 +            fi
 30.1734 +        fi
 30.1735 +    fi
 30.1736 +
 30.1737 +    #   clear pending deferred actions
 30.1738 +    rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
 30.1739 +
 30.1740 +    #   create the hierarchy user/group
 30.1741 +    for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
 30.1742 +               "management:${musr}:${muid}:${mgrp}:${mgid}" \
 30.1743 +               "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
 30.1744 +               "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
 30.1745 +        #   split request into class/usr/uid/grp/gid
 30.1746 +        OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
 30.1747 +        class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
 30.1748 +
 30.1749 +        #   check whether user already exists
 30.1750 +        exists=`(getent passwd "$usr"; \
 30.1751 +                 grep "^$usr:" /etc/passwd; \
 30.1752 +                 ypmatch "$usr" passwd; \
 30.1753 +                 nismatch "$usr" passwd; \
 30.1754 +                 nidump passwd . | grep "^$usr:") 2>/dev/null | \
 30.1755 +                 sed -e 'q'`
 30.1756 +        if [ ".$exists" = . ]; then
 30.1757 +            if [ ".$cusr" != ".root" ]; then
 30.1758 +                echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
 30.1759 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.1760 +            else
 30.1761 +                #   add entry to passwd database
 30.1762 +                realname="${prefix} OpenPKG ($class)"
 30.1763 +                case "$plid" in
 30.1764 +                    FreeBSD/* | NetBSD/* )
 30.1765 +                        file=/etc/master.passwd
 30.1766 +                        entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
 30.1767 +                        update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
 30.1768 +                        ;;
 30.1769 +                    Linux/* )
 30.1770 +                        file=/etc/passwd
 30.1771 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
 30.1772 +                        update="(PATH=\$PATH:/usr/sbin; pwconv)"
 30.1773 +                        ;;
 30.1774 +                    SunOS/5.* | UnixWare/* )
 30.1775 +                        file=/etc/passwd
 30.1776 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
 30.1777 +                        update="(PATH=\$PATH:/usr/sbin; pwconv)"
 30.1778 +                        ;;
 30.1779 +                    AIX/* )
 30.1780 +                        #   intentionally do nothing here
 30.1781 +                        :
 30.1782 +                        ;;
 30.1783 +                    OSF1/V5.* )
 30.1784 +                        file=/etc/passwd
 30.1785 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
 30.1786 +                        update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
 30.1787 +                        ;;
 30.1788 +                    HP-UX/* )
 30.1789 +                        file=/etc/passwd
 30.1790 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
 30.1791 +                        update=":"
 30.1792 +                        ;;
 30.1793 +                    Darwin/* )
 30.1794 +                        #   intentionally do nothing here
 30.1795 +                        :
 30.1796 +                        ;;
 30.1797 +                    IRIX*/6.* )
 30.1798 +                        file=/etc/passwd
 30.1799 +                        entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
 30.1800 +                        if   [ -f /etc/shadow ]
 30.1801 +                        then update="(PATH=\$PATH:/sbin; pwconv)"
 30.1802 +                        else update=":"
 30.1803 +                        fi
 30.1804 +                        ;;
 30.1805 +                esac
 30.1806 +                case "$plid" in
 30.1807 +                    Darwin/* )
 30.1808 +                        niutil -create     . "/users/${usr}"
 30.1809 +                        niutil -createprop . "/users/${usr}" passwd   "*"
 30.1810 +                        niutil -createprop . "/users/${usr}" uid      "${uid}"
 30.1811 +                        niutil -createprop . "/users/${usr}" gid      "${gid}"
 30.1812 +                        niutil -createprop . "/users/${usr}" realname "${realname}"
 30.1813 +                        niutil -createprop . "/users/${usr}" home     "${prefix}"
 30.1814 +                        niutil -createprop . "/users/${usr}" shell    "${shell}"
 30.1815 +                        ;;
 30.1816 +                    AIX/* )
 30.1817 +                        mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
 30.1818 +                        cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
 30.1819 +                        sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
 30.1820 +                            </etc/security/login.cfg.bak >/etc/security/login.cfg && \
 30.1821 +                        rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
 30.1822 +                        #   defer both the setting of the primary group and the shell,
 30.1823 +                        #   as they do not exist at this stage of processing.
 30.1824 +                        echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
 30.1825 +                        echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
 30.1826 +                        ;;
 30.1827 +                    * )
 30.1828 +                        cp $file $file.bak && \
 30.1829 +                        (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
 30.1830 +                        rm -f $file.bak >/dev/null 2>&1
 30.1831 +                        eval $update
 30.1832 +                        [ $? -ne 0 ] && exit $?
 30.1833 +                        ;;
 30.1834 +                esac
 30.1835 +            fi
 30.1836 +        fi
 30.1837 +
 30.1838 +        #   check whether group already exists
 30.1839 +        exists=`(getent group "$grp"; \
 30.1840 +                grep "^$grp:" /etc/group; \
 30.1841 +                ypmatch "$grp" group; \
 30.1842 +                nismatch "$grp" group; \
 30.1843 +                nidump group . | grep "^$grp:") 2>/dev/null | \
 30.1844 +                sed -e 'q'`
 30.1845 +        if [ ".$exists" = . ]; then
 30.1846 +            if [ ".$cusr" != ".root" ]; then
 30.1847 +                echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
 30.1848 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.1849 +            else
 30.1850 +                case "$plid" in
 30.1851 +                    Darwin/* )
 30.1852 +                        niutil -create     . "/groups/${grp}"
 30.1853 +                        niutil -createprop . "/groups/${grp}" gid   "${gid}"
 30.1854 +                        niutil -createprop . "/groups/${grp}" users "${usr}"
 30.1855 +                        ;;
 30.1856 +                    AIX/* )
 30.1857 +                        mkgroup id="${gid}" users="${usr}" "${grp}"
 30.1858 +                        ;;
 30.1859 +                    * )
 30.1860 +                        #   add entry to group database
 30.1861 +                        file=/etc/group
 30.1862 +                        entry="${grp}:*:${gid}:${usr}"
 30.1863 +                        cp $file $file.bak && \
 30.1864 +                        (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
 30.1865 +                        rm -f $file.bak >/dev/null 2>&1
 30.1866 +                    ;;
 30.1867 +                esac
 30.1868 +            fi
 30.1869 +        fi
 30.1870 +    done
 30.1871 +
 30.1872 +    #   optional group processing (deferred adjustment of primary group)
 30.1873 +    if [ -f %{l_prefix}.pre-group-process.sh ]; then
 30.1874 +        sh %{l_prefix}.pre-group-process.sh
 30.1875 +        rm -f %{l_prefix}.pre-group-process.sh
 30.1876 +    fi
 30.1877 +
 30.1878 +    #   invalidate passwd and group tables from Name Service Cache Daemon to
 30.1879 +    #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
 30.1880 +    if [ -x /usr/sbin/nscd ]; then
 30.1881 +        /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
 30.1882 +        /usr/sbin/nscd -i group >/dev/null 2>&1 || true
 30.1883 +    fi
 30.1884 +
 30.1885 +    #   create the startup/shutdown transfer script
 30.1886 +    name=`echo "$prefix" | sed -e 's;/;;g'`
 30.1887 +    if [ ".$cusr" != ".root" ]; then
 30.1888 +        echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
 30.1889 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.1890 +    else
 30.1891 +        case "$plid" in
 30.1892 +            FreeBSD/* )
 30.1893 +                if [ ! -f /etc/rc.d/openpkg-${name} ]; then
 30.1894 +                    #   install transfer script
 30.1895 +                    rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
 30.1896 +                    ( echo "#!/bin/sh"
 30.1897 +                      echo "##"
 30.1898 +                      echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.1899 +                      echo "##"
 30.1900 +                      echo ""
 30.1901 +                      echo "# PROVIDE: openpkg-${name}"
 30.1902 +                      echo "# REQUIRE: LOGIN"
 30.1903 +                      echo "# KEYWORD: shutdown"
 30.1904 +                      echo ""
 30.1905 +                      echo ". /etc/rc.subr"
 30.1906 +                      echo ""
 30.1907 +                      echo "name=\"openpkg_${name}\""
 30.1908 +                      echo "start_cmd=\"openpkg_rc_all start\""
 30.1909 +                      echo "stop_cmd=\"openpkg_rc_all stop\""
 30.1910 +                      echo "restart_cmd=\"openpkg_rc_all stop start\""
 30.1911 +                      echo ""
 30.1912 +                      echo "openpkg_rc_all () {"
 30.1913 +                      echo "    if [ -f ${prefix}/etc/rc ]; then"
 30.1914 +                      echo "        ${prefix}/etc/rc all \"\$@\""
 30.1915 +                      echo "    fi"
 30.1916 +                      echo "}"
 30.1917 +                      echo ""
 30.1918 +                      echo "load_rc_config \$name"
 30.1919 +                      echo "run_rc_command \"\$1\""
 30.1920 +                      echo ""
 30.1921 +                    ) >/etc/rc.d/openpkg-${name}
 30.1922 +                    chmod 755 /etc/rc.d/openpkg-${name}
 30.1923 +                fi
 30.1924 +                ;;
 30.1925 +            NetBSD/* )
 30.1926 +                if [ ! -f /etc/rc.d/${name} ]; then
 30.1927 +                    ( echo "#!/bin/sh"
 30.1928 +                      echo "##"
 30.1929 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.1930 +                      echo "##"
 30.1931 +                      echo "##  PROVIDE: ${name}"
 30.1932 +                      echo "##  REQUIRE: DAEMON LOGIN NETWORK SERVERS"
 30.1933 +                      echo "##"
 30.1934 +                      echo ""
 30.1935 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.1936 +                      echo "case \$1 in"
 30.1937 +                      echo "    start   ) exec ${prefix}/etc/rc all start ;;"
 30.1938 +                      echo "    stop    ) exec ${prefix}/etc/rc all stop  ;;"
 30.1939 +                      echo "    restart ) exec ${prefix}/etc/rc all stop start ;;"
 30.1940 +                      echo "    status  ) ;;"
 30.1941 +                      echo "esac"
 30.1942 +                    ) >/etc/rc.d/${name}
 30.1943 +                    chmod 755 /etc/rc.d/${name}
 30.1944 +                fi
 30.1945 +                ;;
 30.1946 +            Linux/* )
 30.1947 +                if [ -f /etc/gentoo-release ]; then
 30.1948 +                    if [ ! -f /etc/init.d/openpkg-${name} ]; then
 30.1949 +                        #   install transfer script
 30.1950 +                        ( echo "#!/sbin/runscript"
 30.1951 +                          echo "##"
 30.1952 +                          echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.1953 +                          echo "##"
 30.1954 +                          echo ""
 30.1955 +                          echo "depend() {"
 30.1956 +                          echo "    after *"
 30.1957 +                          echo "}"
 30.1958 +                          echo ""
 30.1959 +                          echo "checkconfig() {"
 30.1960 +                          echo "    [ -f ${prefix}/etc/rc ] || return 1"
 30.1961 +                          echo "    case $1 in"
 30.1962 +                          echo "        start ) exec ${prefix}/etc/rc all start ;;"
 30.1963 +                          echo "        stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.1964 +                          echo "    esac"
 30.1965 +                          echo "}"
 30.1966 +                          echo ""
 30.1967 +                          echo "start() {"
 30.1968 +                          echo "    checkconfig || return 1"
 30.1969 +                          echo "    ebegin "Starting OpenPKG ${prefix} hierarchy""
 30.1970 +                          echo "    exec ${prefix}/etc/rc all start"
 30.1971 +                          echo "    eend 0"
 30.1972 +                          echo "}"
 30.1973 +                          echo ""
 30.1974 +                          echo "stop() {"
 30.1975 +                          echo "    checkconfig || return 1"
 30.1976 +                          echo "    ebegin "Stopping OpenPKG ${prefix} hierarchy""
 30.1977 +                          echo "    exec ${prefix}/etc/rc all stop"
 30.1978 +                          echo "    eend 0"
 30.1979 +                          echo "}"
 30.1980 +                        ) >/etc/init.d/openpkg-${name}
 30.1981 +                        chmod 755 /etc/init.d/openpkg-${name}
 30.1982 +                        /sbin/rc-update add openpkg-${name} default
 30.1983 +                    fi
 30.1984 +                else
 30.1985 +                    #   sroot: script root directory
 30.1986 +                    #   lroot: link   root directory
 30.1987 +                    if [ -f /etc/debian_version ]; then
 30.1988 +                        sroot=/etc/init.d
 30.1989 +                        lroot=/etc/rc%d.d
 30.1990 +                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
 30.1991 +                        sroot=/etc/rc.d/init.d
 30.1992 +                        lroot=/etc/rc.d/rc%d.d
 30.1993 +                    elif [ -f /etc/SuSE-release ]; then
 30.1994 +                        sroot=/etc/init.d
 30.1995 +                        lroot=/etc/init.d/rc%d.d
 30.1996 +                    elif [ -f /etc/slackware-version ]; then
 30.1997 +                        sroot=/etc/rc.d
 30.1998 +                        lroot=/etc/rc.d/rc%d.d
 30.1999 +                        name="rc.${name}"
 30.2000 +                        for i in 0 1 2 3 4 5 6; do
 30.2001 +                            l=`echo $lroot | sed -e "s;%d;$i;"`
 30.2002 +                            if [ ! -d $l ]; then
 30.2003 +                                mkdir $l 2>&1 || true
 30.2004 +                            fi
 30.2005 +                        done
 30.2006 +                    else
 30.2007 +                        echo "WARNING: you are not running one of the supported standard" 1>&2
 30.2008 +                        echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)."   1>&2
 30.2009 +                        echo "WARNING: Guessing the location of the system init scripts!" 1>&2
 30.2010 +                        sroot=""
 30.2011 +                        lroot=""
 30.2012 +                        for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
 30.2013 +                            if [ -d $sr ]; then
 30.2014 +                                sroot="$sr"
 30.2015 +                                break
 30.2016 +                            fi
 30.2017 +                        done
 30.2018 +                        for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
 30.2019 +                            if [ -d $lr ]; then
 30.2020 +                                lroot="`echo $lr | sed -e 's;2;%d;'`"
 30.2021 +                                break
 30.2022 +                            fi
 30.2023 +                        done
 30.2024 +                        if [ ".$sroot" = . -o ".$lroot" = . ]; then
 30.2025 +                            echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
 30.2026 +                            exit 1
 30.2027 +                        fi
 30.2028 +                    fi
 30.2029 +                    if [ ! -f $sroot/${name} ]; then
 30.2030 +                        #   install transfer script
 30.2031 +                        ( echo "#!/bin/sh"
 30.2032 +                          echo "##"
 30.2033 +                          echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2034 +                          echo "##"
 30.2035 +                          echo ""
 30.2036 +                          echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2037 +                          echo "case \$1 in"
 30.2038 +                          echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2039 +                          echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2040 +                          echo "esac"
 30.2041 +                        ) >$sroot/${name}
 30.2042 +                        chmod 755 $sroot/${name}
 30.2043 +                        #   create corresponding symbolic links
 30.2044 +                        for i in 2 3 4 5; do
 30.2045 +                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
 30.2046 +                        done
 30.2047 +                        for i in 0 1 6; do
 30.2048 +                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
 30.2049 +                        done
 30.2050 +                    fi
 30.2051 +                fi
 30.2052 +                ;;
 30.2053 +            SunOS/5.* )
 30.2054 +                if [ ! -f /etc/init.d/${name} ]; then
 30.2055 +                    #   install transfer script
 30.2056 +                    ( echo "#!/bin/sh"
 30.2057 +                      echo "##"
 30.2058 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2059 +                      echo "##"
 30.2060 +                      echo ""
 30.2061 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2062 +                      echo "case \$1 in"
 30.2063 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2064 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2065 +                      echo "esac"
 30.2066 +                    ) >/etc/init.d/${name}
 30.2067 +                    chmod 755 /etc/init.d/${name}
 30.2068 +                    #   create corresponding symbolic links
 30.2069 +                    ( cd /etc
 30.2070 +                      ln init.d/${name} rc3.d/S99${name}
 30.2071 +                      ln init.d/${name} rc0.d/K00${name}
 30.2072 +                      ln init.d/${name} rc1.d/K00${name}
 30.2073 +                    ) || exit $?
 30.2074 +                fi
 30.2075 +                ;;
 30.2076 +            UnixWare/* )
 30.2077 +                if [ ! -f /etc/init.d/${name} ]; then
 30.2078 +                    #   install transfer script
 30.2079 +                    ( echo "#!/bin/sh"
 30.2080 +                      echo "##"
 30.2081 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2082 +                      echo "##"
 30.2083 +                      echo ""
 30.2084 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2085 +                      echo "case \$1 in"
 30.2086 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2087 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2088 +                      echo "esac"
 30.2089 +                    ) >/etc/init.d/${name}
 30.2090 +                    chmod 755 /etc/init.d/${name}
 30.2091 +                    #   create corresponding symbolic links
 30.2092 +                    ( cd /etc
 30.2093 +                      ln init.d/${name} rc2.d/S99${name}
 30.2094 +                      ln init.d/${name} rc0.d/K00${name}
 30.2095 +                      ln init.d/${name} rc1.d/K00${name}
 30.2096 +                    ) || exit $?
 30.2097 +                fi
 30.2098 +                ;;
 30.2099 +            AIX/* )
 30.2100 +                if [ ! -f /etc/rc.d/init.d/${name} ]; then
 30.2101 +                    #   install transfer script
 30.2102 +                    ( echo "#!/bin/sh"
 30.2103 +                      echo "##"
 30.2104 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2105 +                      echo "##"
 30.2106 +                      echo ""
 30.2107 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2108 +                      echo "case \$1 in"
 30.2109 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2110 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2111 +                      echo "esac"
 30.2112 +                    ) >/etc/rc.d/init.d/${name}
 30.2113 +                    chmod 755 /etc/rc.d/init.d/${name}
 30.2114 +                    #   create corresponding symbolic links
 30.2115 +                    ( cd /etc/rc.d
 30.2116 +                      ln -s ../init.d/${name} rc2.d/S99${name}
 30.2117 +                    ) || exit $?
 30.2118 +                fi
 30.2119 +                ;;
 30.2120 +            OSF1/V5.* )
 30.2121 +                if [ ! -f /sbin/init.d/${name} ]; then
 30.2122 +                    #   install transfer script
 30.2123 +                    ( echo "#!/bin/sh"
 30.2124 +                      echo "##"
 30.2125 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2126 +                      echo "##"
 30.2127 +                      echo ""
 30.2128 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2129 +                      echo "case \$1 in"
 30.2130 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2131 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2132 +                      echo "esac"
 30.2133 +                    ) >/sbin/init.d/${name}
 30.2134 +                    chmod 755 /sbin/init.d/${name}
 30.2135 +                    #   create corresponding symbolic links
 30.2136 +                    ( cd /sbin
 30.2137 +                      ln -s ../init.d/${name} rc3.d/S99${name}
 30.2138 +                      ln -s ../init.d/${name} rc0.d/K00${name}
 30.2139 +                    ) || exit $?
 30.2140 +                fi
 30.2141 +                ;;
 30.2142 +            HP-UX/* )
 30.2143 +                if [ ! -f /sbin/init.d/${name} ]; then
 30.2144 +                    #   install transfer script
 30.2145 +                    ( echo "#!/bin/sh"
 30.2146 +                      echo "##"
 30.2147 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2148 +                      echo "##"
 30.2149 +                      echo ""
 30.2150 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2151 +                      echo "case \$1 in"
 30.2152 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2153 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2154 +                      echo "esac"
 30.2155 +                    ) >/sbin/init.d/${name}
 30.2156 +                    chmod 755 /sbin/init.d/${name}
 30.2157 +                    #   create corresponding symbolic links
 30.2158 +                    ( cd /sbin
 30.2159 +                      ln -s ../init.d/${name} rc2.d/S900${name}
 30.2160 +                      ln -s ../init.d/${name} rc1.d/K100${name}
 30.2161 +                    ) || exit $?
 30.2162 +                fi
 30.2163 +                ;;
 30.2164 +            Darwin/* )
 30.2165 +                darwin_rc_dir="/System/Library/StartupItems/${name}"
 30.2166 +                if [ ! -d ${darwin_rc_dir} ]; then
 30.2167 +                    mkdir ${darwin_rc_dir}
 30.2168 +                fi
 30.2169 +
 30.2170 +                #   make sure hierarchy is activated in /etc/hostconfig
 30.2171 +                #   FIXME: cs: simple and bad code here without any detection of existing entries
 30.2172 +                echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
 30.2173 +
 30.2174 +                #   install transfer script
 30.2175 +                if [ ! -f ${darwin_rc_dir}/${name} ]; then
 30.2176 +                    rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
 30.2177 +                    ( echo "#!/bin/sh"
 30.2178 +                      echo "##"
 30.2179 +                      echo "##  ${darwin_rc_dir}/${name}"
 30.2180 +                      echo "##      -- startup transfer script for OpenPKG ${prefix} hierarchy"
 30.2181 +                      echo "##"
 30.2182 +                      echo ""
 30.2183 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2184 +                      echo ""
 30.2185 +                      echo ". /etc/rc.common"
 30.2186 +                      echo ""
 30.2187 +                      echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
 30.2188 +                      echo "    ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
 30.2189 +                      echo "    ${prefix}/etc/rc all start"
 30.2190 +                      echo "fi"
 30.2191 +                    ) >${darwin_rc_dir}/${name}
 30.2192 +                    chmod 755 ${darwin_rc_dir}/${name}
 30.2193 +                fi
 30.2194 +                #   install startup parameter list
 30.2195 +                if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
 30.2196 +                    rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
 30.2197 +                    ( echo "{"
 30.2198 +                      echo "  Description     = \"OpenPKG ${prefix} hierarchy\";"
 30.2199 +                      echo "  Provides        = (\"OpenPKG ${prefix}\");"
 30.2200 +                      echo "  Requires        = (\"Disks\", \"Network Configuration\", \"Resolver\");"
 30.2201 +                      echo "  Uses            = (\"Cron\");"
 30.2202 +                      echo "  OrderPreference = \"Last\";"
 30.2203 +                      echo "  Messages ="
 30.2204 +                      echo "  {"
 30.2205 +                      echo "    start = \"Starting OpenPKG ${prefix} hierarchy\";"
 30.2206 +                      echo "    stop  = \"Stopping OpenPKG ${prefix} hierarchy\";"
 30.2207 +                      echo "  };"
 30.2208 +                      echo "}"
 30.2209 +                    ) >${darwin_rc_dir}/StartupParameters.plist
 30.2210 +                    chmod 644 ${darwin_rc_dir}/StartupParameters.plist
 30.2211 +                fi
 30.2212 +                ;;
 30.2213 +            IRIX*/6.* )
 30.2214 +                if [ ! -f /etc/init.d/${name} ]; then
 30.2215 +                    #   install transfer script
 30.2216 +                    ( echo "#!/bin/sh"
 30.2217 +                      echo "##"
 30.2218 +                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
 30.2219 +                      echo "##"
 30.2220 +                      echo ""
 30.2221 +                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
 30.2222 +                      echo "case \$1 in"
 30.2223 +                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
 30.2224 +                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
 30.2225 +                      echo "esac"
 30.2226 +                    ) >/etc/init.d/${name}
 30.2227 +                    chmod 755 /etc/init.d/${name}
 30.2228 +                    #   create corresponding links
 30.2229 +                    ( cd /etc
 30.2230 +                      ln -f init.d/${name} rc2.d/S99${name}
 30.2231 +                      ln -f init.d/${name} rc0.d/K00${name}
 30.2232 +                    ) || exit $?
 30.2233 +                fi
 30.2234 +                ;;
 30.2235 +        esac
 30.2236 +    fi
 30.2237 +
 30.2238 +    #   create the cron transfer entries
 30.2239 +    if [ ".$cusr" != ".root" ]; then
 30.2240 +        echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
 30.2241 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2242 +    else
 30.2243 +        case "$plid" in
 30.2244 +            FreeBSD/* | Linux/* | Darwin/* )
 30.2245 +                if [ -f /etc/slackware-version ]; then
 30.2246 +                    exists=`crontab -l | grep "$prefix/etc/rc"`
 30.2247 +                    if [ ".$exists" = . ]; then
 30.2248 +                        EDITOR=/tmp/vipw.$$
 30.2249 +                        VISUAL="$EDITOR"
 30.2250 +                        export EDITOR
 30.2251 +                        export VISUAL
 30.2252 +                        ( echo "#!/bin/sh"
 30.2253 +                          echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
 30.2254 +                          echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
 30.2255 +                          echo "    echo \"0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
 30.2256 +                          echo "    echo \"0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
 30.2257 +                          echo "    echo \"0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
 30.2258 +                          echo "    echo \"0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
 30.2259 +                          echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
 30.2260 +                          echo "    echo \"# </OpenPKG>\""
 30.2261 +                          echo ") >>\$1"
 30.2262 +                        ) >$EDITOR
 30.2263 +                        chmod a+x $EDITOR
 30.2264 +                        ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
 30.2265 +                        rm -f $EDITOR
 30.2266 +                    fi
 30.2267 +                else
 30.2268 +                    exists=`grep "$prefix/etc/rc" /etc/crontab`
 30.2269 +                    if [ ".$exists" = . ]; then
 30.2270 +                        ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
 30.2271 +                          echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
 30.2272 +                          echo "0    0  1  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
 30.2273 +                          echo "0    0  *  *  0  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
 30.2274 +                          echo "0    0  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
 30.2275 +                          echo "0    *  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
 30.2276 +                          echo "*/15 *  *  *  *  root  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
 30.2277 +                          echo "# </OpenPKG>"
 30.2278 +                        ) >>/etc/crontab
 30.2279 +                    fi
 30.2280 +                fi
 30.2281 +                ;;
 30.2282 +            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
 30.2283 +                exists=`crontab -l | grep "$prefix/etc/rc"`
 30.2284 +                if [ ".$exists" = . ]; then
 30.2285 +                    EDITOR=/tmp/vipw.$$
 30.2286 +                    VISUAL="$EDITOR"
 30.2287 +                    export EDITOR
 30.2288 +                    export VISUAL
 30.2289 +                    ( echo "#!/bin/sh"
 30.2290 +                      echo "(   echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
 30.2291 +                      echo "    echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
 30.2292 +                      echo "    echo \"0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
 30.2293 +                      echo "    echo \"0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
 30.2294 +                      echo "    echo \"0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
 30.2295 +                      echo "    echo \"0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
 30.2296 +                      echo "    echo \"0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
 30.2297 +                      echo "    echo \"# </OpenPKG>\""
 30.2298 +                      echo ") >>\$1"
 30.2299 +                    ) >$EDITOR
 30.2300 +                    chmod a+x $EDITOR
 30.2301 +                    ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
 30.2302 +                    rm -f $EDITOR
 30.2303 +                fi
 30.2304 +                ;;
 30.2305 +            IRIX*/6.* )
 30.2306 +                exists=`crontab -l | grep "$prefix/etc/rc"`
 30.2307 +                if [ ".$exists" = . ]; then
 30.2308 +                    ( crontab -l
 30.2309 +                      echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
 30.2310 +                      echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
 30.2311 +                      echo "0          0  1  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
 30.2312 +                      echo "0          0  *  *  0  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
 30.2313 +                      echo "0          0  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
 30.2314 +                      echo "0          *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
 30.2315 +                      echo "0,15,30,45 *  *  *  *  [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
 30.2316 +                      echo "# </OpenPKG>"
 30.2317 +                    ) | /usr/bin/crontab || exit $?
 30.2318 +                fi
 30.2319 +                ;;
 30.2320 +        esac
 30.2321 +    fi
 30.2322 +
 30.2323 +    #   remember what OpenPKG RPM version was installed, so we can
 30.2324 +    #   correctly upgrade the RPM database in the %post section (see below).
 30.2325 +    if [ -d ${prefix}/RPM/DB ]; then
 30.2326 +        if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
 30.2327 +            #   OpenPKG 2.0
 30.2328 +            rpm="${prefix}/bin/openpkg rpm"
 30.2329 +        else
 30.2330 +            #   OpenPKG 1.x
 30.2331 +            rpm="${prefix}/bin/rpm"
 30.2332 +        fi
 30.2333 +        rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
 30.2334 +        $rpm --version |\
 30.2335 +            sed -e 's;^;X;' \
 30.2336 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
 30.2337 +                -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
 30.2338 +                -e 's;^X.*$;4.0;' \
 30.2339 +                >${prefix}/RPM/DB/.version
 30.2340 +    fi
 30.2341 +
 30.2342 +%post
 30.2343 +    #   optional post-processing from "pre" section
 30.2344 +    if [ -f %{l_prefix}.pre-post-process.sh ]; then
 30.2345 +        sh %{l_prefix}.pre-post-process.sh
 30.2346 +        rm -f %{l_prefix}.pre-post-process.sh
 30.2347 +    fi
 30.2348 +
 30.2349 +    #   update or initially create OpenPKG UUID configuration
 30.2350 +    %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
 30.2351 +
 30.2352 +    #   determine new and old OpenPKG RPM version
 30.2353 +    V_rpm_new="%{V_rpm}"
 30.2354 +    if [ -f %{l_prefix}/RPM/DB/.version ]; then
 30.2355 +        V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
 30.2356 +        rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
 30.2357 +    else
 30.2358 +        V_rpm_old="4.0"
 30.2359 +    fi
 30.2360 +
 30.2361 +    #   make sure all RPM database files are present and that their
 30.2362 +    #   attributes are correct, etc. This is not a database rebuild
 30.2363 +    #   operation, so this is fully harmless and can be done always.
 30.2364 +    %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
 30.2365 +
 30.2366 +    #   check RPM database for upgrade requirements
 30.2367 +    if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
 30.2368 +        #   RPM 4.0/4.1 does not allow concurrent database access, so we
 30.2369 +        #   cannot upgrade the database immediately from here (because
 30.2370 +        #   we are still running within the execution context of the
 30.2371 +        #   old RPM which in turn has the database locked) and instead
 30.2372 +        #   have to just drop a note to the administrator about database
 30.2373 +        #   upgrading. RPM 4.2 in general allows concurrent database
 30.2374 +        #   access, but the whole stuff is too risky here, too.
 30.2375 +        ( echo "You are upgrading the OpenPKG bootstrap from a previous"
 30.2376 +          echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
 30.2377 +          echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
 30.2378 +          echo "be used, but it is strongly recommended to upgrade it as"
 30.2379 +          echo "soon as possible to the latest Berkeley-DB format files by"
 30.2380 +          echo "executing the command:"
 30.2381 +          echo "    \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
 30.2382 +          echo "In case of problems with the RPM database you can always"
 30.2383 +          echo "execute the command:"
 30.2384 +          echo "    \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
 30.2385 +        ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
 30.2386 +    fi
 30.2387 +
 30.2388 +    #   system command overriding support
 30.2389 +    #   ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
 30.2390 +    #   BUILD COMMAND OVERRIDE SOLUTION!
 30.2391 +    if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
 30.2392 +        mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
 30.2393 +    fi
 30.2394 +    chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
 30.2395 +    case "`cat %{l_prefix}/etc/openpkg/platform`" in
 30.2396 +        *-*-debian* | *-*-ubuntu* )
 30.2397 +            #   FIXME: Evil hack to workaround build problems under Debian
 30.2398 +            #   (at least 3.1) (and similar platforms) where a Debian
 30.2399 +            #   install-info(8) exists which is both API and functionally
 30.2400 +            #   incompatible to the de-facto standardized install-info(8)
 30.2401 +            #   command from GNU Texinfo.
 30.2402 +            if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
 30.2403 +                ( echo "#!/bin/sh"
 30.2404 +                  echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
 30.2405 +                  echo "exit 0"
 30.2406 +                ) >%{l_prefix}/lib/openpkg/override/install-info
 30.2407 +                chmod 775 %{l_prefix}/lib/openpkg/override/install-info
 30.2408 +            fi
 30.2409 +            ;;
 30.2410 +        *-*-macosx* | *-*-darwin* )
 30.2411 +            #   FIXME: Evil hack to workaround the fact that Mac OS X'
 30.2412 +            #   linker by default prefers the /usr/lib libraries and does
 30.2413 +            #   not honor the -L options the way one would expect it.
 30.2414 +            gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
 30.2415 +            cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
 30.2416 +            ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
 30.2417 +            if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
 30.2418 +                ( echo "#!/bin/sh"
 30.2419 +                  echo "case \" \$* \" in"
 30.2420 +                  echo "    *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
 30.2421 +                  echo "    * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
 30.2422 +                  echo "esac"
 30.2423 +                ) >%{l_prefix}/lib/openpkg/override/gcc
 30.2424 +                chmod 775 %{l_prefix}/lib/openpkg/override/gcc
 30.2425 +            fi
 30.2426 +            if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
 30.2427 +                ( echo "#!/bin/sh"
 30.2428 +                  echo "case \" \$* \" in"
 30.2429 +                  echo "    *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
 30.2430 +                  echo "    * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
 30.2431 +                  echo "esac"
 30.2432 +                ) >%{l_prefix}/lib/openpkg/override/cc
 30.2433 +                chmod 775 %{l_prefix}/lib/openpkg/override/cc
 30.2434 +            fi
 30.2435 +            if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
 30.2436 +                ( echo "#!/bin/sh"
 30.2437 +                  echo "exec $ld -search_paths_first \"\$@\""
 30.2438 +                ) >%{l_prefix}/lib/openpkg/override/ld
 30.2439 +                chmod 775 %{l_prefix}/lib/openpkg/override/ld
 30.2440 +            fi
 30.2441 +            ;;
 30.2442 +    esac
 30.2443 +
 30.2444 +    #   FIXME: hack to workaround problems in environments with too few
 30.2445 +    #   development tools. ATTENTION: see one paragraph above.
 30.2446 +    if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
 30.2447 +        mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
 30.2448 +    fi
 30.2449 +    chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
 30.2450 +
 30.2451 +    #   check for "openpkg" executable from the OpenPKG Community series
 30.2452 +    #   print license if not OSS, otherwise register with openpkg.org
 30.2453 +    community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \
 30.2454 +        sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'`
 30.2455 +    if [ ".$community_version" = . ]; then
 30.2456 +        ( echo ""
 30.2457 +          echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\""
 30.2458 +          echo "executable which is covered by the following terms of use:"
 30.2459 +          echo "______________________________________________________________________________"
 30.2460 +          echo ""
 30.2461 +          %{l_prefix}/bin/openpkg --license | sed -e '1d'
 30.2462 +        ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
 30.2463 +    else
 30.2464 +        %{l_prefix}/bin/openpkg register </dev/null >/dev/null 2>&1 || true
 30.2465 +    fi
 30.2466 +
 30.2467 +%preun
 30.2468 +    [ ".$1" != .0 ] && exit 0
 30.2469 +
 30.2470 +    #   remove override files
 30.2471 +    if [ -d %{l_prefix}/lib/openpkg/override ]; then
 30.2472 +        rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
 30.2473 +    fi
 30.2474 +
 30.2475 +    #   remove fallback files
 30.2476 +    if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
 30.2477 +        rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
 30.2478 +    fi
 30.2479 +
 30.2480 +    #   remove files which are not RPM controlled
 30.2481 +    rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
 30.2482 +    rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
 30.2483 +    rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
 30.2484 +    rm -rf %{l_prefix}/RPM/DB/*  %{l_prefix}/RPM/DB/.[a-z]*  >/dev/null 2>&1 || true
 30.2485 +
 30.2486 +    #   The following code usually would be done in a %postun section.
 30.2487 +    #   But because we already had to remove the database in this %preun
 30.2488 +    #   section (see the 'rm' commands above) in order to make RPM happy
 30.2489 +    #   inside its own removal procedure, RPM would no longer find the
 30.2490 +    #   %postun script (because it's recorded in the database files). So
 30.2491 +    #   we have to perform the procedure already in this %preun script.
 30.2492 +    #   except for the removal of the top-level directory it does not
 30.2493 +    #   matter. But the top-level directory can only be removed after
 30.2494 +    #   the RPM removal procedure took place, so we play a little delay
 30.2495 +    #   trick below.
 30.2496 +
 30.2497 +    #   determine current user
 30.2498 +    cusr=`(id -un) 2>/dev/null ||\
 30.2499 +          (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
 30.2500 +          (whoami) 2>/dev/null ||\
 30.2501 +          (who am i | cut "-d " -f1) 2>/dev/null ||\
 30.2502 +          echo $LOGNAME`
 30.2503 +
 30.2504 +    #   determine runtime details (for both inside and outside RPM!!)
 30.2505 +    user="%{l_musr}"
 30.2506 +    group="%{l_mgrp}"
 30.2507 +    prefix="%{l_prefix}"
 30.2508 +    prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
 30.2509 +
 30.2510 +    #   determine platform id
 30.2511 +    s=`(uname -s) 2>/dev/null` || s='Unknown'
 30.2512 +    r=`(uname -r) 2>/dev/null` || r='0.0'
 30.2513 +    plid="${s}/${r}"
 30.2514 +
 30.2515 +    #   unregister instance in presence file
 30.2516 +    presence="/etc/openpkg"
 30.2517 +    exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
 30.2518 +    if [ ".$exists" != . ]; then
 30.2519 +        if [ ".$cusr" != ".root" ]; then
 30.2520 +            echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
 30.2521 +            echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2522 +        else
 30.2523 +            cp $presence $presence.bak && \
 30.2524 +            egrep -v "^ *${prefix} *\$" $presence.bak >$presence
 30.2525 +            rm -f $presence.bak >/dev/null 2>&1
 30.2526 +            if [ ".`cat $presence`" = . ]; then
 30.2527 +                rm -f $presence >/dev/null 2>&1
 30.2528 +            fi
 30.2529 +        fi
 30.2530 +    fi
 30.2531 +
 30.2532 +    #   remove entry in /etc/shells
 30.2533 +    shell="${prefix}/lib/openpkg/bash"
 30.2534 +    exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
 30.2535 +    if [ ".$exists" != . ]; then
 30.2536 +        if [ ".$cusr" != ".root" ]; then
 30.2537 +            echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
 30.2538 +            echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2539 +        else
 30.2540 +            cp /etc/shells /etc/shells.bak && \
 30.2541 +            grep -v "^${shell}" /etc/shells.bak >/etc/shells
 30.2542 +            rm -f /etc/shells.bak >/dev/null 2>&1
 30.2543 +        fi
 30.2544 +    fi
 30.2545 +
 30.2546 +    #   remove the hierarchy user/group
 30.2547 +    for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
 30.2548 +               "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
 30.2549 +               "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
 30.2550 +               "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
 30.2551 +        #   split request into class/usr/uid/grp/gid
 30.2552 +        OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
 30.2553 +        class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
 30.2554 +
 30.2555 +        #   check whether user already exists
 30.2556 +        exists=`(getent passwd "$usr"; \
 30.2557 +                 grep "^$usr:" /etc/passwd; \
 30.2558 +                 ypmatch "$usr" passwd; \
 30.2559 +                 nismatch "$usr" passwd; \
 30.2560 +                 nidump passwd . | grep "^$usr:") 2>/dev/null | \
 30.2561 +                 sed -e 'q'`
 30.2562 +        if [ ".$exists" != . ]; then
 30.2563 +            if [ ".$cusr" != ".root" ]; then
 30.2564 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
 30.2565 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2566 +            elif [ ".$usr" = ".root" ]; then
 30.2567 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
 30.2568 +                echo "openpkg:WARNING: (would remove system standard user)" 1>&2
 30.2569 +            else
 30.2570 +                case "$plid" in
 30.2571 +                    FreeBSD/* | NetBSD/* )
 30.2572 +                        cp /etc/master.passwd /etc/master.passwd.bak && \
 30.2573 +                        grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
 30.2574 +                        ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
 30.2575 +                        rm -f /etc/master.passwd.bak >/dev/null 2>&1
 30.2576 +                        ;;
 30.2577 +                    Linux/* | SunOS/5.* | UnixWare/* )
 30.2578 +                        cp /etc/passwd /etc/passwd.bak && \
 30.2579 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
 30.2580 +                        ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
 30.2581 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
 30.2582 +                        ;;
 30.2583 +                    AIX/* )
 30.2584 +                        rmuser -p "${usr}"
 30.2585 +                        cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
 30.2586 +                        sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
 30.2587 +                            </etc/security/login.cfg.bak >/etc/security/login.cfg && \
 30.2588 +                        rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
 30.2589 +                        ;;
 30.2590 +                    OSF1/V5.* )
 30.2591 +                        cp /etc/passwd /etc/passwd.bak && \
 30.2592 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
 30.2593 +                        ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
 30.2594 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
 30.2595 +                        ;;
 30.2596 +                    HP-UX/* )
 30.2597 +                        cp /etc/passwd /etc/passwd.bak && \
 30.2598 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
 30.2599 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
 30.2600 +                        ;;
 30.2601 +                    Darwin/* )
 30.2602 +                        niutil -destroy . "/users/${usr}"
 30.2603 +                        ;;
 30.2604 +                    IRIX*/6.* )
 30.2605 +                        cp /etc/passwd /etc/passwd.bak && \
 30.2606 +                        grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
 30.2607 +                        if   [ -f /etc/shadow ]
 30.2608 +                        then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
 30.2609 +                        fi
 30.2610 +                        rm -f /etc/passwd.bak >/dev/null 2>&1
 30.2611 +                        ;;
 30.2612 +                esac
 30.2613 +            fi
 30.2614 +        fi
 30.2615 +
 30.2616 +        #   check whether group already exists
 30.2617 +        exists=`(getent group "$grp"; \
 30.2618 +                grep "^$grp:" /etc/group; \
 30.2619 +                ypmatch "$grp" group; \
 30.2620 +                nismatch "$grp" group; \
 30.2621 +                nidump group . | grep "^$grp:") 2>/dev/null | \
 30.2622 +                sed -e 'q'`
 30.2623 +        if [ ".$exists" != . ]; then
 30.2624 +            if [ ".$cusr" != ".root" ]; then
 30.2625 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
 30.2626 +                echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2627 +            elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
 30.2628 +                echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
 30.2629 +                echo "openpkg:WARNING: (would remove system standard group)" 1>&2
 30.2630 +            else
 30.2631 +                case "$plid" in
 30.2632 +                    Darwin/* )
 30.2633 +                        niutil -destroy . "/groups/${grp}"
 30.2634 +                        ;;
 30.2635 +                    AIX/* )
 30.2636 +                        rmgroup "${grp}"
 30.2637 +                        ;;
 30.2638 +                    * )
 30.2639 +                        cp /etc/group /etc/group.bak && \
 30.2640 +                        grep -v "^${grp}:" /etc/group.bak >/etc/group
 30.2641 +                        rm -f /etc/group.bak >/dev/null 2>&1
 30.2642 +                        ;;
 30.2643 +                esac
 30.2644 +            fi
 30.2645 +        fi
 30.2646 +    done
 30.2647 +
 30.2648 +    #   invalidate passwd and group tables from Name Service Cache Daemon to
 30.2649 +    #   ensure chown/chgrp works immediately after pwconv on Linux and Solaris
 30.2650 +    if [ -x /usr/sbin/nscd ]; then
 30.2651 +        /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
 30.2652 +        /usr/sbin/nscd -i group >/dev/null 2>&1 || true
 30.2653 +    fi
 30.2654 +
 30.2655 +    #   remove the startup/shutdown transfer scripts
 30.2656 +    name=`echo "$prefix" | sed -e 's;/;;g'`
 30.2657 +    if [ ".$cusr" != ".root" ]; then
 30.2658 +        echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
 30.2659 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2660 +    else
 30.2661 +        case "$plid" in
 30.2662 +            FreeBSD/* )
 30.2663 +                rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
 30.2664 +                ;;
 30.2665 +            NetBSD/* )
 30.2666 +                rm -f /etc/rc.d/${name} >/dev/null 2>&1
 30.2667 +                ;;
 30.2668 +            Linux/* )
 30.2669 +                if [ -f /etc/gentoo-release ]; then
 30.2670 +                    /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
 30.2671 +                    rm -f /etc/init.d/openpkg-${name}   >/dev/null 2>&1
 30.2672 +                else
 30.2673 +                    #   sroot: script root directory
 30.2674 +                    #   lroot: link   root directory
 30.2675 +                    if [ -f /etc/debian_version ]; then
 30.2676 +                        sroot=/etc/init.d
 30.2677 +                        lroot=/etc/rc%d.d
 30.2678 +                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
 30.2679 +                        sroot=/etc/rc.d/init.d
 30.2680 +                        lroot=/etc/rc.d/rc%d.d
 30.2681 +                    elif [ -f /etc/SuSE-release ]; then
 30.2682 +                        sroot=/etc/init.d
 30.2683 +                        lroot=/etc/init.d/rc%d.d
 30.2684 +                    elif [ -f /etc/slackware-version ]; then
 30.2685 +                        sroot=/etc/rc.d
 30.2686 +                        lroot=/etc/rc.d/rc%d.d
 30.2687 +                        name="rc.${name}"
 30.2688 +                    else
 30.2689 +                        echo "WARNING: you are not running one of the supported standard" 1>&2
 30.2690 +                        echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)."   1>&2
 30.2691 +                        echo "WARNING: Guessing the location of the system init scripts!" 1>&2
 30.2692 +                        sroot=""
 30.2693 +                        lroot=""
 30.2694 +                        for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
 30.2695 +                            if [ -d $sr ]; then
 30.2696 +                                sroot="$sr"
 30.2697 +                                break
 30.2698 +                            fi
 30.2699 +                        done
 30.2700 +                        for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
 30.2701 +                            if [ -d $lr ]; then
 30.2702 +                                lroot="`echo $lr | sed -e 's;2;%d;'`"
 30.2703 +                                break
 30.2704 +                            fi
 30.2705 +                        done
 30.2706 +                        if [ ".$sroot" = . -o ".$lroot" = . ]; then
 30.2707 +                            echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
 30.2708 +                            exit 1
 30.2709 +                        fi
 30.2710 +                    fi
 30.2711 +                    rm -f ${sroot}/${name} >/dev/null 2>&1
 30.2712 +                    for i in 2 3 4 5; do
 30.2713 +                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
 30.2714 +                    done
 30.2715 +                    for i in 0 1 6; do
 30.2716 +                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
 30.2717 +                    done
 30.2718 +                    if [ -f /etc/slackware-version ]; then
 30.2719 +                        for i in 0 1 2 3 4 5 6; do
 30.2720 +                            l=`echo $lroot | sed -e "s;%d;$i;"`
 30.2721 +                            if [ -d $l ]; then
 30.2722 +                                rmdir $l >/dev/null 2>&1 || true
 30.2723 +                            fi
 30.2724 +                        done
 30.2725 +                    fi
 30.2726 +                fi
 30.2727 +                ;;
 30.2728 +            SunOS/5.* )
 30.2729 +                rm -f /etc/init.d/${name} >/dev/null 2>&1
 30.2730 +                rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
 30.2731 +                rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
 30.2732 +                rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
 30.2733 +                ;;
 30.2734 +            UnixWare/* )
 30.2735 +                rm -f /etc/init.d/${name} >/dev/null 2>&1
 30.2736 +                rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
 30.2737 +                rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
 30.2738 +                rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
 30.2739 +                ;;
 30.2740 +            AIX/* )
 30.2741 +                rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
 30.2742 +                rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
 30.2743 +                ;;
 30.2744 +            OSF1/V5.* )
 30.2745 +                rm -f /sbin/init.d/${name} >/dev/null 2>&1
 30.2746 +                rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
 30.2747 +                rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
 30.2748 +                ;;
 30.2749 +            HP-UX/* )
 30.2750 +                rm -f /sbin/init.d/${name} >/dev/null 2>&1
 30.2751 +                rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
 30.2752 +                rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
 30.2753 +                ;;
 30.2754 +            Darwin/* )
 30.2755 +                cp /etc/hostconfig /etc/hostconfig.bak && \
 30.2756 +                grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
 30.2757 +                rm -f /etc/hostconfig.bak >/dev/null 2>&1
 30.2758 +                rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
 30.2759 +                ;;
 30.2760 +            IRIX*/6.* )
 30.2761 +                rm -f /etc/init.d/${name} >/dev/null 2>&1
 30.2762 +                rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
 30.2763 +                rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
 30.2764 +                ;;
 30.2765 +        esac
 30.2766 +    fi
 30.2767 +
 30.2768 +    #   remove the cron transfer entries
 30.2769 +    if [ ".$cusr" != ".root" ]; then
 30.2770 +        echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
 30.2771 +        echo "openpkg:WARNING: (would require root-privileges)" 1>&2
 30.2772 +    else
 30.2773 +        case "$plid" in
 30.2774 +            FreeBSD/* | Linux/* | Darwin/* )
 30.2775 +                if [ -f /etc/slackware-version ]; then
 30.2776 +                    EDITOR=/tmp/vipw.$$
 30.2777 +                    VISUAL="$EDITOR"
 30.2778 +                    export EDITOR
 30.2779 +                    export VISUAL
 30.2780 +                    p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
 30.2781 +                    ( echo "cp \$1 \$1.bak"
 30.2782 +                      echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
 30.2783 +                      echo "rm -f \$1.bak"
 30.2784 +                    ) >$EDITOR
 30.2785 +                    chmod a+x $EDITOR
 30.2786 +                    ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
 30.2787 +                    rm -f $EDITOR
 30.2788 +                else
 30.2789 +                    exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
 30.2790 +                    if [ ".$exists" != . ]; then
 30.2791 +                        p=`echo $prefix | sed -e 's;/;\\\\/;g'`
 30.2792 +                        cp /etc/crontab /etc/crontab.bak
 30.2793 +                        cat /etc/crontab.bak |\
 30.2794 +                        sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
 30.2795 +                        >/etc/crontab
 30.2796 +                        rm -f /etc/crontab.bak >/dev/null 2>&1
 30.2797 +                    fi
 30.2798 +                fi
 30.2799 +                ;;
 30.2800 +            SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
 30.2801 +                EDITOR=/tmp/vipw.$$
 30.2802 +                VISUAL="$EDITOR"
 30.2803 +                export EDITOR
 30.2804 +                export VISUAL
 30.2805 +                p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
 30.2806 +                ( echo "cp \$1 \$1.bak"
 30.2807 +                  echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
 30.2808 +                  echo "rm -f \$1.bak"
 30.2809 +                ) >$EDITOR
 30.2810 +                chmod a+x $EDITOR
 30.2811 +                ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
 30.2812 +                rm -f $EDITOR
 30.2813 +                ;;
 30.2814 +            IRIX*/6.* )
 30.2815 +                p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
 30.2816 +                ( crontab -l |
 30.2817 +                  sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d"
 30.2818 +                ) | /usr/bin/crontab || exit $?
 30.2819 +                ;;
 30.2820 +        esac
 30.2821 +    fi
 30.2822 +
 30.2823 +    #   delayed removal of top-level directory.
 30.2824 +    ( sleep 2
 30.2825 +      rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
 30.2826 +      rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
 30.2827 +      rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
 30.2828 +      rmdir %{l_prefix} >/dev/null 2>&1 || true
 30.2829 +    ) </dev/null >/dev/null 2>/dev/null &
 30.2830 +
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/openpkg/openssl.patch	Tue Jan 06 23:40:39 2009 +0100
    31.3 @@ -0,0 +1,355 @@
    31.4 +Index: Configure
    31.5 +--- Configure.orig	2007-09-16 14:24:17 +0200
    31.6 ++++ Configure	2007-10-17 12:14:14 +0200
    31.7 +@@ -6,7 +6,6 @@
    31.8 + ##
    31.9 + 
   31.10 + require 5.000;
   31.11 +-use strict;
   31.12 + 
   31.13 + # see INSTALL for instructions.
   31.14 + 
   31.15 +@@ -34,6 +33,7 @@
   31.16 + #		(Default: KRB5_DIR/include)
   31.17 + # --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently
   31.18 + #		supported values are "MIT" and "Heimdal".  A value is required.
   31.19 ++# --with-cc     compiler to use for $CC (useful if cc is a disguised gcc)
   31.20 + #
   31.21 + # --test-sanity Make a number of sanity checks on the data in this file.
   31.22 + #               This is a debugging tool for OpenSSL developers.
   31.23 +@@ -113,6 +113,7 @@
   31.24 + #$bits2="THIRTY_TWO_BIT ";
   31.25 + my $bits1="THIRTY_TWO_BIT ";
   31.26 + my $bits2="SIXTY_FOUR_BIT ";
   31.27 ++my $ccarg;
   31.28 + 
   31.29 + my $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o:rm86-elf.o:r586-elf.o";
   31.30 + my $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o:rm86-cof.o:r586-cof.o";
   31.31 +@@ -402,8 +403,8 @@
   31.32 + 
   31.33 + #### IBM's AIX.
   31.34 + "aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
   31.35 +-"aix-gcc",  "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
   31.36 +-"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
   31.37 ++"aix-gcc",  "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   31.38 ++"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
   31.39 + # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
   31.40 + # at build time. $OBJECT_MODE is respected at ./config stage!
   31.41 + "aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
   31.42 +@@ -697,6 +698,10 @@
   31.43 + 			{
   31.44 + 			exit(&test_sanity());
   31.45 + 			}
   31.46 ++		elsif (/^--with-cc=(.*)$/)
   31.47 ++			{
   31.48 ++                $ccarg=$1
   31.49 ++			}
   31.50 + 		elsif (/^reconfigure/ || /^reconf/)
   31.51 + 			{
   31.52 + 			if (open(IN,"<$Makefile"))
   31.53 +@@ -949,7 +954,7 @@
   31.54 + print "IsMK1MF=$IsMK1MF\n";
   31.55 + 
   31.56 + my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
   31.57 +-my $cc = $fields[$idx_cc];
   31.58 ++my $cc = $ccarg ? $ccarg : $fields[$idx_cc];
   31.59 + my $cflags = $fields[$idx_cflags];
   31.60 + my $unistd = $fields[$idx_unistd];
   31.61 + my $thread_cflag = $fields[$idx_thread_cflag];
   31.62 +Index: config
   31.63 +--- config.orig	2007-08-01 13:21:35 +0200
   31.64 ++++ config	2007-10-17 12:13:48 +0200
   31.65 +@@ -401,9 +401,9 @@
   31.66 + 
   31.67 + # figure out if gcc is available and if so we use it otherwise
   31.68 + # we fallback to whatever cc does on the system
   31.69 +-GCCVER=`(gcc -dumpversion) 2>/dev/null`
   31.70 ++GCCVER=`(gcc -dumpversion 2>/dev/null && exit; cc --version 2>/dev/null | grep GCC >/dev/null && cc -dumpversion )`
   31.71 + if [ "$GCCVER" != "" ]; then
   31.72 +-  CC=gcc
   31.73 ++  CC=cc; gcc -dumpversion >/dev/null 2>&1 && CC=gcc
   31.74 +   # then strip off whatever prefix egcs prepends the number with...
   31.75 +   # Hopefully, this will work for any future prefixes as well.
   31.76 +   GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
   31.77 +@@ -412,8 +412,10 @@
   31.78 +   # major and minor version numbers.
   31.79 +   # peak single digit before and after first dot, e.g. 2.95.1 gives 29
   31.80 +   GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
   31.81 ++  SUFFIX=gcc
   31.82 + else
   31.83 +   CC=cc
   31.84 ++  SUFFIX=cc
   31.85 + fi
   31.86 + GCCVER=${GCCVER:-0}
   31.87 + if [ "$SYSTEM" = "HP-UX" ];then
   31.88 +@@ -422,7 +424,7 @@
   31.89 +   if [ $GCCVER -ge 30 ]; then
   31.90 +     # PA64 support only came in with gcc 3.0.x.
   31.91 +     # We check if the preprocessor symbol __LP64__ is defined...
   31.92 +-    if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
   31.93 ++    if echo "__LP64__" | $CC -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
   31.94 +       : # __LP64__ has slipped through, it therefore is not defined
   31.95 +     else
   31.96 +       GCC_BITS="64"
   31.97 +@@ -433,13 +435,14 @@
   31.98 +   if [ $GCCVER -ge 30 ]; then
   31.99 +     # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
  31.100 +     # to be working, at the very least 'make test' passes...
  31.101 +-    if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
  31.102 ++    if $CC -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
  31.103 +       GCC_ARCH="-m64"
  31.104 +     else
  31.105 +       GCC_ARCH="-m32"
  31.106 +     fi
  31.107 +   fi
  31.108 +   # check for WorkShop C, expected output is "cc: blah-blah C x.x"
  31.109 ++  if [ $GCCVER -eq 0 ]; then
  31.110 +   CCVER=`(cc -V 2>&1) 2>/dev/null | \
  31.111 +   	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
  31.112 + 	sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
  31.113 +@@ -452,6 +455,7 @@
  31.114 +       sleep 5
  31.115 +     fi
  31.116 +   fi
  31.117 ++  fi
  31.118 + fi
  31.119 + 
  31.120 + if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
  31.121 +@@ -469,6 +473,7 @@
  31.122 + 
  31.123 + if [ "${SYSTEM}" = "AIX" ]; then	# favor vendor cc over gcc
  31.124 +     (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
  31.125 ++    (gcc) 2>&1 | grep -iv "not found" > /dev/null && CC=gcc
  31.126 + fi
  31.127 + 
  31.128 + CCVER=${CCVER:-0}
  31.129 +@@ -488,7 +493,7 @@
  31.130 + 	if [ $CPU -ge 4000 ]; then
  31.131 + 		options="$options -mips2"
  31.132 + 	fi
  31.133 +-	OUT="irix-$CC"
  31.134 ++	OUT="irix-$SUFFIX"
  31.135 + 	;;
  31.136 +   mips3-sgi-irix)
  31.137 + 	#CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
  31.138 +@@ -498,11 +503,11 @@
  31.139 + 	#else
  31.140 + 	#	options="$options -mips3"
  31.141 + 	#fi
  31.142 +-	OUT="irix-mips3-$CC"
  31.143 ++	OUT="irix-mips3-$SUFFIX"
  31.144 + 	;;
  31.145 +   mips4-sgi-irix64)
  31.146 + 	echo "WARNING! If you wish to build 64-bit library, then you have to"
  31.147 +-	echo "         invoke './Configure irix64-mips4-$CC' *manually*."
  31.148 ++	echo "         invoke './Configure irix64-mips4-$SUFFIX' *manually*."
  31.149 + 	if [ "$TEST" = "false" -a -t 1 ]; then
  31.150 + 	  echo "         You have about 5 seconds to press Ctrl-C to abort."
  31.151 + 	  (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
  31.152 +@@ -514,7 +519,7 @@
  31.153 +         #else
  31.154 +         #        options="$options -mips3"
  31.155 +         #fi
  31.156 +-	OUT="irix-mips3-$CC"
  31.157 ++	OUT="irix-mips3-$SUFFIX"
  31.158 + 	;;
  31.159 +   ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
  31.160 +   ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
  31.161 +@@ -522,10 +527,10 @@
  31.162 +   alpha-*-linux2)
  31.163 +         ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
  31.164 + 	case ${ISA:-generic} in
  31.165 +-	*[678])	OUT="linux-alpha+bwx-$CC" ;;
  31.166 +-	*)	OUT="linux-alpha-$CC" ;;
  31.167 ++	*[678])	OUT="linux-alpha+bwx-$SUFFIX" ;;
  31.168 ++	*)	OUT="linux-alpha-$SUFFIX" ;;
  31.169 + 	esac
  31.170 +-	if [ "$CC" = "gcc" ]; then
  31.171 ++	if [ $GCCVER -gt 0 ]; then
  31.172 + 	    case ${ISA:-generic} in
  31.173 + 	    EV5|EV45)		options="$options -mcpu=ev5";;
  31.174 + 	    EV56|PCA56)		options="$options -mcpu=ev56";;
  31.175 +@@ -592,7 +597,7 @@
  31.176 +   s390x-*-linux2) OUT="linux-generic64"; options="$options -DB_ENDIAN" ;;
  31.177 +   x86_64-*-linux?) OUT="linux-x86_64" ;;
  31.178 +   *86-*-linux2) OUT="linux-elf"
  31.179 +-	if [ "$GCCVER" -gt 28 ]; then
  31.180 ++	if [ $GCCVER -gt 28 ]; then
  31.181 +           if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
  31.182 + 	    options="$options -march=pentium"
  31.183 +           fi
  31.184 +@@ -606,17 +611,17 @@
  31.185 +   *-*-linux1) OUT="linux-aout" ;;
  31.186 +   *-*-linux2) OUT="linux-generic32" ;;
  31.187 +   sun4[uv]*-*-solaris2)
  31.188 +-	OUT="solaris-sparcv9-$CC"
  31.189 ++	OUT="solaris-sparcv9-$SUFFIX"
  31.190 + 	ISA64=`(isalist) 2>/dev/null | grep sparcv9`
  31.191 + 	if [ "$ISA64" != "" ]; then
  31.192 +-	    if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
  31.193 ++	    if [ $GCCVER -eq 0 -a $CCVER -ge 50 ]; then
  31.194 + 		echo "WARNING! If you wish to build 64-bit library, then you have to"
  31.195 + 		echo "         invoke './Configure solaris64-sparcv9-cc' *manually*."
  31.196 + 		if [ "$TEST" = "false" -a -t 1 ]; then
  31.197 + 		  echo "         You have about 5 seconds to press Ctrl-C to abort."
  31.198 + 		  (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
  31.199 + 		fi
  31.200 +-	    elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
  31.201 ++	    elif [ $GCCVER -gt 0 -a "$GCC_ARCH" = "-m64" ]; then
  31.202 + 		# $GCC_ARCH denotes default ABI chosen by compiler driver
  31.203 + 		# (first one found on the $PATH). I assume that user
  31.204 + 		# expects certain consistency with the rest of his builds
  31.205 +@@ -639,21 +644,21 @@
  31.206 + 	    fi
  31.207 + 	fi
  31.208 + 	;;
  31.209 +-  sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
  31.210 +-  sun4d-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
  31.211 +-  sun4*-*-solaris2)	OUT="solaris-sparcv7-$CC" ;;
  31.212 ++  sun4m-*-solaris2)	OUT="solaris-sparcv8-$SUFFIX" ;;
  31.213 ++  sun4d-*-solaris2)	OUT="solaris-sparcv8-$SUFFIX" ;;
  31.214 ++  sun4*-*-solaris2)	OUT="solaris-sparcv7-$SUFFIX" ;;
  31.215 +   *86*-*-solaris2)
  31.216 + 	ISA64=`(isalist) 2>/dev/null | grep amd64`
  31.217 +-	if [ "$ISA64" != "" ]; then
  31.218 +-	    OUT="solaris64-x86_64-$CC"
  31.219 ++	if [ "$ISA64" != "" -a $GCCVER -gt 0 -a "$GCC_ARCH" = "-m64" ]; then
  31.220 ++	    OUT="solaris64-x86_64-$SUFFIX"
  31.221 + 	else
  31.222 +-	    OUT="solaris-x86-$CC"
  31.223 ++	    OUT="solaris-x86-$SUFFIX"
  31.224 + 	    if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then
  31.225 + 		options="$options no-sse2"
  31.226 + 	    fi
  31.227 + 	fi
  31.228 + 	;;
  31.229 +-  *-*-sunos4)		OUT="sunos-$CC" ;;
  31.230 ++  *-*-sunos4)		OUT="sunos-$SUFFIX" ;;
  31.231 + 
  31.232 +   *86*-*-bsdi4)		OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
  31.233 +   alpha*-*-*bsd*)	OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
  31.234 +@@ -677,7 +682,7 @@
  31.235 +   *-*-osf)		OUT="osf1-alpha-cc" ;;
  31.236 +   *-*-tru64)		OUT="tru64-alpha-cc" ;;
  31.237 +   *-*-[Uu]nix[Ww]are7)
  31.238 +-	if [ "$CC" = "gcc" ]; then
  31.239 ++	if [ $GCCVER -gt 0 ]; then
  31.240 + 	  OUT="unixware-7-gcc" ; options="$options no-sse2"
  31.241 + 	else    
  31.242 + 	  OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
  31.243 +@@ -688,12 +693,12 @@
  31.244 +   *-*-vos)
  31.245 + 	options="$options no-threads no-shared no-asm no-dso"
  31.246 + 	EXE=".pm"
  31.247 +-	OUT="vos-$CC" ;;
  31.248 ++	OUT="vos-$SUFFIX" ;;
  31.249 +   BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
  31.250 +   RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
  31.251 +   *-siemens-sysv4) OUT="SINIX" ;;
  31.252 +   *-hpux1*)
  31.253 +-	if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
  31.254 ++	if [ $GCCVER -gt 0 -a $GCC_BITS = "64" ]; then
  31.255 + 	    OUT="hpux64-parisc2-gcc"
  31.256 + 	fi
  31.257 + 	KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
  31.258 +@@ -711,8 +716,8 @@
  31.259 + 	     fi
  31.260 + 	     OUT="hpux64-ia64-cc"
  31.261 + 	elif [ $CPU_VERSION -ge 532 ]; then	# PA-RISC 2.x CPU
  31.262 +-	     OUT=${OUT:-"hpux-parisc2-${CC}"}
  31.263 +-	     if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
  31.264 ++	     OUT=${OUT:-"hpux-parisc2-${SUFFIX}"}
  31.265 ++	     if [ $KERNEL_BITS -eq 64 -a $GCCVER -eq 0 ]; then
  31.266 + 		echo "WARNING! If you wish to build 64-bit library then you have to"
  31.267 + 		echo "         invoke './Configure hpux64-parisc2-cc' *manually*."
  31.268 + 		if [ "$TEST" = "false" -a -t 1 ]; then
  31.269 +@@ -721,19 +726,19 @@
  31.270 + 		fi
  31.271 + 	     fi
  31.272 + 	elif [ $CPU_VERSION -ge 528 ]; then	# PA-RISC 1.1+ CPU
  31.273 +-	     OUT="hpux-parisc-${CC}"
  31.274 ++	     OUT="hpux-parisc-${SUFFIX}"
  31.275 + 	elif [ $CPU_VERSION -ge 523 ]; then	# PA-RISC 1.0 CPU
  31.276 +-	     OUT="hpux-parisc-${CC}"
  31.277 ++	     OUT="hpux-parisc-${SUFFIX}"
  31.278 + 	else					# Motorola(?) CPU
  31.279 +-	     OUT="hpux-$CC"
  31.280 ++	     OUT="hpux-$SUFFIX"
  31.281 + 	fi
  31.282 + 	options="$options -D_REENTRANT" ;;
  31.283 +-  *-hpux)	OUT="hpux-parisc-$CC" ;;
  31.284 ++  *-hpux)	OUT="hpux-parisc-$SUFFIX" ;;
  31.285 +   *-aix)
  31.286 + 	KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
  31.287 + 	KERNEL_BITS=${KERNEL_BITS:-32}
  31.288 + 	OBJECT_MODE=${OBJECT_MODE:-32}
  31.289 +-	if [ "$CC" = "gcc" ]; then
  31.290 ++	if [ $GCCVER -gt 0 ]; then
  31.291 + 	    OUT="aix-gcc"
  31.292 + 	elif [ $OBJECT_MODE -eq 64 ]; then
  31.293 + 	    echo 'Your $OBJECT_MODE was found to be set to 64' 
  31.294 +@@ -828,7 +833,7 @@
  31.295 + #fi
  31.296 + 
  31.297 + if [ -z "$OUT" ]; then
  31.298 +-  OUT="$CC"
  31.299 ++  OUT="$SUFFIX"
  31.300 + fi
  31.301 + 
  31.302 + if [ ".$PERL" = . ] ; then
  31.303 +@@ -860,9 +865,9 @@
  31.304 + # compiler for the platform ... in which case we add it on
  31.305 + # the end ... otherwise we leave it off
  31.306 + 
  31.307 +-$PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null
  31.308 ++$PERL ./Configure LIST | grep "$OUT-$SUFFIX" > /dev/null
  31.309 + if [ $? = "0" ]; then
  31.310 +-  OUT="$OUT-$CC"
  31.311 ++  OUT="$OUT-$SUFFIX"
  31.312 + fi
  31.313 + 
  31.314 + OUT="$PREFIX$OUT"
  31.315 +@@ -872,9 +877,9 @@
  31.316 +   echo Configuring for $OUT
  31.317 + 
  31.318 +   if [ "$TEST" = "true" ]; then
  31.319 +-    echo $PERL ./Configure $OUT $options
  31.320 ++    echo $PERL ./Configure $OUT --with-cc=$CC $options
  31.321 +   else
  31.322 +-    $PERL ./Configure $OUT $options
  31.323 ++    $PERL ./Configure $OUT --with-cc=$CC $options
  31.324 +   fi
  31.325 + else
  31.326 +   echo "This system ($OUT) is not supported. See file INSTALL for details."
  31.327 +Index: crypto/objects/obj_dat.pl
  31.328 +--- crypto/objects/obj_dat.pl.orig	2005-08-29 01:20:47 +0200
  31.329 ++++ crypto/objects/obj_dat.pl	2007-10-17 12:13:48 +0200
  31.330 +@@ -1,9 +1,5 @@
  31.331 + #!/usr/local/bin/perl
  31.332 + 
  31.333 +-# fixes bug in floating point emulation on sparc64 when
  31.334 +-# this script produces off-by-one output on sparc64
  31.335 +-use integer;
  31.336 +-
  31.337 + sub obj_cmp
  31.338 + 	{
  31.339 + 	local(@a,@b,$_,$r);
  31.340 +Index: util/mklink.pl
  31.341 +--- util/mklink.pl.orig	2006-02-09 13:28:30 +0100
  31.342 ++++ util/mklink.pl	2007-10-17 12:13:48 +0200
  31.343 +@@ -15,13 +15,12 @@
  31.344 + # Apart from this, this script should be able to handle even the most
  31.345 + # pathological cases.
  31.346 + 
  31.347 +-use Cwd;
  31.348 +-
  31.349 + my $from = shift;
  31.350 + my @files = @ARGV;
  31.351 + 
  31.352 + my @from_path = split(/[\\\/]/, $from);
  31.353 +-my $pwd = getcwd();
  31.354 ++my $pwd = `pwd`;
  31.355 ++$pwd =~ s/\n$//s;
  31.356 + chomp($pwd);
  31.357 + my @pwd_path = split(/[\\\/]/, $pwd);
  31.358 + 
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/openpkg/perl.patch	Tue Jan 06 23:40:39 2009 +0100
    32.3 @@ -0,0 +1,243 @@
    32.4 +By default, the "vendor" area is not used, so Perl's installation
    32.5 +procedure forgot to create its top-level paths, too. In OpenPKG we use
    32.6 +the "vendor" area, so make sure it is created the same way the "site"
    32.7 +area is.
    32.8 +
    32.9 +Index: installperl
   32.10 +--- installperl.orig	2006-08-15 14:37:41 +0200
   32.11 ++++ installperl	2006-08-18 21:05:05 +0200
   32.12 +@@ -211,6 +211,8 @@
   32.13 + my $installarchlib = "$destdir$Config{installarchlib}";
   32.14 + my $installsitelib = "$destdir$Config{installsitelib}";
   32.15 + my $installsitearch = "$destdir$Config{installsitearch}";
   32.16 ++my $installvendorlib = "$destdir$Config{installvendorlib}";
   32.17 ++my $installvendorarch = "$destdir$Config{installvendorarch}";
   32.18 + my $installman1dir = "$destdir$Config{installman1dir}";
   32.19 + my $man1ext = $Config{man1ext};
   32.20 + my $libperl = $Config{libperl};
   32.21 +@@ -403,6 +405,8 @@
   32.22 + mkpath($installarchlib, $verbose, 0777);
   32.23 + mkpath($installsitelib, $verbose, 0777) if ($installsitelib);
   32.24 + mkpath($installsitearch, $verbose, 0777) if ($installsitearch);
   32.25 ++mkpath($installvendorlib, $verbose, 0777) if ($installvendorlib);
   32.26 ++mkpath($installvendorarch, $verbose, 0777) if ($installvendorarch);
   32.27 + 
   32.28 + if (chdir "lib") {
   32.29 +     $do_installarchlib = ! samepath($installarchlib, '.');
   32.30 +
   32.31 +-----------------------------------------------------------------------------
   32.32 +
   32.33 +By default, the Perl module search order is "use lib, -I, PERL[5]LIB,
   32.34 +perl, site, vendor, other". This means that in OpenPKG both the modules
   32.35 +installed via CPAN shell (in "site" area) and the "perl-xxx" packages
   32.36 +(in "vendor" area) cannot override the (sometimes obsoleted) module
   32.37 +versions distributed with Perl (in "perl" area). Hence, we change
   32.38 +the search order to a more reasonable one for OpenPKG: "use lib, -I,
   32.39 +PERL[5]LIB, site, vendor, perl, other".
   32.40 +
   32.41 +Index: perl.c
   32.42 +--- perl.c.orig	2006-08-15 14:37:41 +0200
   32.43 ++++ perl.c	2006-08-18 21:08:14 +0200
   32.44 +@@ -4749,39 +4749,6 @@
   32.45 +     incpush(APPLLIB_EXP, TRUE, TRUE, TRUE, TRUE);
   32.46 + #endif
   32.47 + 
   32.48 +-#ifdef ARCHLIB_EXP
   32.49 +-    incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
   32.50 +-#endif
   32.51 +-#ifdef MACOS_TRADITIONAL
   32.52 +-    {
   32.53 +-	Stat_t tmpstatbuf;
   32.54 +-    	SV * privdir = newSV(0);
   32.55 +-	char * macperl = PerlEnv_getenv("MACPERL");
   32.56 +-	
   32.57 +-	if (!macperl)
   32.58 +-	    macperl = "";
   32.59 +-	
   32.60 +-	Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
   32.61 +-	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
   32.62 +-	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
   32.63 +-	Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
   32.64 +-	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
   32.65 +-	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
   32.66 +-	
   32.67 +-   	SvREFCNT_dec(privdir);
   32.68 +-    }
   32.69 +-    if (!PL_tainting)
   32.70 +-	incpush(":", FALSE, FALSE, TRUE, FALSE);
   32.71 +-#else
   32.72 +-#ifndef PRIVLIB_EXP
   32.73 +-#  define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
   32.74 +-#endif
   32.75 +-#if defined(WIN32)
   32.76 +-    incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
   32.77 +-#else
   32.78 +-    incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
   32.79 +-#endif
   32.80 +-
   32.81 + #ifdef SITEARCH_EXP
   32.82 +     /* sitearch is always relative to sitelib on Windows for
   32.83 +      * DLL-based path intuition to work correctly */
   32.84 +@@ -4824,6 +4791,39 @@
   32.85 +     incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE, TRUE);
   32.86 + #endif
   32.87 + 
   32.88 ++#ifdef ARCHLIB_EXP
   32.89 ++    incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
   32.90 ++#endif
   32.91 ++#ifdef MACOS_TRADITIONAL
   32.92 ++    {
   32.93 ++	Stat_t tmpstatbuf;
   32.94 ++    	SV * privdir = newSV(0);
   32.95 ++	char * macperl = PerlEnv_getenv("MACPERL");
   32.96 ++	
   32.97 ++	if (!macperl)
   32.98 ++	    macperl = "";
   32.99 ++	
  32.100 ++	Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  32.101 ++	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  32.102 ++	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
  32.103 ++	Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  32.104 ++	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  32.105 ++	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
  32.106 ++	
  32.107 ++   	SvREFCNT_dec(privdir);
  32.108 ++    }
  32.109 ++    if (!PL_tainting)
  32.110 ++	incpush(":", FALSE, FALSE, TRUE, FALSE);
  32.111 ++#else
  32.112 ++#ifndef PRIVLIB_EXP
  32.113 ++#  define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  32.114 ++#endif
  32.115 ++#if defined(WIN32)
  32.116 ++    incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
  32.117 ++#else
  32.118 ++    incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
  32.119 ++#endif
  32.120 ++
  32.121 + #ifdef PERL_OTHERLIBDIRS
  32.122 +     incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE, TRUE);
  32.123 + #endif
  32.124 +
  32.125 +-----------------------------------------------------------------------------
  32.126 +
  32.127 +Port to [Open]Darwin 6.6.2:
  32.128 +
  32.129 +1. In OpenPKG, Perl does not use the vendor GCC and our GCC does not
  32.130 +   understand "-no-cpp-precomp", so remove this build option.
  32.131 +
  32.132 +2. The <sys/mman.h> indirectly includes system specific headers
  32.133 +   which in turn have fields named "environ" while Perl uses
  32.134 +   a define of "environ" internally. So wrap the inclusion.
  32.135 +
  32.136 +3. Darwin 6 no longer accepts the non-standard "#import" statements,
  32.137 +   so replace with "#include" and circumvent some header problem
  32.138 +   related to the non-standard "__private_extern__" attribute.
  32.139 +
  32.140 +Index: hints/darwin.sh
  32.141 +--- hints/darwin.sh.orig	2006-08-15 14:37:41 +0200
  32.142 ++++ hints/darwin.sh	2006-08-18 21:05:05 +0200
  32.143 +@@ -120,9 +120,6 @@
  32.144 +   *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;;
  32.145 + esac
  32.146 + 
  32.147 +-# Avoid Apple's cpp precompiler, better for extensions
  32.148 +-cppflags="${cppflags} -no-cpp-precomp"
  32.149 +-
  32.150 + # This is necessary because perl's build system doesn't
  32.151 + # apply cppflags to cc compile lines as it should.
  32.152 + ccflags="${ccflags} ${cppflags}"
  32.153 +@@ -182,8 +179,7 @@
  32.154 + esac
  32.155 + ldlibpthname='DYLD_LIBRARY_PATH';
  32.156 + 
  32.157 +-# useshrplib=true results in much slower startup times.
  32.158 +-# 'false' is the default value.  Use Configure -Duseshrplib to override.
  32.159 ++useshrplib='true'
  32.160 + 
  32.161 + cat > UU/archname.cbu <<'EOCBU'
  32.162 + # This script UU/archname.cbu will get 'called-back' by Configure 
  32.163 +Index: perlio.c
  32.164 +--- perlio.c.orig	2006-08-15 14:37:41 +0200
  32.165 ++++ perlio.c	2006-08-18 21:05:05 +0200
  32.166 +@@ -461,7 +461,14 @@
  32.167 + #include <unistd.h>
  32.168 + #endif
  32.169 + #ifdef HAS_MMAP
  32.170 ++#ifdef PERL_DARWIN
  32.171 ++#define environ_safe environ
  32.172 ++#undef environ
  32.173 + #include <sys/mman.h>
  32.174 ++#define environ environ_safe
  32.175 ++#else
  32.176 ++#include <sys/mman.h>
  32.177 ++#endif
  32.178 + #endif
  32.179 + 
  32.180 + void
  32.181 +
  32.182 +-----------------------------------------------------------------------------
  32.183 +
  32.184 +Port to Tru64 5.1:
  32.185 +
  32.186 +Under Tru64 our gcc has to be built without binutils and the system
  32.187 +ld(1) does not accept a "-O" option, so remove the whole passing of
  32.188 +optimization flags to ld(1). Under a brain-dead platform like Tru64 we
  32.189 +really don't need any more optimization because we are already happy if
  32.190 +it works at all.
  32.191 +
  32.192 +Index: hints/dec_osf.sh
  32.193 +--- hints/dec_osf.sh.orig	2007-12-18 11:47:07 +0100
  32.194 ++++ hints/dec_osf.sh	2007-12-19 12:31:37 +0100
  32.195 +@@ -73,15 +73,6 @@
  32.196 + *)            if $test "X$optimize" = "X$undef"; then
  32.197 +                       lddlflags="$lddlflags -msym"
  32.198 +               else
  32.199 +-		  case "$myosvers" in
  32.200 +-		  *4.0D*)
  32.201 +-		      # QAR 56761: -O4 + .so may produce broken code,
  32.202 +-		      # fixed in 4.0E or better.
  32.203 +-		      ;;
  32.204 +-		  *)
  32.205 +-                      lddlflags="$lddlflags $optimize"
  32.206 +-		      ;;
  32.207 +-		  esac
  32.208 + 		  # -msym: If using a sufficiently recent /sbin/loader,
  32.209 + 		  # keep the module symbols with the modules.
  32.210 +                   lddlflags="$lddlflags -msym $_lddlflags_strict_ansi"
  32.211 +
  32.212 +-----------------------------------------------------------------------------
  32.213 +
  32.214 +Index: Configure
  32.215 +--- Configure.orig	2006-08-15 14:37:40 +0200
  32.216 ++++ Configure	2006-08-18 21:05:05 +0200
  32.217 +@@ -7787,7 +7787,7 @@
  32.218 + 			      ;;	
  32.219 + 			linux|irix*|gnu*)	dflt='-shared' ;;
  32.220 + 			next)  dflt='none' ;;
  32.221 +-			solaris) dflt='-G' ;;
  32.222 ++			solaris) dflt='-shared' ;;
  32.223 + 			sunos) dflt='-assert nodefinitions' ;;
  32.224 + 			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
  32.225 + 	        *)     dflt='none' ;;
  32.226 +
  32.227 +-----------------------------------------------------------------------------
  32.228 +
  32.229 +Security Fix (CVE-2005-3962, OpenPKG-SA-2005.025-perl)
  32.230 +
  32.231 +Index: sv.c
  32.232 +--- sv.c.orig	2006-08-15 14:37:41 +0200
  32.233 ++++ sv.c	2006-08-18 21:05:05 +0200
  32.234 +@@ -8595,7 +8595,10 @@
  32.235 + 	if ( (width = expect_number(&q)) ) {
  32.236 + 	    if (*q == '$') {
  32.237 + 		++q;
  32.238 +-		efix = width;
  32.239 ++		if (width > PERL_INT_MAX)
  32.240 ++		    efix = PERL_INT_MAX;
  32.241 ++		else
  32.242 ++		    efix = width;
  32.243 + 	    } else {
  32.244 + 		goto gotwidth;
  32.245 + 	    }
  32.246 +
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/openpkg/pod2man.sh	Tue Jan 06 23:40:39 2009 +0100
    33.3 @@ -0,0 +1,8 @@
    33.4 +#!/bin/sh
    33.5 +pod2man --section=1 --center="OpenPKG" --release="OPENPKG(8)"    --date="OpenPKG" --quotes=none openpkg.pod    >openpkg.1
    33.6 +pod2man --section=8 --center="OpenPKG" --release="RC(8)"         --date="OpenPKG" --quotes=none rc.pod         >rc.8
    33.7 +pod2man --section=8 --center="OpenPKG" --release="RPMTOOL(8)"    --date="OpenPKG" --quotes=none rpmtool.pod    >rpmtool.8
    33.8 +pod2man --section=8 --center="OpenPKG" --release="LSYNC(8)"      --date="OpenPKG" --quotes=none lsync.pod      >lsync.8
    33.9 +pod2man --section=8 --center="OpenPKG" --release="RPM-CONFIG(8)" --date="OpenPKG" --quotes=none rpm-config.pod >rpm-config.8
   33.10 +pod2man --section=8 --center="OpenPKG" --release="UUID(8)"       --date="OpenPKG" --quotes=none uuid.pod       >uuid.8
   33.11 +pod2man --section=8 --center="OpenPKG" --release="RELEASE(8)"    --date="OpenPKG" --quotes=none release.pod    >release.8
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/openpkg/rc	Tue Jan 06 23:40:39 2009 +0100
    34.3 @@ -0,0 +1,687 @@
    34.4 +#!@l_prefix@/lib/openpkg/bash --noprofile
    34.5 +##
    34.6 +##  rc -- OpenPKG Run-Command Processor
    34.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    34.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    34.9 +##
   34.10 +##  Permission to use, copy, modify, and distribute this software for
   34.11 +##  any purpose with or without fee is hereby granted, provided that
   34.12 +##  the above copyright notice and this permission notice appear in all
   34.13 +##  copies.
   34.14 +##
   34.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   34.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   34.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   34.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   34.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   34.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   34.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   34.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   34.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   34.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   34.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34.26 +##  SUCH DAMAGE.
   34.27 +##
   34.28 +
   34.29 +##
   34.30 +##  configuration
   34.31 +##
   34.32 +
   34.33 +#   program name, version and date
   34.34 +progname="rc"
   34.35 +progvers="1.2.0"
   34.36 +progdate="28-Jul-2003"
   34.37 +
   34.38 +#   path to OpenPKG instance
   34.39 +prefix="@l_prefix@"
   34.40 +
   34.41 +#   path to GNU bash and GNU shtool
   34.42 +bash="$prefix/lib/openpkg/bash"
   34.43 +shtool="$prefix/lib/openpkg/shtool"
   34.44 +
   34.45 +#   path to rc.d, rc.conf and rc.func
   34.46 +rcdir="$prefix/etc/rc.d"
   34.47 +rcconf="$prefix/etc/rc.conf"
   34.48 +rcfunc="$prefix/etc/rc.func"
   34.49 +
   34.50 +#   helper variables
   34.51 +NL="
   34.52 +"
   34.53 +
   34.54 +##
   34.55 +##  command line option parsing
   34.56 +##
   34.57 +
   34.58 +#   default parameters
   34.59 +silent=0
   34.60 +verbose=0
   34.61 +debug=0
   34.62 +help=0
   34.63 +keep=0
   34.64 +print=0
   34.65 +eval=0
   34.66 +config=0
   34.67 +query=0
   34.68 +
   34.69 +#   iterate over argument line
   34.70 +while [ $# -gt 0 ]; do
   34.71 +    opt=$1
   34.72 +    case $opt in
   34.73 +        -*=*) arg=${opt/-*=/} ;;
   34.74 +           *) arg='' ;;
   34.75 +    esac
   34.76 +    case $opt in
   34.77 +        -s|--silent  ) silent=1      ;;
   34.78 +        -v|--verbose ) verbose=1     ;;
   34.79 +        -d|--debug   ) debug=1       ;;
   34.80 +        -h|--help    ) help="Usage"  ;;
   34.81 +        -k|--keep    ) keep=1        ;;
   34.82 +        -p|--print   ) print=1       ;;
   34.83 +        -e|--eval    ) eval=1        ;;
   34.84 +        -c|--config  ) config=1      ;;
   34.85 +        -q|--query   ) query=1       ;;
   34.86 +        -*           ) help="Invalid option \`$opt'"; break ;;
   34.87 +        *            ) break         ;;
   34.88 +    esac
   34.89 +    shift
   34.90 +done
   34.91 +
   34.92 +#   display error or usage message
   34.93 +if [ ".$help" != .0 ]; then
   34.94 +    if [ ".$help" != ".Usage" ]; then
   34.95 +        echo "$progname:ERROR: $help" 1>&2
   34.96 +    fi
   34.97 +    echo "Usage: $progname [-s|--silent] [-v|--verbose] [-d|--debug] [-k|--keep] [-h|--help]" 1>&2
   34.98 +    echo "       [-p|--print] [-e|--eval] [-c|--config] [-q|--query]" 1>&2
   34.99 +    echo "       <package> <command> [<command> ...]"  1>&2
  34.100 +    if [ ".$help" != ".Usage" ]; then
  34.101 +        exit 1
  34.102 +    else
  34.103 +        exit 0
  34.104 +    fi
  34.105 +fi
  34.106 +
  34.107 +#   determine a reasonable default silent/verbose situation in case
  34.108 +#   nothing was explicitly specified or a conflicting situation was
  34.109 +#   specified. Else is silent either disabled by default or was
  34.110 +#   explicitly enabled.
  34.111 +if [ $silent -eq $verbose ]; then
  34.112 +    if [ -t 2 ]; then
  34.113 +        #   stdout connected to a terminal device, so no need to be silent
  34.114 +        silent=0
  34.115 +    else
  34.116 +        #   stdout NOT connected to a terminal device, so be silent
  34.117 +        silent=1
  34.118 +    fi
  34.119 +fi
  34.120 +
  34.121 +#   extend run-time environment with local OpenPKG tools (shtool, rpmtool, etc)
  34.122 +PATH_ORIG="$PATH"
  34.123 +PATH="$prefix/bin:$PATH"
  34.124 +PATH="$prefix/sbin:$PATH"
  34.125 +PATH="$prefix/lib/openpkg:$PATH"
  34.126 +
  34.127 +#   establish secure temporary directory
  34.128 +i=0
  34.129 +while [ $i -lt 10 ]; do
  34.130 +   tmpdir="/tmp/rc-`date '+%Y%m%d%H%M%S'`-$$"
  34.131 +   (umask 022; mkdir $tmpdir >/dev/null 2>&1) && break
  34.132 +   i=$(($i + 1))
  34.133 +   sleep 1
  34.134 +done
  34.135 +if [ $i -eq 10 ]; then
  34.136 +    echo "openpkg:rc:ERROR: unable to establish secure temporary directory" 1>&2
  34.137 +    exit 1
  34.138 +fi
  34.139 +declare -r tmpdir
  34.140 +trap "trap - EXIT INT ABRT QUIT TERM; rm -rf $tmpdir >/dev/null 2>&1 || true" EXIT INT ABRT QUIT TERM
  34.141 +
  34.142 +#   determine reasonable temporary files
  34.143 +tmpfile="$tmpdir/rc.tmp"
  34.144 +outfile="$tmpdir/rc.out"
  34.145 +errfile="$tmpdir/rc.err"
  34.146 +allfile="$tmpdir/rc.all"
  34.147 +
  34.148 +#   handle --query option
  34.149 +if [ ".$query" = .1 ]; then
  34.150 +    #   suck in all %config sections of all scripts
  34.151 +    #   (rc.openpkg is special: has to be first and requires pre-inclusion of rc.conf)
  34.152 +    touch $tmpfile
  34.153 +    sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.154 +    echo ". $rcconf" >>$tmpfile
  34.155 +    scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  34.156 +    for s_name in $scripts; do
  34.157 +        sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.158 +    done
  34.159 +    . $tmpfile
  34.160 +
  34.161 +    #   apply override values to get effective values
  34.162 +    . $rcconf
  34.163 +
  34.164 +    #   display variable value
  34.165 +    for var in $*; do
  34.166 +        eval "echo \${$var}"
  34.167 +    done
  34.168 +
  34.169 +    #   stop processing immediately
  34.170 +    exit 0
  34.171 +fi
  34.172 +
  34.173 +#   handle --config option
  34.174 +if [ ".$config" = .1 ]; then
  34.175 +    #   suck in all %config sections of all scripts
  34.176 +    #   (rc.openpkg is special: has to be first and requires pre-inclusion of rc.conf)
  34.177 +    touch $tmpfile
  34.178 +    sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.179 +    echo ". $rcconf" >>$tmpfile
  34.180 +    scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  34.181 +    for s_name in $scripts; do
  34.182 +        sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.183 +    done
  34.184 +    . $tmpfile
  34.185 +
  34.186 +    #   remember default values
  34.187 +    vars=""
  34.188 +    OIFS="$IFS"; IFS="$NL"
  34.189 +    for assign in `egrep '[ 	]*[a-zA-Z_][a-zA-Z_0-9]*=' $tmpfile | sort`; do
  34.190 +        var=`echo "$assign" | sed -e 's;^[ 	]*\([a-zA-Z_][a-zA-Z_0-9]*\)=.*;\1;'`
  34.191 +        vars="$vars $var"
  34.192 +        eval "${var}_def=\"\$$var\""
  34.193 +    done
  34.194 +    IFS="$OIFS"
  34.195 +
  34.196 +    #   apply override values to get effective values
  34.197 +    . $rcconf
  34.198 +
  34.199 +    #   determine how to print in bold mode in case output
  34.200 +    #   is connected to a terminal device
  34.201 +    if [ -t 1 ]; then
  34.202 +        begin_bold=`$shtool echo -e '%B'`
  34.203 +        end_bold=`$shtool echo -e '%b'`
  34.204 +    else
  34.205 +        begin_bold=""
  34.206 +        end_bold=""
  34.207 +    fi
  34.208 +
  34.209 +    #   iterate over all variables and display name, default and effective value
  34.210 +    echo "${begin_bold}Configuration Variable   Effective Value              Default Value${end_bold}"
  34.211 +    echo "------------------------ ------------------------- -- -------------------------"
  34.212 +    for var in . $vars; do
  34.213 +        test ".$var" = .. && continue
  34.214 +        eval "val=\"\$$var\""
  34.215 +        eval "def=\"\$${var}_def\""
  34.216 +        tag="!="
  34.217 +        begin="$begin_bold"
  34.218 +        end="$end_bold"
  34.219 +        if [ ".$val" = ".$def" ]; then
  34.220 +            tag="=="
  34.221 +            begin=""
  34.222 +            end=""
  34.223 +        fi
  34.224 +        printf "%s%-24s %-25s %s %-25s%s\n" "$begin" "$var" "\"$val\"" "$tag" "\"$def\"" "$end"
  34.225 +    done
  34.226 +
  34.227 +    #   stop processing immediately
  34.228 +    exit 0
  34.229 +fi
  34.230 +
  34.231 +#   determine script(s) to use and make sure they exist
  34.232 +if [ $# -lt 1 ]; then
  34.233 +    echo "openpkg:rc:ERROR: no package and command(s) specified" 1>&2
  34.234 +    exit 1
  34.235 +fi
  34.236 +if [ $# -lt 2 ]; then
  34.237 +    echo "openpkg:rc:ERROR: no command(s) specified for package" 1>&2
  34.238 +    exit 1
  34.239 +fi
  34.240 +scripts="${1/*rc./}"
  34.241 +shift
  34.242 +isall=0
  34.243 +if [ ".$scripts" = ".all" ]; then
  34.244 +    isall=1
  34.245 +    . $rcconf
  34.246 +    if [ ".$openpkg_runall" != . ]; then
  34.247 +        #   backward compatibility only
  34.248 +        echo "openpkg:rc:WARNING: variable \"openpkg_runall\" was renamed to \"openpkg_rc_all\"." 1>&2
  34.249 +        echo "openpkg:rc:WARNING: value of deprecated variable \"openpkg_runall\" taken over for compatibility." 1>&2
  34.250 +        echo "openpkg:rc:WARNING: please update your local configuration in \"$rcconf\"." 1>&2
  34.251 +        openpkg_rc_all="$openpkg_runall"
  34.252 +    fi
  34.253 +    case "$openpkg_rc_all" in
  34.254 +        [Nn][Oo] | [Ff][Aa][Ll][Ss][Ee] | [Oo][Ff][Ff] | 0 ) exit 0 ;;
  34.255 +    esac
  34.256 +    scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;"`
  34.257 +else
  34.258 +    if [ ! -f "$rcdir/rc.$scripts" ]; then
  34.259 +        echo "openpkg:rc:ERROR: package \"$scripts\" not found" 1>&2
  34.260 +        exit 1
  34.261 +    fi
  34.262 +fi
  34.263 +
  34.264 +#   determine current run-time user
  34.265 +user=`(id -un) 2>/dev/null ||\
  34.266 +      (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  34.267 +      (whoami) 2>/dev/null ||\
  34.268 +      (who am i | cut "-d " -f1) 2>/dev/null ||\
  34.269 +      echo ${LOGNAME:-${USER}}`
  34.270 +if [ ".$user" = . ]; then
  34.271 +    echo "openpkg:rc:ERROR: unable to determine current username" 1>&2
  34.272 +    exit 1
  34.273 +fi
  34.274 +
  34.275 +#   iterate over the specified commands
  34.276 +rv=0
  34.277 +cmds="$*"
  34.278 +for cmd in $cmds; do
  34.279 +    #   create "all outputs" file for execution operation (i.e. not --print and --eval)
  34.280 +    if [ ".$print" = .0 -a ".$eval" = .0 ]; then
  34.281 +        rm -f $allfile
  34.282 +        touch $allfile
  34.283 +    fi
  34.284 +
  34.285 +    #   find scripts which contain the command and determine
  34.286 +    #   their individual user/priority settings
  34.287 +    list=''
  34.288 +    for s_name in $scripts; do
  34.289 +        enable=yes
  34.290 +
  34.291 +        #   check for upgraded package with unresolved configuration file conflicts
  34.292 +        if [ -d "$prefix/etc/$s_name" -a ".$eval" != .1 ]; then
  34.293 +            if [ ".`(find $prefix/etc/$s_name -type f -print; find $prefix/etc/$s_name -type l -print) 2>/dev/null | egrep -v '.*/\.(snap|snapshot)/.*' | egrep '.*\.rpm(new|orig|save)$'`" != . ]; then
  34.294 +                case "$cmd" in
  34.295 +                    start|restart ) type="ERROR"   ;;
  34.296 +                    * )             type="WARNING" ;;
  34.297 +                esac
  34.298 +                echo "openpkg:rc:${type}: package \"$s_name\" has unresolved configuration file conflicts" 1>&2
  34.299 +                echo "openpkg:rc:${type}: indicated by \"*.rpm(new|orig|save)\" files in or below the" 1>&2
  34.300 +                echo "openpkg:rc:${type}: directory \"$prefix/etc/$s_name\". Please resolve first!" 1>&2
  34.301 +                if [ ".$type" = .ERROR ]; then
  34.302 +                    continue
  34.303 +                fi
  34.304 +            fi
  34.305 +        fi
  34.306 +
  34.307 +        #   check whether command exists in script at all
  34.308 +        cmdline=`grep "^%$cmd" $rcdir/rc.$s_name | sed -e "s;^%$cmd[^ 	].*;;"`
  34.309 +        if [ ".$cmdline" != . ]; then
  34.310 +            #   parse local command options
  34.311 +            cmdopts=`echo "$cmdline" | sed -e "s;^%$cmd *;;"`
  34.312 +            s_user=$user
  34.313 +            s_prio=500
  34.314 +            s_output=no
  34.315 +            set -- $cmdopts
  34.316 +            prev=''
  34.317 +            for opt
  34.318 +            do
  34.319 +                if [ ".$prev" != . ]; then
  34.320 +                    opt="$prev$opt"
  34.321 +                    prev=''
  34.322 +                fi
  34.323 +                case $opt in
  34.324 +                    -*=*       ) arg=${opt/-*=/} ;;
  34.325 +                    -[a-zA-Z]* ) arg=${opt/-[a-zA-Z0-9]/} ;;
  34.326 +                              *) arg='' ;;
  34.327 +                esac
  34.328 +                case $opt in
  34.329 +                    -u|-p         ) prev=$opt    ;;
  34.330 +                    -e|--enable   ) enable=yes   ;;
  34.331 +                    -d|--disable  ) enable=no    ;;
  34.332 +                    -o|--output   ) s_output=yes ;;
  34.333 +                    -u*|--user=*  ) s_user=$arg  ;;
  34.334 +                    -p*|--prio=*  ) s_prio=$arg  ;;
  34.335 +                    *             ) echo "openpkg:rc:WARNING: invalid local option \"$opt\" in \"$rcdir/rc.$s_name:%$cmd\""; break ;;
  34.336 +                esac
  34.337 +                shift
  34.338 +            done
  34.339 +
  34.340 +            #   sanity check: is operation supported by current environment?
  34.341 +            if [ ".$s_user" != ".$user" -a ".$user" != ".root" -a ".$print" = .0 ]; then
  34.342 +                echo "openpkg:rc:ERROR: $s_name:%$cmd: require root privileges to run as user \"$s_user\"" 1>&2
  34.343 +                exit 1
  34.344 +            fi
  34.345 +
  34.346 +            #   skip this script if script is disabled
  34.347 +            if [ ".$enable" != .yes ]; then
  34.348 +                continue
  34.349 +            fi
  34.350 +
  34.351 +            #   accumulate the determined information
  34.352 +            list="$list,$s_prio:$s_name:$s_user:$s_output"
  34.353 +        else
  34.354 +            #   command not found in script
  34.355 +            if [ ".$isall" = .0 ]; then
  34.356 +                echo "openpkg:rc:ERROR: $s_name: command \"$cmd\" not found" 1>&2
  34.357 +                exit 1
  34.358 +            fi
  34.359 +        fi
  34.360 +    done
  34.361 +
  34.362 +    #   if operating on all scripts, complain if a non-standard command
  34.363 +    #   was used and it was not found in any(!) script at all. The
  34.364 +    #   standard commands are accepted to perform no operation if no
  34.365 +    #   packages are currently installed which provide such commands.
  34.366 +    if [ ".$list" = . -a ".$isall" = .1 ]; then
  34.367 +        case "$cmd" in
  34.368 +            start|stop|monthly|weekly|daily|hourly|quarterly )
  34.369 +                ;;
  34.370 +            * )
  34.371 +                echo "openpkg:rc:ERROR: command \"$cmd\" not found in any script" 1>&2
  34.372 +                rv=1
  34.373 +                break
  34.374 +                ;;
  34.375 +        esac
  34.376 +    fi
  34.377 +
  34.378 +    #   generate global (loop invariant) header for script in case of
  34.379 +    #   --print and --eval (for the execution approach we cannot do
  34.380 +    #   this, because there a new script is generated from scratch for
  34.381 +    #   each package.
  34.382 +    if [ ".$print" = .1 -o ".$eval" = .1 ]; then
  34.383 +        rm -f $tmpfile
  34.384 +        touch $tmpfile
  34.385 +
  34.386 +        #   generate: optionally enable shell debugging
  34.387 +        if [ ".$debug" = .1 ]; then
  34.388 +            echo "set -x" >>$tmpfile
  34.389 +        fi
  34.390 +
  34.391 +        #   generate: inclusion of the run-command helper functions
  34.392 +        echo ". $rcfunc" >>$tmpfile
  34.393 +
  34.394 +        #   generate: all %config sections of all(!) scripts. We cannot
  34.395 +        #   just include those which have the current command in it
  34.396 +        #   because by design all command scripts see the %config
  34.397 +        #   section of all(!) scripts. Because of $openpkg_rc_def the
  34.398 +        #   variable, we place the %config section of "openpkg" to the front.
  34.399 +        #   And we have to extra pre-include the rc.conf to allow
  34.400 +        #   rc.conf to override the default of $openpkg_rc_def, too.
  34.401 +        sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.402 +        echo ". $rcconf" >>$tmpfile
  34.403 +        l_scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  34.404 +        for l_name in $l_scripts; do
  34.405 +            sed <$rcdir/rc.$l_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.406 +        done
  34.407 +
  34.408 +        #   generate: inclusion of the application of override variables
  34.409 +        echo ". $rcconf" >>$tmpfile
  34.410 +
  34.411 +        #   for --eval redirect stderr and stdout (but remember stdout)
  34.412 +        #   (let stderr pass unfiltered in case of debug mode)
  34.413 +        if [ ".$eval" = .1 ]; then
  34.414 +            if [ ".$debug" = .1 ]; then
  34.415 +               echo "exec 3<&1- 1>/dev/null" >>$tmpfile
  34.416 +            else
  34.417 +               echo "exec 3<&1- 1>/dev/null 2>/dev/null" >>$tmpfile
  34.418 +            fi
  34.419 +        fi
  34.420 +    fi
  34.421 +
  34.422 +    #   iterate over all packages (in priority order!) where the command
  34.423 +    #   was found in order to execute, print, or evaluate their scripts
  34.424 +    verbose_pos=0
  34.425 +    for entry in `echo $list | tr ',' '\012' | sort -n`; do
  34.426 +        [ ".$entry" = . ] && continue
  34.427 +
  34.428 +        #   re-determine the script name, script and whether to print output
  34.429 +        eval `echo $entry | sed -e 's%^[0-9]*:\(.*\):\(.*\):\(.*\)$%s_name="\1"; s_user="\2"; s_output="\3";%'`
  34.430 +
  34.431 +        #   display verbose progress message parts
  34.432 +        if [ ".$print" = .0 -a ".$eval" = .0 -a ".$silent" = .0 ]; then
  34.433 +            #   line break if we already have output more than 70
  34.434 +            #   characters (notice that usually already more characters
  34.435 +            #   where printed, because of the name of the last script)
  34.436 +            if [ $verbose_pos -gt 70 ]; then
  34.437 +                verbose_pos=0
  34.438 +                echo "" 1>&2
  34.439 +            fi
  34.440 +
  34.441 +            #   display verbose message parts: prefix (on first), separator and package
  34.442 +            if [ $verbose_pos -eq 0 ]; then
  34.443 +                output=$(printf "OpenPKG: %s: " "$cmd")
  34.444 +                echo -n "$output" 1>&2
  34.445 +                verbose_pos=$(($verbose_pos + ${#output}))
  34.446 +                output_prefix=""
  34.447 +            else
  34.448 +                output_prefix=", "
  34.449 +            fi
  34.450 +            output=$(printf "%s%s" "$output_prefix" "$s_name")
  34.451 +            echo -n "$output" 1>&2
  34.452 +            verbose_pos=$(($verbose_pos + ${#output}))
  34.453 +        fi
  34.454 +
  34.455 +        #   now operate on the particular script
  34.456 +        if [ ".$print" = .1 ]; then
  34.457 +            #   special case: under --print we just add the %common and
  34.458 +            #   command scripts to the generated output script and do
  34.459 +            #   not execute anything at this point.
  34.460 +            sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%common/d" -e '/^%.*/,$d'
  34.461 +            sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%$cmd/d" -e '/^%.*/,$d'
  34.462 +        elif [ ".$eval" = .1 ]; then
  34.463 +            #   special case: under --eval we just add the %common and
  34.464 +            #   command scripts to the generated output script and do
  34.465 +            #   not execute anything at this point. Additionally, we
  34.466 +            #   emulate a real sub-shell environment.
  34.467 +            sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%common/d" -e '/^%.*/,$d'
  34.468 +            echo "while [ 1 ]; do" >>$tmpfile
  34.469 +            sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%$cmd/d" -e '/^%.*/,$d' \
  34.470 +                -e 's/^exit[^;]*/break 99/'   -e 's/\([^a-zA-Z0-9_]\)exit[^;]*/\1break 99/g' \
  34.471 +                -e 's/^return[^;]*/break 99/' -e 's/\([^a-zA-Z0-9_]\)return[^;]*/\1break 99/g'
  34.472 +            echo "break" >>$tmpfile
  34.473 +            echo "done" >>$tmpfile
  34.474 +        else
  34.475 +            #   the regular case of executing the command script directly
  34.476 +
  34.477 +            #   prepare temporary files
  34.478 +            rm -f $tmpfile $outfile $errfile
  34.479 +            (umask 077; touch $tmpfile $outfile $errfile)
  34.480 +
  34.481 +            #   generate: optionally enable shell debugging
  34.482 +            if [ ".$debug" = .1 ]; then
  34.483 +                echo "set -x" >>$tmpfile
  34.484 +            fi
  34.485 +
  34.486 +            #   generate: inclusion of the run-command helper functions
  34.487 +            echo ". $rcfunc" >>$tmpfile
  34.488 +
  34.489 +            #   generate: all %config sections of all(!) scripts. We cannot
  34.490 +            #   just include those which have the current command in it
  34.491 +            #   because by design all command scripts see the %config
  34.492 +            #   section of all(!) scripts. Because of $openpkg_rc_def the
  34.493 +            #   variable, we place the %config section of "openpkg" to the front.
  34.494 +            #   And we have to extra pre-include the rc.conf to allow
  34.495 +            #   rc.conf to override the default of $openpkg_rc_def, too.
  34.496 +            sed <$rcdir/rc.openpkg >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.497 +            echo ". $rcconf" >>$tmpfile
  34.498 +            l_scripts=`/bin/ls $rcdir/rc.* | sed -e "s;^$rcdir/rc\.;;" | egrep -v '^openpkg$'`
  34.499 +            for l_name in $l_scripts; do
  34.500 +                sed <$rcdir/rc.$l_name >>$tmpfile -e "1,/^%config/d" -e '/^%.*/,$d'
  34.501 +            done
  34.502 +
  34.503 +            #   generate: inclusion of the application of override variables
  34.504 +            echo ". $rcconf" >>$tmpfile
  34.505 +
  34.506 +            #   generate: %common section and particular command section
  34.507 +            sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%common/d" -e '/^%.*/,$d'
  34.508 +            sed <$rcdir/rc.$s_name >>$tmpfile -e "1,/^%$cmd/d" -e '/^%.*/,$d'
  34.509 +
  34.510 +            #   execute the generated script with GNU Bash
  34.511 +            if [ ".$user" != ".$s_user" ]; then
  34.512 +                #   execute as different user
  34.513 +                if [ ".$verbose" = .1 ]; then
  34.514 +                    echo "openpkg:rc:NOTICE: $prefix:$s_name:%$cmd: executing as user $s_user"
  34.515 +                fi
  34.516 +                if [ ".$user" = ".@l_susr@" -a ".@l_susr@" = ".root" ]; then
  34.517 +                    chown $s_user $tmpfile
  34.518 +                    if [ ".$debug" = .1 ]; then
  34.519 +                        su - $s_user -c "PATH=\"$PATH\"; $bash $tmpfile" >$outfile
  34.520 +                        rc=$?
  34.521 +                    else
  34.522 +                        su - $s_user -c "PATH=\"$PATH\"; $bash $tmpfile" >$outfile 2>$errfile
  34.523 +                        rc=$?
  34.524 +                    fi
  34.525 +                elif [ ".@l_susr@" != ".root" ]; then
  34.526 +                    #   do not complain if we would not have any chance
  34.527 +                    #   at all to switch the user because we are running
  34.528 +                    #   in a non-privileged instance. Else we would just
  34.529 +                    #   trash the mailbox of the user receiving the
  34.530 +                    #   output of periodic run-commands.
  34.531 +                    rc=0
  34.532 +                else
  34.533 +                    echo "openpkg:rc:WARNING: $prefix:$s_name:%$cmd: require root privileges to run as user \"$s_user\"" 1>&2
  34.534 +                    rc=1
  34.535 +                fi
  34.536 +            else
  34.537 +                #   execute as current user
  34.538 +                if [ ".$verbose" = .1 ]; then
  34.539 +                    echo "openpkg:rc:NOTICE: $prefix:$s_name:%$cmd: executing as user $user"
  34.540 +                fi
  34.541 +                if [ ".$debug" = .1 ]; then
  34.542 +                    $bash $tmpfile >$outfile
  34.543 +                    rc=$?
  34.544 +                else
  34.545 +                    $bash $tmpfile >$outfile 2>$errfile
  34.546 +                    rc=$?
  34.547 +                fi
  34.548 +            fi
  34.549 +            if [ $rc -ne 0 ]; then
  34.550 +                if [ ".$silent" = .0 ]; then
  34.551 +                    #   indicate failure of execution on verbose message line
  34.552 +                    echo ":FAILED" 1>&2
  34.553 +                    verbose_pos=0
  34.554 +                fi
  34.555 +                #   give details of execution failure
  34.556 +                ( echo "openpkg:rc:WARNING: $prefix:$s_name:%$cmd: failed with return code $rc"
  34.557 +                  if [ ".`cat $outfile $errfile`" != . ]; then
  34.558 +                      echo "openpkg:rc:NOTICE: output from stdout/stderr is following:"
  34.559 +                      echo "+----------------------------------------------------------------------"
  34.560 +                      cat $outfile $errfile | sed -e 's;^;| ;'
  34.561 +                      echo "+----------------------------------------------------------------------"
  34.562 +                  else
  34.563 +                      echo "openpkg:rc:NOTICE: no output occurred on stdout/stderr"
  34.564 +                  fi
  34.565 +                ) 1>&2
  34.566 +
  34.567 +                #   enforce global return value
  34.568 +                rv=1
  34.569 +            else
  34.570 +                #   give details of execution success in case verbose operation is requested
  34.571 +                if [ ".$verbose" = .1 ]; then
  34.572 +                    ( echo "openpkg:rc:NOTICE: $prefix:$s_name:%$cmd: succeeded with return code $rc"
  34.573 +                      if [ ".`cat $outfile $errfile`" != . ]; then
  34.574 +                          echo "openpkg:rc:NOTICE: output from stdout/stderr is following:"
  34.575 +                          echo "+----------------------------------------------------------------------"
  34.576 +                          cat $outfile $errfile | sed -e 's;^;| ;'
  34.577 +                          echo "+----------------------------------------------------------------------"
  34.578 +                      else
  34.579 +                          echo "openpkg:rc:NOTICE: no output occurred on stdout/stderr"
  34.580 +                      fi
  34.581 +                    ) 1>&2
  34.582 +                fi
  34.583 +                if [ ".$s_output" = .yes ]; then
  34.584 +                    #   accumulate script output for later display
  34.585 +                    cat $outfile >>$allfile
  34.586 +                fi
  34.587 +            fi
  34.588 +        fi
  34.589 +    done
  34.590 +
  34.591 +    #   post-processing for each command
  34.592 +    if [ ".$print" = .1 ]; then
  34.593 +        #   for --print just print the resulting script to stdout
  34.594 +        cat $tmpfile
  34.595 +    elif [ ".$eval" = .1 ]; then
  34.596 +        #   finish generation of temporary script by restoring stdout
  34.597 +        #   and printing the exported environment variables into a format
  34.598 +        #   suitable for evaluation by the callers shell.
  34.599 +        echo "exec 1<&3-" >>$tmpfile
  34.600 +        echo "unset PWD SHLVL" >>$tmpfile
  34.601 +        echo "env |\\" >>$tmpfile
  34.602 +        echo "egrep '^[A-Z_][A-Z0-9_]*=.' |\\" >>$tmpfile
  34.603 +        echo "sed -e '/^_=/d' -e 's/\\\\/\\\\\\\\/g' -e 's/\"/\\\\\"/g' \\" >>$tmpfile
  34.604 +        case $SHELL in
  34.605 +            csh|*/csh|tcsh|*/tcsh )
  34.606 +                echo "-e 's/^\\([^=]*\\)=\\(.*\\)\$/setenv \\1 \"\\2\"/'" >>$tmpfile
  34.607 +                ;;
  34.608 +            * )
  34.609 +                echo "-e 's/^\\([^=]*\\)=\\(.*\\)\$/\\1=\"\\2\"; export \\1/'" >>$tmpfile
  34.610 +                ;;
  34.611 +        esac
  34.612 +
  34.613 +        #   prepare temporary files
  34.614 +        rm -f $outfile $errfile
  34.615 +        touch $outfile $errfile
  34.616 +
  34.617 +        #   now replace temporary script with its output
  34.618 +        #   by executing it and capturing its output
  34.619 +        #   (let stderr pass unfiltered in case of debug mode)
  34.620 +        if [ ".$debug" = .1 ]; then
  34.621 +            env -i \
  34.622 +                HOME="$HOME" \
  34.623 +                USER="$USER" \
  34.624 +                LOGNAME="$LOGNAME" \
  34.625 +                TERM="$TERM" \
  34.626 +                PATH="$PATH_ORIG" \
  34.627 +                MANPATH="$MANPATH" \
  34.628 +                INFOPATH="$INFOPATH" \
  34.629 +                LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
  34.630 +                $bash --norc --noprofile --posix \
  34.631 +                $tmpfile >$outfile
  34.632 +        else
  34.633 +            env -i \
  34.634 +                HOME="$HOME" \
  34.635 +                USER="$USER" \
  34.636 +                LOGNAME="$LOGNAME" \
  34.637 +                TERM="$TERM" \
  34.638 +                PATH="$PATH_ORIG" \
  34.639 +                MANPATH="$MANPATH" \
  34.640 +                INFOPATH="$INFOPATH" \
  34.641 +                LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
  34.642 +                $bash --norc --noprofile --posix \
  34.643 +                $tmpfile >$outfile 2>/dev/null
  34.644 +        fi
  34.645 +        cp $outfile $tmpfile
  34.646 +
  34.647 +        #   for --eval we cannot just print the resulting script because
  34.648 +        #   not all Bourne-Shell implementations like to "eval" large
  34.649 +        #   multi-line outputs. Hence we output a little one-liner which
  34.650 +        #   "sources" the script instead and cleans up.
  34.651 +        case $SHELL in
  34.652 +            csh|*/csh|tcsh|*/tcsh )
  34.653 +                echo "source $tmpfile; rm -rf $tmpdir 2>/dev/null || true"
  34.654 +                ;;
  34.655 +            * )
  34.656 +                echo ". $tmpfile; rm -rf $tmpdir 2>/dev/null || true"
  34.657 +                ;;
  34.658 +        esac
  34.659 +    else
  34.660 +        #   for the execution situation just make sure we
  34.661 +        #   terminate the verbose message output.
  34.662 +        if [ ".$silent" = .0 -a $verbose_pos -gt 0 ]; then
  34.663 +            echo "." 1>&2
  34.664 +        fi
  34.665 +
  34.666 +        #   additionally, if a script wants its output to be displayed,
  34.667 +        #   now do it. In case there was no such request, do not bother
  34.668 +        #   -- we then just output an empty file and so can avoid an
  34.669 +        #   extra test surrounding the next command.
  34.670 +        cat $allfile
  34.671 +    fi
  34.672 +done
  34.673 +
  34.674 +#   cleanup temporary files except the result script in
  34.675 +#   case of --eval (which is then removed by the caller).
  34.676 +#   keep those files for debugging purposes if requested.
  34.677 +if [ ".$keep" = .0 ]; then
  34.678 +    rm -f $outfile $errfile $allfile >/dev/null 2>&1 || true
  34.679 +    if [ ".$eval" = .0 ]; then
  34.680 +        rm -f $tmpfile >/dev/null 2>&1 || true
  34.681 +        rm -rf $tmpdir >/dev/null 2>&1 || true
  34.682 +    fi
  34.683 +fi
  34.684 +
  34.685 +#   now clean the exit trap and exit with the global return value
  34.686 +#   indicating to the caller whether all scripts were executed
  34.687 +#   successfully or at least one failed.
  34.688 +trap - EXIT
  34.689 +exit $rv
  34.690 +
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/openpkg/rc.8	Tue Jan 06 23:40:39 2009 +0100
    35.3 @@ -0,0 +1,533 @@
    35.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    35.5 +.\"
    35.6 +.\" Standard preamble:
    35.7 +.\" ========================================================================
    35.8 +.de Sh \" Subsection heading
    35.9 +.br
   35.10 +.if t .Sp
   35.11 +.ne 5
   35.12 +.PP
   35.13 +\fB\\$1\fR
   35.14 +.PP
   35.15 +..
   35.16 +.de Sp \" Vertical space (when we can't use .PP)
   35.17 +.if t .sp .5v
   35.18 +.if n .sp
   35.19 +..
   35.20 +.de Vb \" Begin verbatim text
   35.21 +.ft CW
   35.22 +.nf
   35.23 +.ne \\$1
   35.24 +..
   35.25 +.de Ve \" End verbatim text
   35.26 +.ft R
   35.27 +.fi
   35.28 +..
   35.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   35.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   35.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   35.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   35.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   35.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   35.35 +.tr \(*W-|\(bv\*(Tr
   35.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   35.37 +.ie n \{\
   35.38 +.    ds -- \(*W-
   35.39 +.    ds PI pi
   35.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   35.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   35.42 +.    ds L" ""
   35.43 +.    ds R" ""
   35.44 +.    ds C` 
   35.45 +.    ds C' 
   35.46 +'br\}
   35.47 +.el\{\
   35.48 +.    ds -- \|\(em\|
   35.49 +.    ds PI \(*p
   35.50 +.    ds L" ``
   35.51 +.    ds R" ''
   35.52 +'br\}
   35.53 +.\"
   35.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   35.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   35.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   35.57 +.\" output yourself in some meaningful fashion.
   35.58 +.if \nF \{\
   35.59 +.    de IX
   35.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   35.61 +..
   35.62 +.    nr % 0
   35.63 +.    rr F
   35.64 +.\}
   35.65 +.\"
   35.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   35.67 +.\" way too many mistakes in technical documents.
   35.68 +.hy 0
   35.69 +.if n .na
   35.70 +.\"
   35.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   35.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   35.73 +.    \" fudge factors for nroff and troff
   35.74 +.if n \{\
   35.75 +.    ds #H 0
   35.76 +.    ds #V .8m
   35.77 +.    ds #F .3m
   35.78 +.    ds #[ \f1
   35.79 +.    ds #] \fP
   35.80 +.\}
   35.81 +.if t \{\
   35.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   35.83 +.    ds #V .6m
   35.84 +.    ds #F 0
   35.85 +.    ds #[ \&
   35.86 +.    ds #] \&
   35.87 +.\}
   35.88 +.    \" simple accents for nroff and troff
   35.89 +.if n \{\
   35.90 +.    ds ' \&
   35.91 +.    ds ` \&
   35.92 +.    ds ^ \&
   35.93 +.    ds , \&
   35.94 +.    ds ~ ~
   35.95 +.    ds /
   35.96 +.\}
   35.97 +.if t \{\
   35.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   35.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  35.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  35.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  35.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  35.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  35.104 +.\}
  35.105 +.    \" troff and (daisy-wheel) nroff accents
  35.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  35.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  35.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  35.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  35.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  35.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  35.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  35.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  35.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  35.115 +.    \" corrections for vroff
  35.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  35.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  35.118 +.    \" for low resolution devices (crt and lpr)
  35.119 +.if \n(.H>23 .if \n(.V>19 \
  35.120 +\{\
  35.121 +.    ds : e
  35.122 +.    ds 8 ss
  35.123 +.    ds o a
  35.124 +.    ds d- d\h'-1'\(ga
  35.125 +.    ds D- D\h'-1'\(hy
  35.126 +.    ds th \o'bp'
  35.127 +.    ds Th \o'LP'
  35.128 +.    ds ae ae
  35.129 +.    ds Ae AE
  35.130 +.\}
  35.131 +.rm #[ #] #H #V #F C
  35.132 +.\" ========================================================================
  35.133 +.\"
  35.134 +.IX Title "RC 8"
  35.135 +.TH RC 8 "OpenPKG" "RC(8)" "OpenPKG"
  35.136 +.SH "NAME"
  35.137 +\&\fB@l_prefix@/bin/openpkg rc\fR \- OpenPKG Run\-Command Processor
  35.138 +.SH "SYNOPSIS"
  35.139 +.IX Header "SYNOPSIS"
  35.140 +\&\fB@l_prefix@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
  35.141 +.PP
  35.142 +\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]
  35.143 +.PP
  35.144 +eval `\fB@l_prefix@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`
  35.145 +.PP
  35.146 +\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]
  35.147 +.PP
  35.148 +\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR
  35.149 +.PP
  35.150 +\&\fB@l_prefix@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR
  35.151 +.SH "DESCRIPTION"
  35.152 +.IX Header "DESCRIPTION"
  35.153 +The \fB@l_prefix@/bin/openpkg rc\fR program is the run-command (rc) processor
  35.154 +of the \fBOpenPKG\fR instance \f(CW\*(C`@l_prefix@\*(C'\fR. It allows querying the rc
  35.155 +configuration variables and the execution of rc command scripts of one
  35.156 +or more installed \fBOpenPKG\fR packages. The implemented run-command
  35.157 +facility is partly modeled after the classical \s-1UNIX\s0(tm) System V
  35.158 +run-command facility plus ideas taken from the FreeBSD and NetBSD
  35.159 +run-command facilities. It mainly merges the classical startup/shutdown
  35.160 +procedures with periodical procedures into a single approach.
  35.161 +.SH "USAGE"
  35.162 +.IX Header "USAGE"
  35.163 +.IP "\fB@l_prefix@/bin/openpkg rc\fR [\fB\-s\fR|\fB\-\-silent\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-k\fR|\fB\-\-keep\fR] \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  35.164 +.IX Item "@l_prefix@/bin/openpkg rc [-s|--silent] [-v|--verbose] [-d|--debug] [-k|--keep] package command [command ...]"
  35.165 +\&\fBRun-Command Execution.\fR This executes one or more specified
  35.166 +\&\fIcommand\fRs in a particular \fIpackage\fR or in all installed packages if
  35.167 +\&\fIpackage\fR is "\f(CW\*(C`all\*(C'\fR". Option \fB\-\-silent\fR can be used to explicitly
  35.168 +disable progress messages on \f(CW\*(C`stderr\*(C'\fR. Option \fB\-\-verbose\fR can be used
  35.169 +to explicitly enable progress messages on \f(CW\*(C`stderr\*(C'\fR. By default, \fBrc\fR
  35.170 +automatically determines whether progress messages should be displayed
  35.171 +or not depending on whether \f(CW\*(C`stderr\*(C'\fR is connected to a terminal device.
  35.172 +Option \fB\-\-keep\fR can be used for debugging purposes to keep the
  35.173 +temporary files were generated during internal processing.
  35.174 +.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-p\fR|\fB\-\-print\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]" 4
  35.175 +.IX Item "@l_prefix@/bin/openpkg rc -p|--print package command [command ...]"
  35.176 +\&\fBRun-Command Printing.\fR This is like the run-command execution (see
  35.177 +above), but instead of immediately executing all involved individual
  35.178 +run-command scripts, they are concatenated (but with all configuration
  35.179 +parts reduced to a single configuration part) and printed to \f(CW\*(C`stdout\*(C'\fR.
  35.180 +Use this for debugging or post-processing purposes.
  35.181 +.IP "eval `\fB@l_prefix@/bin/openpkg rc\fR \fB\-e\fR|\fB\-\-eval\fR \fIpackage\fR \fIcommand\fR [\fIcommand\fR ...]`" 4
  35.182 +.IX Item "eval `@l_prefix@/bin/openpkg rc -e|--eval package command [command ...]`"
  35.183 +\&\fBRun-Command Evaluation.\fR This is like the run-command execution
  35.184 +(see above), but the resulting exported shell environment variables
  35.185 +are output to a temporary file as a (Bourne\-Shell or C\-Shell syntax)
  35.186 +shell script, suitable for evaluation within the shell environment
  35.187 +of the caller. A one-line script is printed to \f(CW\*(C`stdout\*(C'\fR which then
  35.188 +\&\*(L"sources\*(R" (and immediately removes) this temporary file. This is
  35.189 +slightly different from printing the temporary script directly to
  35.190 +\&\f(CW\*(C`stdout\*(C'\fR, because not all shell implementations like to "\fBeval\fR\*(L"
  35.191 +large multi-line scripts. Hence, use this for executing the \*(R"\f(CW\*(C`env\*(C'\fR"
  35.192 +run-commands within the current shell.
  35.193 +.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-q\fR|\fB\-\-query\fR \fIvariable\fR [\fIvariable\fR ...]" 4
  35.194 +.IX Item "@l_prefix@/bin/openpkg rc -q|--query variable [variable ...]"
  35.195 +\&\fBConfiguration Variable Querying.\fR This queries the effective values
  35.196 +(see \fBRUN-COMMAND \s-1CONFIGURATION\s0\fR section below) of one or more
  35.197 +run-command configuration \fIvariable\fRs. Use this within a shell script
  35.198 +to selectively query a particular variable.
  35.199 +.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-c\fR|\fB\-\-config\fR" 4
  35.200 +.IX Item "@l_prefix@/bin/openpkg rc -c|--config"
  35.201 +\&\fBConfiguration Variable Summary.\fR This displays on \f(CW\*(C`stdout\*(C'\fR a
  35.202 +three-column table showing the name, default and effective values of
  35.203 +all run-command configuration variables. If \f(CW\*(C`stdout\*(C'\fR is connected to
  35.204 +terminal device, variables where the default and effective values differ
  35.205 +are shown in bold mode.
  35.206 +.IP "\fB@l_prefix@/bin/openpkg rc\fR \fB\-h\fR|\fB\-\-help\fR" 4
  35.207 +.IX Item "@l_prefix@/bin/openpkg rc -h|--help"
  35.208 +\&\fBRequesting Help.\fR This just displays a short summary of
  35.209 +the usage for this program.
  35.210 +.SH "FILES"
  35.211 +.IX Header "FILES"
  35.212 +.ie n .Sh "RUN-COMMAND \s-1FILES\s0 (\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C')"
  35.213 +.el .Sh "RUN-COMMAND \s-1FILES\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.d/rc.*\*(C'\fP)"
  35.214 +.IX Subsection "RUN-COMMAND FILES (@l_prefix@/bin/openpkg rc.d/rc.*)"
  35.215 +The foundation of the \fBOpenPKG\fR run-command facility are the individual
  35.216 +run-command files \f(CW\*(C`rc.*\*(C'\fR of the installed packages. They are all
  35.217 +located in the directory \f(CW\*(C`@l_prefix@/bin/openpkg rc.d/\*(C'\fR and are named
  35.218 +"\f(CW\*(C`rc.\*(C'\fR\fIpackage\fR\*(L". They consist of one or more sections, each starting
  35.219 +with a section header \*(R"\f(CW\*(C`%\*(C'\fR\fIname\fR [\fIoptions\fR]" and following a \s-1GNU\s0
  35.220 +Bash compatible shell script. There are three classes of sections:
  35.221 +.IP "\fBSpecial Sections\fR" 4
  35.222 +.IX Item "Special Sections"
  35.223 +There are 2 sections which have a special meaning to the \fBrc\fR program
  35.224 +and cannot be used for different purposes.
  35.225 +.RS 4
  35.226 +.ie n .IP "%config" 4
  35.227 +.el .IP "\f(CW%config\fR" 4
  35.228 +.IX Item "%config"
  35.229 +This section has to consist of run-command configuration
  35.230 +variable default settings in Bourne-Shell syntax only, i.e.,
  35.231 +it has to contain one or more lines, each of exactly the form
  35.232 +"\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIvariable\fR\f(CW\*(C`=\*(C'\fR\fIvalue\fR\*(L". Notice that in section
  35.233 +\&\*(R"\f(CW%config\fR\*(L" of run-command file \*(R"\f(CW\*(C`rc.foo\*(C'\fR\*(L" the variables all have
  35.234 +to be prefixed (by convention) with \*(R"\f(CW\*(C`foo_\*(C'\fR". It is allowed that the
  35.235 +\&\fIvalue\fRs reference other variables defined before in the same section
  35.236 +or from the "\f(CW%config\fR\*(L" section of the bootstrap package \*(R"\f(CW\*(C`openpkg\*(C'\fR".
  35.237 +Additionally, by convention all lines have to be indented by 4 spaces.
  35.238 +.Sp
  35.239 +\&\s-1NOTICE:\s0 All sections of all run-command scripts see all \f(CW%config\fR
  35.240 +sections of all packages.
  35.241 +.ie n .IP "%common" 4
  35.242 +.el .IP "\f(CW%common\fR" 4
  35.243 +.IX Item "%common"
  35.244 +This section can consist of an arbitrary shell script
  35.245 +which is automatically prepended to the shell scripts
  35.246 +of all other sections on execution. It is usually used
  35.247 +to define common and local variables and functions.
  35.248 +.RE
  35.249 +.RS 4
  35.250 +.RE
  35.251 +.IP "\fBConventional Sections\fR" 4
  35.252 +.IX Item "Conventional Sections"
  35.253 +There are 9 sections which have no special meaning to the \fBrc\fR program,
  35.254 +but are used in \fBOpenPKG\fR by convention for standard purposes. Hence,
  35.255 +do not use them for arbitrary things instead.
  35.256 +.Sp
  35.257 +Throughout these sections it is possible to specify the user to be
  35.258 +switched to before the code is executed.
  35.259 +.Sp
  35.260 +A priority can be given for each section to control execution sequence
  35.261 +if "\f(CW\*(C`all\*(C'\fR" packages are given. Higher priority leads to earlier
  35.262 +starting and later stopping. The priority is a number where low numbers
  35.263 +mean high priority (numerically sorted for starting). If omitted, the
  35.264 +priority defaults to 500.
  35.265 +.Sp
  35.266 +Output generated on \fIstdout\fR and \fIstderr\fR is captured and normally
  35.267 +suppressed. In case the sections script exits with a non-zero return
  35.268 +value, the intercepted messages are consolidated, reformatted with a
  35.269 +surrounding ASCII-art border and printed to \fIstderr\fR. If the section
  35.270 +is tagged with option \fB\-o\fR, \fIstdout\fR messages are passed through
  35.271 +verbatim, even if the section script exists with a zero return value.
  35.272 +.RS 4
  35.273 +.ie n .IP "%start\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.274 +.el .IP "\f(CW%start\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.275 +.IX Item "%start [-u user] [-p priority]"
  35.276 +This section should start daemons or initialize components.
  35.277 +It is especially executed by \fBOpenPKG\fR during system startup.
  35.278 +.ie n .IP "%stop\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.279 +.el .IP "\f(CW%stop\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.280 +.IX Item "%stop [-u user] [-p priority]"
  35.281 +This section should stop daemons or cleaning up components. It is
  35.282 +especially executed by \fBOpenPKG\fR during system shutdown and package
  35.283 +deinstallation.
  35.284 +.ie n .IP "%restart\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.285 +.el .IP "\f(CW%restart\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.286 +.IX Item "%restart [-u user] [-p priority]"
  35.287 +This section should restart daemons.
  35.288 +It is especially executed by \fBOpenPKG\fR during package upgrades.
  35.289 +.ie n .IP "\*(C`%status \-o\*(C'\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.290 +.el .IP "\f(CW\*(C`%status \-o\*(C'\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.291 +.IX Item "%status -o [-u user] [-p priority]"
  35.292 +This section has to provide status information for a package
  35.293 +by printing to \f(CW\*(C`stdout\*(C'\fR (hence the \fB\-o\fR option is always required),
  35.294 +in Bourne-Shell syntax, the definition of three variables:
  35.295 +.RS 4
  35.296 +.ie n .IP "\fIpackage\fR\*(C`_enable\*(C'" 4
  35.297 +.el .IP "\fIpackage\fR\f(CW\*(C`_enable\*(C'\fR" 4
  35.298 +.IX Item "package_enable"
  35.299 +Whether package is enabled, i.e., whether it accepts run\-commands. This
  35.300 +variable just has to be printed, because is already set in current
  35.301 +script environment.
  35.302 +.ie n .IP "\fIpackage\fR\*(C`_usable\*(C'" 4
  35.303 +.el .IP "\fIpackage\fR\f(CW\*(C`_usable\*(C'\fR" 4
  35.304 +.IX Item "package_usable"
  35.305 +Whether package is usable, i.e., whether it is already correctly
  35.306 +configured, etc. This variable has to be individually determined.
  35.307 +.ie n .IP "\fIpackage\fR\*(C`_active\*(C'" 4
  35.308 +.el .IP "\fIpackage\fR\f(CW\*(C`_active\*(C'\fR" 4
  35.309 +.IX Item "package_active"
  35.310 +Whether package is active, i.e., whether it is already running.
  35.311 +This variable has to be individually determined.
  35.312 +.RE
  35.313 +.RS 4
  35.314 +.RE
  35.315 +.ie n .IP "%monthly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.316 +.el .IP "\f(CW%monthly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.317 +.IX Item "%monthly [-u user] [-p priority]"
  35.318 +.PD 0
  35.319 +.ie n .IP "%weekly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.320 +.el .IP "\f(CW%weekly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.321 +.IX Item "%weekly [-u user] [-p priority]"
  35.322 +.ie n .IP "%hourly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.323 +.el .IP "\f(CW%hourly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.324 +.IX Item "%hourly [-u user] [-p priority]"
  35.325 +.ie n .IP "%quarterly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority]" 4
  35.326 +.el .IP "\f(CW%quarterly\fR [\fB\-u\fR \fIuser\fR] [\fB\-p\fR \fIpriority\fR]" 4
  35.327 +.IX Item "%quarterly [-u user] [-p priority]"
  35.328 +.PD
  35.329 +These sections should perform periodical tasks for a package and
  35.330 +are executed on a monthly, weekly, hourly or quarterly basis.
  35.331 +.ie n .IP "%env" 4
  35.332 +.el .IP "\f(CW%env\fR" 4
  35.333 +.IX Item "%env"
  35.334 +This section is intended to export one or more environment variables
  35.335 +which are imported into the shell environment of the caller through the
  35.336 +\&\fB\-\-eval\fR command line option.
  35.337 +.RE
  35.338 +.RS 4
  35.339 +.RE
  35.340 +.IP "\fBCustom Sections\fR" 4
  35.341 +.IX Item "Custom Sections"
  35.342 +All other sections are custom ones and can be fully individual to each
  35.343 +package. Some often seen sections are \f(CW%reload\fR (just reload the
  35.344 +configuration without full stop and start procedure), \f(CW%info\fR (output
  35.345 +arbitrary information about package), etc.
  35.346 +.ie n .Sh "RUN-COMMAND \s-1CONFIGURATION\s0 (\*(C`@l_prefix@/bin/openpkg rc.conf\*(C')"
  35.347 +.el .Sh "RUN-COMMAND \s-1CONFIGURATION\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fP)"
  35.348 +.IX Subsection "RUN-COMMAND CONFIGURATION (@l_prefix@/bin/openpkg rc.conf)"
  35.349 +The run-command configuration variables defined in the "\f(CW%config\fR"
  35.350 +sections of all installed packages can be overridden by the
  35.351 +administrator in the global file \f(CW\*(C`@l_prefix@/bin/openpkg rc.conf\*(C'\fR. This file is
  35.352 +usually empty, but can be filled with Bourne-Shell compatible variable
  35.353 +assignment statements like "\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIvariable\fR=\fIvalue\fR".
  35.354 +.ie n .Sh "RUN-COMMAND \s-1FUNCTIONS\s0 (\*(C`@l_prefix@/bin/openpkg rc.func\*(C')"
  35.355 +.el .Sh "RUN-COMMAND \s-1FUNCTIONS\s0 (\f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fP)"
  35.356 +.IX Subsection "RUN-COMMAND FUNCTIONS (@l_prefix@/bin/openpkg rc.func)"
  35.357 +The file \f(CW\*(C`@l_prefix@/bin/openpkg rc.func\*(C'\fR is prepended to the scripts of all
  35.358 +executed run-command sections and provides reusable functions.
  35.359 +Currently the following functions are defined:
  35.360 +.IP "\fBrcMsg\fR [\fB\-e\fR] [\fB\-w\fR] \fImessage\fR" 4
  35.361 +.IX Item "rcMsg [-e] [-w] message"
  35.362 +Print a message to the output device of the run-command caller. The
  35.363 +message is printed to the captured \fIstderr\fR (but are visible to
  35.364 +the caller of the run-command script only if the script fails). All
  35.365 +messages are prefixed with "\f(CW\*(C`rc:\*(C'\fR". If option \fB\-e\fR is given, the
  35.366 +prefix is "\f(CW\*(C`rc:ERROR:\*(C'\fR". If option \fB\-w\fR is given, the prefix is
  35.367 +"\f(CW\*(C`rc:WARNING:\*(C'\fR".
  35.368 +.IP "\fBrcPath\fR [\fB\-a\fR] [\fB\-r\fR] [\fB\-p\fR] [\fB\-e\fR] \fIvariable\fR \fIdir\fR [\fIdir\fR ...]" 4
  35.369 +.IX Item "rcPath [-a] [-r] [-p] [-e] variable dir [dir ...]"
  35.370 +Add (option \fB\-a\fR) or remove (option \fB\-r\fR) one or more \fIdir\fRectories
  35.371 +to/from the colon-separated value of a \fIvar\fRable. By default, on
  35.372 +addition, the directory is appended to the end, if option \fB\-p\fR is used
  35.373 +the directory is prepended to the start. If option \fB\-e\fR is used, the
  35.374 +directories are added only if they exist on the underlying filesystem.
  35.375 +Use this function for conveniently manipulating \f(CW\*(C`PATH\*(C'\fR, \f(CW\*(C`MANPATH\*(C'\fR,
  35.376 +\&\f(CW\*(C`INFOPATH\*(C'\fR, \f(CW\*(C`LD_LIBRARY_PATH\*(C'\fR and similar variables.
  35.377 +.IP "\fBrcTmp\fR [\fB\-i\fR] [\fB\-f\fR] [\fB\-n\fR \fIname\fR] [\fB\-k\fR]" 4
  35.378 +.IX Item "rcTmp [-i] [-f] [-n name] [-k]"
  35.379 +Convenience interface to secure temporary file handling. Option \fB\-i\fR
  35.380 +first has to be used to initialize a secure temporary directory (option
  35.381 +\&\fB\-k\fR later will kill this again). Under option \fB\-f\fR you then can get
  35.382 +reasonable temporary filenames under the created temporary directory. By
  35.383 +default, the temporary filename is just "\f(CW\*(C`tmp\*(C'\fR", but can be specified
  35.384 +with option \fB\-n\fR to be \fIname\fR.
  35.385 +.IP "\fBrcService\fR \fIpackage\fR \fIstatus\fR \fIvalue\fR" 4
  35.386 +.IX Item "rcService package status value"
  35.387 +Convenience interface to checking the \f(CW%status\fR variables
  35.388 +\&\fIpackage\fR\f(CW\*(C`_\*(C'\fR\fIstatus\fR which have to be provided by the \f(CW%config\fR (if
  35.389 +\&\fIstatus\fR is "\f(CW\*(C`enable\*(C'\fR" this is enough) and \f(CW%status\fR (if \fIstatus\fR is
  35.390 +"\f(CW\*(C`enable\*(C'\fR\*(L", \*(R"\f(CW\*(C`usable\*(C'\fR\*(L" and \*(R"\f(CW\*(C`active\*(C'\fR"). The \fBrcService\fR especially
  35.391 +caches the resolving of the variable values. Returns 0 if the resolved
  35.392 +value is \fIvalue\fR, else returns 1.
  35.393 +.IP "\fBrcVarIsYes\fR \fIname\fR" 4
  35.394 +.IX Item "rcVarIsYes name"
  35.395 +Checks whether variable \fIname\fR has a value of "\f(CW\*(C`yes\*(C'\fR\*(L", \*(R"\f(CW\*(C`true\*(C'\fR\*(L",
  35.396 +\&\*(R"\f(CW\*(C`on\*(C'\fR\*(L", or \*(R"\f(CW1\fR" (with arbitrary lower or upper case letters). Returns
  35.397 +0 if value is one of these positive ones, else returns 1.
  35.398 +.SH "EXAMPLES"
  35.399 +.IX Header "EXAMPLES"
  35.400 +First, an example run-command script \f(CW\*(C`@l_prefix@/bin/openpkg rc.d/rc.foo\*(C'\fR for a
  35.401 +fictional daemon package "\f(CW\*(C`foo\*(C'\fR":
  35.402 +.PP
  35.403 +.Vb 8
  35.404 +\& %config
  35.405 +\&    foo_enable="${openpkg_rc_def}"
  35.406 +\&    foo_listen="127.0.0.1"
  35.407 +\&    foo_log_prolog="true"
  35.408 +\&    foo_log_epilog="true"
  35.409 +\&    foo_log_numfiles="10"
  35.410 +\&    foo_log_minsize="1M"
  35.411 +\&    foo_log_complevel="9"
  35.412 +.Ve
  35.413 +.PP
  35.414 +.Vb 13
  35.415 +\& %common
  35.416 +\&    foo_homedir="@l_prefix@/share/foo"
  35.417 +\&    foo_cfgfile="@l_prefix@/etc/foo/foo.cfg"
  35.418 +\&    foo_pidfile="@l_prefix@/var/foo/foo.pid"
  35.419 +\&    foo_logfile="@l_prefix@/var/foo/foo.log"
  35.420 +\&    foo_signal () {
  35.421 +\&        if [ -f ${foo_pidfile} ]; then
  35.422 +\&            kill -$1 `cat ${foo_pidfile}`
  35.423 +\&            return $?
  35.424 +\&        else
  35.425 +\&            return 1
  35.426 +\&        fi
  35.427 +\&    }
  35.428 +.Ve
  35.429 +.PP
  35.430 +.Vb 15
  35.431 +\& %status
  35.432 +\&     foo_usable="no"
  35.433 +\&     if [ ".`grep '<<PASSWORD>>' ${foo_cfgfile}`" = . ]; then
  35.434 +\&         foo_usable="yes"
  35.435 +\&     fi
  35.436 +\&     foo_active="no"
  35.437 +\&     if [ -f ${foo_pidfile} ]; then
  35.438 +\&         foo_signal 0
  35.439 +\&         if [ $? -eq 0 ]; then
  35.440 +\&             foo_active="yes"
  35.441 +\&         fi
  35.442 +\&     fi
  35.443 +\&     echo "foo_enable=${foo_enable}"
  35.444 +\&     echo "foo_usable=${foo_usable}"
  35.445 +\&     echo "foo_active=${foo_active}"
  35.446 +.Ve
  35.447 +.PP
  35.448 +.Vb 4
  35.449 +\& %start
  35.450 +\&     rcService foo enable yes || exit 0
  35.451 +\&     rcService foo active yes && exit 0
  35.452 +\&     @l_prefix@/sbin/foo --listen ${foo_listen}
  35.453 +.Ve
  35.454 +.PP
  35.455 +.Vb 4
  35.456 +\& %stop
  35.457 +\&     rcService foo enable yes || exit 0
  35.458 +\&     rcService foo active yes || exit 0
  35.459 +\&     foo_signal TERM
  35.460 +.Ve
  35.461 +.PP
  35.462 +.Vb 4
  35.463 +\& %restart
  35.464 +\&     rcService foo enable yes || exit 0
  35.465 +\&     rcService foo active yes || exit 0
  35.466 +\&     rc foo stop start
  35.467 +.Ve
  35.468 +.PP
  35.469 +.Vb 7
  35.470 +\& %daily
  35.471 +\&     rcService foo enable yes || exit 0
  35.472 +\&     shtool rotate -f \e
  35.473 +\&         -n ${foo_log_numfiles} -s ${foo_log_minsize} -d \e
  35.474 +\&         -z ${foo_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \e
  35.475 +\&         -P "${foo_log_prolog}" -E "${foo_log_epilog}" \e
  35.476 +\&         ${foo_logfile}
  35.477 +.Ve
  35.478 +.PP
  35.479 +.Vb 5
  35.480 +\& %env
  35.481 +\&     if rcService foo enable yes; then
  35.482 +\&         FOO_HOME="$foo_homedir"
  35.483 +\&         export FOO_HOME
  35.484 +\&     fi
  35.485 +.Ve
  35.486 +.PP
  35.487 +Now, show all run-command configuration variables, their
  35.488 +default values and their effective values of package "\f(CW\*(C`foo\*(C'\fR":
  35.489 +.PP
  35.490 +.Vb 1
  35.491 +\& $ @l_prefix@/bin/openpkg rc --config | grep "^foo_"
  35.492 +.Ve
  35.493 +.PP
  35.494 +Override the default value of a run-command configuration
  35.495 +variable \f(CW\*(C`foo_listen\*(C'\fR:
  35.496 +.PP
  35.497 +.Vb 1
  35.498 +\& $ echo 'foo_listen="192.168.0.1"' >>@l_prefix@/bin/openpkg rc.conf
  35.499 +.Ve
  35.500 +.PP
  35.501 +Stop and start from scratch the package "\f(CW\*(C`foo\*(C'\fR":
  35.502 +.PP
  35.503 +.Vb 1
  35.504 +\& $ @l_prefix@/bin/openpkg rc foo stop start
  35.505 +.Ve
  35.506 +.PP
  35.507 +Query the effective value of run-command configuration
  35.508 +variable \f(CW\*(C`foo_enable\*(C'\fR in a script:
  35.509 +.PP
  35.510 +.Vb 1
  35.511 +\& if [ ".`@l_prefix@/bin/openpkg rc -q foo_enable`" = .yes ]; then ...
  35.512 +.Ve
  35.513 +.PP
  35.514 +Import all environment settings from all (including "\f(CW\*(C`foo\*(C'\fR") installed
  35.515 +packages into the current Bourne-Shell environment:
  35.516 +.PP
  35.517 +.Vb 2
  35.518 +\& $ eval `@l_prefix@/bin/openpkg rc --eval all env`
  35.519 +\& $ echo $FOO_HOME
  35.520 +.Ve
  35.521 +.SH "SEE ALSO"
  35.522 +.IX Header "SEE ALSO"
  35.523 +\&\fBOpenPKG\fR http://www.openpkg.org/
  35.524 +.SH "HISTORY"
  35.525 +.IX Header "HISTORY"
  35.526 +The \fBOpenPKG\fR run-command facility consisting of the scripts \f(CW\*(C`rc\*(C'\fR
  35.527 +and \f(CW\*(C`rc.func\*(C'\fR were originally invented in November 2000 by Ralf S.
  35.528 +Engelschall for \fBOpenPKG\fR. They were completely worked off from scratch
  35.529 +in July 2003 for \fBOpenPKG 1.3\fR.
  35.530 +.SH "AUTHOR"
  35.531 +.IX Header "AUTHOR"
  35.532 +.Vb 3
  35.533 +\& Ralf S. Engelschall
  35.534 +\& rse@engelschall.com
  35.535 +\& www.engelschall.com
  35.536 +.Ve
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/openpkg/rc.conf	Tue Jan 06 23:40:39 2009 +0100
    36.3 @@ -0,0 +1,12 @@
    36.4 +##
    36.5 +##  @l_prefix@/etc/rc.conf -- Run-Command Configuration for OpenPKG Hierarchy
    36.6 +##
    36.7 +##  This Bourne-Shell script is sourced from @l_prefix@/etc/rc after
    36.8 +##  reading the %config sections from the @l_prefix@/etc/rc.d/rc.<name>
    36.9 +##  script and before executing its %<cmd> section when
   36.10 +##  "@l_prefix@/etc/rc <name> <cmd>" is run. You can use this to
   36.11 +##  override all configuration variables which are listed in the output
   36.12 +##  of the "@l_prefix@/etc/rc --config" command. By default this
   36.13 +##  script obviously is empty.
   36.14 +##
   36.15 +
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/openpkg/rc.func	Tue Jan 06 23:40:39 2009 +0100
    37.3 @@ -0,0 +1,210 @@
    37.4 +##
    37.5 +##  @l_prefix@/etc/rc.func -- Run-Command Helper Functions
    37.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    37.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    37.8 +##
    37.9 +##  Permission to use, copy, modify, and distribute this software for
   37.10 +##  any purpose with or without fee is hereby granted, provided that
   37.11 +##  the above copyright notice and this permission notice appear in all
   37.12 +##  copies.
   37.13 +##
   37.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   37.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   37.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   37.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   37.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   37.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   37.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   37.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   37.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   37.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   37.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   37.25 +##  SUCH DAMAGE.
   37.26 +##
   37.27 +
   37.28 +##
   37.29 +##  NOTICE: This script is a collection of reusable shell functions
   37.30 +##  running under GNU Bash during the execution of OpenPKG run-command
   37.31 +##  sections.
   37.32 +##
   37.33 +
   37.34 +#
   37.35 +#   rcMsg (display message)
   37.36 +#
   37.37 +#   Usage:       rcMsg [-e] [-w] <message>
   37.38 +#   Example:     rcMsg -e "invalid command line"
   37.39 +#   Description: display a regular/warning/error message.
   37.40 +#
   37.41 +rcMsg () {
   37.42 +    local prefix="rc:"
   37.43 +    while [ $# -gt 0 ]; do
   37.44 +        case $1 in
   37.45 +            -e ) prefix="${prefix}ERROR:";   shift ;;
   37.46 +            -w ) prefix="${prefix}WARNING:"; shift ;;
   37.47 +            *  ) break ;;
   37.48 +        esac
   37.49 +    done
   37.50 +    echo "${prefix} $*"
   37.51 +    return 0
   37.52 +}
   37.53 +
   37.54 +#
   37.55 +#   rcPath (manipulate colon-separated PATH-style variable)
   37.56 +#
   37.57 +#   Usage:       rcPath [-a] [-r] [-p] [-e] <var> <dir> [<dir> ...]
   37.58 +#   Example:     rcPath -a -e PATH /bin /sbin /usr/bin /usr/sbin /usr/ccs/bin
   37.59 +#   Description: removes (-r) or adds (-a) by appending or prepending
   37.60 +#                (-p) one or more directories <dir> (optionally have
   37.61 +#                to be existing if -e is given) to a colon-separated
   37.62 +#                PATH-style variable <var>. In case a directory already
   37.63 +#                exists, it is first removed.
   37.64 +#
   37.65 +rcPath () {
   37.66 +    local mode=""
   37.67 +    local prepend=0
   37.68 +    local exists=0
   37.69 +    while [ $# -gt 0 ]; do
   37.70 +        case $1 in
   37.71 +            -a ) mode="add";    shift ;;
   37.72 +            -r ) mode="remove"; shift ;;
   37.73 +            -p ) prepend=1;     shift ;;
   37.74 +            -e ) exists=1;      shift ;;
   37.75 +            *  ) break                ;;
   37.76 +        esac
   37.77 +    done
   37.78 +    local var="$1"
   37.79 +    shift
   37.80 +    if [ ".${mode}" = .add ]; then
   37.81 +        local edit_del=""
   37.82 +        local edit_add=""
   37.83 +        local dir
   37.84 +        for dir in "$@"; do
   37.85 +            if [ ".${exists}" = .1 ] && [ ! -d "${dir}" ]; then
   37.86 +                continue
   37.87 +            fi
   37.88 +            edit_del="${edit_del} -e 's;^${dir}\$;;' -e 's;^${dir}:;;'"
   37.89 +            edit_del="${edit_del} -e 's;:${dir}:;:;' -e 's;:${dir}\$;;'"
   37.90 +            if [ ".${prepend}" = .0 ]; then
   37.91 +                edit_add="${edit_add} -e 's;\$;:${dir};'"
   37.92 +            else
   37.93 +                edit_add="-e 's;^;${dir}:;' ${edit_add}"
   37.94 +            fi
   37.95 +        done
   37.96 +        if [ ".${edit_del}${edit_add}" != . ]; then
   37.97 +            eval "${var}=\`echo \"\$${var}\" | sed ${edit_del} ${edit_add}\`"
   37.98 +        fi
   37.99 +        return 0
  37.100 +    elif [ ".${mode}" = .remove ]; then
  37.101 +        local edit=""
  37.102 +        local dir
  37.103 +        for dir in "$@"; do
  37.104 +            edit="${edit} -e 's;^${dir}\$;;' -e 's;^${dir}:;;'"
  37.105 +            edit="${edit} -e 's;:${dir}:;:;' -e 's;:${dir}\$;;'"
  37.106 +        done
  37.107 +        eval "${var}=\`echo \"\$${var}\" | sed ${edit}\`"
  37.108 +        return 0
  37.109 +    else
  37.110 +        rcMsg -e "rcPath: neither add (-a) nor remove (-r) operation specified"
  37.111 +        return 1
  37.112 +    fi
  37.113 +}
  37.114 +
  37.115 +#
  37.116 +#   rcTmp (temporary file handling)
  37.117 +#
  37.118 +#   Usage:       rcTmp [-i] [-f [-n <name>]] [-k]
  37.119 +#   Example:     rcTmp -i; tmpfile=`rcTmp -f -n tmp`; ...; rcTmp -k
  37.120 +#   Description: ???
  37.121 +#
  37.122 +rcTmp () {
  37.123 +    local mode=""
  37.124 +    local name=""
  37.125 +    while [ $# -gt 0 ]; do
  37.126 +        case $1 in
  37.127 +            -i ) mode="init"; shift        ;;
  37.128 +            -f ) mode="file"; shift        ;;
  37.129 +            -k ) mode="kill"; shift        ;;
  37.130 +            -n ) name="$2";   shift; shift ;;
  37.131 +            *  ) break                     ;;
  37.132 +        esac
  37.133 +    done
  37.134 +    if [ ".${mode}" = .init ]; then
  37.135 +        if [ ".${RC_TMPDIR}" = . ]; then
  37.136 +            local i=0
  37.137 +            while [ ${i} -lt 10 ]; do
  37.138 +               RC_TMPDIR="@l_prefix@/RPM/TMP/rc-`date '+%Y%m%d%H%M%S'`-$$"
  37.139 +               (umask 022; mkdir ${RC_TMPDIR} >/dev/null 2>&1) && break
  37.140 +               i=$((${i} + 1))
  37.141 +               sleep 1
  37.142 +            done
  37.143 +            if [ ${i} -eq 10 ]; then
  37.144 +                rcMsg -e "rcTmp: unable to establish secure temporary directory" 1>&2
  37.145 +                return 1
  37.146 +            fi
  37.147 +            declare -r RC_TMPDIR
  37.148 +        fi
  37.149 +        return 0
  37.150 +    elif [ ".${mode}" = .file ]; then
  37.151 +        echo "${RC_TMPDIR}/${name:-tmp}"
  37.152 +        return 0
  37.153 +    elif [ ".${mode}" = .kill ]; then
  37.154 +        if [ ".${RC_TMPDIR}" = . ]; then
  37.155 +            rcMsg -e "rcTmp: no secure temporary directory known"
  37.156 +            return 1
  37.157 +        else
  37.158 +            rm -rf ${RC_TMPDIR}
  37.159 +            return 0
  37.160 +        fi
  37.161 +    else
  37.162 +        rcMsg -e "rcTmp: neither init (-i), file (-f) nor kill (-k) operation specified"
  37.163 +        return 1
  37.164 +    fi
  37.165 +}
  37.166 +
  37.167 +#
  37.168 +#   rcService (check for service status enable/active/usable)
  37.169 +#
  37.170 +#   Usage:       rcService <pkg> <service> <val>
  37.171 +#   Example:     if rcService openssh enable yes; then ...
  37.172 +#   Description: check <service> of package <pkg> against value <val>.
  37.173 +#                <service> has to be one of "enable", "active" or "usable".
  37.174 +#                <val> has to be either "no", "yes", or "unknown".
  37.175 +#
  37.176 +rcService () {
  37.177 +    local pkg="`echo ${1} | sed -e 's;-;_;g'`"
  37.178 +    local var="${pkg}_${2}"
  37.179 +    local chk="${3}"
  37.180 +    eval "local val=\$${var}"
  37.181 +    if [ ".${val}" = . ]; then
  37.182 +        eval `@l_prefix@/bin/openpkg rc 2>/dev/null --silent ${1} status || true`
  37.183 +        eval "local val=\$${var}"
  37.184 +    fi
  37.185 +    if [ ".${val}" = ".${chk}" ]; then
  37.186 +        return 0
  37.187 +    else
  37.188 +        return 1
  37.189 +    fi
  37.190 +}
  37.191 +
  37.192 +#
  37.193 +#   rcVarIsYes (check variable for positive value)
  37.194 +#
  37.195 +#   Usage:       rcVarIsYes <var>
  37.196 +#   Example:     if rcVarIsYes foo; then ...
  37.197 +#   Description: check whether a variable <var> contains a positive
  37.198 +#                value, i.e., the values "yes", "true", "on" or "1" in
  37.199 +#                arbitrary lower or upper case.
  37.200 +#
  37.201 +rcVarIsYes () {
  37.202 +    local var="${1}"
  37.203 +    eval "local val=\"\$${var}\""
  37.204 +    case "${val}" in
  37.205 +        [Yy][Ee][Ss] | [Tt][Rr][Uu][Ee] | [Oo][Nn] | 1 )
  37.206 +            return 0
  37.207 +            ;;
  37.208 +        * )
  37.209 +            return 1
  37.210 +            ;;
  37.211 +    esac
  37.212 +}
  37.213 +
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/openpkg/rc.openpkg	Tue Jan 06 23:40:39 2009 +0100
    38.3 @@ -0,0 +1,96 @@
    38.4 +#!@l_prefix@/bin/openpkg rc
    38.5 +##
    38.6 +##  rc.openpkg -- Run-Commands
    38.7 +##
    38.8 +
    38.9 +%config
   38.10 +    openpkg_rc_def="yes"
   38.11 +    openpkg_rc_all="$openpkg_rc_def"
   38.12 +    openpkg_enable="$openpkg_rc_def"
   38.13 +    openpkg_envprio="high"
   38.14 +    openpkg_reghour="3"
   38.15 +    openpkg_regrand="1"
   38.16 +
   38.17 +%status -o
   38.18 +    openpkg_usable="unknown"
   38.19 +    openpkg_active="unknown"
   38.20 +    echo "openpkg_enable=\"$openpkg_enable\""
   38.21 +    echo "openpkg_usable=\"$openpkg_usable\""
   38.22 +    echo "openpkg_active=\"$openpkg_active\""
   38.23 +
   38.24 +%info -o
   38.25 +    @l_prefix@/bin/openpkg uuid info
   38.26 +
   38.27 +%start -p0
   38.28 +    rcService openpkg enable yes || exit 0
   38.29 +    #   update UUID information (in background to not slow down boot sequences)
   38.30 +    (nohup @l_prefix@/bin/openpkg uuid update </dev/null >/dev/null 2>&1 &) >/dev/null 2>&1
   38.31 +
   38.32 +%hourly -u @l_musr@
   38.33 +    rcService openpkg enable yes || exit 0
   38.34 +    #   automatic (re-)registration
   38.35 +    reregister=0
   38.36 +    #   re-register if previously registered
   38.37 +    @l_prefix@/bin/openpkg register --printstatus >/dev/null 2>&1 && reregister=1
   38.38 +    #   re-register if "openpkg" executable from community series
   38.39 +    [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg --license 2>/dev/null \
   38.40 +    | sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C' >/dev/null && reregister=1
   38.41 +    #   re-register if "openpkg release" configured to pull packages directly from openpkg.(org|com|net)
   38.42 +    [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg release --fmt='%u' \
   38.43 +    | egrep '^[^:]*://(([^:]*:)?([^@]*@)?)?([^/]*\.)?openpkg\.(com|org|net)/' >/dev/null && reregister=1
   38.44 +    #   perform (re-)registration
   38.45 +    if [ $reregister -eq 1 ]; then
   38.46 +        [ $openpkg_reghour -lt 00 -o $openpkg_reghour -gt 23 ] && openpkg_reghour="3"
   38.47 +        now=`date '+%H'`
   38.48 +        [ $openpkg_reghour -eq $now ] || exit 0
   38.49 +        [ $openpkg_regrand -lt 01 -o $openpkg_regrand -gt 04 ] && openpkg_regrand="1"
   38.50 +        rnd=`expr $RANDOM \* 3600 \* $openpkg_regrand / 32768`
   38.51 +        (nohup @l_prefix@/lib/openpkg/bash -c "sleep $rnd; @l_prefix@/bin/openpkg register" </dev/null >/dev/null 2>&1 &) >/dev/null 2>&1
   38.52 +    fi
   38.53 +
   38.54 +%daily -p0
   38.55 +    rcService openpkg enable yes || exit 0
   38.56 +    #   update UUID information
   38.57 +    @l_prefix@/bin/openpkg uuid update >/dev/null 2>&1 || true
   38.58 +
   38.59 +%env -p0
   38.60 +    rcService openpkg enable yes || exit 0
   38.61 +
   38.62 +    #   determine append (low prio) or prepend (high prio) mode
   38.63 +    opt_prepend=""
   38.64 +    if [ ".$openpkg_envprio" = ".high" ]; then
   38.65 +        opt_prepend="-p"
   38.66 +    fi
   38.67 +
   38.68 +    #   make sure the software package executables are found
   38.69 +    export PATH
   38.70 +    rcPath -a -e PATH \
   38.71 +        /bin /sbin /usr/bin /usr/sbin
   38.72 +    rcPath -a ${opt_prepend} PATH \
   38.73 +        @l_prefix@/bin @l_prefix@/sbin \
   38.74 +        @l_prefix@/local/bin @l_prefix@/local/sbin
   38.75 +
   38.76 +    #   make sure the software package manual pages are found
   38.77 +    export MANPATH
   38.78 +    rcPath -a -e MANPATH \
   38.79 +        /usr/man /usr/share/man
   38.80 +    rcPath -a ${opt_prepend} MANPATH \
   38.81 +        @l_prefix@/man @l_prefix@/local/man
   38.82 +
   38.83 +    #   make sure the software package info pages are found
   38.84 +    export INFOPATH
   38.85 +    rcPath -a -e INFOPATH \
   38.86 +        /usr/info /usr/share/info
   38.87 +    rcPath -a ${opt_prepend} INFOPATH \
   38.88 +        @l_prefix@/info @l_prefix@/local/info
   38.89 +
   38.90 +    #   make sure the software package libraries are found
   38.91 +    export LD_LIBRARY_PATH
   38.92 +    rcPath -a -e LD_LIBRARY_PATH \
   38.93 +        /lib /usr/lib
   38.94 +    rcPath -a ${opt_prepend} LD_LIBRARY_PATH \
   38.95 +        @l_prefix@/lib @l_prefix@/local/lib
   38.96 +
   38.97 +    #   cleanup
   38.98 +    unset opt_prepend
   38.99 +
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/openpkg/rc.pod	Tue Jan 06 23:40:39 2009 +0100
    39.3 @@ -0,0 +1,430 @@
    39.4 +##
    39.5 +##  rc.pod -- RPM Auxiliary Tool (Manual Page)
    39.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    39.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    39.8 +##
    39.9 +##  Permission to use, copy, modify, and distribute this software for
   39.10 +##  any purpose with or without fee is hereby granted, provided that
   39.11 +##  the above copyright notice and this permission notice appear in all
   39.12 +##  copies.
   39.13 +##
   39.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   39.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   39.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   39.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   39.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   39.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   39.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   39.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   39.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   39.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   39.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   39.25 +##  SUCH DAMAGE.
   39.26 +##
   39.27 +
   39.28 +=pod
   39.29 +
   39.30 +=head1 NAME
   39.31 +
   39.32 +B<@l_prefix@/bin/openpkg rc> - OpenPKG Run-Command Processor
   39.33 +
   39.34 +=head1 SYNOPSIS
   39.35 +
   39.36 +B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] I<package> I<command> [I<command> ...]
   39.37 +
   39.38 +B<@l_prefix@/bin/openpkg rc> B<-p>|B<--print> I<package> I<command> [I<command> ...]
   39.39 +
   39.40 +eval `B<@l_prefix@/bin/openpkg rc> B<-e>|B<--eval> I<package> I<command> [I<command> ...]`
   39.41 +
   39.42 +B<@l_prefix@/bin/openpkg rc> B<-q>|B<--query> I<variable> [I<variable> ...]
   39.43 +
   39.44 +B<@l_prefix@/bin/openpkg rc> B<-c>|B<--config>
   39.45 +
   39.46 +B<@l_prefix@/bin/openpkg rc> B<-h>|B<--help>
   39.47 +
   39.48 +=head1 DESCRIPTION
   39.49 +
   39.50 +The B<@l_prefix@/bin/openpkg rc> program is the run-command (rc) processor
   39.51 +of the B<OpenPKG> instance C<@l_prefix@>. It allows querying the rc
   39.52 +configuration variables and the execution of rc command scripts of one
   39.53 +or more installed B<OpenPKG> packages. The implemented run-command
   39.54 +facility is partly modeled after the classical UNIX(tm) System V
   39.55 +run-command facility plus ideas taken from the FreeBSD and NetBSD
   39.56 +run-command facilities. It mainly merges the classical startup/shutdown
   39.57 +procedures with periodical procedures into a single approach.
   39.58 +
   39.59 +=head1 USAGE
   39.60 +
   39.61 +=over 4
   39.62 +
   39.63 +=item B<@l_prefix@/bin/openpkg rc> [B<-s>|B<--silent>] [B<-v>|B<--verbose>] [B<-d>|B<--debug>] [B<-k>|B<--keep>] I<package> I<command> [I<command> ...]
   39.64 +
   39.65 +B<Run-Command Execution.> This executes one or more specified
   39.66 +I<command>s in a particular I<package> or in all installed packages if
   39.67 +I<package> is "C<all>". Option B<--silent> can be used to explicitly
   39.68 +disable progress messages on C<stderr>. Option B<--verbose> can be used
   39.69 +to explicitly enable progress messages on C<stderr>. By default, B<rc>
   39.70 +automatically determines whether progress messages should be displayed
   39.71 +or not depending on whether C<stderr> is connected to a terminal device.
   39.72 +Option B<--keep> can be used for debugging purposes to keep the
   39.73 +temporary files were generated during internal processing.
   39.74 +
   39.75 +=item B<@l_prefix@/bin/openpkg rc> B<-p>|B<--print> I<package> I<command> [I<command> ...]
   39.76 +
   39.77 +B<Run-Command Printing.> This is like the run-command execution (see
   39.78 +above), but instead of immediately executing all involved individual
   39.79 +run-command scripts, they are concatenated (but with all configuration
   39.80 +parts reduced to a single configuration part) and printed to C<stdout>.
   39.81 +Use this for debugging or post-processing purposes.
   39.82 +
   39.83 +=item eval `B<@l_prefix@/bin/openpkg rc> B<-e>|B<--eval> I<package> I<command> [I<command> ...]`
   39.84 +
   39.85 +B<Run-Command Evaluation.> This is like the run-command execution
   39.86 +(see above), but the resulting exported shell environment variables
   39.87 +are output to a temporary file as a (Bourne-Shell or C-Shell syntax)
   39.88 +shell script, suitable for evaluation within the shell environment
   39.89 +of the caller. A one-line script is printed to C<stdout> which then
   39.90 +"sources" (and immediately removes) this temporary file. This is
   39.91 +slightly different from printing the temporary script directly to
   39.92 +C<stdout>, because not all shell implementations like to "B<eval>"
   39.93 +large multi-line scripts. Hence, use this for executing the "C<env>"
   39.94 +run-commands within the current shell.
   39.95 +
   39.96 +=item B<@l_prefix@/bin/openpkg rc> B<-q>|B<--query> I<variable> [I<variable> ...]
   39.97 +
   39.98 +B<Configuration Variable Querying.> This queries the effective values
   39.99 +(see B<RUN-COMMAND CONFIGURATION> section below) of one or more
  39.100 +run-command configuration I<variable>s. Use this within a shell script
  39.101 +to selectively query a particular variable.
  39.102 +
  39.103 +=item B<@l_prefix@/bin/openpkg rc> B<-c>|B<--config>
  39.104 +
  39.105 +B<Configuration Variable Summary.> This displays on C<stdout> a
  39.106 +three-column table showing the name, default and effective values of
  39.107 +all run-command configuration variables. If C<stdout> is connected to
  39.108 +terminal device, variables where the default and effective values differ
  39.109 +are shown in bold mode.
  39.110 +
  39.111 +=item B<@l_prefix@/bin/openpkg rc> B<-h>|B<--help>
  39.112 +
  39.113 +B<Requesting Help.> This just displays a short summary of
  39.114 +the usage for this program.
  39.115 +
  39.116 +=back
  39.117 +
  39.118 +=head1 FILES
  39.119 +
  39.120 +=head2 RUN-COMMAND FILES (C<@l_prefix@/bin/openpkg rc.d/rc.*>)
  39.121 +
  39.122 +The foundation of the B<OpenPKG> run-command facility are the individual
  39.123 +run-command files C<rc.*> of the installed packages. They are all
  39.124 +located in the directory C<@l_prefix@/bin/openpkg rc.d/> and are named
  39.125 +"C<rc.>I<package>". They consist of one or more sections, each starting
  39.126 +with a section header "C<%>I<name> [I<options>]" and following a GNU
  39.127 +Bash compatible shell script. There are three classes of sections:
  39.128 +
  39.129 +=over 4
  39.130 +
  39.131 +=item B<Special Sections>
  39.132 +
  39.133 +There are 2 sections which have a special meaning to the B<rc> program
  39.134 +and cannot be used for different purposes.
  39.135 +
  39.136 +=over 4
  39.137 +
  39.138 +=item C<%config>
  39.139 +
  39.140 +This section has to consist of run-command configuration
  39.141 +variable default settings in Bourne-Shell syntax only, i.e.,
  39.142 +it has to contain one or more lines, each of exactly the form
  39.143 +"I<package>C<_>I<variable>C<=>I<value>". Notice that in section
  39.144 +"C<%config>" of run-command file "C<rc.foo>" the variables all have
  39.145 +to be prefixed (by convention) with "C<foo_>". It is allowed that the
  39.146 +I<value>s reference other variables defined before in the same section
  39.147 +or from the "C<%config>" section of the bootstrap package "C<openpkg>".
  39.148 +Additionally, by convention all lines have to be indented by 4 spaces.
  39.149 +
  39.150 +NOTICE: All sections of all run-command scripts see all C<%config>
  39.151 +sections of all packages.
  39.152 +
  39.153 +=item C<%common>
  39.154 +
  39.155 +This section can consist of an arbitrary shell script
  39.156 +which is automatically prepended to the shell scripts
  39.157 +of all other sections on execution. It is usually used
  39.158 +to define common and local variables and functions.
  39.159 +
  39.160 +=back
  39.161 +
  39.162 +=item B<Conventional Sections>
  39.163 +
  39.164 +There are 9 sections which have no special meaning to the B<rc> program,
  39.165 +but are used in B<OpenPKG> by convention for standard purposes. Hence,
  39.166 +do not use them for arbitrary things instead.
  39.167 +
  39.168 +Throughout these sections it is possible to specify the user to be
  39.169 +switched to before the code is executed.
  39.170 +
  39.171 +A priority can be given for each section to control execution sequence
  39.172 +if "C<all>" packages are given. Higher priority leads to earlier
  39.173 +starting and later stopping. The priority is a number where low numbers
  39.174 +mean high priority (numerically sorted for starting). If omitted, the
  39.175 +priority defaults to 500.
  39.176 +
  39.177 +Output generated on F<stdout> and F<stderr> is captured and normally
  39.178 +suppressed. In case the sections script exits with a non-zero return
  39.179 +value, the intercepted messages are consolidated, reformatted with a
  39.180 +surrounding ASCII-art border and printed to F<stderr>. If the section
  39.181 +is tagged with option B<-o>, F<stdout> messages are passed through
  39.182 +verbatim, even if the section script exists with a zero return value.
  39.183 +
  39.184 +=over 4
  39.185 +
  39.186 +=item C<%start> [B<-u> I<user>] [B<-p> I<priority>]
  39.187 +
  39.188 +This section should start daemons or initialize components.
  39.189 +It is especially executed by B<OpenPKG> during system startup.
  39.190 +
  39.191 +=item C<%stop> [B<-u> I<user>] [B<-p> I<priority>]
  39.192 +
  39.193 +This section should stop daemons or cleaning up components. It is
  39.194 +especially executed by B<OpenPKG> during system shutdown and package
  39.195 +deinstallation.
  39.196 +
  39.197 +=item C<%restart> [B<-u> I<user>] [B<-p> I<priority>]
  39.198 +
  39.199 +This section should restart daemons.
  39.200 +It is especially executed by B<OpenPKG> during package upgrades.
  39.201 +
  39.202 +=item C<%status -o> [B<-u> I<user>] [B<-p> I<priority>]
  39.203 +
  39.204 +This section has to provide status information for a package
  39.205 +by printing to C<stdout> (hence the B<-o> option is always required),
  39.206 +in Bourne-Shell syntax, the definition of three variables:
  39.207 +
  39.208 +=over 4
  39.209 +
  39.210 +=item I<package>C<_enable>
  39.211 +
  39.212 +Whether package is enabled, i.e., whether it accepts run-commands. This
  39.213 +variable just has to be printed, because is already set in current
  39.214 +script environment.
  39.215 +
  39.216 +=item I<package>C<_usable>
  39.217 +
  39.218 +Whether package is usable, i.e., whether it is already correctly
  39.219 +configured, etc. This variable has to be individually determined.
  39.220 +
  39.221 +=item I<package>C<_active>
  39.222 +
  39.223 +Whether package is active, i.e., whether it is already running.
  39.224 +This variable has to be individually determined.
  39.225 +
  39.226 +=back
  39.227 +
  39.228 +=item C<%monthly> [B<-u> I<user>] [B<-p> I<priority>]
  39.229 +
  39.230 +=item C<%weekly> [B<-u> I<user>] [B<-p> I<priority>]
  39.231 +
  39.232 +=item C<%hourly> [B<-u> I<user>] [B<-p> I<priority>]
  39.233 +
  39.234 +=item C<%quarterly> [B<-u> I<user>] [B<-p> I<priority>]
  39.235 +
  39.236 +These sections should perform periodical tasks for a package and
  39.237 +are executed on a monthly, weekly, hourly or quarterly basis.
  39.238 +
  39.239 +=item C<%env>
  39.240 +
  39.241 +This section is intended to export one or more environment variables
  39.242 +which are imported into the shell environment of the caller through the
  39.243 +B<--eval> command line option.
  39.244 +
  39.245 +=back
  39.246 +
  39.247 +=item B<Custom Sections>
  39.248 +
  39.249 +All other sections are custom ones and can be fully individual to each
  39.250 +package. Some often seen sections are C<%reload> (just reload the
  39.251 +configuration without full stop and start procedure), C<%info> (output
  39.252 +arbitrary information about package), etc.
  39.253 +
  39.254 +=back
  39.255 +
  39.256 +=head2 RUN-COMMAND CONFIGURATION (C<@l_prefix@/bin/openpkg rc.conf>)
  39.257 +
  39.258 +The run-command configuration variables defined in the "C<%config>"
  39.259 +sections of all installed packages can be overridden by the
  39.260 +administrator in the global file C<@l_prefix@/bin/openpkg rc.conf>. This file is
  39.261 +usually empty, but can be filled with Bourne-Shell compatible variable
  39.262 +assignment statements like "I<package>C<_>I<variable>=I<value>".
  39.263 +
  39.264 +=head2 RUN-COMMAND FUNCTIONS (C<@l_prefix@/bin/openpkg rc.func>)
  39.265 +
  39.266 +The file C<@l_prefix@/bin/openpkg rc.func> is prepended to the scripts of all
  39.267 +executed run-command sections and provides reusable functions.
  39.268 +Currently the following functions are defined:
  39.269 +
  39.270 +=over 4
  39.271 +
  39.272 +=item B<rcMsg> [B<-e>] [B<-w>] I<message>
  39.273 +
  39.274 +Print a message to the output device of the run-command caller. The
  39.275 +message is printed to the captured F<stderr> (but are visible to
  39.276 +the caller of the run-command script only if the script fails). All
  39.277 +messages are prefixed with "C<rc:>". If option B<-e> is given, the
  39.278 +prefix is "C<rc:ERROR:>". If option B<-w> is given, the prefix is
  39.279 +"C<rc:WARNING:>".
  39.280 +
  39.281 +=item B<rcPath> [B<-a>] [B<-r>] [B<-p>] [B<-e>] I<variable> I<dir> [I<dir> ...]
  39.282 +
  39.283 +Add (option B<-a>) or remove (option B<-r>) one or more I<dir>ectories
  39.284 +to/from the colon-separated value of a I<var>able. By default, on
  39.285 +addition, the directory is appended to the end, if option B<-p> is used
  39.286 +the directory is prepended to the start. If option B<-e> is used, the
  39.287 +directories are added only if they exist on the underlying filesystem.
  39.288 +Use this function for conveniently manipulating C<PATH>, C<MANPATH>,
  39.289 +C<INFOPATH>, C<LD_LIBRARY_PATH> and similar variables.
  39.290 +
  39.291 +=item B<rcTmp> [B<-i>] [B<-f>] [B<-n> I<name>] [B<-k>]
  39.292 +
  39.293 +Convenience interface to secure temporary file handling. Option B<-i>
  39.294 +first has to be used to initialize a secure temporary directory (option
  39.295 +B<-k> later will kill this again). Under option B<-f> you then can get
  39.296 +reasonable temporary filenames under the created temporary directory. By
  39.297 +default, the temporary filename is just "C<tmp>", but can be specified
  39.298 +with option B<-n> to be I<name>.
  39.299 +
  39.300 +=item B<rcService> I<package> I<status> I<value>
  39.301 +
  39.302 +Convenience interface to checking the C<%status> variables
  39.303 +I<package>C<_>I<status> which have to be provided by the C<%config> (if
  39.304 +I<status> is "C<enable>" this is enough) and C<%status> (if I<status> is
  39.305 +"C<enable>", "C<usable>" and "C<active>"). The B<rcService> especially
  39.306 +caches the resolving of the variable values. Returns 0 if the resolved
  39.307 +value is I<value>, else returns 1.
  39.308 +
  39.309 +=item B<rcVarIsYes> I<name>
  39.310 +
  39.311 +Checks whether variable I<name> has a value of "C<yes>", "C<true>",
  39.312 +"C<on>", or "C<1>" (with arbitrary lower or upper case letters). Returns
  39.313 +0 if value is one of these positive ones, else returns 1.
  39.314 +
  39.315 +=back
  39.316 +
  39.317 +=head1 EXAMPLES
  39.318 +
  39.319 +First, an example run-command script C<@l_prefix@/bin/openpkg rc.d/rc.foo> for a
  39.320 +fictional daemon package "C<foo>":
  39.321 +
  39.322 + %config
  39.323 +    foo_enable="${openpkg_rc_def}"
  39.324 +    foo_listen="127.0.0.1"
  39.325 +    foo_log_prolog="true"
  39.326 +    foo_log_epilog="true"
  39.327 +    foo_log_numfiles="10"
  39.328 +    foo_log_minsize="1M"
  39.329 +    foo_log_complevel="9"
  39.330 +
  39.331 + %common
  39.332 +    foo_homedir="@l_prefix@/share/foo"
  39.333 +    foo_cfgfile="@l_prefix@/etc/foo/foo.cfg"
  39.334 +    foo_pidfile="@l_prefix@/var/foo/foo.pid"
  39.335 +    foo_logfile="@l_prefix@/var/foo/foo.log"
  39.336 +    foo_signal () {
  39.337 +        if [ -f ${foo_pidfile} ]; then
  39.338 +            kill -$1 `cat ${foo_pidfile}`
  39.339 +            return $?
  39.340 +        else
  39.341 +            return 1
  39.342 +        fi
  39.343 +    }
  39.344 +
  39.345 + %status
  39.346 +     foo_usable="no"
  39.347 +     if [ ".`grep '<<PASSWORD>>' ${foo_cfgfile}`" = . ]; then
  39.348 +         foo_usable="yes"
  39.349 +     fi
  39.350 +     foo_active="no"
  39.351 +     if [ -f ${foo_pidfile} ]; then
  39.352 +         foo_signal 0
  39.353 +         if [ $? -eq 0 ]; then
  39.354 +             foo_active="yes"
  39.355 +         fi
  39.356 +     fi
  39.357 +     echo "foo_enable=${foo_enable}"
  39.358 +     echo "foo_usable=${foo_usable}"
  39.359 +     echo "foo_active=${foo_active}"
  39.360 +
  39.361 + %start
  39.362 +     rcService foo enable yes || exit 0
  39.363 +     rcService foo active yes && exit 0
  39.364 +     @l_prefix@/sbin/foo --listen ${foo_listen}
  39.365 +
  39.366 + %stop
  39.367 +     rcService foo enable yes || exit 0
  39.368 +     rcService foo active yes || exit 0
  39.369 +     foo_signal TERM
  39.370 +
  39.371 + %restart
  39.372 +     rcService foo enable yes || exit 0
  39.373 +     rcService foo active yes || exit 0
  39.374 +     rc foo stop start
  39.375 +
  39.376 + %daily
  39.377 +     rcService foo enable yes || exit 0
  39.378 +     shtool rotate -f \
  39.379 +         -n ${foo_log_numfiles} -s ${foo_log_minsize} -d \
  39.380 +         -z ${foo_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
  39.381 +         -P "${foo_log_prolog}" -E "${foo_log_epilog}" \
  39.382 +         ${foo_logfile}
  39.383 +
  39.384 + %env
  39.385 +     if rcService foo enable yes; then
  39.386 +         FOO_HOME="$foo_homedir"
  39.387 +         export FOO_HOME
  39.388 +     fi
  39.389 +
  39.390 +Now, show all run-command configuration variables, their
  39.391 +default values and their effective values of package "C<foo>":
  39.392 +
  39.393 + $ @l_prefix@/bin/openpkg rc --config | grep "^foo_"
  39.394 +
  39.395 +Override the default value of a run-command configuration
  39.396 +variable C<foo_listen>:
  39.397 +
  39.398 + $ echo 'foo_listen="192.168.0.1"' >>@l_prefix@/bin/openpkg rc.conf
  39.399 +
  39.400 +Stop and start from scratch the package "C<foo>":
  39.401 +
  39.402 + $ @l_prefix@/bin/openpkg rc foo stop start
  39.403 +
  39.404 +Query the effective value of run-command configuration
  39.405 +variable C<foo_enable> in a script:
  39.406 +
  39.407 + if [ ".`@l_prefix@/bin/openpkg rc -q foo_enable`" = .yes ]; then ...
  39.408 +
  39.409 +Import all environment settings from all (including "C<foo>") installed
  39.410 +packages into the current Bourne-Shell environment:
  39.411 +
  39.412 + $ eval `@l_prefix@/bin/openpkg rc --eval all env`
  39.413 + $ echo $FOO_HOME
  39.414 +
  39.415 +=head1 SEE ALSO
  39.416 +
  39.417 +B<OpenPKG> http://www.openpkg.org/
  39.418 +
  39.419 +=head1 HISTORY
  39.420 +
  39.421 +The B<OpenPKG> run-command facility consisting of the scripts C<rc>
  39.422 +and C<rc.func> were originally invented in November 2000 by Ralf S.
  39.423 +Engelschall for B<OpenPKG>. They were completely worked off from scratch
  39.424 +in July 2003 for B<OpenPKG 1.3>.
  39.425 +
  39.426 +=head1 AUTHOR
  39.427 +
  39.428 + Ralf S. Engelschall
  39.429 + rse@engelschall.com
  39.430 + www.engelschall.com
  39.431 +
  39.432 +=cut
  39.433 +
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/openpkg/release.8	Tue Jan 06 23:40:39 2009 +0100
    40.3 @@ -0,0 +1,224 @@
    40.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    40.5 +.\"
    40.6 +.\" Standard preamble:
    40.7 +.\" ========================================================================
    40.8 +.de Sh \" Subsection heading
    40.9 +.br
   40.10 +.if t .Sp
   40.11 +.ne 5
   40.12 +.PP
   40.13 +\fB\\$1\fR
   40.14 +.PP
   40.15 +..
   40.16 +.de Sp \" Vertical space (when we can't use .PP)
   40.17 +.if t .sp .5v
   40.18 +.if n .sp
   40.19 +..
   40.20 +.de Vb \" Begin verbatim text
   40.21 +.ft CW
   40.22 +.nf
   40.23 +.ne \\$1
   40.24 +..
   40.25 +.de Ve \" End verbatim text
   40.26 +.ft R
   40.27 +.fi
   40.28 +..
   40.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   40.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   40.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   40.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   40.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   40.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   40.35 +.tr \(*W-|\(bv\*(Tr
   40.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   40.37 +.ie n \{\
   40.38 +.    ds -- \(*W-
   40.39 +.    ds PI pi
   40.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   40.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   40.42 +.    ds L" ""
   40.43 +.    ds R" ""
   40.44 +.    ds C` 
   40.45 +.    ds C' 
   40.46 +'br\}
   40.47 +.el\{\
   40.48 +.    ds -- \|\(em\|
   40.49 +.    ds PI \(*p
   40.50 +.    ds L" ``
   40.51 +.    ds R" ''
   40.52 +'br\}
   40.53 +.\"
   40.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   40.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   40.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   40.57 +.\" output yourself in some meaningful fashion.
   40.58 +.if \nF \{\
   40.59 +.    de IX
   40.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   40.61 +..
   40.62 +.    nr % 0
   40.63 +.    rr F
   40.64 +.\}
   40.65 +.\"
   40.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   40.67 +.\" way too many mistakes in technical documents.
   40.68 +.hy 0
   40.69 +.if n .na
   40.70 +.\"
   40.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   40.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   40.73 +.    \" fudge factors for nroff and troff
   40.74 +.if n \{\
   40.75 +.    ds #H 0
   40.76 +.    ds #V .8m
   40.77 +.    ds #F .3m
   40.78 +.    ds #[ \f1
   40.79 +.    ds #] \fP
   40.80 +.\}
   40.81 +.if t \{\
   40.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   40.83 +.    ds #V .6m
   40.84 +.    ds #F 0
   40.85 +.    ds #[ \&
   40.86 +.    ds #] \&
   40.87 +.\}
   40.88 +.    \" simple accents for nroff and troff
   40.89 +.if n \{\
   40.90 +.    ds ' \&
   40.91 +.    ds ` \&
   40.92 +.    ds ^ \&
   40.93 +.    ds , \&
   40.94 +.    ds ~ ~
   40.95 +.    ds /
   40.96 +.\}
   40.97 +.if t \{\
   40.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   40.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  40.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  40.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  40.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  40.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  40.104 +.\}
  40.105 +.    \" troff and (daisy-wheel) nroff accents
  40.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  40.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  40.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  40.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  40.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  40.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  40.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  40.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  40.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  40.115 +.    \" corrections for vroff
  40.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  40.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  40.118 +.    \" for low resolution devices (crt and lpr)
  40.119 +.if \n(.H>23 .if \n(.V>19 \
  40.120 +\{\
  40.121 +.    ds : e
  40.122 +.    ds 8 ss
  40.123 +.    ds o a
  40.124 +.    ds d- d\h'-1'\(ga
  40.125 +.    ds D- D\h'-1'\(hy
  40.126 +.    ds th \o'bp'
  40.127 +.    ds Th \o'LP'
  40.128 +.    ds ae ae
  40.129 +.    ds Ae AE
  40.130 +.\}
  40.131 +.rm #[ #] #H #V #F C
  40.132 +.\" ========================================================================
  40.133 +.\"
  40.134 +.IX Title "RELEASE 8"
  40.135 +.TH RELEASE 8 "OpenPKG" "RELEASE(8)" "OpenPKG"
  40.136 +.SH "NAME"
  40.137 +\&\fBopenpkg release\fR \- OpenPKG Release Utility
  40.138 +.SH "SYNOPSIS"
  40.139 +.IX Header "SYNOPSIS"
  40.140 +\&\fBopenpkg release\fR [\fB\-F\fR|\fB\-\-fmt\fR \fIformat\fR]
  40.141 +.SH "DESCRIPTION"
  40.142 +.IX Header "DESCRIPTION"
  40.143 +The \fBopenpkg release\fR command displays the OpenPKG release tag and
  40.144 +distribution \s-1URL\s0. The release tag uniquely identifies an OpenPKG
  40.145 +distribution and the distribution \s-1URL\s0 is the location where the
  40.146 +distribution packages and indices are stored.
  40.147 +.SH "OPTIONS"
  40.148 +.IX Header "OPTIONS"
  40.149 +.IP "\fB\-F\fR, \fB\-\-fmt\fR \fIformat\fR" 4
  40.150 +.IX Item "-F, --fmt format"
  40.151 +The output format specification. The argument \fIformat\fR is an arbitrary
  40.152 +string which can contain the special expansion constructs "\f(CW%t\fR\*(L" for
  40.153 +expanding the release tag, \*(R"\f(CW%u\fR\*(L" for expanding the distribution \s-1URL\s0
  40.154 +and \*(R"\f(CW\*(C`\en\*(C'\fR" for expanding an embedded newline character. 
  40.155 +The instance \s-1UUID\s0 information is also availble by expanding
  40.156 +\&\f(CW%r\fR to \s-1UUID_REGISTRY\s0, \f(CW%i\fR to \s-1UUID_INSTANCE\s0, \f(CW%p\fR to \s-1UUID_PLATFORM\s0.
  40.157 +The default \fIformat\fR is "\f(CW\*(C`OpenPKG\-%t %u\*(C'\fR".
  40.158 +.IP "\fB\-r\fR, \fB\-\-release\fR \fIrelease\fR" 4
  40.159 +.IX Item "-r, --release release"
  40.160 +The package "\f(CW\*(C`Release\*(C'\fR" header value to use for deriving the release
  40.161 +tag. The values in the \fI@l_prefix@/etc/openpkg/release\fR file and the
  40.162 +"\f(CW\*(C`Release\*(C'\fR" header of the bootstrap package \fBopenpkg\fR are ignored if
  40.163 +this option is used.
  40.164 +.SH "FILES"
  40.165 +.IX Header "FILES"
  40.166 +.IP "\fI@l_prefix@/etc/openpkg/release\fR" 4
  40.167 +.IX Item "@l_prefix@/etc/openpkg/release"
  40.168 +This optional configuration file can be used to explicitly set values
  40.169 +for the OpenPKG release tag and distribution URLs. It consists of lines
  40.170 +with variable name/value pairs. The following configuration variables
  40.171 +are recognized:
  40.172 +.RS 4
  40.173 +.IP "\fBTAG=\fR\fItag\fR" 4
  40.174 +.IX Item "TAG=tag"
  40.175 +The default \fItag\fR is automatically derived from the "\f(CW\*(C`Version\*(C'\fR" header
  40.176 +of the OpenPKG bootstrap package \fBopenpkg\fR. One usually only sets this
  40.177 +explicitly to a value if a bootstrap package is used from a foreign
  40.178 +distribution version.
  40.179 +.IP "\fBURL=\fR\fIurl\fR" 4
  40.180 +.IX Item "URL=url"
  40.181 +The fully-qualified distribution \s-1URL\s0 based on either the "\f(CW\*(C`ftp\*(C'\fR\*(L",
  40.182 +\&\*(R"\f(CW\*(C`http\*(C'\fR\*(L" or \*(R"\f(CW\*(C`file\*(C'\fR" \s-1URL\s0 schemes. If \fIurl\fR contains a trailing
  40.183 +"\f(CW\*(C`/*\*(C'\fR", this is expanded according to the \fItag\fR value of the \fB\s-1TAG\s0\fR
  40.184 +variable and the corresponding filesystem layout on \f(CW\*(C`ftp.openpkg.org\*(C'\fR.
  40.185 +The default \fIurl\fR is "\f(CW\*(C`ftp://ftp.openpkg.org/*\*(C'\fR".
  40.186 +.RS 4
  40.187 +.RE
  40.188 +.RS 4
  40.189 +.SH "EXAMPLE"
  40.190 +.IX Header "EXAMPLE"
  40.191 +.Vb 2
  40.192 +\& $ openpkg release
  40.193 +\& OpenPKG-CURRENT ftp://ftp.openpkg.org/current/SRC/
  40.194 +.Ve
  40.195 +.Sp
  40.196 +.Vb 2
  40.197 +\& $ openpkg release --fmt=%t
  40.198 +\& CURRENT
  40.199 +.Ve
  40.200 +.Sp
  40.201 +.Vb 2
  40.202 +\& $ openpkg release --fmt=%u
  40.203 +\& ftp://ftp.openpkg.org/current/SRC/
  40.204 +.Ve
  40.205 +.Sp
  40.206 +.Vb 3
  40.207 +\& $ openpkg release --fmt="OpenPKG %t is located at:\e\en%u"
  40.208 +\& OpenPKG CURRENT is located at:
  40.209 +\& ftp://ftp.openpkg.org/current/SRC/
  40.210 +.Ve
  40.211 +.Sp
  40.212 +.Vb 2
  40.213 +\& $ openpkg release --release=2.5.4 --fmt=%t
  40.214 +\& 2.5-RELEASE
  40.215 +.Ve
  40.216 +.Sp
  40.217 +.Vb 3
  40.218 +\& $ cat /openpkg/etc/openpkg/release
  40.219 +\& TAG=2-STABLE-20060622
  40.220 +\& URL=ftp://ftp.example.com/mirror/openpkg.org/*
  40.221 +.Ve
  40.222 +.SH "SEE ALSO"
  40.223 +.IX Header "SEE ALSO"
  40.224 +\&\fIuuid\fR\|(8)
  40.225 +.SH "HISTORY"
  40.226 +.IX Header "HISTORY"
  40.227 +The \fBopenpkg release\fR command first appeared in \fBOpenPKG 2\-STABLE\-20060622\fR.
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/openpkg/release.pod	Tue Jan 06 23:40:39 2009 +0100
    41.3 @@ -0,0 +1,128 @@
    41.4 +##
    41.5 +##  release -- OpenPKG Release Utility
    41.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    41.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    41.8 +##
    41.9 +##  Permission to use, copy, modify, and distribute this software for
   41.10 +##  any purpose with or without fee is hereby granted, provided that
   41.11 +##  the above copyright notice and this permission notice appear in all
   41.12 +##  copies.
   41.13 +##
   41.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   41.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   41.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   41.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   41.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   41.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   41.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   41.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   41.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   41.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   41.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   41.25 +##  SUCH DAMAGE.
   41.26 +##
   41.27 +
   41.28 +=pod
   41.29 +
   41.30 +=head1 NAME
   41.31 +
   41.32 +B<openpkg release> - OpenPKG Release Utility
   41.33 +
   41.34 +=head1 SYNOPSIS
   41.35 +
   41.36 +B<openpkg release> [B<-F>|B<--fmt> I<format>]
   41.37 +
   41.38 +=head1 DESCRIPTION
   41.39 +
   41.40 +The B<openpkg release> command displays the OpenPKG release tag and
   41.41 +distribution URL. The release tag uniquely identifies an OpenPKG
   41.42 +distribution and the distribution URL is the location where the
   41.43 +distribution packages and indices are stored.
   41.44 +
   41.45 +=head1 OPTIONS
   41.46 +
   41.47 +=over 4
   41.48 +
   41.49 +=item B<-F>, B<--fmt> I<format>
   41.50 +
   41.51 +The output format specification. The argument I<format> is an arbitrary
   41.52 +string which can contain the special expansion constructs "C<%t>" for
   41.53 +expanding the release tag, "C<%u>" for expanding the distribution URL
   41.54 +and "C<\n>" for expanding an embedded newline character. 
   41.55 +The instance UUID information is also availble by expanding
   41.56 +C<%r> to UUID_REGISTRY, C<%i> to UUID_INSTANCE, C<%p> to UUID_PLATFORM.
   41.57 +The default I<format> is "C<OpenPKG-%t %u>".
   41.58 +
   41.59 +=item B<-r>, B<--release> I<release>
   41.60 +
   41.61 +The package "C<Release>" header value to use for deriving the release
   41.62 +tag. The values in the F<@l_prefix@/etc/openpkg/release> file and the
   41.63 +"C<Release>" header of the bootstrap package B<openpkg> are ignored if
   41.64 +this option is used.
   41.65 +
   41.66 +=back
   41.67 +
   41.68 +=head1 FILES
   41.69 +
   41.70 +=over 4
   41.71 +
   41.72 +=item F<@l_prefix@/etc/openpkg/release>
   41.73 +
   41.74 +This optional configuration file can be used to explicitly set values
   41.75 +for the OpenPKG release tag and distribution URLs. It consists of lines
   41.76 +with variable name/value pairs. The following configuration variables
   41.77 +are recognized:
   41.78 +
   41.79 +=over 4
   41.80 +
   41.81 +=item B<TAG=>I<tag>
   41.82 +
   41.83 +The default I<tag> is automatically derived from the "C<Version>" header
   41.84 +of the OpenPKG bootstrap package B<openpkg>. One usually only sets this
   41.85 +explicitly to a value if a bootstrap package is used from a foreign
   41.86 +distribution version.
   41.87 +
   41.88 +=item B<URL=>I<url>
   41.89 +
   41.90 +The fully-qualified distribution URL based on either the "C<ftp>",
   41.91 +"C<http>" or "C<file>" URL schemes. If I<url> contains a trailing
   41.92 +"C</*>", this is expanded according to the I<tag> value of the B<TAG>
   41.93 +variable and the corresponding filesystem layout on C<ftp.openpkg.org>.
   41.94 +The default I<url> is "C<ftp://ftp.openpkg.org/*>".
   41.95 +
   41.96 +=over
   41.97 +
   41.98 +=back
   41.99 +
  41.100 +=head1 EXAMPLE
  41.101 +
  41.102 + $ openpkg release
  41.103 + OpenPKG-CURRENT ftp://ftp.openpkg.org/current/SRC/
  41.104 +
  41.105 + $ openpkg release --fmt=%t
  41.106 + CURRENT
  41.107 +
  41.108 + $ openpkg release --fmt=%u
  41.109 + ftp://ftp.openpkg.org/current/SRC/
  41.110 +
  41.111 + $ openpkg release --fmt="OpenPKG %t is located at:\\n%u"
  41.112 + OpenPKG CURRENT is located at:
  41.113 + ftp://ftp.openpkg.org/current/SRC/
  41.114 +
  41.115 + $ openpkg release --release=2.5.4 --fmt=%t
  41.116 + 2.5-RELEASE
  41.117 +
  41.118 + $ cat /openpkg/etc/openpkg/release
  41.119 + TAG=2-STABLE-20060622
  41.120 + URL=ftp://ftp.example.com/mirror/openpkg.org/*
  41.121 +
  41.122 +=head1 SEE ALSO
  41.123 +
  41.124 +uuid(8)
  41.125 +
  41.126 +=head1 HISTORY
  41.127 +
  41.128 +The B<openpkg release> command first appeared in B<OpenPKG 2-STABLE-20060622>.
  41.129 +
  41.130 +=cut
  41.131 +
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/openpkg/release.sh	Tue Jan 06 23:40:39 2009 +0100
    42.3 @@ -0,0 +1,147 @@
    42.4 +#!@l_prefix@/lib/openpkg/bash
    42.5 +##
    42.6 +##  release -- OpenPKG Release Determination Utility
    42.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    42.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    42.9 +##
   42.10 +##  Permission to use, copy, modify, and distribute this software for
   42.11 +##  any purpose with or without fee is hereby granted, provided that
   42.12 +##  the above copyright notice and this permission notice appear in all
   42.13 +##  copies.
   42.14 +##
   42.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   42.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   42.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   42.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   42.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   42.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   42.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   42.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   42.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   42.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   42.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   42.26 +##  SUCH DAMAGE.
   42.27 +##
   42.28 +
   42.29 +#   configuration
   42.30 +prefix="@l_prefix@"
   42.31 +
   42.32 +#   minimum command line parsing
   42.33 +opt_F="OpenPKG-%t %u"
   42.34 +opt_r=""
   42.35 +while [ $# -gt 0 ]; do
   42.36 +    case "$1" in
   42.37 +        -F          ) opt_F="$2"; shift;                      shift ;;
   42.38 +        --fmt       ) opt_F="$2"; shift;                      shift ;;
   42.39 +        -F*         ) opt_F="`expr ".$1" : '.-F\(.*\)'`";     shift ;;
   42.40 +        --fmt=*     ) opt_F="`expr ".$1" : '.--fmt=\(.*\)'`"; shift ;;
   42.41 +        -r          ) opt_r="$2"; shift;                      shift ;;
   42.42 +        --release   ) opt_r="$2"; shift;                      shift ;;
   42.43 +        -r*         ) opt_r="`expr ".$1" : '.-r\(.*\)'`";     shift ;;
   42.44 +        --release=* ) opt_r="`expr ".$1" : '.--release=\(.*\)'`"; shift ;;
   42.45 +        *       ) break ;;
   42.46 +    esac
   42.47 +done
   42.48 +
   42.49 +#   translate a release number to a release tag
   42.50 +number_to_tag () {
   42.51 +    sed -e 's;^;X;' \
   42.52 +        -e 's;^X\([^.-][^.-]*\.[^.-][^.-]*\)\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].*$;\1-SOLID;' \
   42.53 +        -e 's;^X\([^.-][^.-]*\.[^.-][^.-]*\)\.[^.-][^.-]*.*$;\1-RELEASE;' \
   42.54 +        -e 's;^X\([^.-][^.-]*\)\.[^.-][^.-]*.*$;\1-STABLE;' \
   42.55 +        -e 's;^X[^.-][^.-]*.*$;CURRENT;' \
   42.56 +        -e 's;^X.*$;UNKNOWN;'
   42.57 +}
   42.58 +
   42.59 +#   sanity check a release tag
   42.60 +tag_sanity () {
   42.61 +    sed -e 's;^;X;' \
   42.62 +        -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-RELEASE$;OK;' \
   42.63 +        -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-SOLID-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
   42.64 +        -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-SOLID$;OK;' \
   42.65 +        -e 's;^X[^.-][^.-]*-STABLE-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
   42.66 +        -e 's;^X[^.-][^.-]*-STABLE$;OK;' \
   42.67 +        -e 's;^XCURRENT-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
   42.68 +        -e 's;^XCURRENT$;OK;' \
   42.69 +        -e 's;^X.*$;ERROR;'
   42.70 +}
   42.71 +
   42.72 +#   determine release
   42.73 +tag=""
   42.74 +if [ ".$opt_r" != . ]; then
   42.75 +    tag=`echo ".$opt_r" | sed -e 's;^\.;;' | number_to_tag`
   42.76 +elif [ -f "$prefix/etc/openpkg/release" ]; then
   42.77 +    tag=`(cat $prefix/etc/openpkg/release; echo "") | sed \
   42.78 +        -e 's;^;X;' \
   42.79 +        -e 's;^X *TAG *= *\([^ ][^ ]*\).*;\1;' \
   42.80 +        -e '/^X/d' | \
   42.81 +        sed -n -e '$p'`
   42.82 +else
   42.83 +    tag=`$prefix/bin/openpkg rpm \
   42.84 +        -q --qf '%{VERSION}\n' openpkg | number_to_tag`
   42.85 +fi
   42.86 +if [ .`echo ".$tag" | sed -e 's;^\.;;' | tag_sanity` = .ERROR ]; then
   42.87 +    echo "openpkg:release: WARNING: unable to determine OpenPKG release tag" 1>&2
   42.88 +    tag="UNKNOWN"
   42.89 +fi
   42.90 +
   42.91 +#   determine distribution URL
   42.92 +url=""
   42.93 +if [ -f "$prefix/etc/openpkg/release" ]; then
   42.94 +    url=`(cat $prefix/etc/openpkg/release; echo "") | sed \
   42.95 +        -e 's;^;X;' \
   42.96 +        -e 's;^X *URL *= *\([^ ][^ ]*\).*;\1;' \
   42.97 +        -e '/^X/d' | \
   42.98 +        sed -n -e '$p'`
   42.99 +fi
  42.100 +if [ ".$url" = . ]; then
  42.101 +    url="ftp://ftp.openpkg.org/*"
  42.102 +fi
  42.103 +case ".$url" in
  42.104 +    */\* )
  42.105 +        url=`echo ".$url" | sed -e 's;^\.;;' -e 's;/\*$;;'`
  42.106 +        case "$tag" in
  42.107 +            CURRENT )
  42.108 +                url="$url/current/SRC/"
  42.109 +                ;;
  42.110 +            CURRENT-* )
  42.111 +                version=`echo "$tag" | sed -e 's;^CURRENT-;;'`
  42.112 +                url="$url/current/$version/"
  42.113 +                ;;
  42.114 +            *-STABLE )
  42.115 +                version=`echo "$tag" | sed -e 's;^\(.*\)-STABLE$;\1;'`
  42.116 +                url="$url/stable/$version/"
  42.117 +                ;;
  42.118 +            *-STABLE-* )
  42.119 +                version=`echo "$tag" | sed -e 's;^\(.*\)-STABLE-\(.*\)$;\1.\2;'`
  42.120 +                url="$url/stable/$version/"
  42.121 +                ;;
  42.122 +            *-SOLID )
  42.123 +                version=`echo "$tag" | sed -e 's;^\(.*\)-SOLID$;\1;'`
  42.124 +                url="$url/solid/$version/"
  42.125 +                ;;
  42.126 +            *-SOLID-* )
  42.127 +                version=`echo "$tag" | sed -e 's;^\(.*\)-SOLID-\(.*\)$;\1.\2;'`
  42.128 +                url="$url/solid/$version/"
  42.129 +                ;;
  42.130 +            *-RELEASE )
  42.131 +                version=`echo "$tag" | sed -e 's;^\(.*\)-RELEASE$;\1;'`
  42.132 +                url="$url/release/$version/"
  42.133 +                ;;
  42.134 +        esac
  42.135 +        ;;
  42.136 +esac
  42.137 +
  42.138 +#   read uuid
  42.139 +[ -f "$prefix/etc/openpkg/uuid" ] && . "$prefix/etc/openpkg/uuid"
  42.140 +
  42.141 +#   generate output
  42.142 +echo "X$opt_F" |\
  42.143 +sed -e 's/^X//' \
  42.144 +    -e "s;%t;${tag};g" \
  42.145 +    -e "s;%u;${url};g" \
  42.146 +    -e "s;%r;${UUID_REGISTRY};g" \
  42.147 +    -e "s;%i;${UUID_INSTANCE};g" \
  42.148 +    -e "s;%p;${UUID_PLATFORM};g" \
  42.149 +    -e 's/\\n/^/g' | tr '^' '\012'
  42.150 +
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/openpkg/root.README	Tue Jan 06 23:40:39 2009 +0100
    43.3 @@ -0,0 +1,24 @@
    43.4 +
    43.5 +  This is @l_prefix@, an RPM-based OpenPKG software package hierarchy.
    43.6 +  This filesystem area contains software which was automatically
    43.7 +  installed through OpenPKG RPM packages from http://www.openpkg.org/.
    43.8 +
    43.9 +  Short OpenPKG RPM query command summary:
   43.10 +
   43.11 +  $ @l_prefix@/bin/openpkg rpm -qa
   43.12 +    (q)uery list of (a)ll installed packages
   43.13 +
   43.14 +  $ @l_prefix@/bin/openpkg rpm -qi <name>
   43.15 +    (q)uery (i)nformation about package <name>
   43.16 +
   43.17 +  $ @l_prefix@/bin/openpkg rpm -qlv <name>
   43.18 +    (q)uery (v)erbose (l)ist of installed files of package <name>
   43.19 +
   43.20 +  Use "eval `@l_prefix@/bin/openpkg rc --eval all env`" from within a
   43.21 +  user's Bourne (Again) Shell startup script (.profile or .bashrc) in
   43.22 +  order to activate this hierarchy and all of its packages.
   43.23 +
   43.24 +  In case of any questions or problems post to the OpenPKG project
   43.25 +  user support mailing list <openpkg-users@openpkg.org>. For more
   43.26 +  details about OpenPKG visit http://www.openpkg.org/.
   43.27 +
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/openpkg/rpm-config.8	Tue Jan 06 23:40:39 2009 +0100
    44.3 @@ -0,0 +1,220 @@
    44.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    44.5 +.\"
    44.6 +.\" Standard preamble:
    44.7 +.\" ========================================================================
    44.8 +.de Sh \" Subsection heading
    44.9 +.br
   44.10 +.if t .Sp
   44.11 +.ne 5
   44.12 +.PP
   44.13 +\fB\\$1\fR
   44.14 +.PP
   44.15 +..
   44.16 +.de Sp \" Vertical space (when we can't use .PP)
   44.17 +.if t .sp .5v
   44.18 +.if n .sp
   44.19 +..
   44.20 +.de Vb \" Begin verbatim text
   44.21 +.ft CW
   44.22 +.nf
   44.23 +.ne \\$1
   44.24 +..
   44.25 +.de Ve \" End verbatim text
   44.26 +.ft R
   44.27 +.fi
   44.28 +..
   44.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   44.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   44.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   44.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   44.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   44.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   44.35 +.tr \(*W-|\(bv\*(Tr
   44.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   44.37 +.ie n \{\
   44.38 +.    ds -- \(*W-
   44.39 +.    ds PI pi
   44.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   44.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   44.42 +.    ds L" ""
   44.43 +.    ds R" ""
   44.44 +.    ds C` 
   44.45 +.    ds C' 
   44.46 +'br\}
   44.47 +.el\{\
   44.48 +.    ds -- \|\(em\|
   44.49 +.    ds PI \(*p
   44.50 +.    ds L" ``
   44.51 +.    ds R" ''
   44.52 +'br\}
   44.53 +.\"
   44.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   44.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   44.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   44.57 +.\" output yourself in some meaningful fashion.
   44.58 +.if \nF \{\
   44.59 +.    de IX
   44.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   44.61 +..
   44.62 +.    nr % 0
   44.63 +.    rr F
   44.64 +.\}
   44.65 +.\"
   44.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   44.67 +.\" way too many mistakes in technical documents.
   44.68 +.hy 0
   44.69 +.if n .na
   44.70 +.\"
   44.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   44.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   44.73 +.    \" fudge factors for nroff and troff
   44.74 +.if n \{\
   44.75 +.    ds #H 0
   44.76 +.    ds #V .8m
   44.77 +.    ds #F .3m
   44.78 +.    ds #[ \f1
   44.79 +.    ds #] \fP
   44.80 +.\}
   44.81 +.if t \{\
   44.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   44.83 +.    ds #V .6m
   44.84 +.    ds #F 0
   44.85 +.    ds #[ \&
   44.86 +.    ds #] \&
   44.87 +.\}
   44.88 +.    \" simple accents for nroff and troff
   44.89 +.if n \{\
   44.90 +.    ds ' \&
   44.91 +.    ds ` \&
   44.92 +.    ds ^ \&
   44.93 +.    ds , \&
   44.94 +.    ds ~ ~
   44.95 +.    ds /
   44.96 +.\}
   44.97 +.if t \{\
   44.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   44.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  44.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  44.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  44.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  44.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  44.104 +.\}
  44.105 +.    \" troff and (daisy-wheel) nroff accents
  44.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  44.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  44.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  44.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  44.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  44.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  44.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  44.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  44.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  44.115 +.    \" corrections for vroff
  44.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  44.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  44.118 +.    \" for low resolution devices (crt and lpr)
  44.119 +.if \n(.H>23 .if \n(.V>19 \
  44.120 +\{\
  44.121 +.    ds : e
  44.122 +.    ds 8 ss
  44.123 +.    ds o a
  44.124 +.    ds d- d\h'-1'\(ga
  44.125 +.    ds D- D\h'-1'\(hy
  44.126 +.    ds th \o'bp'
  44.127 +.    ds Th \o'LP'
  44.128 +.    ds ae ae
  44.129 +.    ds Ae AE
  44.130 +.\}
  44.131 +.rm #[ #] #H #V #F C
  44.132 +.\" ========================================================================
  44.133 +.\"
  44.134 +.IX Title "RPM-CONFIG 8"
  44.135 +.TH RPM-CONFIG 8 "OpenPKG" "RPM-CONFIG(8)" "OpenPKG"
  44.136 +.SH "NAME"
  44.137 +\&\fBrpm\-config\fR \- OpenPKG RPM library build utility
  44.138 +.SH "VERSION"
  44.139 +.IX Header "VERSION"
  44.140 +OpenPKG \s-1RPM\s0 \s-1RPM_VERSION\s0
  44.141 +.SH "SYNOPSIS"
  44.142 +.IX Header "SYNOPSIS"
  44.143 +\&\fBrpm-config\fR
  44.144 +[\fB\-\-help\fR]
  44.145 +[\fB\-\-version\fR]
  44.146 +[\fB\-\-cc\fR]
  44.147 +[\fB\-\-cppflags\fR]
  44.148 +[\fB\-\-cflags\fR]
  44.149 +[\fB\-\-ldflags\fR]
  44.150 +[\fB\-\-libs\fR]
  44.151 +.SH "DESCRIPTION"
  44.152 +.IX Header "DESCRIPTION"
  44.153 +The \fBrpm-config\fR program is a little helper utility for easy
  44.154 +configuring and building applications based on the OpenPKG \s-1RPM\s0 library.
  44.155 +It can be used to query the C compiler and linker flags which are
  44.156 +required to correctly compile and link the application against the
  44.157 +\&\s-1RPM\s0 library.
  44.158 +.SH "OPTIONS"
  44.159 +.IX Header "OPTIONS"
  44.160 +\&\fBrpm-config\fR accepts the following options:
  44.161 +.IP "\fB\-\-help\fR" 4
  44.162 +.IX Item "--help"
  44.163 +Prints the short usage information.
  44.164 +.IP "\fB\-\-version\fR" 4
  44.165 +.IX Item "--version"
  44.166 +Prints the version number and date of the installed \s-1RPM\s0 library.
  44.167 +.IP "\fB\-\-cc\fR" 4
  44.168 +.IX Item "--cc"
  44.169 +.PD 0
  44.170 +.IP "\fB\-\-cppflags\fR" 4
  44.171 +.IX Item "--cppflags"
  44.172 +.PD
  44.173 +Prints the C pre-processor flags (\f(CW\*(C`\-I\*(C'\fR) which are needed to compile the
  44.174 +RPM-based application. The output is usually added to the \f(CW\*(C`CPPFLAGS\*(C'\fR
  44.175 +variable of the applications \f(CW\*(C`Makefile\*(C'\fR.
  44.176 +.IP "\fB\-\-cflags\fR" 4
  44.177 +.IX Item "--cflags"
  44.178 +Prints the C compiler flags which are needed to compile the RPM-based
  44.179 +application. The output is usually added to the \f(CW\*(C`CFLAGS\*(C'\fR variable of the
  44.180 +applications \f(CW\*(C`Makefile\*(C'\fR.
  44.181 +.IP "\fB\-\-ldflags\fR" 4
  44.182 +.IX Item "--ldflags"
  44.183 +Prints the linker flags (\f(CW\*(C`\-L\*(C'\fR) which are needed to link the application with
  44.184 +the \s-1RPM\s0 library. The output is usually added to the \f(CW\*(C`LDFLAGS\*(C'\fR variable of
  44.185 +the applications \f(CW\*(C`Makefile\*(C'\fR.
  44.186 +.IP "\fB\-\-libs\fR" 4
  44.187 +.IX Item "--libs"
  44.188 +Prints the library flags (\f(CW\*(C`\-l\*(C'\fR) which are needed to link the application with
  44.189 +the \s-1RPM\s0 library. The output is usually added to the \f(CW\*(C`LIBS\*(C'\fR variable of the
  44.190 +applications \f(CW\*(C`Makefile\*(C'\fR.
  44.191 +.SH "EXAMPLE"
  44.192 +.IX Header "EXAMPLE"
  44.193 +.Vb 5
  44.194 +\& CC       = `rpm-config --cc`
  44.195 +\& CPPFLAGS = `rpm-config --cppflags`
  44.196 +\& CFLAGS   = `rpm-config --cflags`
  44.197 +\& LDFLAGS  = `rpm-config --ldflags`
  44.198 +\& LIBS     = `rpm-config --libs`
  44.199 +.Ve
  44.200 +.PP
  44.201 +.Vb 1
  44.202 +\& all: foo
  44.203 +.Ve
  44.204 +.PP
  44.205 +.Vb 2
  44.206 +\& foo: foo.o
  44.207 +\&     $(CC) $(LDFLAGS) -o foo foo.o $(LIBS)
  44.208 +.Ve
  44.209 +.PP
  44.210 +.Vb 2
  44.211 +\& foo.o: foo.c
  44.212 +\&     $(CC) $(CPPFLAGS) $(CFLAGS) -o foo.o -c foo.c
  44.213 +.Ve
  44.214 +.SH "SEE ALSO"
  44.215 +.IX Header "SEE ALSO"
  44.216 +\&\fIrpm\fR\|(1), \fIcc\fR\|(1).
  44.217 +.SH "AUTHOR"
  44.218 +.IX Header "AUTHOR"
  44.219 +.Vb 3
  44.220 +\& Ralf S. Engelschall
  44.221 +\& rse@engelschall.com
  44.222 +\& www.engelschall.com
  44.223 +.Ve
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/openpkg/rpm-config.pod	Tue Jan 06 23:40:39 2009 +0100
    45.3 @@ -0,0 +1,125 @@
    45.4 +##
    45.5 +##  rpm-config -- OpenPKG RPM Library Build Utility
    45.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    45.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    45.8 +##
    45.9 +##  Permission to use, copy, modify, and distribute this software for
   45.10 +##  any purpose with or without fee is hereby granted, provided that
   45.11 +##  the above copyright notice and this permission notice appear in all
   45.12 +##  copies.
   45.13 +##
   45.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   45.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   45.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   45.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   45.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   45.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   45.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   45.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   45.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   45.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   45.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   45.25 +##  SUCH DAMAGE.
   45.26 +##
   45.27 +##  rpm-config.pod: manual page
   45.28 +##
   45.29 +
   45.30 +=pod
   45.31 +
   45.32 +=head1 NAME
   45.33 +
   45.34 +B<rpm-config> - OpenPKG RPM library build utility
   45.35 +
   45.36 +=head1 VERSION
   45.37 +
   45.38 +OpenPKG RPM RPM_VERSION
   45.39 +
   45.40 +=head1 SYNOPSIS
   45.41 +
   45.42 +B<rpm-config>
   45.43 +[B<--help>]
   45.44 +[B<--version>]
   45.45 +[B<--cc>]
   45.46 +[B<--cppflags>]
   45.47 +[B<--cflags>]
   45.48 +[B<--ldflags>]
   45.49 +[B<--libs>]
   45.50 +
   45.51 +=head1 DESCRIPTION
   45.52 +
   45.53 +The B<rpm-config> program is a little helper utility for easy
   45.54 +configuring and building applications based on the OpenPKG RPM library.
   45.55 +It can be used to query the C compiler and linker flags which are
   45.56 +required to correctly compile and link the application against the
   45.57 +RPM library.
   45.58 +
   45.59 +=head1 OPTIONS
   45.60 +
   45.61 +B<rpm-config> accepts the following options:
   45.62 +
   45.63 +=over 4
   45.64 +
   45.65 +=item B<--help>
   45.66 +
   45.67 +Prints the short usage information.
   45.68 +
   45.69 +=item B<--version>
   45.70 +
   45.71 +Prints the version number and date of the installed RPM library.
   45.72 +
   45.73 +=item B<--cc>
   45.74 +
   45.75 +=item B<--cppflags>
   45.76 +
   45.77 +Prints the C pre-processor flags (C<-I>) which are needed to compile the
   45.78 +RPM-based application. The output is usually added to the C<CPPFLAGS>
   45.79 +variable of the applications C<Makefile>.
   45.80 +
   45.81 +=item B<--cflags>
   45.82 +
   45.83 +Prints the C compiler flags which are needed to compile the RPM-based
   45.84 +application. The output is usually added to the C<CFLAGS> variable of the
   45.85 +applications C<Makefile>.
   45.86 +
   45.87 +=item B<--ldflags>
   45.88 +
   45.89 +Prints the linker flags (C<-L>) which are needed to link the application with
   45.90 +the RPM library. The output is usually added to the C<LDFLAGS> variable of
   45.91 +the applications C<Makefile>.
   45.92 +
   45.93 +=item B<--libs>
   45.94 +
   45.95 +Prints the library flags (C<-l>) which are needed to link the application with
   45.96 +the RPM library. The output is usually added to the C<LIBS> variable of the
   45.97 +applications C<Makefile>.
   45.98 +
   45.99 +=back
  45.100 +
  45.101 +=head1 EXAMPLE
  45.102 +
  45.103 + CC       = `rpm-config --cc`
  45.104 + CPPFLAGS = `rpm-config --cppflags`
  45.105 + CFLAGS   = `rpm-config --cflags`
  45.106 + LDFLAGS  = `rpm-config --ldflags`
  45.107 + LIBS     = `rpm-config --libs`
  45.108 +
  45.109 + all: foo
  45.110 +
  45.111 + foo: foo.o
  45.112 +     $(CC) $(LDFLAGS) -o foo foo.o $(LIBS)
  45.113 +
  45.114 + foo.o: foo.c
  45.115 +     $(CC) $(CPPFLAGS) $(CFLAGS) -o foo.o -c foo.c
  45.116 +
  45.117 +=head1 SEE ALSO
  45.118 +
  45.119 +rpm(1), cc(1).
  45.120 +
  45.121 +=head1 AUTHOR
  45.122 +
  45.123 + Ralf S. Engelschall
  45.124 + rse@engelschall.com
  45.125 + www.engelschall.com
  45.126 +
  45.127 +=cut
  45.128 +
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/openpkg/rpm-config.sh	Tue Jan 06 23:40:39 2009 +0100
    46.3 @@ -0,0 +1,96 @@
    46.4 +#!/bin/sh
    46.5 +##
    46.6 +##  rpm-config -- OpenPKG RPM Library Build Utility
    46.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    46.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    46.9 +##
   46.10 +##  Permission to use, copy, modify, and distribute this software for
   46.11 +##  any purpose with or without fee is hereby granted, provided that
   46.12 +##  the above copyright notice and this permission notice appear in all
   46.13 +##  copies.
   46.14 +##
   46.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   46.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   46.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   46.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   46.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   46.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   46.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   46.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   46.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   46.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   46.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   46.26 +##  SUCH DAMAGE.
   46.27 +##
   46.28 +##  rpm-config.sh: program
   46.29 +##
   46.30 +
   46.31 +rpm_version="@l_version@"
   46.32 +rpm_cc="@l_cc@"
   46.33 +rpm_cppflags="@l_cppflags@"
   46.34 +rpm_cflags="@l_cflags@"
   46.35 +rpm_ldflags="@l_ldflags@"
   46.36 +rpm_libs="@l_libs@"
   46.37 +
   46.38 +usage="rpm-config"
   46.39 +usage="$usage [--cc] [--cppflags] [--cflags] [--ldflags] [--libs]"
   46.40 +usage="$usage [--help] [--version]"
   46.41 +if [ $# -eq 0 ]; then
   46.42 +    echo "rpm-config:Error: Invalid option" 1>&2
   46.43 +    echo "rpm-config:Usage: $usage" 1>&2
   46.44 +    exit 1
   46.45 +fi
   46.46 +
   46.47 +output=''
   46.48 +prev=''
   46.49 +for option
   46.50 +do
   46.51 +    if [ ".$prev" != . ]; then
   46.52 +        eval "$prev=\$option"
   46.53 +        prev=''
   46.54 +        continue
   46.55 +    fi
   46.56 +    case "$option" in
   46.57 +        -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
   46.58 +           *) optarg='' ;;
   46.59 +    esac
   46.60 +    case "$option" in
   46.61 +        --help|-h)
   46.62 +            echo "Usage: $usage"
   46.63 +            exit 0
   46.64 +            ;;
   46.65 +        --version|-v)
   46.66 +            echo "OpenPKG RPM $rpm_version"
   46.67 +            exit 0
   46.68 +            ;;
   46.69 +        --cc)
   46.70 +            output="$output $rpm_cc"
   46.71 +            ;;
   46.72 +        --cppflags)
   46.73 +            output="$output $rpm_cppflags"
   46.74 +            ;;
   46.75 +        --cflags)
   46.76 +            output="$output $rpm_cflags"
   46.77 +            ;;
   46.78 +        --ldflags)
   46.79 +            output="$output $rpm_ldflags"
   46.80 +            ;;
   46.81 +        --libs)
   46.82 +            output="$output $rpm_libs"
   46.83 +            ;;
   46.84 +        * )
   46.85 +            echo "rpm-config:Error: Invalid option" 1>&2
   46.86 +            echo "rpm-config:Usage: $usage" 1>&2
   46.87 +            exit 1;
   46.88 +            ;;
   46.89 +    esac
   46.90 +done
   46.91 +if [ ".$prev" != . ]; then
   46.92 +    echo "rpm-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
   46.93 +    exit 1
   46.94 +fi
   46.95 +
   46.96 +if [ ".$output" != . ]; then
   46.97 +    echo "$output" | sed -e 's/^ *//' -e 's/ *$//'
   46.98 +fi
   46.99 +
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/openpkg/rpm.patch.bugfix	Tue Jan 06 23:40:39 2009 +0100
    47.3 @@ -0,0 +1,369 @@
    47.4 +##
    47.5 +##  rpm.patch.bugfix -- Annotated OpenPKG RPM Patch file
    47.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    47.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    47.8 +##
    47.9 +##  This file assembles changes to existing RPM source files between
   47.10 +##  the original RedHat RPM and the OpenPKG RPM variant. It can be
   47.11 +##  automatically applied to a vanilla RedHat RPM source tree with the
   47.12 +##  'patch' tool to upgrade those files. Each patch snippet is annotated
   47.13 +##  with a short description.
   47.14 +##
   47.15 +##  Created on: 13-Sep-2006
   47.16 +##
   47.17 +##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
   47.18 +##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
   47.19 +##
   47.20 +
   47.21 ++---------------------------------------------------------------------------
   47.22 +| %setup and %patch macros are treated very special internally, but
   47.23 +| make sure they at least optically can be used like any other macro
   47.24 +| and especially can have leading whitespaces.
   47.25 ++---------------------------------------------------------------------------
   47.26 +Index: build/parsePrep.c
   47.27 +--- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
   47.28 ++++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
   47.29 +@@ -584,12 +635,15 @@
   47.30 +     saveLines = splitString(getStringBuf(sb), strlen(getStringBuf(sb)), '\n');
   47.31 +     /*@-usereleased@*/
   47.32 +     for (lines = saveLines; *lines; lines++) {
   47.33 ++        char *cp;
   47.34 ++        for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++)
   47.35 ++            ;
   47.36 + 	res = 0;
   47.37 + /*@-boundsread@*/
   47.38 +-	if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
   47.39 +-	    res = doSetupMacro(spec, *lines);
   47.40 +-	} else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) {
   47.41 +-	    res = doPatchMacro(spec, *lines);
   47.42 ++	if (! strncmp(cp, "%setup", sizeof("%setup")-1)) {
   47.43 ++	    res = doSetupMacro(spec, cp);
   47.44 ++	} else if (! strncmp(cp, "%patch", sizeof("%patch")-1)) {
   47.45 ++	    res = doPatchMacro(spec, cp);
   47.46 + 	} else {
   47.47 + 	    appendLineStringBuf(spec->prep, *lines);
   47.48 + 	}
   47.49 +
   47.50 ++---------------------------------------------------------------------------
   47.51 +| Do not pick of the vendor BeeCrypt package on RedHat Linux.
   47.52 ++---------------------------------------------------------------------------
   47.53 +Index: configure.ac
   47.54 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   47.55 ++++ configure.ac	13 Sep 2006 13:38:23 -0000
   47.56 +@@ -416,7 +417,7 @@
   47.57 + AC_CHECK_HEADER([beecrypt/beecrypt.h], [
   47.58 + 	AC_CHECK_LIB(beecrypt, mpfprintln, [
   47.59 + 	    AC_DEFINE(HAVE_LIBBEECRYPT, 1, [Define to 1 if you have the `beecrypt' library (-lbeecrypt).])
   47.60 +-	    WITH_BEECRYPT_INCLUDE="-I/usr/include/beecrypt"
   47.61 ++	    WITH_BEECRYPT_INCLUDE=""
   47.62 + 	    WITH_BEECRYPT_LIB="-lbeecrypt"
   47.63 + 	])
   47.64 +     ], [
   47.65 +
   47.66 ++---------------------------------------------------------------------------
   47.67 +| Remove access to not-existing beecrypt/ subdirectory
   47.68 +| to avoid the configure script to break building.
   47.69 ++---------------------------------------------------------------------------
   47.70 +Index: configure.ac
   47.71 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   47.72 ++++ configure.ac	13 Sep 2006 13:38:26 -0000
   47.73 +@@ -1274,7 +1305,6 @@
   47.74 + 	python/rpmdb/Makefile
   47.75 + 	python/test/Makefile
   47.76 +   ], [	echo timestamp > popt/stamp-h.in
   47.77 +-	echo timestamp > beecrypt/stamp-h.in
   47.78 + 	echo timestamp > stamp-h.in
   47.79 +   ]
   47.80 + )
   47.81 +
   47.82 ++---------------------------------------------------------------------------
   47.83 +| Fix filedescriptor leakage.
   47.84 ++---------------------------------------------------------------------------
   47.85 +Index: lib/psm.c
   47.86 +--- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
   47.87 ++++ lib/psm.c	13 Sep 2006 13:38:27 -0000
   47.88 +@@ -940,6 +960,8 @@
   47.89 + 	    if (sfdno > STDERR_FILENO) {
   47.90 + 		xx = Fclose (scriptFd);
   47.91 + 	    }
   47.92 ++	} else {
   47.93 ++	    xx = Fclose(out);
   47.94 + 	}
   47.95 + 
   47.96 + 	{   const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL);
   47.97 +
   47.98 ++---------------------------------------------------------------------------
   47.99 +| Fix trigger argument passing. For more details see RPM BugDB under:
  47.100 +| http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100509
  47.101 ++---------------------------------------------------------------------------
  47.102 +Index: lib/psm.c
  47.103 +--- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
  47.104 ++++ lib/psm.c	13 Sep 2006 13:38:29 -0000
  47.105 +@@ -1106,11 +1128,13 @@
  47.106 +     const char ** triggerProgs;
  47.107 +     int_32 * triggerIndices;
  47.108 +     const char * sourceName;
  47.109 ++    const char * triggerName;
  47.110 +     rpmRC rc = RPMRC_OK;
  47.111 +     int xx;
  47.112 +     int i;
  47.113 + 
  47.114 +     xx = headerNVR(sourceH, &sourceName, NULL, NULL);
  47.115 ++    xx = headerNVR(triggeredH, &triggerName, NULL, NULL);
  47.116 + 
  47.117 +     trigger = rpmdsInit(rpmdsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
  47.118 +     if (trigger == NULL)
  47.119 +@@ -1149,7 +1173,7 @@
  47.120 + 	{   int arg1;
  47.121 + 	    int index;
  47.122 + 
  47.123 +-	    arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), Name);
  47.124 ++	    arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), triggerName);
  47.125 + 	    if (arg1 < 0) {
  47.126 + 		/* XXX W2DO? fails as "execution of script failed" */
  47.127 + 		rc = RPMRC_FAIL;
  47.128 +
  47.129 ++---------------------------------------------------------------------------
  47.130 +| Make sure RPM does not try to set file owner/group on files during
  47.131 +| installation of _source_ RPMs. Instead, let it use the current
  47.132 +| run-time owner/group, because most of the time the owner/group in
  47.133 +| the source RPM (which is the owner/group of the files as staying on
  47.134 +| the package author system) is not existing on the target system, of
  47.135 +| course.
  47.136 ++---------------------------------------------------------------------------
  47.137 +Index: lib/psm.c
  47.138 +--- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
  47.139 ++++ lib/psm.c	13 Sep 2006 13:38:32 -0000
  47.140 +@@ -1710,6 +1734,7 @@
  47.141 + 
  47.142 + 		uid = fi->uid;
  47.143 + 		gid = fi->gid;
  47.144 ++		if (!headerIsEntry(fi->h, RPMTAG_SOURCEPACKAGE)) {
  47.145 + 		if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
  47.146 + 		    rpmMessage(RPMMESS_WARNING,
  47.147 + 			_("user %s does not exist - using root\n"),
  47.148 +@@ -1727,6 +1752,7 @@
  47.149 + 		    /* XXX this diddles header memory. */
  47.150 + 		    fi->fmodes[i] &= ~S_ISGID;	/* turn off the sgid bit */
  47.151 + 		}
  47.152 ++		}
  47.153 + 		if (fi->fuids) fi->fuids[i] = uid;
  47.154 + 		if (fi->fgids) fi->fgids[i] = gid;
  47.155 + 	    }
  47.156 +
  47.157 ++---------------------------------------------------------------------------
  47.158 +| Fix --justdb operation by consistently use the same rootDir checks
  47.159 +| RPM uses everywhere else, too.
  47.160 ++---------------------------------------------------------------------------
  47.161 +Index: lib/psm.c
  47.162 +--- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
  47.163 ++++ lib/psm.c	13 Sep 2006 13:38:33 -0000
  47.164 +@@ -2027,7 +2053,8 @@
  47.165 +     case PSM_CHROOT_IN:
  47.166 +     {	const char * rootDir = rpmtsRootDir(ts);
  47.167 + 	/* Change root directory if requested and not already done. */
  47.168 +-	if (rootDir != NULL && !rpmtsChrootDone(ts) && !psm->chrootDone) {
  47.169 ++	if (rootDir != NULL && !(rootDir[0] == '/' && rootDir[1] == '\0')
  47.170 ++        && !rpmtsChrootDone(ts) && !psm->chrootDone) {
  47.171 + 	    static int _loaded = 0;
  47.172 + 
  47.173 + 	    /*
  47.174 +
  47.175 ++---------------------------------------------------------------------------
  47.176 +| First, remove incorrectly introduced buffer assignment. Second, fix
  47.177 +| second and subsequent "%{foo -x}" constructs for non-Linux systems
  47.178 +| (without resetting the option index only the first construct would
  47.179 +| work). Third, bugfix the handling of macros inside macro arguments
  47.180 +| as in "%{foo bar%{quux}baz}": RPM correctly determined the pointer
  47.181 +| to the terminating second closing brace, but instead of passing
  47.182 +| this pointer to the subroutine which handles the macro argument
  47.183 +| construction, it passed the underlying character. This in turn
  47.184 +| obviously leaded to an incorrect determination of the argument end
  47.185 +| (it then though the first closing brace is the end). We fix this by
  47.186 +| passing the pointer and not the underlying character.
  47.187 ++---------------------------------------------------------------------------
  47.188 +Index: rpmio/macro.c
  47.189 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  47.190 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  47.191 +@@ -879,7 +882,7 @@
  47.192 +  */
  47.193 + /*@-bounds@*/
  47.194 + /*@dependent@*/ static const char *
  47.195 +-grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char lastc)
  47.196 ++grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char *lastc)
  47.197 + 	/*@globals rpmGlobalMacroContext @*/
  47.198 + 	/*@modifies mb, rpmGlobalMacroContext @*/
  47.199 + {
  47.200 +@@ -900,7 +903,7 @@
  47.201 + 
  47.202 +     /* Copy args into buf until lastc */
  47.203 +     *be++ = ' ';
  47.204 +-    while ((c = *se++) != '\0' && c != lastc) {
  47.205 ++    while ((c = *se++) != '\0' && (se-1) != lastc) {
  47.206 + /*@-globs@*/
  47.207 + 	if (!isblank(c)) {
  47.208 + 	    *be++ = c;
  47.209 +@@ -968,6 +971,8 @@
  47.210 +     /*@-mods@*/
  47.211 +     optind = 0;		/* XXX but posix != glibc */
  47.212 +     /*@=mods@*/
  47.213 ++#else
  47.214 ++    optind = 1;
  47.215 + #endif
  47.216 + 
  47.217 +     opts = me->opts;
  47.218 +@@ -1168,7 +1175,7 @@
  47.219 +     int c;
  47.220 +     int rc = 0;
  47.221 +     int negate;
  47.222 +-    char grab;
  47.223 ++    char *grab;
  47.224 +     int chkexist;
  47.225 + 
  47.226 +     if (++mb->depth > max_macro_depth) {
  47.227 +@@ -1202,7 +1209,7 @@
  47.228 + 	if (mb->depth > 1)	/* XXX full expansion for outermost level */
  47.229 + 		t = mb->t;	/* save expansion pointer for printExpand */
  47.230 + 	negate = 0;
  47.231 +-	grab = '\0';
  47.232 ++	grab = NULL;
  47.233 + 	chkexist = 0;
  47.234 + 	switch ((c = *s)) {
  47.235 + 	default:		/* %name substitution */
  47.236 +@@ -1237,7 +1244,8 @@
  47.237 + 		/* For "%name " macros ... */
  47.238 + /*@-globs@*/
  47.239 + 		if ((c = *fe) && isblank(c))
  47.240 +-			grab = '\n';
  47.241 ++			if ((grab = strchr(fe,'\n')) == NULL)
  47.242 ++                grab = strchr(fe, '\0');
  47.243 + /*@=globs@*/
  47.244 + 		/*@switchbreak@*/ break;
  47.245 + 	case '(':		/* %(...) shell escape */
  47.246 +@@ -1284,7 +1292,7 @@
  47.247 + 			ge = se - 1;
  47.248 + 			/*@innerbreak@*/ break;
  47.249 + 		case ' ':
  47.250 +-			grab = se[-1];
  47.251 ++			grab = se-1;
  47.252 + 			/*@innerbreak@*/ break;
  47.253 + 		default:
  47.254 + 			/*@innerbreak@*/ break;
  47.255 +@@ -1438,7 +1446,7 @@
  47.256 + 
  47.257 + 	/* Setup args for "%name " macros with opts */
  47.258 + 	if (me && me->opts != NULL) {
  47.259 +-		if (grab != '\0') {
  47.260 ++		if (grab != NULL) {
  47.261 + 			se = grabArgs(mb, me, fe, grab);
  47.262 + 		} else {
  47.263 + 			addMacro(mb->mc, "**", NULL, "", mb->depth);
  47.264 +
  47.265 ++---------------------------------------------------------------------------
  47.266 +| Backported RPM vendor patch:
  47.267 +| "fix: packages w/o file colors segfault"
  47.268 +| (cvs diff -r2.41.2.6 -r2.41.2.7 lib/rpmfi.c)
  47.269 ++---------------------------------------------------------------------------
  47.270 +Index: lib/rpmfi.c
  47.271 +--- lib/rpmfi.c	17 Jul 2003 22:44:28 -0000	1.1.1.3
  47.272 ++++ lib/rpmfi.c	22 Jan 2004 21:42:24 -0000	1.2
  47.273 +@@ -866,6 +866,7 @@
  47.274 + 	*fn = '\0';
  47.275 + 	fnlen = stpcpy( stpcpy(fn, dirNames[dirIndexes[i]]), baseNames[i]) - fn;
  47.276 + 
  47.277 ++if (fColors != NULL)
  47.278 + dColors[dirIndexes[i]] |= fColors[i];
  47.279 + 	/*
  47.280 + 	 * See if this file path needs relocating.
  47.281 +
  47.282 ++---------------------------------------------------------------------------
  47.283 +| The "%_excludedocs" macro is intended to set the _default_ if
  47.284 +| both --excludedocs and --includedocs are not specified and it is
  47.285 +| evaluated already before. So, do not override it here again, because
  47.286 +| it would not allow us to make "%_excludedocs 1" the default.
  47.287 ++---------------------------------------------------------------------------
  47.288 +Index: lib/transaction.c
  47.289 +--- lib/transaction.c	15 Jul 2003 15:15:47 -0000	1.1.1.15
  47.290 ++++ lib/transaction.c	22 Jan 2004 21:42:26 -0000	1.2
  47.291 +@@ -702,8 +702,10 @@
  47.292 +     int dc;
  47.293 +     int i, j;
  47.294 + 
  47.295 ++#if 0
  47.296 +     if (!noDocs)
  47.297 + 	noDocs = rpmExpandNumeric("%{_excludedocs}");
  47.298 ++#endif
  47.299 + 
  47.300 +     {	const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
  47.301 + 	/*@-branchstate@*/
  47.302 +
  47.303 ++---------------------------------------------------------------------------
  47.304 +| Bugfix: POSIX/SUSv3 clearly expresses that fcntl(2) returns "value
  47.305 +| other than -1" on success, so check for equality to -1 instead of
  47.306 +| non-equality to 0. In practice this does not harm on most platforms,
  47.307 +| because they fortunately (by conincidence and common practice)
  47.308 +| return 0.
  47.309 +| Additionally, at least Solaris may reject (see fcntl(2) manpage) the
  47.310 +| (partial) locking, because DB mmap(2)'ed the file (or vice versa).
  47.311 +| The workaround is to lock the entire(!) file.
  47.312 ++---------------------------------------------------------------------------
  47.313 +Index: db/mutex/mut_fcntl.c
  47.314 +--- db/mutex/mut_fcntl.c	18 Jan 2003 14:05:03 -0000	1.1.1.5
  47.315 ++++ db/mutex/mut_fcntl.c	22 Jan 2004 21:42:18 -0000	1.2
  47.316 +@@ -84,8 +84,13 @@
  47.317 + 
  47.318 + 	/* Initialize the lock. */
  47.319 + 	k_lock.l_whence = SEEK_SET;
  47.320 ++#if 0
  47.321 + 	k_lock.l_start = mutexp->off;
  47.322 + 	k_lock.l_len = 1;
  47.323 ++#else
  47.324 ++	k_lock.l_start = 0;
  47.325 ++	k_lock.l_len = 0;
  47.326 ++#endif
  47.327 + 
  47.328 + 	for (locked = waited = 0;;) {
  47.329 + 		/*
  47.330 +@@ -101,7 +106,7 @@
  47.331 + 
  47.332 + 		/* Acquire an exclusive kernel lock. */
  47.333 + 		k_lock.l_type = F_WRLCK;
  47.334 +-		if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock))
  47.335 ++		if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock) == -1)
  47.336 + 			return (__os_get_errno());
  47.337 + 
  47.338 + 		/* If the resource is still available, it's ours. */
  47.339 +@@ -112,7 +117,7 @@
  47.340 + 
  47.341 + 		/* Release the kernel lock. */
  47.342 + 		k_lock.l_type = F_UNLCK;
  47.343 +-		if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock))
  47.344 ++		if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock) == -1)
  47.345 + 			return (__os_get_errno());
  47.346 + 
  47.347 + 		/*
  47.348 +
  47.349 ++---------------------------------------------------------------------------
  47.350 +| The O_DIRECT feature is fully broken under at least Linux 2.2 and
  47.351 +| 2.4. It is sometimes accepted by open(2) without error and later
  47.352 +| causes a write(2) to fail with EINVAL -- all depending on the
  47.353 +| underlying filesystem (usually works on tmpfs and fails on ext3).
  47.354 +| Sometimes it also causes open(2) to fail with EINVAL. In general,
  47.355 +| it does especially no "graceful degradation" and so is useless for
  47.356 +| use mostly all platforms except for those where we know it works
  47.357 +| (currently FreeBSD only). Interestingly, RPM works on RedHat, just
  47.358 +| because RedHat's "kernel" package contains a patch which masks out
  47.359 +| O_DIRECT usage... ;-)
  47.360 ++---------------------------------------------------------------------------
  47.361 +Index: db/os/os_open.c
  47.362 +--- db/os/os_open.c	18 Jan 2003 14:05:03 -0000	1.1.1.5
  47.363 ++++ db/os/os_open.c	22 Jan 2004 21:42:19 -0000	1.2
  47.364 +@@ -93,7 +93,7 @@
  47.365 + 	if (LF_ISSET(DB_OSO_TRUNC))
  47.366 + 		oflags |= O_TRUNC;
  47.367 + 
  47.368 +-#ifdef HAVE_O_DIRECT
  47.369 ++#if defined(HAVE_O_DIRECT) && defined(__FreeBSD__)
  47.370 + 	if (LF_ISSET(DB_OSO_DIRECT))
  47.371 + 		oflags |= O_DIRECT;
  47.372 + #endif
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/openpkg/rpm.patch.feature	Tue Jan 06 23:40:39 2009 +0100
    48.3 @@ -0,0 +1,2211 @@
    48.4 +##
    48.5 +##  rpm.patch.feature -- Annotated OpenPKG RPM Patch file
    48.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    48.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    48.8 +##
    48.9 +##  This file assembles changes to existing RPM source files between
   48.10 +##  the original RedHat RPM and the OpenPKG RPM variant. It can be
   48.11 +##  automatically applied to a vanilla RedHat RPM source tree with the
   48.12 +##  'patch' tool to upgrade those files. Each patch snippet is annotated
   48.13 +##  with a short description.
   48.14 +##
   48.15 +##  Created on: 13-Sep-2006
   48.16 +##
   48.17 +##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
   48.18 +##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
   48.19 +##
   48.20 +
   48.21 ++---------------------------------------------------------------------------
   48.22 +| Remove "tools" directory from sub-directory list because it contains
   48.23 +| things we are not interested in and which cause some build trouble
   48.24 +| anyway.
   48.25 +| Use a plain "rpmpopt" file without any trailing version.
   48.26 +| Adjust paths to conform to OpenPKG filesystem layout.
   48.27 +| Do not run the "installplatform" script, because not needed for OpenPKG.
   48.28 ++---------------------------------------------------------------------------
   48.29 +Index: Makefile.am
   48.30 +--- Makefile.am	29 May 2003 18:20:28 -0000	1.1.1.17
   48.31 ++++ Makefile.am	22 Jan 2004 21:42:02 -0000	1.2
   48.32 +@@ -12,9 +12,9 @@
   48.33 + 	xmlspec/examples/*.sh xmlspec/examples/*.lst \
   48.34 + 	xmlspec/examples/*.xmlspec \
   48.35 + 	po/*.in po/*.po po/rpm.pot \
   48.36 +-	rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c
   48.37 ++	rpm.magic rpmpopt rpmqv.c rpm.c
   48.38 + 
   48.39 +-SUBDIRS = intl po @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc .
   48.40 ++SUBDIRS = intl @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ scripts tests doc .
   48.41 + 
   48.42 + INCLUDES = \
   48.43 + 	-I$(top_srcdir)/build \
   48.44 +@@ -47,13 +47,10 @@
   48.45 + 
   48.46 + pkglibdir =		@RPMCONFIGDIR@
   48.47 + pkglib_PROGRAMS =	rpmb rpmd rpmi rpmk rpmq
   48.48 +-pkglib_DATA =		rpmrc rpmpopt-$(VERSION) macros
   48.49 ++pkglib_DATA =		rpmrc rpmpopt macros
   48.50 + pkglib_SCRIPTS =	find-provides find-requires mkinstalldirs \
   48.51 + 			config.guess config.sub config.site
   48.52 + 
   48.53 +-rpmpopt-$(VERSION): rpmpopt
   48.54 +-	cp rpmpopt $@
   48.55 +-
   48.56 + noinst_HEADERS = build.h debug.h system.h
   48.57 + 
   48.58 + rpm_SOURCES =
   48.59 +@@ -124,32 +121,32 @@
   48.60 + pkgsrcdir = $(prefix)/src/$(RPMCANONVENDOR)
   48.61 + 
   48.62 + install-data-local:
   48.63 +-	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
   48.64 ++	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg
   48.65 + 	@rm -f $(DESTDIR)$(libdir)/rpmrc
   48.66 + 	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
   48.67 + 	@rm -f $(DESTDIR)$(libdir)/rpmpopt
   48.68 + 	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
   48.69 + 	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
   48.70 +-	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
   48.71 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
   48.72 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
   48.73 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
   48.74 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
   48.75 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
   48.76 +-	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv
   48.77 ++	@@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt
   48.78 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpme
   48.79 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme
   48.80 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmu
   48.81 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu
   48.82 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmv
   48.83 ++	@@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv
   48.84 + 	rm -f $(DESTDIR)$(bindir)/rpmbuild
   48.85 +-	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
   48.86 ++	@LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild
   48.87 + 	rm -f $(DESTDIR)$(bindir)/rpmquery
   48.88 +-	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
   48.89 ++	@LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery
   48.90 + 	rm -f $(DESTDIR)$(bindir)/rpmverify
   48.91 +-	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
   48.92 ++	@LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify
   48.93 + 	rm -f $(DESTDIR)$(bindir)/rpmsign
   48.94 +-	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
   48.95 ++	@LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign
   48.96 + 	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
   48.97 +-	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
   48.98 ++	@LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
   48.99 + 	for bf in e i u ; do \
  48.100 + 	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
  48.101 +-	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
  48.102 ++	    @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
  48.103 + 	done
  48.104 + 	@for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\
  48.105 + 	    $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\
  48.106 +@@ -174,11 +171,6 @@
  48.107 + 	*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
  48.108 + 	esac
  48.109 + 	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
  48.110 +-	@case "@host_os@" in \
  48.111 +-	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
  48.112 +-	solaris*|linux*) \
  48.113 +-	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ;; \
  48.114 +-	esac
  48.115 + 	@$(mkinstalldirs) $(DESTDIR)/var/tmp
  48.116 + 
  48.117 + .PHONY:	setperms
  48.118 +@@ -198,10 +190,10 @@
  48.119 + 	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
  48.120 + 	done
  48.121 + 	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
  48.122 +-	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
  48.123 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
  48.124 +-	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
  48.125 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
  48.126 ++	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg
  48.127 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]*
  48.128 ++	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg
  48.129 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.*
  48.130 + 
  48.131 + .PHONY:	unsetgid
  48.132 + unsetgid:
  48.133 +@@ -244,7 +236,7 @@
  48.134 + 	@sudo ./rpm -ta rpm-$(VERSION).tar.gz
  48.135 + 
  48.136 + .PHONY:	doxygen
  48.137 +-doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
  48.138 ++doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt
  48.139 + 	rm -rf $@
  48.140 + 	mkdir -p $@
  48.141 + 	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
  48.142 +
  48.143 ++---------------------------------------------------------------------------
  48.144 +| Remove "tools" directory from sub-directory list because it contains
  48.145 +| things we are not interested in and which cause some build trouble
  48.146 +| anyway.
  48.147 +| Use a plain "rpmpopt" file without any trailing version.
  48.148 +| Adjust paths to conform to OpenPKG filesystem layout.
  48.149 +| Do not run the "installplatform" script, because not needed for OpenPKG.
  48.150 ++---------------------------------------------------------------------------
  48.151 +Index: Makefile.in
  48.152 +--- Makefile.in	16 Jul 2003 17:05:42 -0000	1.1.1.23
  48.153 ++++ Makefile.in	22 Jan 2004 21:42:03 -0000	1.2
  48.154 +@@ -265,10 +265,10 @@
  48.155 + 	xmlspec/examples/*.sh xmlspec/examples/*.lst \
  48.156 + 	xmlspec/examples/*.xmlspec \
  48.157 + 	po/*.in po/*.po po/rpm.pot \
  48.158 +-	rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c
  48.159 ++	rpm.magic rpmpopt rpmqv.c rpm.c
  48.160 + 
  48.161 + 
  48.162 +-SUBDIRS = intl po @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc .
  48.163 ++SUBDIRS = intl @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ scripts tests doc .
  48.164 + 
  48.165 + INCLUDES = \
  48.166 + 	-I$(top_srcdir)/build \
  48.167 +@@ -301,7 +301,7 @@
  48.168 + bin_PROGRAMS = rpm2cpio
  48.169 + bin_SCRIPTS = gendiff
  48.170 + pkglib_PROGRAMS = rpmb rpmd rpmi rpmk rpmq
  48.171 +-pkglib_DATA = rpmrc rpmpopt-$(VERSION) macros
  48.172 ++pkglib_DATA = rpmrc rpmpopt macros
  48.173 + pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \
  48.174 + 			config.guess config.sub config.site
  48.175 + 
  48.176 +@@ -1058,8 +1058,6 @@
  48.177 + 	uninstall-rpmbinPROGRAMS
  48.178 + 
  48.179 + 
  48.180 +-rpmpopt-$(VERSION): rpmpopt
  48.181 +-	cp rpmpopt $@
  48.182 + rpm.o:	rpmqv.c
  48.183 + 	$(COMPILE) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV -o $@ -c rpmqv.c
  48.184 + rpmb.o:	rpmqv.c
  48.185 +@@ -1097,32 +1095,32 @@
  48.186 + 		`make -s sources -C popt`
  48.187 + 
  48.188 + install-data-local:
  48.189 +-	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
  48.190 ++	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg
  48.191 + 	@rm -f $(DESTDIR)$(libdir)/rpmrc
  48.192 + 	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
  48.193 + 	@rm -f $(DESTDIR)$(libdir)/rpmpopt
  48.194 + 	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
  48.195 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
  48.196 +-	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
  48.197 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
  48.198 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
  48.199 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
  48.200 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
  48.201 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
  48.202 +-	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv
  48.203 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmt
  48.204 ++	@@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt
  48.205 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpme
  48.206 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme
  48.207 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmu
  48.208 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu
  48.209 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmv
  48.210 ++	@@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv
  48.211 + 	rm -f $(DESTDIR)$(bindir)/rpmbuild
  48.212 +-	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
  48.213 ++	@LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild
  48.214 + 	rm -f $(DESTDIR)$(bindir)/rpmquery
  48.215 +-	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
  48.216 ++	@LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery
  48.217 + 	rm -f $(DESTDIR)$(bindir)/rpmverify
  48.218 +-	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
  48.219 ++	@LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify
  48.220 + 	rm -f $(DESTDIR)$(bindir)/rpmsign
  48.221 +-	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
  48.222 ++	@LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign
  48.223 + 	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
  48.224 +-	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
  48.225 ++	@LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
  48.226 + 	for bf in e i u ; do \
  48.227 + 	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
  48.228 +-	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
  48.229 ++	    @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
  48.230 + 	done
  48.231 + 	@for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\
  48.232 + 	    $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\
  48.233 +@@ -1147,11 +1145,6 @@
  48.234 + 	*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
  48.235 + 	esac
  48.236 + 	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
  48.237 +-	@case "@host_os@" in \
  48.238 +-	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
  48.239 +-	solaris*|linux*) \
  48.240 +-	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ;; \
  48.241 +-	esac
  48.242 + 	@$(mkinstalldirs) $(DESTDIR)/var/tmp
  48.243 + 
  48.244 + .PHONY:	setperms
  48.245 +@@ -1171,10 +1164,10 @@
  48.246 + 	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
  48.247 + 	done
  48.248 + 	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
  48.249 +-	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
  48.250 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
  48.251 +-	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
  48.252 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
  48.253 ++	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg
  48.254 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]*
  48.255 ++	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg
  48.256 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.*
  48.257 + 
  48.258 + .PHONY:	unsetgid
  48.259 + unsetgid:
  48.260 +@@ -1217,7 +1210,7 @@
  48.261 + 	@sudo ./rpm -ta rpm-$(VERSION).tar.gz
  48.262 + 
  48.263 + .PHONY:	doxygen
  48.264 +-doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
  48.265 ++doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt
  48.266 + 	rm -rf $@
  48.267 + 	mkdir -p $@
  48.268 + 	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
  48.269 +
  48.270 ++---------------------------------------------------------------------------
  48.271 +| Add support for splitted source directories, i.e., source files
  48.272 +| alternatively can be placed into the .spec directory and are picked
  48.273 +| up there, too.
  48.274 ++---------------------------------------------------------------------------
  48.275 +Index: build/build.c
  48.276 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
  48.277 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
  48.278 +@@ -33,7 +33,15 @@
  48.279 + 
  48.280 +     for (p = spec->sources; p != NULL; p = p->next) {
  48.281 + 	if (! (p->flags & RPMBUILD_ISNO)) {
  48.282 ++#ifndef OPENPKG
  48.283 + 	    const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
  48.284 ++#else
  48.285 ++	    const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
  48.286 ++        if (access(fn, F_OK) == -1) {
  48.287 ++            fn = _free(fn);
  48.288 ++	        fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
  48.289 ++        }
  48.290 ++#endif
  48.291 + 	    rc = Unlink(fn);
  48.292 + 	    fn = _free(fn);
  48.293 + 	}
  48.294 +@@ -42,7 +50,15 @@
  48.295 +     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
  48.296 + 	for (p = pkg->icon; p != NULL; p = p->next) {
  48.297 + 	    if (! (p->flags & RPMBUILD_ISNO)) {
  48.298 ++#ifndef OPENPKG
  48.299 + 		const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
  48.300 ++#else
  48.301 ++		const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
  48.302 ++        if (access(fn, F_OK) == -1) {
  48.303 ++            fn = _free(fn);
  48.304 ++		    fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
  48.305 ++        }
  48.306 ++#endif
  48.307 + 		rc = Unlink(fn);
  48.308 + 		fn = _free(fn);
  48.309 + 	    }
  48.310 +
  48.311 ++---------------------------------------------------------------------------
  48.312 +| Add support for the OpenPKG custom .spec file sections %track
  48.313 +| (package build-time feature for performing vendor source tracking)
  48.314 +| and %test (package install-time feature for performing package
  48.315 +| run-time tests).
  48.316 ++---------------------------------------------------------------------------
  48.317 +Index: build/build.c
  48.318 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
  48.319 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
  48.320 +@@ -113,6 +129,14 @@
  48.321 + 	mTemplate = "%{__spec_clean_template}";
  48.322 + 	mPost = "%{__spec_clean_post}";
  48.323 + 	break;
  48.324 ++#ifdef OPENPKG
  48.325 ++    case RPMBUILD_TRACK:
  48.326 ++	name = "%track";
  48.327 ++	sb = spec->track;
  48.328 ++	mTemplate = "%{__spec_track_template}";
  48.329 ++	mPost = "%{__spec_track_post}";
  48.330 ++	break;
  48.331 ++#endif
  48.332 +     case RPMBUILD_STRINGBUF:
  48.333 +     default:
  48.334 + 	mTemplate = "%{___build_template}";
  48.335 +@@ -169,7 +193,11 @@
  48.336 + 
  48.337 +     (void) fputs(buildTemplate, fp);
  48.338 + 
  48.339 ++#ifdef OPENPKG
  48.340 ++    if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir && what != RPMBUILD_TRACK)
  48.341 ++#else
  48.342 +     if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
  48.343 ++#endif
  48.344 + 	fprintf(fp, "cd %s\n", spec->buildSubdir);
  48.345 + 
  48.346 +     if (what == RPMBUILD_RMBUILD) {
  48.347 +@@ -215,6 +243,9 @@
  48.348 +     buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
  48.349 +     (void) poptParseArgvString(buildCmd, &argc, &argv);
  48.350 + 
  48.351 ++#ifdef OPENPKG
  48.352 ++    if (what != RPMBUILD_TRACK)
  48.353 ++#endif
  48.354 +     rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
  48.355 +     if (!(child = fork())) {
  48.356 + 
  48.357 +@@ -290,6 +323,12 @@
  48.358 + /*@=boundsread@*/
  48.359 + 	}
  48.360 +     } else {
  48.361 ++#ifdef OPENPKG
  48.362 ++	if ((what & RPMBUILD_TRACK) &&
  48.363 ++	    (rc = doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
  48.364 ++		goto exit;
  48.365 ++#endif
  48.366 ++
  48.367 + 	if ((what & RPMBUILD_PREP) &&
  48.368 + 	    (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
  48.369 + 		goto exit;
  48.370 +
  48.371 ++---------------------------------------------------------------------------
  48.372 +| Unconditionally remove temporary files ("rpm-tmp.XXXXX") which
  48.373 +| were generated for the executed scripts. In OpenPKG we run the
  48.374 +| scripts in debug mode ("set -x") anyway, so we never need to
  48.375 +| see the whole generated script -- not even if it breaks.  Instead
  48.376 +| we would just have temporary files staying around forever.
  48.377 ++---------------------------------------------------------------------------
  48.378 +Index: build/build.c
  48.379 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
  48.380 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
  48.381 +@@ -242,7 +273,9 @@
  48.382 +     
  48.383 + exit:
  48.384 +     if (scriptName) {
  48.385 ++#ifndef OPENPKG
  48.386 + 	if (!rc)
  48.387 ++#endif
  48.388 + 	    (void) Unlink(scriptName);
  48.389 + 	scriptName = _free(scriptName);
  48.390 +     }
  48.391 +
  48.392 ++---------------------------------------------------------------------------
  48.393 +| In OpenPKG we use per-package %{_sourcedir} and %{_specdir}
  48.394 +| definitions (macros have trailing ".../%{name}"). On removal
  48.395 +| of source(s) and .spec file, this per-package directory would
  48.396 +| be kept (usually <prefix>/RPM/SRC/<name>/), because RPM does
  48.397 +| not know about this OpenPKG convention.  So, let RPM try(!) to
  48.398 +| remove the two directories (if they are empty) and just ignore
  48.399 +| removal failures (if they are still not empty).
  48.400 ++---------------------------------------------------------------------------
  48.401 +Index: build/build.c
  48.402 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
  48.403 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
  48.404 +@@ -338,6 +377,21 @@
  48.405 +     if (what & RPMBUILD_RMSPEC)
  48.406 + 	(void) Unlink(spec->specFile);
  48.407 + 
  48.408 ++#ifdef OPENPKG
  48.409 ++    if (what & RPMBUILD_RMSOURCE) {
  48.410 ++        const char *pn;
  48.411 ++        pn = rpmGetPath("%{_sourcedir}", NULL);
  48.412 ++        Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
  48.413 ++        pn = _free(pn);
  48.414 ++    }
  48.415 ++    if (what & RPMBUILD_RMSPEC) {
  48.416 ++        const char *pn;
  48.417 ++        pn = rpmGetPath("%{_specdir}", NULL);
  48.418 ++        Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
  48.419 ++        pn = _free(pn);
  48.420 ++    }
  48.421 ++#endif
  48.422 ++
  48.423 + exit:
  48.424 +     if (rc && rpmlogGetNrecs() > 0) {
  48.425 + 	rpmMessage(RPMMESS_NORMAL, _("\n\nRPM build errors:\n"));
  48.426 +
  48.427 ++---------------------------------------------------------------------------
  48.428 +| Do not declare any files as %doc files by default.
  48.429 ++---------------------------------------------------------------------------
  48.430 +Index: build/files.c
  48.431 +--- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
  48.432 ++++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
  48.433 +@@ -1971,6 +1971,7 @@
  48.434 +     fl.defSpecdFlags = 0;
  48.435 + 
  48.436 +     fl.docDirCount = 0;
  48.437 ++#if 0
  48.438 +     fl.docDirs[fl.docDirCount++] = xstrdup("/usr/doc");
  48.439 +     fl.docDirs[fl.docDirCount++] = xstrdup("/usr/man");
  48.440 +     fl.docDirs[fl.docDirCount++] = xstrdup("/usr/info");
  48.441 +@@ -1981,6 +1982,7 @@
  48.442 +     fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_docdir}", NULL);
  48.443 +     fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_mandir}", NULL);
  48.444 +     fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_infodir}", NULL);
  48.445 ++#endif
  48.446 +     
  48.447 +     fl.fileList = NULL;
  48.448 +     fl.fileListRecsAlloced = 0;
  48.449 +
  48.450 ++---------------------------------------------------------------------------
  48.451 +| Make sure the "Provides" headers are available for querying from the
  48.452 +| .src.rpm files.
  48.453 ++---------------------------------------------------------------------------
  48.454 +Index: build/files.c
  48.455 +--- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
  48.456 ++++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
  48.457 +@@ -2183,6 +2185,12 @@
  48.458 + 	case RPMTAG_CHANGELOGTEXT:
  48.459 + 	case RPMTAG_URL:
  48.460 + 	case HEADER_I18NTABLE:
  48.461 ++#ifdef OPENPKG
  48.462 ++	case RPMTAG_PROVIDENAME:
  48.463 ++	case RPMTAG_PROVIDEVERSION:
  48.464 ++	case RPMTAG_PROVIDEFLAGS:
  48.465 ++	case RPMTAG_CLASS:
  48.466 ++#endif
  48.467 + 	    if (ptr)
  48.468 + 		(void)headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
  48.469 + 	    /*@switchbreak@*/ break;
  48.470 +
  48.471 ++---------------------------------------------------------------------------
  48.472 +| Add support for splitted source directories, i.e., source files
  48.473 +| alternatively can be placed into the .spec directory and are picked
  48.474 +| up there, too.
  48.475 ++---------------------------------------------------------------------------
  48.476 +Index: build/files.c
  48.477 +--- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
  48.478 ++++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
  48.479 +@@ -2253,8 +2261,20 @@
  48.480 + 	}
  48.481 + 
  48.482 +       {	const char * sfn;
  48.483 ++#ifndef OPENPKG
  48.484 + 	sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
  48.485 + 		"%{_sourcedir}/", srcPtr->source, NULL);
  48.486 ++#else
  48.487 ++        const char *sfn2;
  48.488 ++	sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
  48.489 ++        if (access(sfn2, F_OK) == 0)
  48.490 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
  48.491 ++                "%{_specdir}/", srcPtr->source, NULL);
  48.492 ++        else
  48.493 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
  48.494 ++                "%{_sourcedir}/", srcPtr->source, NULL);
  48.495 ++        sfn2 = _free(sfn2);
  48.496 ++#endif
  48.497 + 	appendLineStringBuf(sourceFiles, sfn);
  48.498 + 	sfn = _free(sfn);
  48.499 +       }
  48.500 +@@ -2263,8 +2283,20 @@
  48.501 +     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
  48.502 + 	for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) {
  48.503 + 	    const char * sfn;
  48.504 ++#ifndef OPENPKG
  48.505 + 	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
  48.506 + 		"%{_sourcedir}/", srcPtr->source, NULL);
  48.507 ++#else
  48.508 ++            const char *sfn2;
  48.509 ++	    sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
  48.510 ++        if (access(sfn2, F_OK) == 0)
  48.511 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
  48.512 ++                "%{_specdir}/", srcPtr->source, NULL);
  48.513 ++        else
  48.514 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
  48.515 ++                "%{_sourcedir}/", srcPtr->source, NULL);
  48.516 ++        sfn2 = _free(sfn2);
  48.517 ++#endif
  48.518 + 	    appendLineStringBuf(sourceFiles, sfn);
  48.519 + 	    sfn = _free(sfn);
  48.520 + 	}
  48.521 +
  48.522 ++---------------------------------------------------------------------------
  48.523 +| Add support for splitted source directories, i.e., source files
  48.524 +| alternatively can be placed into the .spec directory and are picked
  48.525 +| up there, too.
  48.526 ++---------------------------------------------------------------------------
  48.527 +Index: build/parsePreamble.c
  48.528 +--- build/parsePreamble.c	3 Mar 2003 20:46:34 -0000	1.1.1.13
  48.529 ++++ build/parsePreamble.c	6 Feb 2004 15:37:58 -0000	1.3
  48.530 +@@ -366,7 +368,15 @@
  48.531 +     size_t nb, iconsize;
  48.532 + 
  48.533 +     /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
  48.534 ++#ifndef OPENPKG
  48.535 +     fn = rpmGetPath("%{_sourcedir}/", file, NULL);
  48.536 ++#else
  48.537 ++    fn = rpmGetPath("%{_specdir}/", file, NULL);
  48.538 ++    if (access(fn, F_OK) == -1) {
  48.539 ++        fn = _free(fn);
  48.540 ++        fn = rpmGetPath("%{_sourcedir}/", file, NULL);
  48.541 ++    }
  48.542 ++#endif
  48.543 + 
  48.544 +     fd = Fopen(fn, "r.ufdio");
  48.545 +     if (fd == NULL || Ferror(fd)) {
  48.546 +
  48.547 ++---------------------------------------------------------------------------
  48.548 +| In OpenPKG, the RPM package contains own local versions of the
  48.549 +| "patch" and "tar" tools, so we cannot accept hard-coded names here.
  48.550 +| Instead we expand a variable to allow us to direct RPM to our tools.
  48.551 +| Additionally, pass option "-b" to patch(1) so it creates original
  48.552 +| files not only if a non-standard (not ".orig") suffix is used.
  48.553 +| Finally, add support for the GNU patch "-d" option for convenient
  48.554 +| changing into a subdirectory.
  48.555 +| Remove "unzip" support, because in OpenPKG there are less than
  48.556 +| a dozend packages requiring unpacking of .zip files. For these
  48.557 +| it is fully sufficient to explicitly require the "infozip"
  48.558 +| package (containing "unzip") and leaving the less portable
  48.559 +| "unzip" out of the bootstrap package.
  48.560 ++---------------------------------------------------------------------------
  48.561 +Index: build/parsePrep.c
  48.562 +--- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
  48.563 ++++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
  48.564 +@@ -66,7 +66,7 @@
  48.565 +  */
  48.566 + /*@-boundswrite@*/
  48.567 + /*@observer@*/ static char *doPatch(Spec spec, int c, int strip, const char *db,
  48.568 +-		     int reverse, int removeEmpties)
  48.569 ++		     int reverse, int removeEmpties, const char *subdir)
  48.570 + 	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
  48.571 + 	/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
  48.572 + {
  48.573 +@@ -76,6 +76,7 @@
  48.574 +     struct Source *sp;
  48.575 +     rpmCompressedMagic compressed = COMPRESSED_NOT;
  48.576 +     int urltype;
  48.577 ++    const char *patcher;
  48.578 + 
  48.579 +     for (sp = spec->sources; sp != NULL; sp = sp->next) {
  48.580 + 	if ((sp->flags & RPMBUILD_ISPATCH) && (sp->num == c)) {
  48.581 +@@ -97,6 +106,10 @@
  48.582 + 	strcat(args, "--suffix ");
  48.583 + 	strcat(args, db);
  48.584 +     }
  48.585 ++    if (subdir) {
  48.586 ++	strcat(args, "-d ");
  48.587 ++	strcat(args, subdir);
  48.588 ++    }
  48.589 +     if (reverse) {
  48.590 + 	strcat(args, " -R");
  48.591 +     }
  48.592 +@@ -124,6 +137,10 @@
  48.593 + 	/*@notreached@*/ break;
  48.594 +     }
  48.595 + 
  48.596 ++    patcher = rpmGetPath("%{_patchbin}", NULL);
  48.597 ++    if (strcmp(patcher, "%{_patchbin}") == 0)
  48.598 ++        patcher = "patch";
  48.599 ++
  48.600 +     if (compressed) {
  48.601 + 	const char *zipper = rpmGetPath(
  48.602 + 	    (compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"),
  48.603 +@@ -131,22 +148,23 @@
  48.604 + 
  48.605 + 	sprintf(buf,
  48.606 + 		"echo \"Patch #%d (%s):\"\n"
  48.607 +-		"%s -d < %s | patch -p%d %s -s\n"
  48.608 ++		"%s -d <%s | %s -p%d %s -s -b\n"
  48.609 + 		"STATUS=$?\n"
  48.610 + 		"if [ $STATUS -ne 0 ]; then\n"
  48.611 + 		"  exit $STATUS\n"
  48.612 + 		"fi",
  48.613 +-		c, /*@-unrecog@*/ (const char *) basename(fn), /*@=unrecog@*/
  48.614 ++		c, /*@-unrecog@*/ basename(fn), /*@=unrecog@*/
  48.615 + 		zipper,
  48.616 +-		fn, strip, args);
  48.617 ++		fn, patcher, strip, args);
  48.618 + 	zipper = _free(zipper);
  48.619 +     } else {
  48.620 + 	sprintf(buf,
  48.621 + 		"echo \"Patch #%d (%s):\"\n"
  48.622 +-		"patch -p%d %s -s < %s", c, (const char *) basename(fn),
  48.623 +-		strip, args, fn);
  48.624 ++		"%s -p%d %s -s -b <%s", c, basename(fn),
  48.625 ++		patcher, strip, args, fn);
  48.626 +     }
  48.627 + 
  48.628 ++    patcher = _free(patcher);
  48.629 +     urlfn = _free(urlfn);
  48.630 +     return buf;
  48.631 + }
  48.632 +@@ -171,6 +189,7 @@
  48.633 +     struct Source *sp;
  48.634 +     rpmCompressedMagic compressed = COMPRESSED_NOT;
  48.635 +     int urltype;
  48.636 ++    const char *tar;
  48.637 + 
  48.638 +     for (sp = spec->sources; sp != NULL; sp = sp->next) {
  48.639 + 	if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) {
  48.640 +@@ -228,6 +255,10 @@
  48.641 + 	/*@notreached@*/ break;
  48.642 +     }
  48.643 + 
  48.644 ++    tar = rpmGetPath("%{_tarbin}", NULL);
  48.645 ++    if (strcmp(tar, "%{_tarbin}") == 0)
  48.646 ++        tar = "tar";
  48.647 ++
  48.648 +     if (compressed != COMPRESSED_NOT) {
  48.649 + 	const char *zipper;
  48.650 + 	int needtar = 1;
  48.651 +@@ -240,6 +271,7 @@
  48.652 + 	case COMPRESSED_BZIP2:
  48.653 + 	    t = "%{_bzip2bin} -dc";
  48.654 + 	    break;
  48.655 ++#if 0
  48.656 + 	case COMPRESSED_ZIP:
  48.657 + 	    if (rpmIsVerbose() && !quietly)
  48.658 + 		t = "%{_unzipbin}";
  48.659 +@@ -247,6 +279,7 @@
  48.660 + 		t = "%{_unzipbin} -qq";
  48.661 + 	    needtar = 0;
  48.662 + 	    break;
  48.663 ++#endif
  48.664 + 	}
  48.665 + 	zipper = rpmGetPath(t, NULL);
  48.666 + 	buf[0] = '\0';
  48.667 +@@ -254,8 +287,13 @@
  48.668 + 	zipper = _free(zipper);
  48.669 + 	*t++ = ' ';
  48.670 + 	t = stpcpy(t, fn);
  48.671 +-	if (needtar)
  48.672 +-	    t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -");
  48.673 ++	if (needtar) {
  48.674 ++	    t = stpcpy(t, " | ");
  48.675 ++            t = stpcpy(t, tar);
  48.676 ++            t = stpcpy(t, " ");
  48.677 ++            t = stpcpy(t, taropts);
  48.678 ++            t = stpcpy(t, " -");
  48.679 ++        }
  48.680 + 	t = stpcpy(t,
  48.681 + 		"\n"
  48.682 + 		"STATUS=$?\n"
  48.683 +@@ -264,11 +302,14 @@
  48.684 + 		"fi");
  48.685 +     } else {
  48.686 + 	buf[0] = '\0';
  48.687 +-	t = stpcpy( stpcpy(buf, "tar "), taropts);
  48.688 +-	*t++ = ' ';
  48.689 ++	t = stpcpy(buf, tar);
  48.690 ++	t = stpcpy(t, " ");
  48.691 ++	t = stpcpy(t, taropts);
  48.692 ++	t = stpcpy(t, " ");
  48.693 + 	t = stpcpy(t, fn);
  48.694 +     }
  48.695 + 
  48.696 ++    tar = _free(tar);
  48.697 +     urlfn = _free(urlfn);
  48.698 +     return buf;
  48.699 + }
  48.700 +@@ -443,7 +484,7 @@
  48.701 + 	/*@modifies spec->prep, rpmGlobalMacroContext,
  48.702 + 		fileSystem, internalState  @*/
  48.703 + {
  48.704 +-    char *opt_b;
  48.705 ++    char *opt_b, *opt_d;
  48.706 +     int opt_P, opt_p, opt_R, opt_E;
  48.707 +     char *s;
  48.708 +     char buf[BUFSIZ], *bp;
  48.709 +@@ -453,6 +494,7 @@
  48.710 +     memset(patch_nums, 0, sizeof(patch_nums));
  48.711 +     opt_P = opt_p = opt_R = opt_E = 0;
  48.712 +     opt_b = NULL;
  48.713 ++    opt_d = NULL;
  48.714 +     patch_index = 0;
  48.715 + 
  48.716 +     if (! strchr(" \t\n", line[6])) {
  48.717 +@@ -492,6 +534,15 @@
  48.718 + 			spec->lineNum, spec->line);
  48.719 + 		return RPMERR_BADSPEC;
  48.720 + 	    }
  48.721 ++	} else if (!strcmp(s, "-d")) {
  48.722 ++	    /* orig suffix */
  48.723 ++	    opt_d = strtok(NULL, " \t\n");
  48.724 ++	    if (! opt_d) {
  48.725 ++		rpmError(RPMERR_BADSPEC,
  48.726 ++			_("line %d: Need arg to %%patch -d: %s\n"),
  48.727 ++			spec->lineNum, spec->line);
  48.728 ++		return RPMERR_BADSPEC;
  48.729 ++	    }
  48.730 + 	} else if (!strncmp(s, "-p", sizeof("-p")-1)) {
  48.731 + 	    /* unfortunately, we must support -pX */
  48.732 + 	    if (! strchr(" \t\n", s[2])) {
  48.733 +@@ -530,14 +581,14 @@
  48.734 +     /* All args processed */
  48.735 + 
  48.736 +     if (! opt_P) {
  48.737 +-	s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E);
  48.738 ++	s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E, opt_d);
  48.739 + 	if (s == NULL)
  48.740 + 	    return RPMERR_BADSPEC;
  48.741 + 	appendLineStringBuf(spec->prep, s);
  48.742 +     }
  48.743 + 
  48.744 +     for (x = 0; x < patch_index; x++) {
  48.745 +-	s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E);
  48.746 ++	s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E, opt_d);
  48.747 + 	if (s == NULL)
  48.748 + 	    return RPMERR_BADSPEC;
  48.749 + 	appendLineStringBuf(spec->prep, s);
  48.750 +
  48.751 ++---------------------------------------------------------------------------
  48.752 +| Add support for splitted source directories, i.e., source files
  48.753 +| alternatively can be placed into the .spec directory and are picked
  48.754 +| up there, too.
  48.755 ++---------------------------------------------------------------------------
  48.756 +Index: build/parsePrep.c
  48.757 +--- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
  48.758 ++++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
  48.759 +@@ -87,7 +88,15 @@
  48.760 + 	return NULL;
  48.761 +     }
  48.762 + 
  48.763 ++#ifndef OPENPKG
  48.764 +     urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
  48.765 ++#else
  48.766 ++    urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
  48.767 ++    if (access(urlfn, F_OK) == -1) {
  48.768 ++        urlfn = _free(urlfn);
  48.769 ++        urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
  48.770 ++    }
  48.771 ++#endif
  48.772 + 
  48.773 +     args[0] = '\0';
  48.774 +     if (db) {
  48.775 +@@ -182,7 +201,15 @@
  48.776 + 	return NULL;
  48.777 +     }
  48.778 + 
  48.779 ++#ifndef OPENPKG
  48.780 +     urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
  48.781 ++#else
  48.782 ++    urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
  48.783 ++    if (access(urlfn, F_OK) == -1) {
  48.784 ++        urlfn = _free(urlfn);
  48.785 ++        urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
  48.786 ++    }
  48.787 ++#endif
  48.788 + 
  48.789 +     /*@-internalglobs@*/ /* FIX: shrug */
  48.790 +     taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
  48.791 +
  48.792 ++---------------------------------------------------------------------------
  48.793 +| Not everything on a system is RPM based (for instance OpenPKG is
  48.794 +| just an add-on to the system), so do not assume we can just require
  48.795 +| a package to provide "/bin/sh".
  48.796 ++---------------------------------------------------------------------------
  48.797 +Index: build/parseScript.c
  48.798 +--- build/parseScript.c	23 Jun 2002 19:47:12 -0000	1.1.1.12
  48.799 ++++ build/parseScript.c	30 Jan 2004 17:06:29 -0000	1.3
  48.800 +@@ -261,6 +269,7 @@
  48.801 +     stripTrailingBlanksStringBuf(sb);
  48.802 +     p = getStringBuf(sb);
  48.803 + 
  48.804 ++    if (progArgv[0] != NULL && strcmp(progArgv[0], "/bin/sh") != 0)
  48.805 +     (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
  48.806 + 
  48.807 +     /* Trigger script insertion is always delayed in order to */
  48.808 +
  48.809 ++---------------------------------------------------------------------------
  48.810 +| Add support for splitted source directories, i.e., source files
  48.811 +| alternatively can be placed into the spec directory and are picked
  48.812 +| up there, too.
  48.813 ++---------------------------------------------------------------------------
  48.814 +Index: build/spec.c
  48.815 +--- build/spec.c	4 Mar 2003 15:25:51 -0000	1.1.1.21
  48.816 ++++ build/spec.c	30 Jan 2004 17:06:31 -0000	1.3
  48.817 +@@ -334,7 +337,15 @@
  48.818 + 
  48.819 +     if (tag != RPMTAG_ICON) {
  48.820 + 	/*@-nullpass@*/		/* LCL: varargs needs null annotate. */
  48.821 ++#ifndef OPENPKG
  48.822 + 	const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
  48.823 ++#else
  48.824 ++	const char *body = rpmGetPath("%{_specdir}/", p->source, NULL);
  48.825 ++    if (access(body, F_OK) == -1) {
  48.826 ++        body = _free(body);
  48.827 ++	    body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
  48.828 ++    }
  48.829 ++#endif
  48.830 + 	/*@=nullpass@*/
  48.831 + 
  48.832 + 	sprintf(buf, "%s%d",
  48.833 +
  48.834 ++---------------------------------------------------------------------------
  48.835 +| Do not build with warnings on, because we do no RPM development
  48.836 +| (so warnings are useless here), they cause some confusion inside
  48.837 +| Berkeley-DB and also slow down building. Instead, increase the
  48.838 +| optimization level. Additionally, disable static linking of RPM
  48.839 +| tools. Finally, use "shtool mkdir" as the "mkdir -p" fallback.
  48.840 ++---------------------------------------------------------------------------
  48.841 +Index: configure.ac
  48.842 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
  48.843 ++++ configure.ac	13 Sep 2006 13:39:07 -0000
  48.844 +@@ -53,7 +53,7 @@
  48.845 + AS=${AS-as}
  48.846 + AC_SUBST(AS)
  48.847 + if test "$ac_cv_prog_gcc" = yes; then
  48.848 +-    CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
  48.849 ++    CFLAGS="$CFLAGS -O2 -D_GNU_SOURCE -D_REENTRANT"
  48.850 + fi
  48.851 + export CFLAGS
  48.852 + 
  48.853 +@@ -142,6 +142,7 @@
  48.854 + 	# just link it dynamically
  48.855 + 	LDFLAGS_STATIC=""
  48.856 + fi
  48.857 ++LDFLAGS_STATIC="" # OpenPKG wants dynamically linked RPM tools
  48.858 + LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"	# libtool format
  48.859 + AC_MSG_RESULT($LDFLAGS_STATIC)
  48.860 + AC_SUBST(LDFLAGS_STATIC)
  48.861 +@@ -201,7 +202,7 @@
  48.862 + 
  48.863 + if test X"$MKDIR_P" = X0 ; then
  48.864 + 	AC_MSG_RESULT(no)
  48.865 +-	MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
  48.866 ++	MKDIR_P="@l_prefix@/lib/openpkg/shtool mkdir -f -p -m 755"
  48.867 + else
  48.868 + 	AC_MSG_RESULT(yes)
  48.869 + fi
  48.870 +
  48.871 ++---------------------------------------------------------------------------
  48.872 +| Disable the use of the internal zlib library, because
  48.873 +| we build against an external one.
  48.874 ++---------------------------------------------------------------------------
  48.875 +Index: configure.ac
  48.876 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
  48.877 ++++ configure.ac	13 Sep 2006 13:39:09 -0000
  48.878 +@@ -310,7 +311,7 @@
  48.879 + WITH_ZLIB_SUBDIR=
  48.880 + WITH_ZLIB_INCLUDE=
  48.881 + WITH_ZLIB_LIB=
  48.882 +-if test -d zlib ; then
  48.883 ++if false; then
  48.884 +   WITH_ZLIB_SUBDIR=zlib
  48.885 +   addlib \${top_builddir}/zlib
  48.886 +   WITH_ZLIB_INCLUDE="-I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
  48.887 +
  48.888 ++---------------------------------------------------------------------------
  48.889 +| Disable unnecessary INCPATH checks, because in OpenPKG the
  48.890 +| externally used libraries are all explicitly given. And they just
  48.891 +| would make RPM pick up things which we do not want to be picked up.
  48.892 ++---------------------------------------------------------------------------
  48.893 +Index: configure.ac
  48.894 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
  48.895 ++++ configure.ac	13 Sep 2006 13:39:11 -0000
  48.896 +@@ -324,38 +325,38 @@
  48.897 + 
  48.898 + localdone=
  48.899 + 
  48.900 +-dirs=$prefix
  48.901 +-if test "$cross_compiling" != "yes"; then
  48.902 +-  dirs="$dirs /usr/local"
  48.903 +-fi
  48.904 +-for dir in $dirs
  48.905 +-do
  48.906 +-	case $dir in
  48.907 +-	NONE|/usr)	continue;;
  48.908 +-	/usr/local)
  48.909 +-		if test X$localdone != X ; then continue; fi
  48.910 +-		localdone="$dir"
  48.911 +-		;;
  48.912 +-	esac
  48.913 +-
  48.914 +-	AC_MSG_CHECKING(for $dir/lib in LIBS)
  48.915 +-	if test -d $dir/lib 2> /dev/null ; then
  48.916 +-		addlib $dir/lib
  48.917 +-		AC_MSG_RESULT(yes)
  48.918 +-	else
  48.919 +-		AC_MSG_RESULT(no)
  48.920 +-	fi
  48.921 +-
  48.922 +-	AC_MSG_CHECKING(for $dir/include in INCPATH)
  48.923 +-	if test -d $dir/include 2>/dev/null ; then
  48.924 +-		if [ "$dir" != "/usr/local" ] ; then
  48.925 +-		    INCPATH="$INCPATH -I$dir/include"
  48.926 +-		fi
  48.927 +-		AC_MSG_RESULT(yes)
  48.928 +-	else
  48.929 +-		AC_MSG_RESULT(no)
  48.930 +-	fi
  48.931 +-done
  48.932 ++dnl dirs=$prefix
  48.933 ++dnl if test "$cross_compiling" != "yes"; then
  48.934 ++dnl   dirs="$dirs /usr/local"
  48.935 ++dnl fi
  48.936 ++dnl for dir in $dirs
  48.937 ++dnl do
  48.938 ++dnl 	case $dir in
  48.939 ++dnl 	NONE|/usr)	continue;;
  48.940 ++dnl 	/usr/local)
  48.941 ++dnl 		if test X$localdone != X ; then continue; fi
  48.942 ++dnl 		localdone="$dir"
  48.943 ++dnl 		;;
  48.944 ++dnl 	esac
  48.945 ++dnl 
  48.946 ++dnl 	AC_MSG_CHECKING(for $dir/lib in LIBS)
  48.947 ++dnl 	if test -d $dir/lib 2> /dev/null ; then
  48.948 ++dnl 		addlib $dir/lib
  48.949 ++dnl 		AC_MSG_RESULT(yes)
  48.950 ++dnl 	else
  48.951 ++dnl 		AC_MSG_RESULT(no)
  48.952 ++dnl 	fi
  48.953 ++dnl 
  48.954 ++dnl 	AC_MSG_CHECKING(for $dir/include in INCPATH)
  48.955 ++dnl 	if test -d $dir/include 2>/dev/null ; then
  48.956 ++dnl 		if test "$dir" != "/usr/local"; then
  48.957 ++dnl 		    INCPATH="$INCPATH -I$dir/include"
  48.958 ++dnl 		fi
  48.959 ++dnl 		AC_MSG_RESULT(yes)
  48.960 ++dnl 	else
  48.961 ++dnl 		AC_MSG_RESULT(no)
  48.962 ++dnl 	fi
  48.963 ++dnl done
  48.964 + 
  48.965 + AC_MSG_CHECKING(for /usr/ucblib in LIBS)
  48.966 + if test -d /usr/ucblib ; then
  48.967 +
  48.968 ++---------------------------------------------------------------------------
  48.969 +| Adjust paths for OpenPKG filesystem layout.
  48.970 ++---------------------------------------------------------------------------
  48.971 +Index: configure.ac
  48.972 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
  48.973 ++++ configure.ac	13 Sep 2006 13:39:12 -0000
  48.974 +@@ -1200,12 +1202,12 @@
  48.975 + AC_SUBST(LOCALEDIR)
  48.976 + LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
  48.977 + AC_SUBST(LIBDIR)
  48.978 +-RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
  48.979 ++RPMCONFIGDIR="@l_prefix@/lib/openpkg"
  48.980 + AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR",
  48.981 + 	[Full path to rpm global configuration directory (usually /usr/lib/rpm)])
  48.982 + AC_SUBST(RPMCONFIGDIR)
  48.983 + 
  48.984 +-SYSCONFIGDIR="`echo /etc/rpm`"
  48.985 ++SYSCONFIGDIR="@l_prefix@/etc/openpkg"
  48.986 + AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR",
  48.987 + 	[Full path to rpm system configuration directory (usually /etc/rpm)])
  48.988 + AC_SUBST(SYSCONFIGDIR)
  48.989 +@@ -1215,17 +1217,17 @@
  48.990 + 	[Colon separated paths of macro files to read.])
  48.991 + AC_SUBST(MACROFILES)
  48.992 + 
  48.993 +-LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
  48.994 ++LIBRPMRC_FILENAME="${SYSCONFIGDIR}/rpmrc"
  48.995 + AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME",
  48.996 + 	[Full path to rpmrc configuration file (usually /usr/lib/rpm/rpmrc)])
  48.997 + AC_SUBST(LIBRPMRC_FILENAME)
  48.998 + 
  48.999 +-VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
 48.1000 ++VENDORRPMRC_FILENAME="${SYSCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
 48.1001 + AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME",
 48.1002 +        [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)])
 48.1003 + AC_SUBST(VENDORRPMRC_FILENAME)
 48.1004 + 
 48.1005 +-LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
 48.1006 ++LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
 48.1007 + AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME",
 48.1008 + 	[Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)])
 48.1009 + AC_SUBST(LIBRPMALIAS_FILENAME)
 48.1010 +
 48.1011 ++---------------------------------------------------------------------------
 48.1012 +| If running as "susr", do not unpack source RPM packages with "susr"
 48.1013 +| file ownerships as the OpenPKG Set-UID wrapper switches from "musr"
 48.1014 +| to "susr" on "openpkg rpm -Uvh *.src.rpm". As a result the installed
 48.1015 +| files could be never removed again by "musr". It is more consistent
 48.1016 +| to always unpack as "musr" if possible.
 48.1017 ++---------------------------------------------------------------------------
 48.1018 +Index: lib/psm.c
 48.1019 +--- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
 48.1020 ++++ lib/psm.c	13 Sep 2006 13:39:15 -0000
 48.1021 +@@ -314,6 +314,20 @@
 48.1022 + 
 48.1023 +     fi->uid = getuid();
 48.1024 +     fi->gid = getgid();
 48.1025 ++#ifdef OPENPKG
 48.1026 ++    if (fi->uid == 0) {
 48.1027 ++        char *muid_str;
 48.1028 ++        char *mgid_str;
 48.1029 ++        uid_t *muid;
 48.1030 ++        gid_t *mgid;
 48.1031 ++        if ((muid_str = rpmExpand("%{l_muid}", NULL)) != NULL)
 48.1032 ++            if ((muid = (uid_t)strtol(muid_str, (char **)NULL, 10)) > 0)
 48.1033 ++                fi->uid = muid;
 48.1034 ++        if ((mgid_str = rpmExpand("%{l_mgid}", NULL)) != NULL)
 48.1035 ++            if ((mgid = (gid_t)strtol(mgid_str, (char **)NULL, 10)) > 0)
 48.1036 ++                fi->gid = mgid;
 48.1037 ++    }
 48.1038 ++#endif
 48.1039 +     fi->astriplen = 0;
 48.1040 +     fi->striplen = 0;
 48.1041 + 
 48.1042 +@@ -352,6 +366,9 @@
 48.1043 + 	rpmrc = RPMRC_FAIL;
 48.1044 + 	goto exit;
 48.1045 +     }
 48.1046 ++#ifdef OPENPKG
 48.1047 ++    chown(_sourcedir, fi->uid, fi->gid);
 48.1048 ++#endif
 48.1049 + 
 48.1050 +     _specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
 48.1051 +     rpmrc = rpmMkdirPath(_specdir, "specdir");
 48.1052 +@@ -359,6 +376,9 @@
 48.1053 + 	rpmrc = RPMRC_FAIL;
 48.1054 + 	goto exit;
 48.1055 +     }
 48.1056 ++#ifdef OPENPKG
 48.1057 ++    chown(_specdir, fi->uid, fi->gid);
 48.1058 ++#endif
 48.1059 + 
 48.1060 +     /* Build dnl/dil with {_sourcedir, _specdir} as values. */
 48.1061 +     if (i < fi->fc) {
 48.1062 +
 48.1063 ++---------------------------------------------------------------------------
 48.1064 +| RPM has two platform id canonicalizations: hard-coded ones in
 48.1065 +| the "rpm" program and defined ones in the rpmrc files. The
 48.1066 +| hard-coded ones make the defined ones inconsistent. Additionally,
 48.1067 +| in OpenPKG we know exactly what we do. So, disable the hard-coded
 48.1068 +| canonicalizations and use only the defined ones. The only thing we
 48.1069 +| do inside RPM is to reduce the platform version to major and minor
 48.1070 +| version numbers in order to simplify the "rpmrc" files. Then, RPM
 48.1071 +| allows to read the platform from an external program. Adjust the
 48.1072 +| hard-coded path to this program and allow it to be overridden with
 48.1073 +| the macro %{__platform}. Finally, change the default definition of
 48.1074 +| %{_host} to not contain the vendor stuff to more conform to what
 48.1075 +| %{_target} usually is defined to and what we are using throughout
 48.1076 +| OpenPKG, too.
 48.1077 ++---------------------------------------------------------------------------
 48.1078 +Index: lib/rpmrc.c
 48.1079 +--- lib/rpmrc.c	4 Jun 2003 18:18:45 -0000	1.1.1.25
 48.1080 ++++ lib/rpmrc.c	6 Jun 2005 15:53:06 -0000	1.3
 48.1081 +@@ -27,7 +27,7 @@
 48.1082 + const char * macrofiles = MACROFILES;
 48.1083 + 
 48.1084 + /*@observer@*/ /*@unchecked@*/
 48.1085 +-static const char * platform = "/etc/rpm/platform";
 48.1086 ++static const char * platform = "@l_prefix@/etc/openpkg/platform";
 48.1087 + /*@only@*/ /*@relnull@*/ /*@unchecked@*/
 48.1088 + static const char ** platpat = NULL;
 48.1089 + /*@unchecked@*/
 48.1090 +@@ -861,7 +861,11 @@
 48.1091 + 
 48.1092 + 	platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat));
 48.1093 + /*@-onlyunqglobaltrans@*/
 48.1094 ++#ifdef OPENPKG
 48.1095 ++	platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_os}", NULL);
 48.1096 ++#else
 48.1097 + 	platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_vendor}-%{_host_os}", (gnu && *gnu ? "-" : NULL), gnu, NULL);
 48.1098 ++#endif
 48.1099 + 	nplatpat++;
 48.1100 + 	platpat[nplatpat] = NULL;
 48.1101 + /*@=onlyunqglobaltrans@*/
 48.1102 +@@ -1055,14 +1059,35 @@
 48.1103 + 	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
 48.1104 + 	/*@modifies *arch, *os, rpmGlobalMacroContext, fileSystem, internalState @*/
 48.1105 + {
 48.1106 ++#ifdef OPENPKG
 48.1107 ++    static struct utsname un_real;
 48.1108 ++    /* utsname fields on some platforms (like HP-UX) are very small
 48.1109 ++       (about 8 characters). This is too small for OpenPKG, so cheat! */
 48.1110 ++    static struct {
 48.1111 ++        char sysname[32];
 48.1112 ++        char nodename[32];
 48.1113 ++        char release[32];
 48.1114 ++        char version[32];
 48.1115 ++        char machine[32];
 48.1116 ++    } un;
 48.1117 ++#else
 48.1118 +     static struct utsname un;
 48.1119 ++#endif
 48.1120 +     static int gotDefaults = 0;
 48.1121 +     char * chptr;
 48.1122 +     canonEntry canon;
 48.1123 +     int rc;
 48.1124 + 
 48.1125 +     while (!gotDefaults) {
 48.1126 ++#ifdef OPENPKG
 48.1127 ++	const char *cp;
 48.1128 ++	cp = rpmExpand("%{?__platform}", NULL);
 48.1129 ++    if (cp == NULL || cp[0] == '\0')
 48.1130 ++	    cp = platform;
 48.1131 ++	if (!rpmPlatform(cp)) {
 48.1132 ++#else
 48.1133 + 	if (!rpmPlatform(platform)) {
 48.1134 ++#endif
 48.1135 + 	    const char * s;
 48.1136 + 	    s = rpmExpand("%{_host_cpu}", NULL);
 48.1137 + 	    if (s) {
 48.1138 +@@ -1079,9 +1104,44 @@
 48.1139 + 	    gotDefaults = 1;
 48.1140 + 	    break;
 48.1141 + 	}
 48.1142 ++#ifdef OPENPKG
 48.1143 ++	rc = uname(&un_real);
 48.1144 ++        strncpy(un.sysname,  un_real.sysname,  sizeof(un.sysname));  un.sysname [sizeof(un.sysname)-1]  = '\0';
 48.1145 ++        strncpy(un.nodename, un_real.nodename, sizeof(un.nodename)); un.nodename[sizeof(un.nodename)-1] = '\0';
 48.1146 ++        strncpy(un.release,  un_real.release,  sizeof(un.release));  un.release [sizeof(un.release)-1]  = '\0';
 48.1147 ++        strncpy(un.version,  un_real.version,  sizeof(un.version));  un.version [sizeof(un.version)-1]  = '\0';
 48.1148 ++        strncpy(un.machine,  un_real.machine,  sizeof(un.machine));  un.machine [sizeof(un.machine)-1]  = '\0';
 48.1149 ++#else
 48.1150 + 	rc = uname(&un);
 48.1151 ++#endif
 48.1152 + 	if (rc < 0) return;
 48.1153 + 
 48.1154 ++#ifdef OPENPKG
 48.1155 ++    {
 48.1156 ++        char *cp;
 48.1157 ++        char *cpR;
 48.1158 ++        int n;
 48.1159 ++        cpR = un.release;
 48.1160 ++        if ((n = strcspn(cpR, "0123456789")) > 0)
 48.1161 ++            cpR += n;
 48.1162 ++        if ((n = strspn(cpR, "0123456789.")) > 0) {
 48.1163 ++            /* terminate after "N.N.N...." prefix */
 48.1164 ++            cpR[n] = '\0';
 48.1165 ++            /* shorten to "N.N" if longer */
 48.1166 ++            if ((cp = strchr(cpR, '.')) != NULL) {
 48.1167 ++                if ((cp = strchr(cp+1, '.')) != NULL)
 48.1168 ++                    *cp = '\0';
 48.1169 ++            }
 48.1170 ++            strcat(un.sysname, cpR);
 48.1171 ++        }
 48.1172 ++        /* fix up machine hardware name containing white-space as it
 48.1173 ++         * happens to be on Power Macs running MacOS X
 48.1174 ++         */
 48.1175 ++        if (!strncmp(un.machine, "Power Macintosh", 15)) {
 48.1176 ++            sprintf(un.machine, "powerpc");
 48.1177 ++        }
 48.1178 ++    }
 48.1179 ++#else /* OPENPKG */
 48.1180 + #if !defined(__linux__)
 48.1181 + #ifdef SNI
 48.1182 + 	/* USUALLY un.sysname on sinix does start with the word "SINIX"
 48.1183 +@@ -1298,6 +1358,7 @@
 48.1184 + 	    }
 48.1185 + 	}
 48.1186 + #	endif
 48.1187 ++#endif /* OPENPKG */
 48.1188 + 
 48.1189 + 	/* the uname() result goes through the arch_canon table */
 48.1190 + 	canon = lookupInCanonTable(un.machine,
 48.1191 +
 48.1192 ++---------------------------------------------------------------------------
 48.1193 +| In verbose file listing output, give the owner and group fields more
 48.1194 +| width and at the same time reduce the nlink and size fields to more
 48.1195 +| typical sizes within OpenPKG.
 48.1196 ++---------------------------------------------------------------------------
 48.1197 +Index: lib/query.c
 48.1198 +--- lib/query.c	4 Jun 2003 18:24:14 -0000	1.1.1.13
 48.1199 ++++ lib/query.c	22 Jan 2004 21:42:24 -0000	1.2
 48.1200 +@@ -33,7 +33,11 @@
 48.1201 + 	/*@modifies *te @*/
 48.1202 + {
 48.1203 +     char sizefield[15];
 48.1204 ++#ifdef OPENPKG
 48.1205 ++    char ownerfield[13+1], groupfield[13+1];
 48.1206 ++#else
 48.1207 +     char ownerfield[8+1], groupfield[8+1];
 48.1208 ++#endif
 48.1209 +     char timefield[100];
 48.1210 +     time_t when = mtime;  /* important if sizeof(int_32) ! sizeof(time_t) */
 48.1211 +     struct tm * tm;
 48.1212 +@@ -58,7 +62,11 @@
 48.1213 +     groupfield[sizeof(groupfield)-1] = '\0';
 48.1214 + 
 48.1215 +     /* this is normally right */
 48.1216 ++#ifdef OPENPKG
 48.1217 ++    sprintf(sizefield, "%8u", size);
 48.1218 ++#else
 48.1219 +     sprintf(sizefield, "%12u", size);
 48.1220 ++#endif
 48.1221 + 
 48.1222 +     /* this knows too much about dev_t */
 48.1223 + 
 48.1224 +@@ -98,7 +106,11 @@
 48.1225 + 	(void)strftime(timefield, sizeof(timefield) - 1, fmt, tm);
 48.1226 +     }
 48.1227 + 
 48.1228 ++#ifdef OPENPKG
 48.1229 ++    sprintf(te, "%s %d %-13s %-13s %8s %s %s", perms,
 48.1230 ++#else
 48.1231 +     sprintf(te, "%s %4d %-8s%-8s %10s %s %s", perms,
 48.1232 ++#endif
 48.1233 + 	(int)nlink, ownerfield, groupfield, sizefield, timefield, namefield);
 48.1234 +     perms = _free(perms);
 48.1235 + }
 48.1236 +
 48.1237 ++---------------------------------------------------------------------------
 48.1238 +| Enable the exlusion of "%doc" files by default.
 48.1239 +| Disable "check-files" feature, because it is useless in OpenPKG
 48.1240 +| (we consistently use BuildRoot and our %files lists are fully
 48.1241 +| autogenerated) and just makes problems on bootstrapping.
 48.1242 +| Provide the possibility to optionally re-enable the old
 48.1243 +| RPM 4.0.2 way of RPM database operation by defining the
 48.1244 +| macro %{_rpmdb_private}. This is important for easily fixing
 48.1245 +| corrupted/hanging RPM database (on upgrades, etc) or if you
 48.1246 +| permanently have to operate RPM on a NFS filesystem where no
 48.1247 +| rpc.lockd(8) support is available.
 48.1248 +| Additionally, do not override the "_host_xx" macros because their
 48.1249 +| value (derived from <prefix>/etc/openpkg/platform) is already
 48.1250 +| correctly set internally.
 48.1251 +| Additionally, provide default macros for the %track and %test
 48.1252 +| section expansion.
 48.1253 +| Finally, provide default for introduced variable
 48.1254 +| %{_force_oldpackage}, which, if non-zero, automatically enforces
 48.1255 +| --oldpackage on all upgrade operations (this is useful on
 48.1256 +| mass-upgrades from OpenPKG-CURRENT to OpenPKG-RELEASE).
 48.1257 ++---------------------------------------------------------------------------
 48.1258 +Index: macros.in
 48.1259 +--- macros.in	2 Jul 2003 19:20:52 -0000	1.1.1.14
 48.1260 ++++ macros.in	30 Jan 2004 17:06:27 -0000	1.3
 48.1261 +@@ -1,7 +1,7 @@
 48.1262 + #/*! \page config_macros Default configuration: @RPMCONFIGDIR@/macros
 48.1263 + # \verbatim
 48.1264 + #
 48.1265 +-# $Id: macros.in,v 1.138.2.1 2003/07/02 19:14:06 jbj Exp $
 48.1266 ++# $Id: macros.in,v 1.2 2004/01/22 21:42:09 rse Exp $
 48.1267 + #
 48.1268 + # This is a global RPM configuration file. All changes made here will
 48.1269 + # be lost when the rpm package is upgraded. Any per-system configuration
 48.1270 +@@ -206,7 +206,7 @@
 48.1271 + 
 48.1272 + #	Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
 48.1273 + #	marked as %doc should be installed.
 48.1274 +-#%_excludedocs
 48.1275 ++%_excludedocs 1
 48.1276 + 
 48.1277 + #	The port and machine name of a FTP proxy host running TIS firewall.
 48.1278 + #
 48.1279 +@@ -305,7 +305,7 @@
 48.1280 + # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
 48.1281 + #
 48.1282 + # Note: Disable (by commenting out) for legacy compatibility.
 48.1283 +-%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
 48.1284 ++#%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
 48.1285 + 
 48.1286 + #
 48.1287 + # Should unpackaged files in a build root terminate a build?
 48.1288 +@@ -449,7 +449,7 @@
 48.1289 + 
 48.1290 + # Use a CDB database model for concurrent access.
 48.1291 + # XXX Add "private" here for legacy interoperation transiting to glibc+nptl.
 48.1292 +-%__dbi_cdb			create cdb mpool mp_mmapsize=16Mb mp_size=1Mb
 48.1293 ++%__dbi_cdb			create cdb mpool mp_mmapsize=16Mb mp_size=1Mb %{?_rpmdb_private:private}
 48.1294 + 
 48.1295 + %__dbi_other			%{?_tmppath:tmpdir=%{_tmppath}} %{?__dbi_cdb}
 48.1296 + 
 48.1297 +@@ -618,6 +618,10 @@
 48.1298 + #	If non-zero, all erasures will be automagically repackaged.
 48.1299 + %_repackage_all_erasures	0
 48.1300 + 
 48.1301 ++#   If non-zero, automatically enforce --oldpackage for all upgrade operations
 48.1302 ++#   (useful on mass-upgrades from OpenPKG-CURRENT to OpenPKG-RELEASE)
 48.1303 ++%_force_oldpackage          0
 48.1304 ++
 48.1305 + #	Verify digest/signature flags for various rpm modes:
 48.1306 + #	     1	--nohdrchk	if set, don't check rpmdb headers
 48.1307 + #
 48.1308 +@@ -870,6 +874,26 @@
 48.1309 + #%{__spec_clean_post}\
 48.1310 + #%{nil}
 48.1311 + 
 48.1312 ++%__spec_track_shell    %{___build_shell}
 48.1313 ++%__spec_track_args     %{___build_args}
 48.1314 ++%__spec_track_cmd      %{___build_cmd}
 48.1315 ++%__spec_track_pre      %{___build_pre}
 48.1316 ++%__spec_track_body     %{___build_body}
 48.1317 ++%__spec_track_post     %{___build_post}
 48.1318 ++%__spec_track_template #!%{__spec_track_shell}\
 48.1319 ++%{__spec_track_pre}\
 48.1320 ++%{nil}
 48.1321 ++
 48.1322 ++%__spec_test_shell    %{___build_shell}
 48.1323 ++%__spec_test_args     %{___build_args}
 48.1324 ++%__spec_test_cmd      %{___build_cmd}
 48.1325 ++%__spec_test_pre      %{___build_pre}
 48.1326 ++%__spec_test_body     %{___build_body}
 48.1327 ++%__spec_test_post     %{___build_post}
 48.1328 ++%__spec_test_template #!%{__spec_test_shell}\
 48.1329 ++%{__spec_test_pre}\
 48.1330 ++%{nil}
 48.1331 ++
 48.1332 + %__spec_rmbuild_shell	%{___build_shell}
 48.1333 + %__spec_rmbuild_args	%{___build_args}
 48.1334 + %__spec_rmbuild_cmd	%{___build_cmd}
 48.1335 +@@ -929,11 +953,11 @@
 48.1336 + %_build_cpu		%{_host_cpu}
 48.1337 + %_build_vendor		%{_host_vendor}
 48.1338 + %_build_os		%{_host_os}
 48.1339 +-%_host			@host@
 48.1340 +-%_host_alias		@host_alias@%{nil}
 48.1341 +-%_host_cpu		@host_cpu@
 48.1342 +-%_host_vendor		@host_vendor@
 48.1343 +-%_host_os		@host_os@
 48.1344 ++#%_host			@host@
 48.1345 ++#%_host_alias		@host_alias@%{nil}
 48.1346 ++#%_host_cpu		@host_cpu@
 48.1347 ++#%_host_vendor		@host_vendor@
 48.1348 ++#%_host_os		@host_os@
 48.1349 + %_target		%{_host}
 48.1350 + %_target_alias		%{_host_alias}
 48.1351 + %_target_cpu		%{_host_cpu}
 48.1352 +
 48.1353 ++---------------------------------------------------------------------------
 48.1354 +| Adjust path for OpenPKG filesystem layout.
 48.1355 ++---------------------------------------------------------------------------
 48.1356 +Index: scripts/Makefile.am
 48.1357 +--- scripts/Makefile.am	20 Jun 2003 19:04:49 -0000	1.1.1.11
 48.1358 ++++ scripts/Makefile.am	22 Jan 2004 21:42:34 -0000	1.2
 48.1359 +@@ -22,7 +22,7 @@
 48.1360 + 
 48.1361 + all:
 48.1362 + 
 48.1363 +-configdir = ${prefix}/lib/rpm
 48.1364 ++configdir = ${prefix}/lib/openpkg
 48.1365 + config_SCRIPTS = \
 48.1366 + 	brp-compress brp-python-bytecompile brp-redhat \
 48.1367 + 	brp-strip brp-strip-comment-note \
 48.1368 +
 48.1369 ++---------------------------------------------------------------------------
 48.1370 +| Adjust path for OpenPKG filesystem layout.
 48.1371 ++---------------------------------------------------------------------------
 48.1372 +Index: scripts/Makefile.in
 48.1373 +--- scripts/Makefile.in	16 Jul 2003 17:05:49 -0000	1.1.1.14
 48.1374 ++++ scripts/Makefile.in	22 Jan 2004 21:42:34 -0000	1.2
 48.1375 +@@ -273,7 +273,7 @@
 48.1376 + 
 48.1377 + installprefix = $(DESTDIR)
 48.1378 + 
 48.1379 +-configdir = ${prefix}/lib/rpm
 48.1380 ++configdir = ${prefix}/lib/openpkg
 48.1381 + config_SCRIPTS = \
 48.1382 + 	brp-compress brp-python-bytecompile brp-redhat \
 48.1383 + 	brp-strip brp-strip-comment-note \
 48.1384 +
 48.1385 ++---------------------------------------------------------------------------
 48.1386 +| Use GNU libtool's weaker -static (link with own static libraries)
 48.1387 +| instead of the strong -all-static (link even with static libc, etc),
 48.1388 +| because OpenPKG does not need to be fully static.
 48.1389 +| Additionally, adjust the path to file(1)'s "magic" file.
 48.1390 ++---------------------------------------------------------------------------
 48.1391 +Index: file/Makefile.am
 48.1392 +--- file/Makefile.am	24 Jan 2003 19:41:56 -0000	1.1.1.1
 48.1393 ++++ file/Makefile.am	22 Jan 2004 21:42:21 -0000	1.2
 48.1394 +@@ -36,7 +36,7 @@
 48.1395 + #MAGIC	 = @datadir@/magic
 48.1396 + #data_DATA = magic magic.mime magic.mgc magic.mime.mgc
 48.1397 + 
 48.1398 +-pkglibdir =  @prefix@/lib/rpm
 48.1399 ++pkglibdir =  @prefix@/lib/openpkg
 48.1400 + pkglib_DATA = magic magic.mime magic.mgc magic.mime.mgc
 48.1401 + MAGIC	 = $(pkglibdir)/magic
 48.1402 + CPPFLAGS = -DMAGIC='"$(MAGIC)"'
 48.1403 +
 48.1404 ++---------------------------------------------------------------------------
 48.1405 +| Use GNU libtool's weaker -static (link with own static libraries)
 48.1406 +| instead of the strong -all-static (link even with static libc, etc),
 48.1407 +| because OpenPKG does not need to be fully static.
 48.1408 +| Additionally, adjust the path to file(1)'s "magic" file.
 48.1409 ++---------------------------------------------------------------------------
 48.1410 +Index: file/Makefile.in
 48.1411 +--- file/Makefile.in	16 Jul 2003 17:05:23 -0000	1.1.1.2
 48.1412 ++++ file/Makefile.in	22 Jan 2004 21:42:22 -0000	1.2
 48.1413 +@@ -39,7 +39,7 @@
 48.1414 + 
 48.1415 + #MAGIC	 = @datadir@/magic
 48.1416 + #data_DATA = magic magic.mime magic.mgc magic.mime.mgc
 48.1417 +-pkglibdir = @prefix@/lib/rpm
 48.1418 ++pkglibdir = @prefix@/lib/openpkg
 48.1419 + ACLOCAL = @ACLOCAL@
 48.1420 + AMDEP_FALSE = @AMDEP_FALSE@
 48.1421 + AMDEP_TRUE = @AMDEP_TRUE@
 48.1422 +@@ -159,7 +159,7 @@
 48.1423 + noinst_PROGRAMS = file
 48.1424 + 
 48.1425 + file_SOURCES = file.c
 48.1426 +-file_LDFLAGS = -all-static
 48.1427 ++file_LDFLAGS = -static
 48.1428 + file_LDADD = libfmagic.la
 48.1429 + 
 48.1430 + man_MAGIC = magic.@fsect@
 48.1431 +
 48.1432 ++---------------------------------------------------------------------------
 48.1433 +| Use GNU libtool's weaker -static (link with own static libraries)
 48.1434 +| instead of the strong -all-static (link even with static libc, etc),
 48.1435 +| because OpenPKG does not need to be fully static.
 48.1436 +| Additionally, disable the building of gettext stuff we don't need.
 48.1437 ++---------------------------------------------------------------------------
 48.1438 +Index: popt/Makefile.am
 48.1439 +--- popt/Makefile.am	6 Mar 2003 23:16:43 -0000	1.1.1.9
 48.1440 ++++ popt/Makefile.am	22 Jan 2004 21:42:28 -0000	1.2
 48.1441 +@@ -9,7 +9,7 @@
 48.1442 + 	po/*.in po/*.po po/popt.pot \
 48.1443 + 	popt.ps
 48.1444 + 
 48.1445 +-SUBDIRS = intl po
 48.1446 ++SUBDIRS = intl
 48.1447 + 
 48.1448 + INCLUDES = -I. -I$(top_srcdir)
 48.1449 + 
 48.1450 +@@ -17,13 +17,13 @@
 48.1451 + 
 48.1452 + noinst_PROGRAMS = test1 test2 test3
 48.1453 + test1_SOURCES = test1.c
 48.1454 +-test1_LDFLAGS = -all-static
 48.1455 ++test1_LDFLAGS = -static
 48.1456 + test1_LDADD = $(usrlib_LTLIBRARIES)
 48.1457 + test2_SOURCES = test2.c
 48.1458 +-test2_LDFLAGS = -all-static
 48.1459 ++test2_LDFLAGS = -static
 48.1460 + test2_LDADD = $(usrlib_LTLIBRARIES)
 48.1461 + test3_SOURCES = test3.c
 48.1462 +-test3_LDFLAGS = -all-static
 48.1463 ++test3_LDFLAGS = -static
 48.1464 + test3_LDADD = $(usrlib_LTLIBRARIES)
 48.1465 + 
 48.1466 + noinst_SCRIPTS = testit.sh
 48.1467 +
 48.1468 ++---------------------------------------------------------------------------
 48.1469 +| Use GNU libtool's weaker -static (link with own static libraries)
 48.1470 +| instead of the strong -all-static (link even with static libc, etc),
 48.1471 +| because OpenPKG does not need to be fully static.
 48.1472 +| Additionally, disable the building of gettext stuff we don't need.
 48.1473 ++---------------------------------------------------------------------------
 48.1474 +Index: popt/Makefile.in
 48.1475 +--- popt/Makefile.in	16 Jul 2003 17:04:49 -0000	1.1.1.14
 48.1476 ++++ popt/Makefile.in	22 Jan 2004 21:42:28 -0000	1.2
 48.1477 +@@ -163,7 +163,7 @@
 48.1478 + 	popt.ps
 48.1479 + 
 48.1480 + 
 48.1481 +-SUBDIRS = intl po
 48.1482 ++SUBDIRS = intl
 48.1483 + 
 48.1484 + INCLUDES = -I. -I$(top_srcdir)
 48.1485 + 
 48.1486 +@@ -171,13 +171,13 @@
 48.1487 + 
 48.1488 + noinst_PROGRAMS = test1 test2 test3
 48.1489 + test1_SOURCES = test1.c
 48.1490 +-test1_LDFLAGS = -all-static
 48.1491 ++test1_LDFLAGS = -static
 48.1492 + test1_LDADD = $(usrlib_LTLIBRARIES)
 48.1493 + test2_SOURCES = test2.c
 48.1494 +-test2_LDFLAGS = -all-static
 48.1495 ++test2_LDFLAGS = -static
 48.1496 + test2_LDADD = $(usrlib_LTLIBRARIES)
 48.1497 + test3_SOURCES = test3.c
 48.1498 +-test3_LDFLAGS = -all-static
 48.1499 ++test3_LDFLAGS = -static
 48.1500 + test3_LDADD = $(usrlib_LTLIBRARIES)
 48.1501 + 
 48.1502 + noinst_SCRIPTS = testit.sh
 48.1503 +
 48.1504 ++---------------------------------------------------------------------------
 48.1505 +| Revert back to the old behaviour of passing to "exec" programs an
 48.1506 +| extra "--" argument to separate options and arguments. Additionally,
 48.1507 +| allow the "!#:+" constructs to be used multiple times and then each
 48.1508 +| time eat another argument (instead of just eating an argument once
 48.1509 +| and expanding this multiple times).
 48.1510 ++---------------------------------------------------------------------------
 48.1511 +Index: popt/popt.c
 48.1512 +--- popt/popt.c	22 Aug 2002 14:17:44 -0000	1.1.1.12
 48.1513 ++++ popt/popt.c	22 Jan 2004 21:42:28 -0000	1.2
 48.1514 +@@ -400,9 +400,7 @@
 48.1515 +     }
 48.1516 + 
 48.1517 +     if (con->leftovers != NULL && con->numLeftovers > 0) {
 48.1518 +-#if 0
 48.1519 + 	argv[argc++] = "--";
 48.1520 +-#endif
 48.1521 + 	memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers);
 48.1522 + 	argc += con->numLeftovers;
 48.1523 +     }
 48.1524 +@@ -580,10 +578,8 @@
 48.1525 + 	    if (!(s[0] == '#' && s[1] == ':' && s[2] == '+'))
 48.1526 + 		/*@switchbreak@*/ break;
 48.1527 + 	    /* XXX Make sure that findNextArg deletes only next arg. */
 48.1528 +-	    if (a == NULL) {
 48.1529 + 		if ((a = findNextArg(con, 1, 1)) == NULL)
 48.1530 + 		    /*@switchbreak@*/ break;
 48.1531 +-	    }
 48.1532 + 	    s += 3;
 48.1533 + 
 48.1534 + 	    alen = strlen(a);
 48.1535 +
 48.1536 ++---------------------------------------------------------------------------
 48.1537 +| Dedefine the stdio variable BUFSIZ because it is usually just 1024
 48.1538 +| on some platforms (on Linux it is 8192) and unfortunately RPM uses
 48.1539 +| it here for the macro expansion buffer. For OpenPKG the size 1024 is
 48.1540 +| definetely too small. So increase this to a 16KB buffer.
 48.1541 ++---------------------------------------------------------------------------
 48.1542 +Index: rpmio/macro.c
 48.1543 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
 48.1544 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
 48.1545 +@@ -50,6 +50,9 @@
 48.1546 + 
 48.1547 + #include "debug.h"
 48.1548 + 
 48.1549 ++#undef  BUFSIZ
 48.1550 ++#define BUFSIZ 16384
 48.1551 ++
 48.1552 + #if defined(__LCLINT__)
 48.1553 + /*@-exportheader@*/
 48.1554 + extern const unsigned short int **__ctype_b_loc (void) /*@*/;
 48.1555 +
 48.1556 ++---------------------------------------------------------------------------
 48.1557 +| Remove "unzip" support, because in OpenPKG there are less than
 48.1558 +| a dozend packages requiring unpacking of .zip files. For these
 48.1559 +| it is fully sufficient to explicitly require the "infozip"
 48.1560 +| package (containing "unzip") and leaving the less portable
 48.1561 +| "unzip" out of the bootstrap package.
 48.1562 ++---------------------------------------------------------------------------
 48.1563 +Index: rpmio/macro.c
 48.1564 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
 48.1565 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
 48.1566 +@@ -1114,9 +1119,11 @@
 48.1567 + 	case 2:	/* COMPRESSED_BZIP2 */
 48.1568 + 	    sprintf(be, "%%_bzip2 %s", b);
 48.1569 + 	    break;
 48.1570 ++#if 0
 48.1571 + 	case 3:	/* COMPRESSED_ZIP */
 48.1572 + 	    sprintf(be, "%%_unzip %s", b);
 48.1573 + 	    break;
 48.1574 ++#endif
 48.1575 + 	}
 48.1576 + 	b = be;
 48.1577 +     } else if (STREQ("S", f, fn)) {
 48.1578 +@@ -1717,9 +1725,11 @@
 48.1579 + 
 48.1580 +     if ((magic[0] == 'B') && (magic[1] == 'Z')) {
 48.1581 + 	*compressed = COMPRESSED_BZIP2;
 48.1582 ++#if 0
 48.1583 +     } else if ((magic[0] == 0120) && (magic[1] == 0113) &&
 48.1584 + 	 (magic[2] == 0003) && (magic[3] == 0004)) {	/* pkzip */
 48.1585 + 	*compressed = COMPRESSED_ZIP;
 48.1586 ++#endif
 48.1587 +     } else if (((magic[0] == 0037) && (magic[1] == 0213)) || /* gzip */
 48.1588 + 	((magic[0] == 0037) && (magic[1] == 0236)) ||	/* old gzip */
 48.1589 + 	((magic[0] == 0037) && (magic[1] == 0036)) ||	/* pack */
 48.1590 +
 48.1591 ++---------------------------------------------------------------------------
 48.1592 +| Make sure that an %{error:<msg>} macro really stops further
 48.1593 +| processing. Else it would be nothing more than a %{warn:<msg>}.
 48.1594 ++---------------------------------------------------------------------------
 48.1595 +Index: rpmio/macro.c
 48.1596 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
 48.1597 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
 48.1598 +@@ -1329,7 +1337,7 @@
 48.1599 + 	    STREQ("error", f, fn)) {
 48.1600 + 		int waserror = 0;
 48.1601 + 		if (STREQ("error", f, fn))
 48.1602 +-			waserror = 1;
 48.1603 ++			waserror = 1, rc = 1;
 48.1604 + 		if (g < ge)
 48.1605 + 			doOutput(mb, waserror, g, gn);
 48.1606 + 		else
 48.1607 +
 48.1608 ++---------------------------------------------------------------------------
 48.1609 +| Reactivate build mode aliases which were removed in rpm-4.1 
 48.1610 +| (and now should be available through "rpmbuild" only).
 48.1611 ++---------------------------------------------------------------------------
 48.1612 +Index: rpmpopt.in
 48.1613 +--- rpmpopt.in	24 Jan 2003 14:56:30 -0000	1.1.1.7
 48.1614 ++++ rpmpopt.in	22 Jan 2004 21:42:11 -0000	1.2
 48.1615 +@@ -147,28 +147,28 @@
 48.1616 + # Popt glue to preserve legacy CLI behavior.
 48.1617 + #
 48.1618 + # XXX popt exec parsing doesn't honor POPT_ARGFLAG_ONEDASH
 48.1619 +-# XXX Build mode aliases, removed in rpm-4.1.
 48.1620 +-#rpm	exec --bp		rpmb -bp
 48.1621 +-#rpm	exec --bc		rpmb -bc
 48.1622 +-#rpm	exec --bi		rpmb -bi
 48.1623 +-#rpm	exec --bl		rpmb -bl
 48.1624 +-#rpm	exec --ba		rpmb -ba
 48.1625 +-#rpm	exec --bb		rpmb -bb
 48.1626 +-#rpm	exec --bs		rpmb -bs
 48.1627 +-#rpm	exec --tp		rpmb -tp
 48.1628 +-#rpm	exec --tc		rpmb -tc
 48.1629 +-#rpm	exec --ti		rpmb -ti
 48.1630 +-#rpm	exec --tl		rpmb -tl
 48.1631 +-#rpm	exec --ta		rpmb -ta
 48.1632 +-#rpm	exec --tb		rpmb -tb
 48.1633 +-#rpm	exec --ts		rpmb -ts
 48.1634 +-#rpm	exec --rebuild		rpmb --rebuild
 48.1635 +-#rpm	exec --recompile	rpmb --recompile
 48.1636 +-#rpm	exec --clean		rpmb --clean
 48.1637 +-#rpm	exec --rmsource		rpmb --rmsource
 48.1638 +-#rpm	exec --rmspec		rpmb --rmspec
 48.1639 +-#rpm	exec --target		rpmb --target
 48.1640 +-#rpm	exec --short-circuit	rpmb --short-circuit
 48.1641 ++rpm	exec --bp		rpmb -bp
 48.1642 ++rpm	exec --bc		rpmb -bc
 48.1643 ++rpm	exec --bi		rpmb -bi
 48.1644 ++rpm	exec --bl		rpmb -bl
 48.1645 ++rpm	exec --ba		rpmb -ba
 48.1646 ++rpm	exec --bb		rpmb -bb
 48.1647 ++rpm	exec --bs		rpmb -bs
 48.1648 ++rpm	exec --bt		rpmb -bt
 48.1649 ++rpm	exec --tp		rpmb -tp
 48.1650 ++rpm	exec --tc		rpmb -tc
 48.1651 ++rpm	exec --ti		rpmb -ti
 48.1652 ++rpm	exec --tl		rpmb -tl
 48.1653 ++rpm	exec --ta		rpmb -ta
 48.1654 ++rpm	exec --tb		rpmb -tb
 48.1655 ++rpm	exec --ts		rpmb -ts
 48.1656 ++rpm	exec --rebuild		rpmb --rebuild
 48.1657 ++rpm	exec --recompile	rpmb --recompile
 48.1658 ++rpm	exec --clean		rpmb --clean
 48.1659 ++rpm	exec --rmsource		rpmb --rmsource
 48.1660 ++rpm	exec --rmspec		rpmb --rmspec
 48.1661 ++rpm	exec --target		rpmb --target
 48.1662 ++rpm	exec --short-circuit	rpmb --short-circuit
 48.1663 + 
 48.1664 + rpm	exec --initdb		rpmd --initdb
 48.1665 + rpm	exec --rebuilddb	rpmd --rebuilddb
 48.1666 +
 48.1667 ++---------------------------------------------------------------------------
 48.1668 +| Allow "-bb --short-circuit" for continuing building a binary package
 48.1669 +| after the %install step (usually previously fixed and repeated with
 48.1670 +| "-bi --short-circuit".
 48.1671 ++---------------------------------------------------------------------------
 48.1672 +Index: rpmqv.c
 48.1673 +--- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
 48.1674 ++++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
 48.1675 +@@ -682,6 +682,10 @@
 48.1676 + 	case 'b':
 48.1677 + 	    ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
 48.1678 + 	    ba->buildAmount |= RPMBUILD_CLEAN;
 48.1679 ++#ifdef OPENPKG
 48.1680 ++	    if ((ba->buildChar == 'b') && ba->shortCircuit)
 48.1681 ++		/*@innerbreak@*/ break;
 48.1682 ++#endif
 48.1683 + 	    /*@fallthrough@*/
 48.1684 + 	case 'i':
 48.1685 + 	    ba->buildAmount |= RPMBUILD_INSTALL;
 48.1686 +
 48.1687 ++---------------------------------------------------------------------------
 48.1688 +| Because permissions and ownership on Berkeley-DB region files
 48.1689 +| __db.XXX have to be already fixed in advance and those files cannot
 48.1690 +| be created in advance on the command line with some reasonable
 48.1691 +| default (as it is the case for the other files which are created
 48.1692 +| with [rpm]db_load), so force Berkeley-DB to accept zero-sized files
 48.1693 +| and create them (instead of thinking another process is currently
 48.1694 +| creating them).
 48.1695 ++---------------------------------------------------------------------------
 48.1696 +Index: db/env/env_region.c
 48.1697 +--- db/env/env_region.c	18 Jan 2003 14:05:01 -0000	1.1.1.5
 48.1698 ++++ db/env/env_region.c	22 Jan 2004 21:42:17 -0000	1.2
 48.1699 +@@ -184,6 +184,24 @@
 48.1700 + 	}
 48.1701 + 
 48.1702 + 	/*
 48.1703 ++	 * OpenPKG hack: because permissions and ownership on Berkeley-DB
 48.1704 ++	 * region files __db.XXX have to be already fixed in advance and
 48.1705 ++	 * those files cannot be created in advance on the command line
 48.1706 ++	 * with some reasonable default (as it is the case for the other
 48.1707 ++	 * files which are created with [rpm]db_load), so force Berkeley-DB
 48.1708 ++	 * to accept zero-sized files and create them (instead of thinking
 48.1709 ++	 * another process is currently creating them).
 48.1710 ++	 */
 48.1711 ++	if (mbytes == 0 && bytes == 0) {
 48.1712 ++		if (F_ISSET(dbenv, DB_ENV_CREATE))
 48.1713 ++			goto creation;
 48.1714 ++		else {
 48.1715 ++			ret = ENOENT;
 48.1716 ++			goto err;
 48.1717 ++		}
 48.1718 ++	}
 48.1719 ++
 48.1720 ++	/*
 48.1721 + 	 * !!!
 48.1722 + 	 * A size_t is OK -- regions get mapped into memory, and so can't
 48.1723 + 	 * be larger than a size_t.
 48.1724 +
 48.1725 ++---------------------------------------------------------------------------
 48.1726 +| Make sure RPM passes DB_CREATE to Berkeley-DB also if file exists,
 48.1727 +| but is (still) zero-sized.
 48.1728 ++---------------------------------------------------------------------------
 48.1729 +Index: rpmdb/db3.c
 48.1730 +--- rpmdb/db3.c	3 Mar 2003 16:18:29 -0000	1.1.1.5
 48.1731 ++++ rpmdb/db3.c	22 Jan 2004 21:42:29 -0000	1.2
 48.1732 +@@ -1019,9 +1019,13 @@
 48.1733 + 	} else {	/* dbhome is writable, check for persistent dbenv. */
 48.1734 + 	    /*@-mods@*/
 48.1735 + 	    const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
 48.1736 ++            struct stat sb;
 48.1737 ++            long size = -1;
 48.1738 + 	    /*@=mods@*/
 48.1739 + 
 48.1740 +-	    if (access(dbf, F_OK) == -1) {
 48.1741 ++            if (stat(dbf, &sb) == 0)
 48.1742 ++                size = (long)sb.st_size;
 48.1743 ++	    if (access(dbf, F_OK) == -1 || size == 0) {
 48.1744 + 		/* ... non-existent (or unwritable) DBENV, will create ... */
 48.1745 + 		dbi->dbi_oeflags |= DB_CREATE;
 48.1746 + 		dbi->dbi_eflags &= ~DB_JOINENV;
 48.1747 +
 48.1748 ++---------------------------------------------------------------------------
 48.1749 +| Add internal feature variable %{_force_oldpackage} which, if
 48.1750 +| non-zero, automatically enforces --oldpackage on all upgrade
 48.1751 +| operations (this is useful on mass-upgrades from OpenPKG-CURRENT to
 48.1752 +| OpenPKG-RELEASE).
 48.1753 ++---------------------------------------------------------------------------
 48.1754 +Index: rpm.c
 48.1755 +--- rpm.c	16 May 2002 16:55:25 -0000	1.1.1.23
 48.1756 ++++ rpm.c	22 Jan 2004 21:42:10 -0000	1.2
 48.1757 +@@ -1016,6 +1016,10 @@
 48.1758 + 
 48.1759 +     if (oldPackage && !upgrade)
 48.1760 + 	argerror(_("--oldpackage may only be used during upgrades"));
 48.1761 ++#ifdef OPENPKG
 48.1762 ++    if (upgrade && rpmExpandNumeric("%{?_force_oldpackage}"))
 48.1763 ++        probFilter |= RPMPROB_FILTER_OLDPACKAGE;
 48.1764 ++#endif
 48.1765 + 
 48.1766 +     if (noPgp && bigMode != MODE_CHECKSIG)
 48.1767 + 	argerror(_("--nopgp may only be used during signature checking"));
 48.1768 +
 48.1769 ++---------------------------------------------------------------------------
 48.1770 +| Add OpenPKG branding to make sure people do not intermix
 48.1771 +| this RPM version with the stock RPM version.
 48.1772 ++---------------------------------------------------------------------------
 48.1773 +Index: lib/poptALL.c
 48.1774 +--- lib/poptALL.c	25 Jun 2003 19:10:01 -0000	1.1.1.3
 48.1775 ++++ lib/poptALL.c	22 Jan 2004 21:42:23 -0000	1.2
 48.1776 +@@ -102,7 +102,7 @@
 48.1777 + 	/*@globals rpmEVR, fileSystem @*/
 48.1778 + 	/*@modifies *fp, fileSystem @*/
 48.1779 + {
 48.1780 +-    fprintf(fp, _("RPM version %s\n"), rpmEVR);
 48.1781 ++    fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
 48.1782 + }
 48.1783 + 
 48.1784 + /**
 48.1785 +
 48.1786 ++---------------------------------------------------------------------------
 48.1787 +| Add OpenPKG branding to make sure people do not intermix
 48.1788 +| this RPM version with the stock RPM version.
 48.1789 ++---------------------------------------------------------------------------
 48.1790 +Index: rpm.c
 48.1791 +--- rpm.c	16 May 2002 16:55:25 -0000	1.1.1.23
 48.1792 ++++ rpm.c	22 Jan 2004 21:42:10 -0000	1.2
 48.1793 +@@ -235,7 +235,7 @@
 48.1794 + static void printHelpLine(char * prefix, char * help);
 48.1795 + 
 48.1796 + static void printVersion(void) {
 48.1797 +-    fprintf(stdout, _("RPM version %s\n"), rpmEVR);
 48.1798 ++    fprintf(stdout, _("OpenPKG RPM %s\n"), rpmEVR);
 48.1799 + }
 48.1800 + 
 48.1801 + static void printBanner(void) {
 48.1802 +
 48.1803 ++---------------------------------------------------------------------------
 48.1804 +| Add OpenPKG branding to make sure people do not intermix
 48.1805 +| this RPM version with the stock RPM version.
 48.1806 ++---------------------------------------------------------------------------
 48.1807 +Index: rpmqv.c
 48.1808 +--- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
 48.1809 ++++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
 48.1810 +@@ -126,7 +126,7 @@
 48.1811 + 	/*@globals rpmEVR, fileSystem @*/
 48.1812 + 	/*@modifies *fp, fileSystem @*/
 48.1813 + {
 48.1814 +-    fprintf(fp, _("RPM version %s\n"), rpmEVR);
 48.1815 ++    fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
 48.1816 + }
 48.1817 + 
 48.1818 + static void printBanner(FILE * fp)
 48.1819 +
 48.1820 ++---------------------------------------------------------------------------
 48.1821 +| Add support for the OpenPKG custom .spec file sections %track
 48.1822 +| (package build-time feature for performing vendor source tracking)
 48.1823 +| and %test (package install-time feature for performing package
 48.1824 +| run-time tests).
 48.1825 ++---------------------------------------------------------------------------
 48.1826 +Index: rpmqv.c
 48.1827 +--- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
 48.1828 ++++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
 48.1829 +@@ -703,7 +707,19 @@
 48.1830 + 	    /*@innerbreak@*/ break;
 48.1831 + 	case 's':
 48.1832 + 	    ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
 48.1833 ++	    /* enforce no dependency checking */
 48.1834 ++	    ba->noDeps = 1;
 48.1835 + 	    /*@innerbreak@*/ break;
 48.1836 ++#ifdef OPENPKG
 48.1837 ++	case 't':
 48.1838 ++	    ba->buildAmount |= RPMBUILD_TRACK;
 48.1839 ++	    /* enforce no dependency checking and expansion of %setup, %patch and %prep macros */
 48.1840 ++	    ba->noDeps = 1;
 48.1841 ++	    rpmDefineMacro(NULL, "setup #", RMIL_CMDLINE);
 48.1842 ++	    rpmDefineMacro(NULL, "patch #", RMIL_CMDLINE);
 48.1843 ++	    rpmDefineMacro(NULL, "prep %%prep", RMIL_CMDLINE);
 48.1844 ++	    /*@innerbreak@*/ break;
 48.1845 ++#endif
 48.1846 + 	}
 48.1847 + 
 48.1848 + 	if (!poptPeekArg(optCon)) {
 48.1849 +
 48.1850 ++---------------------------------------------------------------------------
 48.1851 +| Add support for the OpenPKG custom .spec file sections %track
 48.1852 +| (package build-time feature for performing vendor source tracking)
 48.1853 +| and %test (package install-time feature for performing package
 48.1854 +| run-time tests).
 48.1855 ++---------------------------------------------------------------------------
 48.1856 +Index: build/pack.c
 48.1857 +--- build/pack.c	4 Mar 2003 17:03:17 -0000	1.1.1.20
 48.1858 ++++ build/pack.c	30 Jan 2004 17:06:29 -0000	1.2
 48.1859 +@@ -252,6 +252,15 @@
 48.1860 + 	    return RPMERR_BADFILENAME;
 48.1861 + 	}
 48.1862 +     }
 48.1863 ++#ifdef OPENPKG
 48.1864 ++    if (pkg->testFile) {
 48.1865 ++	if (addFileToTag(spec, pkg->testFile, pkg->header, RPMTAG_TEST)) {
 48.1866 ++	    rpmError(RPMERR_BADFILENAME,
 48.1867 ++		     _("Could not open Test file: %s\n"), pkg->testFile);
 48.1868 ++	    return RPMERR_BADFILENAME;
 48.1869 ++	}
 48.1870 ++    }
 48.1871 ++#endif
 48.1872 + 
 48.1873 +     for (p = pkg->triggerFiles; p != NULL; p = p->next) {
 48.1874 + 	(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
 48.1875 +
 48.1876 ++---------------------------------------------------------------------------
 48.1877 +| Add support for the OpenPKG custom .spec file sections %track
 48.1878 +| (package build-time feature for performing vendor source tracking)
 48.1879 +| and %test (package install-time feature for performing package
 48.1880 +| run-time tests).
 48.1881 ++---------------------------------------------------------------------------
 48.1882 +Index: build/parseBuildInstallClean.c
 48.1883 +--- build/parseBuildInstallClean.c	3 Mar 2003 20:43:30 -0000	1.1.1.9
 48.1884 ++++ build/parseBuildInstallClean.c	30 Jan 2004 17:06:29 -0000	1.2
 48.1885 +@@ -29,6 +29,11 @@
 48.1886 +     } else if (parsePart == PART_CLEAN) {
 48.1887 + 	sbp = &(spec->clean);
 48.1888 + 	name = "%clean";
 48.1889 ++#ifdef OPENPKG
 48.1890 ++    } else if (parsePart == PART_TRACK) {
 48.1891 ++	sbp = &(spec->track);
 48.1892 ++	name = "%track";
 48.1893 ++#endif
 48.1894 +     }
 48.1895 +     /*@=branchstate@*/
 48.1896 +     
 48.1897 +
 48.1898 ++---------------------------------------------------------------------------
 48.1899 +| Add support for the OpenPKG custom .spec file sections %track
 48.1900 +| (package build-time feature for performing vendor source tracking)
 48.1901 +| and %test (package install-time feature for performing package
 48.1902 +| run-time tests).
 48.1903 ++---------------------------------------------------------------------------
 48.1904 +Index: build/parseScript.c
 48.1905 +--- build/parseScript.c	23 Jun 2002 19:47:12 -0000	1.1.1.12
 48.1906 ++++ build/parseScript.c	30 Jan 2004 17:06:29 -0000	1.3
 48.1907 +@@ -156,6 +156,14 @@
 48.1908 + 	progtag = RPMTAG_TRIGGERSCRIPTPROG;
 48.1909 + 	partname = "%triggerpostun";
 48.1910 + 	break;
 48.1911 ++#ifdef OPENPKG
 48.1912 ++      case PART_TEST:
 48.1913 ++	tag = RPMTAG_TEST;
 48.1914 ++	tagflags = RPMSENSE_SCRIPT_TEST;
 48.1915 ++	progtag = RPMTAG_TESTPROG;
 48.1916 ++	partname = "%test";
 48.1917 ++	break;
 48.1918 ++#endif
 48.1919 +     }
 48.1920 +     /*@=branchstate@*/
 48.1921 + 
 48.1922 +@@ -303,6 +312,11 @@
 48.1923 + 	      case PART_VERIFYSCRIPT:
 48.1924 + 		pkg->verifyFile = xstrdup(file);
 48.1925 + 		break;
 48.1926 ++#ifdef OPENPKG
 48.1927 ++	      case PART_TEST:
 48.1928 ++		pkg->testFile = xstrdup(file);
 48.1929 ++		break;
 48.1930 ++#endif
 48.1931 + 	    }
 48.1932 + 	}
 48.1933 +     }
 48.1934 +
 48.1935 ++---------------------------------------------------------------------------
 48.1936 +| Add support for the OpenPKG custom .spec file sections %track
 48.1937 +| (package build-time feature for performing vendor source tracking)
 48.1938 +| and %test (package install-time feature for performing package
 48.1939 +| run-time tests).
 48.1940 ++---------------------------------------------------------------------------
 48.1941 +Index: build/parseSpec.c
 48.1942 +--- build/parseSpec.c	15 May 2003 13:38:57 -0000	1.1.1.15
 48.1943 ++++ build/parseSpec.c	30 Jan 2004 17:06:30 -0000	1.2
 48.1944 +@@ -43,6 +43,10 @@
 48.1945 +     { PART_TRIGGERIN,     0, "%triggerin"},
 48.1946 +     { PART_TRIGGERIN,     0, "%trigger"},
 48.1947 +     { PART_VERIFYSCRIPT,  0, "%verifyscript"},
 48.1948 ++#ifdef OPENPKG
 48.1949 ++    { PART_TRACK,         0, "%track"},
 48.1950 ++    { PART_TEST,          0, "%test"},
 48.1951 ++#endif
 48.1952 +     {0, 0, 0}
 48.1953 + };
 48.1954 + 
 48.1955 +@@ -489,6 +493,15 @@
 48.1956 + 	    parsePart = parseFiles(spec);
 48.1957 + 	    /*@switchbreak@*/ break;
 48.1958 + 
 48.1959 ++#ifdef OPENPKG
 48.1960 ++	case PART_TRACK:
 48.1961 ++	    parsePart = parseBuildInstallClean(spec, parsePart);
 48.1962 ++	    /*@switchbreak@*/ break;
 48.1963 ++	case PART_TEST:
 48.1964 ++	    parsePart = parseScript(spec, parsePart);
 48.1965 ++	    /*@switchbreak@*/ break;
 48.1966 ++#endif
 48.1967 ++
 48.1968 + 	case PART_NONE:		/* XXX avoid gcc whining */
 48.1969 + 	case PART_LAST:
 48.1970 + 	case PART_BUILDARCHITECTURES:
 48.1971 +
 48.1972 ++---------------------------------------------------------------------------
 48.1973 +| Add support for the OpenPKG custom .spec file sections %track
 48.1974 +| (package build-time feature for performing vendor source tracking)
 48.1975 +| and %test (package install-time feature for performing package
 48.1976 +| run-time tests).
 48.1977 ++---------------------------------------------------------------------------
 48.1978 +Index: build/poptBT.c
 48.1979 +--- build/poptBT.c	3 Mar 2003 20:04:12 -0000	1.1.1.3
 48.1980 ++++ build/poptBT.c	30 Jan 2004 17:06:30 -0000	1.2
 48.1981 +@@ -35,6 +35,9 @@
 48.1982 + #define	POPT_BL			0x626c
 48.1983 + #define	POPT_BP			0x6270
 48.1984 + #define	POPT_BS			0x6273
 48.1985 ++#ifdef OPENPKG
 48.1986 ++#define	POPT_BT			0x6274
 48.1987 ++#endif
 48.1988 + #define	POPT_TA			0x7461
 48.1989 + #define	POPT_TB			0x7462
 48.1990 + #define	POPT_TC			0x7463
 48.1991 +@@ -82,6 +85,9 @@
 48.1992 +     case POPT_BL:
 48.1993 +     case POPT_BP:
 48.1994 +     case POPT_BS:
 48.1995 ++#ifdef OPENPKG
 48.1996 ++    case POPT_BT:
 48.1997 ++#endif
 48.1998 +     case POPT_TA:
 48.1999 +     case POPT_TB:
 48.2000 +     case POPT_TC:
 48.2001 +@@ -177,6 +183,11 @@
 48.2002 +  { "bs", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BS,
 48.2003 + 	N_("build source package only from <specfile>"),
 48.2004 + 	N_("<specfile>") },
 48.2005 ++#ifdef OPENPKG
 48.2006 ++ { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
 48.2007 ++	N_("track versions of sources from <specfile>"),
 48.2008 ++	N_("<specfile>") },
 48.2009 ++#endif
 48.2010 + 
 48.2011 +  { "tp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TP,
 48.2012 + 	N_("build through %prep (unpack sources and apply patches) from <tarball>"),
 48.2013 +
 48.2014 ++---------------------------------------------------------------------------
 48.2015 +| Add support for the OpenPKG custom .spec file sections %track
 48.2016 +| (package build-time feature for performing vendor source tracking)
 48.2017 +| and %test (package install-time feature for performing package
 48.2018 +| run-time tests).
 48.2019 ++---------------------------------------------------------------------------
 48.2020 +Index: build/rpmbuild.h
 48.2021 +--- build/rpmbuild.h	4 Mar 2003 17:03:07 -0000	1.1.1.13
 48.2022 ++++ build/rpmbuild.h	30 Jan 2004 17:06:30 -0000	1.2
 48.2023 +@@ -34,6 +34,9 @@
 48.2024 +     RPMBUILD_RMSOURCE	= (1 <<  8),	/*!< Remove source(s) and patch(s). */
 48.2025 +     RPMBUILD_RMBUILD	= (1 <<  9),	/*!< Remove build sub-tree. */
 48.2026 +     RPMBUILD_STRINGBUF	= (1 << 10),	/*!< only for doScript() */
 48.2027 ++#ifdef OPENPKG
 48.2028 ++    RPMBUILD_TRACK	= (1 << 12),	/*!< Execute %%track. */
 48.2029 ++#endif
 48.2030 +     RPMBUILD_RMSPEC	= (1 << 11)	/*!< Remove spec file. */
 48.2031 + } rpmBuildFlags;
 48.2032 + /*@=typeuse@*/
 48.2033 +@@ -69,7 +72,13 @@
 48.2034 +     PART_VERIFYSCRIPT	= 16,	/*!< */
 48.2035 +     PART_BUILDARCHITECTURES= 17,/*!< */
 48.2036 +     PART_TRIGGERPOSTUN	= 18,	/*!< */
 48.2037 ++#ifdef OPENPKG
 48.2038 ++    PART_TRACK	        = 19,	/*!< */
 48.2039 ++    PART_TEST	        = 20,	/*!< */
 48.2040 ++    PART_LAST		= 21	/*!< */
 48.2041 ++#else
 48.2042 +     PART_LAST		= 19	/*!< */
 48.2043 ++#endif
 48.2044 + } rpmParseState;
 48.2045 + 
 48.2046 + #define STRIP_NOTHING             0
 48.2047 +
 48.2048 ++---------------------------------------------------------------------------
 48.2049 +| Add support for the OpenPKG custom .spec file sections %track
 48.2050 +| (package build-time feature for performing vendor source tracking)
 48.2051 +| and %test (package install-time feature for performing package
 48.2052 +| run-time tests).
 48.2053 ++---------------------------------------------------------------------------
 48.2054 +Index: build/rpmspec.h
 48.2055 +--- build/rpmspec.h	4 Mar 2003 15:30:23 -0000	1.1.1.11
 48.2056 ++++ build/rpmspec.h	30 Jan 2004 17:06:30 -0000	1.2
 48.2057 +@@ -164,6 +164,10 @@
 48.2058 +     StringBuf check;		/*!< %check scriptlet. */
 48.2059 + /*@only@*/
 48.2060 +     StringBuf clean;		/*!< %clean scriptlet. */
 48.2061 ++#ifdef OPENPKG
 48.2062 ++/*@only@*/
 48.2063 ++    StringBuf track;		/*!< %track scriptlet. */
 48.2064 ++#endif
 48.2065 + 
 48.2066 + /*@owned@*/
 48.2067 +     Package packages;		/*!< Package list. */
 48.2068 +@@ -196,6 +200,10 @@
 48.2069 +     const char * postUnFile;	/*!< %postun scriptlet. */
 48.2070 + /*@only@*/
 48.2071 +     const char * verifyFile;	/*!< %verifyscript scriptlet. */
 48.2072 ++#ifdef OPENPKG
 48.2073 ++/*@only@*/
 48.2074 ++    const char * testFile;	/*!< %test scriptlet. */
 48.2075 ++#endif
 48.2076 + 
 48.2077 + /*@only@*/
 48.2078 +     StringBuf specialDoc;
 48.2079 +
 48.2080 ++---------------------------------------------------------------------------
 48.2081 +| Add support for the OpenPKG custom .spec file sections %track
 48.2082 +| (package build-time feature for performing vendor source tracking)
 48.2083 +| and %test (package install-time feature for performing package
 48.2084 +| run-time tests).
 48.2085 ++---------------------------------------------------------------------------
 48.2086 +Index: build/spec.c
 48.2087 +--- build/spec.c	4 Mar 2003 15:25:51 -0000	1.1.1.21
 48.2088 ++++ build/spec.c	30 Jan 2004 17:06:31 -0000	1.3
 48.2089 +@@ -138,6 +138,9 @@
 48.2090 +     p->preUnFile = NULL;
 48.2091 +     p->postUnFile = NULL;
 48.2092 +     p->verifyFile = NULL;
 48.2093 ++#ifdef OPENPKG
 48.2094 ++    p->testFile = NULL;
 48.2095 ++#endif
 48.2096 + 
 48.2097 +     p->specialDoc = NULL;
 48.2098 + 
 48.2099 +@@ -444,6 +455,9 @@
 48.2100 +     spec->install = NULL;
 48.2101 +     spec->check = NULL;
 48.2102 +     spec->clean = NULL;
 48.2103 ++#ifdef OPENPKG
 48.2104 ++    spec->track = NULL;
 48.2105 ++#endif
 48.2106 + 
 48.2107 +     spec->sources = NULL;
 48.2108 +     spec->packages = NULL;
 48.2109 +@@ -491,6 +505,9 @@
 48.2110 +     spec->install = freeStringBuf(spec->install);
 48.2111 +     spec->check = freeStringBuf(spec->check);
 48.2112 +     spec->clean = freeStringBuf(spec->clean);
 48.2113 ++#ifdef OPENPKG
 48.2114 ++    spec->track = freeStringBuf(spec->track);
 48.2115 ++#endif
 48.2116 + 
 48.2117 +     spec->buildRootURL = _free(spec->buildRootURL);
 48.2118 +     spec->buildSubdir = _free(spec->buildSubdir);
 48.2119 +
 48.2120 ++---------------------------------------------------------------------------
 48.2121 +| Add support for the OpenPKG custom .spec file sections %track
 48.2122 +| (package build-time feature for performing vendor source tracking)
 48.2123 +| and %test (package install-time feature for performing package
 48.2124 +| run-time tests).
 48.2125 ++---------------------------------------------------------------------------
 48.2126 +Index: lib/rpmlib.h
 48.2127 +--- lib/rpmlib.h	19 Jun 2003 17:39:35 -0000	1.1.1.26
 48.2128 ++++ lib/rpmlib.h	30 Jan 2004 17:06:31 -0000	1.2
 48.2129 +@@ -414,6 +414,12 @@
 48.2130 +     RPMTAG_FILEDEPENDSN		= 1144,
 48.2131 +     RPMTAG_DEPENDSDICT		= 1145,
 48.2132 +     RPMTAG_SOURCEPKGID		= 1146,
 48.2133 ++#ifdef OPENPKG
 48.2134 ++    RPMTAG_TRACK 		= 1200,
 48.2135 ++    RPMTAG_TEST 		= 1201,
 48.2136 ++    RPMTAG_TESTPROG		= 1202,
 48.2137 ++    RPMTAG_CLASS		= 1203,
 48.2138 ++#endif
 48.2139 + /*@-enummemuse@*/
 48.2140 +     RPMTAG_FIRSTFREE_TAG	/*!< internal */
 48.2141 + /*@=enummemuse@*/
 48.2142 +@@ -488,6 +494,9 @@
 48.2143 +     RPMSENSE_SCRIPT_BUILD = (1 << 21),	/*!< %build build dependency. */
 48.2144 +     RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
 48.2145 +     RPMSENSE_SCRIPT_CLEAN = (1 << 23),	/*!< %clean build dependency. */
 48.2146 ++#ifdef OPENPKG
 48.2147 ++    RPMSENSE_SCRIPT_TEST = (1 << 29),	/*!< %test build dependency. */
 48.2148 ++#endif
 48.2149 +     RPMSENSE_RPMLIB	= ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
 48.2150 + /*@-enummemuse@*/
 48.2151 +     RPMSENSE_TRIGGERPREIN = (1 << 25),	/*!< @todo Implement %triggerprein. */
 48.2152 +
 48.2153 ++---------------------------------------------------------------------------
 48.2154 +| Add support for the OpenPKG custom .spec file sections %track
 48.2155 +| (package build-time feature for performing vendor source tracking)
 48.2156 +| and %test (package install-time feature for performing package
 48.2157 +| run-time tests).
 48.2158 +| Additionally, add support for "Class" header.
 48.2159 ++---------------------------------------------------------------------------
 48.2160 +Index: rpmdb/tagtbl.c
 48.2161 +--- rpmdb/tagtbl.c	2 Jul 2003 20:20:27 -0000	1.1.1.4
 48.2162 ++++ rpmdb/tagtbl.c	30 Jan 2004 17:06:32 -0000	1.2
 48.2163 +@@ -135,6 +135,12 @@
 48.2164 + 	{ "RPMTAG_FILEDEPENDSN", 1144, },
 48.2165 + 	{ "RPMTAG_DEPENDSDICT", 1145, },
 48.2166 + 	{ "RPMTAG_SOURCEPKGID", 1146, },
 48.2167 ++#ifdef OPENPKG
 48.2168 ++	{ "RPMTAG_TRACK", 1200, },
 48.2169 ++	{ "RPMTAG_TEST", 1201, },
 48.2170 ++	{ "RPMTAG_TESTPROG", 1202, },
 48.2171 ++	{ "RPMTAG_CLASS", 1203, },
 48.2172 ++#endif
 48.2173 + 	{ NULL, 0 }
 48.2174 + };
 48.2175 + 
 48.2176 +
 48.2177 ++---------------------------------------------------------------------------
 48.2178 +| Add support for "Class" header.
 48.2179 ++---------------------------------------------------------------------------
 48.2180 +Index: build/parsePreamble.c
 48.2181 +--- build/parsePreamble.c	3 Mar 2003 20:46:34 -0000	1.1.1.13
 48.2182 ++++ build/parsePreamble.c	6 Feb 2004 15:37:58 -0000	1.3
 48.2183 +@@ -21,6 +21,7 @@
 48.2184 +     RPMTAG_LICENSE,
 48.2185 +     RPMTAG_PACKAGER,
 48.2186 +     RPMTAG_DISTRIBUTION,
 48.2187 ++    RPMTAG_CLASS,
 48.2188 +     RPMTAG_DISTURL,
 48.2189 +     RPMTAG_VENDOR,
 48.2190 +     RPMTAG_ICON,
 48.2191 +@@ -327,6 +328,7 @@
 48.2192 +     { RPMTAG_VENDOR,		"%{vendor}" },
 48.2193 +     { RPMTAG_PACKAGER,		"%{packager}" },
 48.2194 +     { RPMTAG_DISTRIBUTION,	"%{distribution}" },
 48.2195 ++    { RPMTAG_CLASS,		"%{class}" },
 48.2196 +     { RPMTAG_DISTURL,		"%{disturl}" },
 48.2197 +     { -1, NULL }
 48.2198 + };
 48.2199 +@@ -537,6 +547,7 @@
 48.2200 + 	(void) stashSt(spec, pkg->header, tag, lang);
 48.2201 + 	/*@fallthrough@*/
 48.2202 +     case RPMTAG_DISTRIBUTION:
 48.2203 ++    case RPMTAG_CLASS:
 48.2204 +     case RPMTAG_VENDOR:
 48.2205 +     case RPMTAG_LICENSE:
 48.2206 +     case RPMTAG_PACKAGER:
 48.2207 +@@ -743,6 +754,7 @@
 48.2208 +     {RPMTAG_LICENSE,		0, 0, "copyright"},
 48.2209 +     {RPMTAG_LICENSE,		0, 0, "license"},
 48.2210 +     {RPMTAG_DISTRIBUTION,	0, 0, "distribution"},
 48.2211 ++    {RPMTAG_CLASS,		0, 0, "class"},
 48.2212 +     {RPMTAG_DISTURL,		0, 0, "disturl"},
 48.2213 +     {RPMTAG_VENDOR,		0, 0, "vendor"},
 48.2214 +     {RPMTAG_GROUP,		0, 1, "group"},
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/openpkg/rpm.patch.porting	Tue Jan 06 23:40:39 2009 +0100
    49.3 @@ -0,0 +1,1484 @@
    49.4 +##
    49.5 +##  rpm.patch.porting -- Annotated OpenPKG RPM Patch file
    49.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    49.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    49.8 +##
    49.9 +##  This file assembles changes to existing RPM source files between
   49.10 +##  the original RedHat RPM and the OpenPKG RPM variant. It can be
   49.11 +##  automatically applied to a vanilla RedHat RPM source tree with the
   49.12 +##  'patch' tool to upgrade those files. Each patch snippet is annotated
   49.13 +##  with a short description.
   49.14 +##
   49.15 +##  Created on: 13-Sep-2006
   49.16 +##
   49.17 +##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
   49.18 +##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
   49.19 +##
   49.20 +
   49.21 ++---------------------------------------------------------------------------
   49.22 +| Evil hack to get GNU libtool working under NetBSD 1.6
   49.23 +| with the ugly way RPM currently has to use it.
   49.24 ++---------------------------------------------------------------------------
   49.25 +Index: ltconfig
   49.26 +--- ltconfig	17 Jan 2001 16:22:58 -0000	1.1.1.7
   49.27 ++++ ltconfig	29 Apr 2004 13:07:28 -0000	1.4
   49.28 +@@ -2017,6 +2017,7 @@
   49.29 +     dynamic_linker='NetBSD ld.elf_so'
   49.30 +   fi
   49.31 +   shlibpath_var=LD_LIBRARY_PATH
   49.32 ++  deplibs_check_method=pass_all
   49.33 +   ;;
   49.34 + 
   49.35 + openbsd*)
   49.36 +
   49.37 ++---------------------------------------------------------------------------
   49.38 +| Disable special RedHat NPTL handling.
   49.39 ++---------------------------------------------------------------------------
   49.40 +Index: configure.ac
   49.41 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   49.42 ++++ configure.ac	13 Sep 2006 13:40:20 -0000
   49.43 +@@ -150,10 +151,10 @@
   49.44 + dnl XXX Test for libpthread.a that is NPTL aware (static link only).
   49.45 + dnl
   49.46 + LDFLAGS_NPTL=
   49.47 +-if test -f /usr/lib/nptl/libpthread.a ; then
   49.48 +-    LDFLAGS_NPTL="-L/usr/lib/nptl"
   49.49 +-#    INCPATH="$INCPATH -I/usr/include/nptl"
   49.50 +-fi
   49.51 ++dnl if test -f /usr/lib/nptl/libpthread.a ; then
   49.52 ++dnl     LDFLAGS_NPTL="-L/usr/lib/nptl"
   49.53 ++dnl #    INCPATH="$INCPATH -I/usr/include/nptl"
   49.54 ++dnl fi
   49.55 + AC_SUBST(LDFLAGS_NPTL)
   49.56 + 
   49.57 + dnl
   49.58 +
   49.59 ++---------------------------------------------------------------------------
   49.60 +| Disable any POSIX Pthread stuff because in OpenPKG we use
   49.61 +| non-Pthread mutexes in Berkeley-DB.
   49.62 ++---------------------------------------------------------------------------
   49.63 +Index: configure.ac
   49.64 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   49.65 ++++ configure.ac	13 Sep 2006 13:40:21 -0000
   49.66 +@@ -446,14 +447,17 @@
   49.67 +     AC_CHECK_LIB(socket, socket)
   49.68 + ])
   49.69 + 
   49.70 +-AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
   49.71 ++dnl # required for HP-UX because of RPC stuff in DB
   49.72 ++AC_CHECK_LIB(nsl, svc_run)
   49.73 + 
   49.74 +-AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
   49.75 +-  dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
   49.76 +-  AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
   49.77 +-    AC_CHECK_LIB(thread, mutex_lock)
   49.78 +-  ])
   49.79 +-])
   49.80 ++dnl AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
   49.81 ++dnl 
   49.82 ++dnl AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
   49.83 ++dnl   dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
   49.84 ++dnl   AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
   49.85 ++dnl     AC_CHECK_LIB(thread, mutex_lock)
   49.86 ++dnl   ])
   49.87 ++dnl ])
   49.88 + 
   49.89 + AC_CHECK_HEADERS(aio.h)
   49.90 + AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
   49.91 +
   49.92 ++---------------------------------------------------------------------------
   49.93 +| Add support for BSD getmntinfo(3).
   49.94 ++---------------------------------------------------------------------------
   49.95 +Index: configure.ac
   49.96 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   49.97 ++++ configure.ac	13 Sep 2006 13:40:23 -0000
   49.98 +@@ -963,12 +967,13 @@
   49.99 + AC_CHECK_FUNCS(getpassphrase)
  49.100 + 
  49.101 + AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
  49.102 ++ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have the getmntinfo() function]), [
  49.103 +   AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
  49.104 +     AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
  49.105 +       AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; 
  49.106 + 					AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
  49.107 + 		 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
  49.108 +-                 AC_LIBOBJ(getmntent)])])])])
  49.109 ++                 AC_LIBOBJ(getmntent)])])])])])
  49.110 + 
  49.111 + AC_CHECK_FUNC(lchown,
  49.112 +    [__CHOWN_RHF="%{__chown} -Rhf"
  49.113 +
  49.114 ++---------------------------------------------------------------------------
  49.115 +| Remove RPM's "lib64" hack because we do not install
  49.116 +| into any system locations at all.
  49.117 ++---------------------------------------------------------------------------
  49.118 +Index: configure.ac
  49.119 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
  49.120 ++++ configure.ac	13 Sep 2006 13:40:25 -0000
  49.121 +@@ -1141,9 +1146,6 @@
  49.122 + 
  49.123 + dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
  49.124 + MARK64=
  49.125 +-case "${target_cpu}" in
  49.126 +-x86_64*|ppc64*|powerpc64*|sparc64*|s390x*)	MARK64=64 ;;
  49.127 +-esac
  49.128 + AC_SUBST(MARK64)
  49.129 + 
  49.130 + dnl Determine the canonical arch-vendor-os for the build machine
  49.131 +
  49.132 ++---------------------------------------------------------------------------
  49.133 +| Provide fallback definitions for uintX_t stuff, which is used by
  49.134 +| build/rpmfile.h and not available on all platforms. We do this by
  49.135 +| adding the same Autoconf checks file/configure already used for its
  49.136 +| original file.h.
  49.137 +| Additionally, do not try to configure in an internal
  49.138 +| beecrypt subdirectory.
  49.139 ++---------------------------------------------------------------------------
  49.140 +Index: configure.ac
  49.141 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
  49.142 ++++ configure.ac	13 Sep 2006 13:40:29 -0000
  49.143 +@@ -1249,11 +1251,40 @@
  49.144 + 
  49.145 + AC_SUBST(OBJDUMP)
  49.146 + 
  49.147 ++dnl OpenPKG: rpmfile.h (used in RPM) from file(1) needs additional checks
  49.148 ++dnl for its use of uintXX_t (which are available in file/config.h, but which
  49.149 ++dnl we cannot include into RPM because of conflicts with RPM's config.h)
  49.150 ++AC_DEFUN([AC_CHECK_TYPE_STDC],
  49.151 ++[AC_REQUIRE([AC_HEADER_STDC])dnl
  49.152 ++AC_MSG_CHECKING(for $1)
  49.153 ++AC_CACHE_VAL(ac_cv_type_$1,
  49.154 ++[AC_EGREP_CPP(dnl
  49.155 ++[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
  49.156 ++[#if HAVE_STDINT_H
  49.157 ++#include <stdint.h>
  49.158 ++#endif
  49.159 ++#include <sys/types.h>
  49.160 ++#if STDC_HEADERS
  49.161 ++#include <stdlib.h>
  49.162 ++#include <stddef.h>
  49.163 ++#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
  49.164 ++AC_MSG_RESULT($ac_cv_type_$1)
  49.165 ++if test $ac_cv_type_$1 = no; then
  49.166 ++  AC_DEFINE($1, $2, $1)
  49.167 ++fi])
  49.168 ++AC_CHECK_TYPE_STDC(uint8_t,  unsigned char)
  49.169 ++AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
  49.170 ++AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
  49.171 ++
  49.172 ++dnl OpenPKG: some strange platforms (like Unixware) really have MADV_XXX
  49.173 ++dnl but no madvise(2) function itself, so check for madvise explicitly.
  49.174 ++AC_CHECK_FUNC(madvise)
  49.175 ++
  49.176 + dnl XXX this causes popt to depend on zlib et al
  49.177 + dnl # XXX Propagate -lucb to popt ...
  49.178 + dnl export LIBS INCPATH CONFIG_SITE
  49.179 + 
  49.180 +-AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3)
  49.181 ++AC_CONFIG_SUBDIRS(popt zlib elfutils file db3)
  49.182 + 
  49.183 + AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
  49.184 + 	rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
  49.185 +
  49.186 ++---------------------------------------------------------------------------
  49.187 +| Remove RPM's "lib64" hack because we do not install
  49.188 +| into any system locations at all.
  49.189 ++---------------------------------------------------------------------------
  49.190 +Index: popt/configure.ac
  49.191 +--- popt/configure.ac	27 Mar 2003 17:23:18 -0000	1.1.1.3
  49.192 ++++ popt/configure.ac	12 May 2004 14:34:35 -0000	1.2
  49.193 +@@ -53,9 +53,6 @@
  49.194 + 
  49.195 + dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
  49.196 + MARK64=
  49.197 +-case "${target_cpu}" in
  49.198 +-x86_64*|powerpc64*|ppc64*|sparc64*|s390x*)        MARK64=64 ;;
  49.199 +-esac
  49.200 + AC_SUBST(MARK64)
  49.201 + 
  49.202 + AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h)
  49.203 +
  49.204 ++---------------------------------------------------------------------------
  49.205 +| Prevent (at least NetBSD's) gcc 2.95 from optimizing (at least sha1.c)
  49.206 +| and this way run into a resource (virtual memory) exhaustion situation.
  49.207 +| Not all Bourne-Shells support embedded TAB characters in
  49.208 +| here-document style constructs. Insert the TAB character indirectly
  49.209 +| to workaround problems.
  49.210 +| Additionally, there is no need to build a shared library version of
  49.211 +| Berkeley-DB.
  49.212 +| Finally, enforce the use of the standard UNIX/fcntl mutex type for
  49.213 +| full portability and to get rid of Pthread library dependencies
  49.214 +| (which especially are nasty for the external RPM API users).
  49.215 ++---------------------------------------------------------------------------
  49.216 +Index: db3/configure
  49.217 +--- db3/configure	18 Jan 2003 14:04:22 -0000	1.1.1.4
  49.218 ++++ db3/configure	6 Jun 2005 15:53:05 -0000	1.3
  49.219 +@@ -7,19 +7,29 @@
  49.220 + # XXX edit CFLAGS= ... out of invocation args ???
  49.221 + ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
  49.222 + 
  49.223 ++# prevent gcc 2.95 from optimizing (at least sha1.c)
  49.224 ++# and this way get into a resource exhaustion situation
  49.225 ++if [ ".`($CC -v; $CC --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
  49.226 ++    case "`$CC -dumpversion 2>/dev/null`" in
  49.227 ++        3.* ) ;;
  49.228 ++        *   ) CFLAGS=`echo " $CFLAGS -O0" | sed -e 's; -O[0-9]* ; ;g' -e 's;^  *;;'` ;;
  49.229 ++    esac
  49.230 ++fi
  49.231 ++
  49.232 + CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
  49.233 +-	--enable-shared --enable-static --enable-rpc \
  49.234 +-	--with-uniquename=_rpmdb --srcdir=$db_dist
  49.235 ++	--disable-shared --enable-static --enable-rpc \
  49.236 ++	--with-uniquename=_rpmdb --srcdir=$db_dist \
  49.237 ++	--with-mutex="UNIX/fcntl" --disable-largefile
  49.238 + 
  49.239 + mv Makefile Makefile.orig
  49.240 + cat Makefile.orig | sed -e '/^install[:-]/c\
  49.241 + .PHONY: listobjs\
  49.242 + listobjs:\
  49.243 +-	@echo $(OBJS) $(C_OBJS) \
  49.244 ++~@echo $(OBJS) $(C_OBJS) \
  49.245 + \
  49.246 + distdir install check:\
  49.247 + \
  49.248 +-db4_install: all install_setip' > Makefile
  49.249 ++db4_install: all install_setip' | tr '~' '	' > Makefile
  49.250 + 
  49.251 + mv db.h db.h.orig
  49.252 + cat db.h.orig | sed \
  49.253 +
  49.254 ++---------------------------------------------------------------------------
  49.255 +| Add support for BSD getmntinfo(3).
  49.256 ++---------------------------------------------------------------------------
  49.257 +Index: lib/fs.c
  49.258 +--- lib/fs.c	4 Jun 2003 18:09:43 -0000	1.1.1.13
  49.259 ++++ lib/fs.c	25 Nov 2004 09:32:16 -0000	1.3
  49.260 +@@ -164,6 +164,15 @@
  49.261 +     int nextMount = 0;
  49.262 + 
  49.263 + 	getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
  49.264 ++#   elif HAVE_GETMNTINFO
  49.265 ++#   if defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)
  49.266 ++#   define statfs statvfs
  49.267 ++#   endif
  49.268 ++    struct statfs * mounts = NULL;
  49.269 ++    int mntCount, flags = MNT_NOWAIT;
  49.270 ++    int nextMount = 0;
  49.271 ++
  49.272 ++	mntCount = getmntinfo(&mounts, flags);
  49.273 + #   endif
  49.274 + 
  49.275 +     filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems));	/* XXX memory leak */
  49.276 +@@ -193,6 +202,9 @@
  49.277 + #	elif HAVE_GETMNTINFO_R
  49.278 + 	    if (nextMount == mntCount) break;
  49.279 + 	    mntdir = mounts[nextMount++].f_mntonname;
  49.280 ++#	elif HAVE_GETMNTINFO
  49.281 ++	    if (nextMount == mntCount) break;
  49.282 ++	    mntdir = mounts[nextMount++].f_mntonname;
  49.283 + #	endif
  49.284 + 
  49.285 + 	if (stat(mntdir, &sb)) {
  49.286 +
  49.287 ++---------------------------------------------------------------------------
  49.288 +| Add support for Compaq/HP OSF1/Tru64.
  49.289 ++---------------------------------------------------------------------------
  49.290 +Index: misc/fnmatch.h
  49.291 +--- misc/fnmatch.h	22 Feb 2002 17:12:15 -0000	1.1.1.3
  49.292 ++++ misc/fnmatch.h	22 Jan 2004 21:42:26 -0000	1.2
  49.293 +@@ -55,7 +55,7 @@
  49.294 + #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
  49.295 + #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
  49.296 + 
  49.297 +-#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
  49.298 ++#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE || defined __osf__
  49.299 + # define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
  49.300 + # define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
  49.301 + # define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
  49.302 +
  49.303 ++---------------------------------------------------------------------------
  49.304 +| Use more correct Autoconf based size_t check.
  49.305 +| Add support for Compaq/HP OSF1/Tru64 and SCO UnixWare.
  49.306 ++---------------------------------------------------------------------------
  49.307 +Index: misc/glob.h
  49.308 +--- misc/glob.h	11 Mar 2000 20:59:30 -0000	1.1.1.3
  49.309 ++++ misc/glob.h	22 Jan 2004 21:42:27 -0000	1.2
  49.310 +@@ -46,7 +46,7 @@
  49.311 + #endif /* C++ or ANSI C.  */
  49.312 + 
  49.313 + /* We need `size_t' for the following definitions.  */
  49.314 +-#ifndef __size_t
  49.315 ++#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
  49.316 + # if defined __GNUC__ && __GNUC__ >= 2
  49.317 + typedef __SIZE_TYPE__ __size_t;
  49.318 + #  ifdef _XOPEN_SOURCE
  49.319 +@@ -74,7 +74,7 @@
  49.320 + #define	GLOB_PERIOD	(1 << 7)/* Leading `.' can be matched by metachars.  */
  49.321 + 
  49.322 + #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \
  49.323 +-     || defined _GNU_SOURCE)
  49.324 ++     || defined _GNU_SOURCE || defined __osf__ )
  49.325 + # define GLOB_MAGCHAR	 (1 << 8)/* Set in gl_flags if any metachars seen.  */
  49.326 + # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions.  */
  49.327 + # define GLOB_BRACE	 (1 << 10)/* Expand "{a,b}" to "a" "b".  */
  49.328 +@@ -151,7 +151,8 @@
  49.329 +    `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
  49.330 +    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
  49.331 +    Otherwise, `glob' returns zero.  */
  49.332 +-#if _FILE_OFFSET_BITS != 64
  49.333 ++/* #if _FILE_OFFSET_BITS != 64 || defined(OPENPKG_UNIXWARE) */
  49.334 ++#if !defined(__linux__)
  49.335 + extern int glob __P ((__const char *__pattern, int __flags,
  49.336 + 		      int (*__errfunc) (__const char *, int),
  49.337 + 		      glob_t *__pglob));
  49.338 +
  49.339 ++---------------------------------------------------------------------------
  49.340 +| Better portability.
  49.341 ++---------------------------------------------------------------------------
  49.342 +Index: misc/glob.c
  49.343 +--- misc/glob.c	11 Mar 2000 21:13:18 -0000	1.1.1.4
  49.344 ++++ misc/glob.c	22 Jan 2004 21:42:26 -0000	1.2
  49.345 +@@ -813,6 +813,7 @@
  49.346 + 
  49.347 + 
  49.348 + /* Free storage allocated in PGLOB by a previous `glob' call.  */
  49.349 ++#if !defined(__linux__) || (defined(__linux__) && (_FILE_OFFSET_BITS != 64) || (__GNUC__ >= 2))
  49.350 + void
  49.351 + globfree (pglob)
  49.352 +      register glob_t *pglob;
  49.353 +@@ -826,7 +827,7 @@
  49.354 +       free ((__ptr_t) pglob->gl_pathv);
  49.355 +     }
  49.356 + }
  49.357 +-
  49.358 ++#endif
  49.359 + 
  49.360 + /* Do a collated comparison of A and B.  */
  49.361 + static int
  49.362 +
  49.363 ++---------------------------------------------------------------------------
  49.364 +| Add libmisc.a for platform portability.
  49.365 ++---------------------------------------------------------------------------
  49.366 +Index: tools/Makefile.am
  49.367 +--- tools/Makefile.am	29 May 2003 17:40:17 -0000	1.1.1.14
  49.368 ++++ tools/Makefile.am	22 Jan 2004 21:42:34 -0000	1.2
  49.369 +@@ -22,7 +22,7 @@
  49.370 + 
  49.371 + LDADD = \
  49.372 + 	$(top_builddir)/lib/librpm.la \
  49.373 +-	@INTLLIBS@
  49.374 ++	@INTLLIBS@ @LIBMISC@
  49.375 + 
  49.376 + staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
  49.377 + 
  49.378 +
  49.379 ++---------------------------------------------------------------------------
  49.380 +| Add libmisc.a for platform portability.
  49.381 ++---------------------------------------------------------------------------
  49.382 +Index: tools/Makefile.in
  49.383 +--- tools/Makefile.in	16 Jul 2003 17:05:51 -0000	1.1.1.20
  49.384 ++++ tools/Makefile.in	22 Jan 2004 21:42:35 -0000	1.2
  49.385 +@@ -275,7 +275,7 @@
  49.386 + 
  49.387 + LDADD = \
  49.388 + 	$(top_builddir)/lib/librpm.la \
  49.389 +-	@INTLLIBS@
  49.390 ++	@INTLLIBS@ @LIBMISC@
  49.391 + 
  49.392 + 
  49.393 + staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
  49.394 +
  49.395 ++---------------------------------------------------------------------------
  49.396 +| Drop GCC "inline" attribute if not compiling with GCC.
  49.397 +| Workaround some other GCC'isms, too.
  49.398 +| Do not take over "const" replacements from Zlib.
  49.399 ++---------------------------------------------------------------------------
  49.400 +Index: file/system.h
  49.401 +--- file/system.h	24 Jan 2003 19:41:56 -0000	1.1.1.1
  49.402 ++++ file/system.h	6 Jun 2005 15:53:05 -0000	1.4
  49.403 +@@ -13,6 +13,9 @@
  49.404 + #endif
  49.405 + 
  49.406 + #include <sys/types.h>
  49.407 ++#ifdef HAVE_INTTYPES_H
  49.408 ++#include <inttypes.h>
  49.409 ++#endif
  49.410 + 
  49.411 + #include <sys/stat.h>
  49.412 + #include <stdio.h>
  49.413 +@@ -53,6 +56,8 @@
  49.414 + #else
  49.415 + #if HAVE_ERROR && HAVE_ERROR_H
  49.416 + #include <error.h>
  49.417 ++#else
  49.418 ++extern void error(int status, int errnum, const char *format, ...);
  49.419 + #endif
  49.420 + #endif
  49.421 + 
  49.422 +@@ -194,6 +199,7 @@
  49.423 + 
  49.424 + #ifdef HAVE_LIBZ
  49.425 + #include <zlib.h>
  49.426 ++#undef const
  49.427 + #endif
  49.428 + 
  49.429 + #ifndef HAVE_STRERROR
  49.430 +@@ -246,7 +252,11 @@
  49.431 +  */
  49.432 + /*@-shadow@*/
  49.433 + /*@unused@*/ /*@exits@*/ /*@only@*/
  49.434 ++#if defined(__GNUC__)
  49.435 + static inline void * vmefail(/*@unused@*/ size_t nb)
  49.436 ++#else
  49.437 ++static void * vmefail(/*@unused@*/ size_t nb)
  49.438 ++#endif
  49.439 + 	/*@globals fileSystem @*/
  49.440 + 	/*@modifies fileSystem @*/
  49.441 + {
  49.442 +@@ -286,9 +296,33 @@
  49.443 + 
  49.444 + #if !defined(__LCLINT__)
  49.445 + /* Memory allocation via macro defs to get meaningful locations from mtrace() */
  49.446 ++#if defined(__GNUC__)
  49.447 + #define	xmalloc(_size) 		(malloc(_size) ? : vmefail(0))
  49.448 + #define	xcalloc(_nmemb, _size)	(calloc((_nmemb), (_size)) ? : vmefail(0))
  49.449 + #define	xrealloc(_ptr, _size)	(realloc((_ptr), (_size)) ? : vmefail(0))
  49.450 ++#else
  49.451 ++static void *xmalloc(size_t size)
  49.452 ++{
  49.453 ++    void *vp = malloc(size);
  49.454 ++    if (vp == NULL)
  49.455 ++        vmefail(0);
  49.456 ++    return vp;
  49.457 ++}
  49.458 ++static void *xcalloc(size_t number, size_t size)
  49.459 ++{
  49.460 ++    void *vp = calloc(number, size);
  49.461 ++    if (vp == NULL)
  49.462 ++        vmefail(0);
  49.463 ++    return vp;
  49.464 ++}
  49.465 ++static void *xrealloc(void *ptr, size_t size)
  49.466 ++{
  49.467 ++    void *vp = realloc(ptr, size);
  49.468 ++    if (vp == NULL)
  49.469 ++        vmefail(0);
  49.470 ++    return vp;
  49.471 ++}
  49.472 ++#endif
  49.473 + #define	xstrdup(_str)	(strcpy(xmalloc(strlen(_str)+1), (_str)))
  49.474 + #endif
  49.475 + 
  49.476 +@@ -314,9 +348,14 @@
  49.477 + 
  49.478 + #if defined(__LCLINT__)
  49.479 + #define FILE_RCSID(id)
  49.480 +-#else
  49.481 ++#elif defined(__GNUC__)
  49.482 + #define FILE_RCSID(id) \
  49.483 + static inline const char *rcsid(const char *p) { \
  49.484 ++        return rcsid(p = id); \
  49.485 ++}
  49.486 ++#else
  49.487 ++#define FILE_RCSID(id) \
  49.488 ++static const char *rcsid(const char *p) { \
  49.489 + 	return rcsid(p = id); \
  49.490 + }
  49.491 + #endif
  49.492 +
  49.493 ++---------------------------------------------------------------------------
  49.494 +| Use GCC extensional features only if compiled with GCC.
  49.495 ++---------------------------------------------------------------------------
  49.496 +Index: file/file.h
  49.497 +--- file/file.h	24 Jan 2003 19:41:56 -0000	1.1.1.1
  49.498 ++++ file/file.h	22 Jan 2004 21:42:22 -0000	1.2
  49.499 +@@ -95,7 +95,11 @@
  49.500 + 	} value;		/* either number or string */
  49.501 + 	uint32_t mask;	/* mask before comparison with value */
  49.502 + 	char desc[MAXDESC];	/* description */
  49.503 ++#if defined(__GNUC__)
  49.504 + } __attribute__((__packed__));
  49.505 ++#else
  49.506 ++};
  49.507 ++#endif
  49.508 + 
  49.509 + #define BIT(A)   (1 << (A))
  49.510 + #define STRING_IGNORE_LOWERCASE		BIT(0)
  49.511 +
  49.512 ++---------------------------------------------------------------------------
  49.513 +| Add int32_t detection and automatic fallback support.
  49.514 ++---------------------------------------------------------------------------
  49.515 +Index: file/config.h.in
  49.516 +--- file/config.h.in	7 Mar 2003 19:39:18 -0000	1.1.1.1
  49.517 ++++ file/config.h.in	13 Sep 2006 13:40:49 -0000
  49.518 +@@ -106,6 +106,9 @@
  49.519 + /* Define to 1 if you have the <unistd.h> header file. */
  49.520 + #undef HAVE_UNISTD_H
  49.521 + 
  49.522 ++/* Define to 1 if you have the `vsnprintf' function. */
  49.523 ++#undef HAVE_VSNPRINTF
  49.524 ++
  49.525 + /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
  49.526 +    */
  49.527 + #undef MAJOR_IN_MKDEV
  49.528 +@@ -162,12 +165,16 @@
  49.529 + /* Define to empty if `const' does not conform to ANSI C. */
  49.530 + #undef const
  49.531 + 
  49.532 ++/* int32_t */
  49.533 ++#undef int32_t
  49.534 ++
  49.535 + /* Define to `long' if <sys/types.h> does not define. */
  49.536 + #undef off_t
  49.537 + 
  49.538 + /* Define to `unsigned' if <sys/types.h> does not define. */
  49.539 + #undef size_t
  49.540 + 
  49.541 ++#ifndef HAVE_STDINT_H
  49.542 + /* uint16_t */
  49.543 + #undef uint16_t
  49.544 + 
  49.545 +@@ -179,3 +186,4 @@
  49.546 + 
  49.547 + /* uint8_t */
  49.548 + #undef uint8_t
  49.549 ++#endif
  49.550 +
  49.551 ++---------------------------------------------------------------------------
  49.552 +| Add int32_t detection and automatic fallback support.
  49.553 ++---------------------------------------------------------------------------
  49.554 +Index: file/configure.ac
  49.555 +--- file/configure.ac	1 Dec 2002 21:34:06 -0000	1.1.1.1
  49.556 ++++ file/configure.ac	6 Jun 2005 15:53:05 -0000	1.2
  49.557 +@@ -92,6 +92,7 @@
  49.558 + AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
  49.559 + AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
  49.560 + AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
  49.561 ++AC_CHECK_TYPE_STDC(int32_t, int)
  49.562 + AC_C_LONG_LONG
  49.563 + if test $ac_cv_c_long_long = yes; then
  49.564 +   long64='unsigned long long';
  49.565 +@@ -107,7 +108,7 @@
  49.566 + AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
  49.567 + 
  49.568 + dnl Checks for functions
  49.569 +-AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul)
  49.570 ++AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul vsnprintf)
  49.571 + 
  49.572 + dnl Checks for libraries
  49.573 + AC_CHECK_LIB(z, gzopen)
  49.574 +
  49.575 ++---------------------------------------------------------------------------
  49.576 +| Add int32_t detection and automatic fallback support.
  49.577 ++---------------------------------------------------------------------------
  49.578 +Index: file/configure
  49.579 +--- file/configure	16 Jul 2003 17:05:25 -0000	1.1.1.2
  49.580 ++++ file/configure	6 Jun 2005 15:53:05 -0000	1.2
  49.581 +@@ -10847,6 +10847,46 @@
  49.582 + 
  49.583 + fi
  49.584 + 
  49.585 ++echo "$as_me:$LINENO: checking for int32_t" >&5
  49.586 ++echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
  49.587 ++if test "${ac_cv_type_int32_t+set}" = set; then
  49.588 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  49.589 ++else
  49.590 ++  cat >conftest.$ac_ext <<_ACEOF
  49.591 ++#line $LINENO "configure"
  49.592 ++/* confdefs.h.  */
  49.593 ++_ACEOF
  49.594 ++cat confdefs.h >>conftest.$ac_ext
  49.595 ++cat >>conftest.$ac_ext <<_ACEOF
  49.596 ++/* end confdefs.h.  */
  49.597 ++#if HAVE_STDINT_H
  49.598 ++#include <stdint.h>
  49.599 ++#endif
  49.600 ++#include <sys/types.h>
  49.601 ++#if STDC_HEADERS
  49.602 ++#include <stdlib.h>
  49.603 ++#include <stddef.h>
  49.604 ++#endif
  49.605 ++_ACEOF
  49.606 ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  49.607 ++  $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  49.608 ++  ac_cv_type_int32_t=yes
  49.609 ++else
  49.610 ++  ac_cv_type_int32_t=no
  49.611 ++fi
  49.612 ++rm -f conftest*
  49.613 ++
  49.614 ++fi
  49.615 ++echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
  49.616 ++echo "${ECHO_T}$ac_cv_type_int32_t" >&6
  49.617 ++if test $ac_cv_type_int32_t = no; then
  49.618 ++
  49.619 ++cat >>confdefs.h <<\_ACEOF
  49.620 ++#define int32_t int
  49.621 ++_ACEOF
  49.622 ++
  49.623 ++fi
  49.624 ++
  49.625 + echo "$as_me:$LINENO: checking for long long" >&5
  49.626 + echo $ECHO_N "checking for long long... $ECHO_C" >&6
  49.627 + if test "${ac_cv_c_long_long+set}" = set; then
  49.628 +@@ -11220,7 +11260,8 @@
  49.629 + 
  49.630 + 
  49.631 + 
  49.632 +-for ac_func in error mtrace mkstemp mmap strdup strerror strtoul
  49.633 ++
  49.634 ++for ac_func in error mtrace mkstemp mmap strdup strerror strtoul vsnprintf
  49.635 + do
  49.636 + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  49.637 + echo "$as_me:$LINENO: checking for $ac_func" >&5
  49.638 +
  49.639 ++---------------------------------------------------------------------------
  49.640 +| Fallback to vsprintf(3) if vsnprintf(3) does not exist.
  49.641 ++---------------------------------------------------------------------------
  49.642 +Index: file/print.c
  49.643 +--- file/print.c	24 Jan 2003 19:41:56 -0000	1.1.1.1
  49.644 ++++ file/print.c	6 Jun 2005 15:53:05 -0000	1.2
  49.645 +@@ -187,7 +187,11 @@
  49.646 + 
  49.647 + 	va_start(va, f);
  49.648 + /*@-boundswrite@*/
  49.649 ++#ifdef HAVE_VSNPRINTF
  49.650 + 	rc = vsnprintf(fm->obp, fm->nob, f, va);
  49.651 ++#else
  49.652 ++	rc = vsprintf(fm->obp, f, va);
  49.653 ++#endif
  49.654 + /*@=boundswrite@*/
  49.655 + 	va_end(va);
  49.656 + 
  49.657 +
  49.658 ++---------------------------------------------------------------------------
  49.659 +| Use GNU libtool's weaker -static (link with own static libraries)
  49.660 +| instead of the strong -all-static (link even with static libc, etc),
  49.661 +| because OpenPKG does not need to be fully static.
  49.662 ++---------------------------------------------------------------------------
  49.663 +Index: rpmdb/Makefile.am
  49.664 +--- rpmdb/Makefile.am	2 Jul 2003 20:14:07 -0000	1.1.1.7
  49.665 ++++ rpmdb/Makefile.am	22 Jan 2004 21:42:29 -0000	1.2
  49.666 +@@ -18,7 +18,7 @@
  49.667 + EXTRA_PROGRAMS = tjfn
  49.668 + 
  49.669 + tjfn_SOURCES = tjfn.c
  49.670 +-tjfn_LDFLAGS = -all-static
  49.671 ++tjfn_LDFLAGS = -static
  49.672 + tjfn_LDADD = librpmdb.la
  49.673 + 
  49.674 + pkgincdir = $(pkgincludedir)
  49.675 +@@ -180,4 +180,4 @@
  49.676 + 	$(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
  49.677 + 
  49.678 + tdbi: librpmdb.la tdbi.o
  49.679 +-	$(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
  49.680 ++	$(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
  49.681 +
  49.682 ++---------------------------------------------------------------------------
  49.683 +| Use GNU libtool's weaker -static (link with own static libraries)
  49.684 +| instead of the strong -all-static (link even with static libc, etc),
  49.685 +| because OpenPKG does not need to be fully static.
  49.686 ++---------------------------------------------------------------------------
  49.687 +Index: rpmdb/Makefile.in
  49.688 +--- rpmdb/Makefile.in	16 Jul 2003 17:05:48 -0000	1.1.1.7
  49.689 ++++ rpmdb/Makefile.in	22 Jan 2004 21:42:29 -0000	1.2
  49.690 +@@ -273,7 +273,7 @@
  49.691 + EXTRA_PROGRAMS = tjfn
  49.692 + 
  49.693 + tjfn_SOURCES = tjfn.c
  49.694 +-tjfn_LDFLAGS = -all-static
  49.695 ++tjfn_LDFLAGS = -static
  49.696 + tjfn_LDADD = librpmdb.la
  49.697 + 
  49.698 + pkgincdir = $(pkgincludedir)
  49.699 +@@ -952,7 +952,7 @@
  49.700 + 	$(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
  49.701 + 
  49.702 + tdbi: librpmdb.la tdbi.o
  49.703 +-	$(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
  49.704 ++	$(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
  49.705 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
  49.706 + # Otherwise a system limit (for SysV at least) may be exceeded.
  49.707 + .NOEXPORT:
  49.708 +
  49.709 ++---------------------------------------------------------------------------
  49.710 +| Use GNU libtool's weaker -static (link with own static libraries)
  49.711 +| instead of the strong -all-static (link even with static libc, etc),
  49.712 +| because OpenPKG does not need to be fully static.
  49.713 ++---------------------------------------------------------------------------
  49.714 +Index: rpmio/Makefile.am
  49.715 +--- rpmio/Makefile.am	5 Jun 2003 12:05:23 -0000	1.1.1.9
  49.716 ++++ rpmio/Makefile.am	22 Jan 2004 21:42:31 -0000	1.2
  49.717 +@@ -68,27 +68,27 @@
  49.718 + tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.719 + 
  49.720 + tdir_SOURCES = tdir.c
  49.721 +-tdir_LDFLAGS = -all-static
  49.722 ++tdir_LDFLAGS = -static
  49.723 + tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.724 + 
  49.725 + tfts_SOURCES = tfts.c
  49.726 +-tfts_LDFLAGS = -all-static
  49.727 ++tfts_LDFLAGS = -static
  49.728 + tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.729 + 
  49.730 + tglob_SOURCES = tglob.c
  49.731 +-tglob_LDFLAGS = -all-static
  49.732 ++tglob_LDFLAGS = -static
  49.733 + tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.734 + 
  49.735 + tinv_SOURCES = tinv.c
  49.736 +-tinv_LDFLAGS = -all-static
  49.737 ++tinv_LDFLAGS = -static
  49.738 + tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.739 + 
  49.740 + tkey_SOURCES = tkey.c
  49.741 +-tkey_LDFLAGS = -all-static
  49.742 ++tkey_LDFLAGS = -static
  49.743 + tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.744 + 
  49.745 + tring_SOURCES = tring.c
  49.746 +-tring_LDFLAGS = -all-static
  49.747 ++tring_LDFLAGS = -static
  49.748 + tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.749 + 
  49.750 + trpmio_SOURCES = trpmio.c
  49.751 +
  49.752 ++---------------------------------------------------------------------------
  49.753 +| Use GNU libtool's weaker -static (link with own static libraries)
  49.754 +| instead of the strong -all-static (link even with static libc, etc),
  49.755 +| because OpenPKG does not need to be fully static.
  49.756 +| Additionally, remove hard-coded Linux'ism of linking against POSIX
  49.757 +| rt/pthread libraries (is not needed even under Linux itself) and
  49.758 +| make sure the build does not break by an empty argument list when
  49.759 +| iterating over (the not existing) BeeCrypt objects.
  49.760 ++---------------------------------------------------------------------------
  49.761 +Index: rpmio/Makefile.in
  49.762 +--- rpmio/Makefile.in	16 Jul 2003 17:05:49 -0000	1.1.1.9
  49.763 ++++ rpmio/Makefile.in	22 Jan 2004 21:42:31 -0000	1.2
  49.764 +@@ -288,8 +288,7 @@
  49.765 + librpmio_la_LDFLAGS = -release 4.2 \
  49.766 + 	@WITH_BEECRYPT_LIB@ \
  49.767 + 	$(top_builddir)/file/libfmagic.la \
  49.768 +-	@WITH_ZLIB_LIB@ \
  49.769 +-	-lrt -lpthread
  49.770 ++	@WITH_ZLIB_LIB@
  49.771 + 
  49.772 + librpmio_la_LIBADD = $(BEECRYPTLOBJS)
  49.773 + librpmio_la_DEPENDENCIES = .created
  49.774 +@@ -298,27 +297,27 @@
  49.775 + tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.776 + 
  49.777 + tdir_SOURCES = tdir.c
  49.778 +-tdir_LDFLAGS = -all-static
  49.779 ++tdir_LDFLAGS = -static
  49.780 + tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.781 + 
  49.782 + tfts_SOURCES = tfts.c
  49.783 +-tfts_LDFLAGS = -all-static
  49.784 ++tfts_LDFLAGS = -static
  49.785 + tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.786 + 
  49.787 + tglob_SOURCES = tglob.c
  49.788 +-tglob_LDFLAGS = -all-static
  49.789 ++tglob_LDFLAGS = -static
  49.790 + tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.791 + 
  49.792 + tinv_SOURCES = tinv.c
  49.793 +-tinv_LDFLAGS = -all-static
  49.794 ++tinv_LDFLAGS = -static
  49.795 + tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.796 + 
  49.797 + tkey_SOURCES = tkey.c
  49.798 +-tkey_LDFLAGS = -all-static
  49.799 ++tkey_LDFLAGS = -static
  49.800 + tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.801 + 
  49.802 + tring_SOURCES = tring.c
  49.803 +-tring_LDFLAGS = -all-static
  49.804 ++tring_LDFLAGS = -static
  49.805 + tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  49.806 + 
  49.807 + trpmio_SOURCES = trpmio.c
  49.808 +@@ -743,8 +742,8 @@
  49.809 + .created:
  49.810 + 	if test X"@WITH_BEECRYPT_SUBDIR@" != X; then \
  49.811 + 	${MAKE} -C $(top_builddir)/@WITH_BEECRYPT_SUBDIR@ listobjs ; \
  49.812 +-	for lo in $(BEECRYPTLOBJS); do \
  49.813 +-	  [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
  49.814 ++	for lo in $(BEECRYPTLOBJS) ''; do \
  49.815 ++	  [ ".$$lo" = . ] || [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
  49.816 + 	done \
  49.817 + 	fi
  49.818 + 	touch $@
  49.819 +
  49.820 ++---------------------------------------------------------------------------
  49.821 +| Add Unixware support.
  49.822 ++---------------------------------------------------------------------------
  49.823 +Index: rpmio/fts.h
  49.824 +--- rpmio/fts.h	18 Jan 2003 16:13:17 -0000	1.1.1.3
  49.825 ++++ rpmio/fts.h	22 Jan 2004 21:42:32 -0000	1.2
  49.826 +@@ -51,7 +51,7 @@
  49.827 + # define	_LARGEFILE64_SOURCE
  49.828 + #endif
  49.829 + 
  49.830 +-#if defined(sun)
  49.831 ++#if defined(sun) || defined(OPENPKG_UNIXWARE)
  49.832 + # define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
  49.833 + #endif
  49.834 + 
  49.835 +
  49.836 ++---------------------------------------------------------------------------
  49.837 +| Add FreeBSD/NetBSD/OpenBSD support.
  49.838 +| Workaround some GCC'isms.
  49.839 ++---------------------------------------------------------------------------
  49.840 +Index: rpmio/fts.c
  49.841 +--- rpmio/fts.c	18 Jan 2003 16:13:17 -0000	1.1.1.3
  49.842 ++++ rpmio/fts.c	8 Jun 2005 13:16:25 -0000	1.5
  49.843 +@@ -34,6 +34,8 @@
  49.844 + static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
  49.845 + #endif /* LIBC_SCCS and not lint */
  49.846 + 
  49.847 ++#include <limits.h>
  49.848 ++
  49.849 + #if defined(_LIBC)
  49.850 + #include <sys/param.h>
  49.851 + #include <include/sys/stat.h>
  49.852 +@@ -45,20 +47,49 @@
  49.853 + #include <string.h>
  49.854 + #include <unistd.h>
  49.855 + #else
  49.856 +-#if defined(hpux)
  49.857 ++#if defined(OPENPKG_HPUX)
  49.858 + # define        _INCLUDE_POSIX_SOURCE
  49.859 + #   define __errno_location() 	(&errno)
  49.860 + #   define dirfd(dirp)		-1
  49.861 + #   define stat64		stat
  49.862 + #   define _STAT_VER		0
  49.863 + #   define __fxstat64(_stat_ver, _fd, _sbp)	fstat((_fd), (_sbp))
  49.864 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
  49.865 + #endif
  49.866 +-#if defined(sun)
  49.867 ++#if defined(sun) || defined(OPENPKG_UNIXWARE)
  49.868 + #   define __errno_location()	(&errno)
  49.869 + #   define dirfd(dirp)		-1
  49.870 + #   define _STAT_VER		0
  49.871 + #   define __fxstat64(_stat_ver, _fd, _sbp)	fstat((_fd), (_sbp))
  49.872 + #endif
  49.873 ++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
  49.874 ++#   define __errno_location()	(&errno)
  49.875 ++#   define stat64 stat
  49.876 ++#   define _STAT_VER		0
  49.877 ++#   define __fxstat64(_stat_ver, _fd, _sbp)	fstat((_fd), (_sbp))
  49.878 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
  49.879 ++#endif
  49.880 ++#if defined(__osf__)
  49.881 ++#   define __errno_location()   (&errno)
  49.882 ++#   define dirfd(dirp)          -1
  49.883 ++#   define stat64               stat
  49.884 ++#   define _STAT_VER            0
  49.885 ++#   define __fxstat64(_stat_ver, _fd, _sbp)     fstat((_fd), (_sbp))
  49.886 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
  49.887 ++#endif
  49.888 ++#if defined(OPENPKG_IRIX64)
  49.889 ++#   define __errno_location()   (&errno)
  49.890 ++#   define dirfd(dirp)          -1
  49.891 ++#   define __fxstat64(_stat_ver, _fd, _sbp)     fstat((_fd), (_sbp))
  49.892 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
  49.893 ++#endif
  49.894 ++#if defined(OPENPKG_AIX)
  49.895 ++#   define __errno_location()   (&errno)
  49.896 ++#   define _STAT_VER            0
  49.897 ++#   define dirfd(dirp)          ((dirp)->dd_fd)
  49.898 ++#   define __fxstat64(_stat_ver, _fd, _sbp)     fstat((_fd), (_sbp))
  49.899 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
  49.900 ++#endif
  49.901 + #include "system.h"
  49.902 + #include "fts.h"
  49.903 + #include "rpmio.h"
  49.904 +@@ -73,7 +104,12 @@
  49.905 + /* Largest alignment size needed, minus one.
  49.906 +    Usually long double is the worst case.  */
  49.907 + #ifndef ALIGNBYTES
  49.908 ++#if defined(__GNUC__)
  49.909 + #define ALIGNBYTES	(__alignof__ (long double) - 1)
  49.910 ++#else
  49.911 ++/* not accurate enough (usually too large), but sufficient (and this way equal safe) */
  49.912 ++#define ALIGNBYTES	(sizeof (long double) - 1)
  49.913 ++#endif
  49.914 + #endif
  49.915 + /* Align P to that size.  */
  49.916 + #ifndef ALIGN
  49.917 +@@ -107,9 +143,13 @@
  49.918 + 	/*@modifies fileSystem, internalState @*/;
  49.919 + 
  49.920 + #ifndef MAX
  49.921 ++#if defined(__GNUC__)
  49.922 + #define MAX(a, b)	({ __typeof__ (a) _a = (a); \
  49.923 + 			   __typeof__ (b) _b = (b); \
  49.924 + 			   _a > _b ? _a : _b; })
  49.925 ++#else
  49.926 ++#define MAX(a, b)   ((a) > (b) ? (a) : (b))
  49.927 ++#endif
  49.928 + #endif
  49.929 + 
  49.930 + #define	ISDOT(a)	(a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
  49.931 +
  49.932 ++---------------------------------------------------------------------------
  49.933 +| Remove inclusion of system <glob.h> because RPM uses its own glob(3)
  49.934 +| implementation and this can conflict with the system one.
  49.935 ++---------------------------------------------------------------------------
  49.936 +Index: rpmio/rpmio.h
  49.937 +--- rpmio/rpmio.h	12 Jun 2003 18:22:18 -0000	1.1.1.7
  49.938 ++++ rpmio/rpmio.h	22 Jan 2004 21:42:33 -0000	1.2
  49.939 +@@ -9,9 +9,6 @@
  49.940 + #include <sys/types.h>
  49.941 + #include <sys/stat.h>
  49.942 + #include <dirent.h>
  49.943 +-/*@-noparams@*/
  49.944 +-#include <glob.h>
  49.945 +-/*@=noparams@*/
  49.946 + #include <stdio.h>
  49.947 + #include <stdlib.h>
  49.948 + #include <unistd.h>
  49.949 +
  49.950 ++---------------------------------------------------------------------------
  49.951 +| Make this whole "dirent" fiddling at least working on
  49.952 +| FreeBSD/NetBSD/OpenBSD, Solaris, HPUX and Unixware. This certainly
  49.953 +| is a bad corner of RPM which inherently leads to portability
  49.954 +| problems.
  49.955 ++---------------------------------------------------------------------------
  49.956 +Index: rpmio/rpmrpc.c
  49.957 +--- rpmio/rpmrpc.c	29 May 2003 22:14:04 -0000	1.1.1.8
  49.958 ++++ rpmio/rpmrpc.c	8 Jun 2005 13:16:26 -0000	1.5
  49.959 +@@ -1079,6 +1079,8 @@
  49.960 +     return rc;
  49.961 + }
  49.962 + 
  49.963 ++#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_DARWIN)
  49.964 ++
  49.965 + struct __dirstream {
  49.966 +     int fd;			/* File descriptor.  */
  49.967 +     char * data;		/* Directory block.  */
  49.968 +@@ -1091,6 +1093,8 @@
  49.969 + #endif
  49.970 + };
  49.971 + 
  49.972 ++#endif
  49.973 ++
  49.974 + #if !defined(DT_DIR)
  49.975 + # define DT_UNKNOWN	0
  49.976 + # define DT_FIFO	1
  49.977 +@@ -1101,14 +1105,30 @@
  49.978 + # define DT_LNK		10
  49.979 + # define DT_SOCK	12
  49.980 + # define DT_WHT		14
  49.981 +-typedef struct __dirstream *	FTPDIR;
  49.982 +-#else
  49.983 +-typedef DIR *			FTPDIR;
  49.984 + #endif
  49.985 + 
  49.986 ++struct mydirstreament {
  49.987 ++    unsigned char type;
  49.988 ++    char *name;
  49.989 ++};
  49.990 ++struct mydirstream {
  49.991 ++    DIR dir;
  49.992 ++    struct dirent ent;
  49.993 ++    unsigned int offset;
  49.994 ++    unsigned int size;
  49.995 ++    struct mydirstreament av[1];
  49.996 ++};
  49.997 ++typedef struct mydirstream *FTPDIR;
  49.998 ++
  49.999 + /*@unchecked@*/
 49.1000 + static int ftpmagicdir = 0x8440291;
 49.1001 +-#define	ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
 49.1002 ++#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_UNIXWARE) && !defined(OPENPKG_DARWIN) && !defined(__osf__) && !defined(OPENPKG_IRIX64) && !defined(OPENPKG_HPUX) && !defined(OPENPKG_AIX)
 49.1003 ++#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
 49.1004 ++#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
 49.1005 ++#else
 49.1006 ++#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
 49.1007 ++#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
 49.1008 ++#endif
 49.1009 + 
 49.1010 + /*@-boundswrite@*/
 49.1011 + /*@-type@*/ /* FIX: abstract DIR */
 49.1012 +@@ -1121,8 +1141,7 @@
 49.1013 +     struct dirent * dp;
 49.1014 +     size_t nb;
 49.1015 +     const char * s, * sb, * se;
 49.1016 +-    const char ** av;
 49.1017 +-    unsigned char * dt;
 49.1018 ++    struct mydirstreament * av;
 49.1019 +     char * t;
 49.1020 +     int ac;
 49.1021 +     int c;
 49.1022 +@@ -1165,28 +1184,22 @@
 49.1023 + 	}
 49.1024 +     }
 49.1025 + 
 49.1026 +-    nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
 49.1027 ++    nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
 49.1028 +     mydir = xcalloc(1, nb);
 49.1029 +     /*@-abstract@*/
 49.1030 +-    dp = (struct dirent *) (mydir + 1);
 49.1031 +-    av = (const char **) (dp + 1);
 49.1032 +-    dt = (char *) (av + (ac + 1));
 49.1033 +-    t = (char *) (dt + ac + 1);
 49.1034 ++    dp = &mydir->ent;
 49.1035 ++    av = &mydir->av[0];
 49.1036 ++    t  = (char *)&mydir->av[ac+1];
 49.1037 +     /*@=abstract@*/
 49.1038 + 
 49.1039 +-    mydir->fd = ftpmagicdir;
 49.1040 +-/*@-usereleased@*/
 49.1041 +-    mydir->data = (char *) dp;
 49.1042 +-/*@=usereleased@*/
 49.1043 +-    mydir->allocation = nb;
 49.1044 +-    mydir->size = ac;
 49.1045 +-    mydir->offset = -1;
 49.1046 +-    mydir->filepos = 0;
 49.1047 ++    SETFTPMAGIC((DIR *)mydir);
 49.1048 ++    mydir->size   = ac;
 49.1049 ++    mydir->offset = 0;
 49.1050 + 
 49.1051 +     ac = 0;
 49.1052 +     /*@-dependenttrans -unrecog@*/
 49.1053 +-    dt[ac] = DT_DIR;	av[ac++] = t;	t = stpcpy(t, ".");	t++;
 49.1054 +-    dt[ac] = DT_DIR;	av[ac++] = t;	t = stpcpy(t, "..");	t++;
 49.1055 ++    av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".");  ++ac;
 49.1056 ++    av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
 49.1057 +     /*@=dependenttrans =unrecog@*/
 49.1058 +     sb = NULL;
 49.1059 +     s = se = ftpBuf;
 49.1060 +@@ -1198,34 +1211,34 @@
 49.1061 + 	    /*@switchbreak@*/ break;
 49.1062 + 	case '\r':
 49.1063 + 	    /*@-dependenttrans@*/
 49.1064 +-	    av[ac] = t;
 49.1065 ++	    av[ac].name = t;
 49.1066 + 	    /*@=dependenttrans@*/
 49.1067 + 	    if (sb == NULL) {
 49.1068 + 		/*@-unrecog@*/
 49.1069 + 		switch(*s) {
 49.1070 + 		case 'p':
 49.1071 +-		    dt[ac] = DT_FIFO;
 49.1072 ++		    av[ac].type = DT_FIFO;
 49.1073 + 		    /*@innerbreak@*/ break;
 49.1074 + 		case 'c':
 49.1075 +-		    dt[ac] = DT_CHR;
 49.1076 ++		    av[ac].type = DT_CHR;
 49.1077 + 		    /*@innerbreak@*/ break;
 49.1078 + 		case 'd':
 49.1079 +-		    dt[ac] = DT_DIR;
 49.1080 ++		    av[ac].type = DT_DIR;
 49.1081 + 		    /*@innerbreak@*/ break;
 49.1082 + 		case 'b':
 49.1083 +-		    dt[ac] = DT_BLK;
 49.1084 ++		    av[ac].type = DT_BLK;
 49.1085 + 		    /*@innerbreak@*/ break;
 49.1086 + 		case '-':
 49.1087 +-		    dt[ac] = DT_REG;
 49.1088 ++		    av[ac].type = DT_REG;
 49.1089 + 		    /*@innerbreak@*/ break;
 49.1090 + 		case 'l':
 49.1091 +-		    dt[ac] = DT_LNK;
 49.1092 ++		    av[ac].type = DT_LNK;
 49.1093 + 		    /*@innerbreak@*/ break;
 49.1094 + 		case 's':
 49.1095 +-		    dt[ac] = DT_SOCK;
 49.1096 ++		    av[ac].type = DT_SOCK;
 49.1097 + 		    /*@innerbreak@*/ break;
 49.1098 + 		default:
 49.1099 +-		    dt[ac] = DT_UNKNOWN;
 49.1100 ++		    av[ac].type = DT_UNKNOWN;
 49.1101 + 		    /*@innerbreak@*/ break;
 49.1102 + 		}
 49.1103 + 		/*@=unrecog@*/
 49.1104 +@@ -1243,7 +1256,7 @@
 49.1105 + 	    /*@switchbreak@*/ break;
 49.1106 + 	}
 49.1107 +     }
 49.1108 +-    av[ac] = NULL;
 49.1109 ++    av[ac].name = NULL;
 49.1110 + 
 49.1111 + /*@-kepttrans@*/
 49.1112 +     return (DIR *) mydir;
 49.1113 +@@ -1258,43 +1271,50 @@
 49.1114 + {
 49.1115 +     FTPDIR mydir = (FTPDIR)dir;
 49.1116 +     struct dirent * dp;
 49.1117 +-    const char ** av;
 49.1118 +-    unsigned char * dt;
 49.1119 ++    struct mydirstreament * av;
 49.1120 +     int ac;
 49.1121 +     int i;
 49.1122 + 
 49.1123 +     /*@+voidabstract@*/
 49.1124 +-    if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
 49.1125 ++    if (dir == NULL || !ISFTPMAGIC(dir)) {
 49.1126 + 	/* XXX TODO: EBADF errno. */
 49.1127 + 	return NULL;
 49.1128 +     }
 49.1129 +     /*@=voidabstract@*/
 49.1130 + 
 49.1131 +-    dp = (struct dirent *) mydir->data;
 49.1132 +-    av = (const char **) (dp + 1);
 49.1133 ++    dp = &mydir->ent;
 49.1134 ++    av = &mydir->av[0];
 49.1135 +     ac = mydir->size;
 49.1136 +-    dt = (char *) (av + (ac + 1));
 49.1137 +-    i = mydir->offset + 1;
 49.1138 ++    i  = mydir->offset + 1;
 49.1139 + 
 49.1140 + /*@-boundsread@*/
 49.1141 +-    if (i < 0 || i >= ac || av[i] == NULL)
 49.1142 ++    if (i < 0 || i >= ac || av[i].name == NULL)
 49.1143 + 	return NULL;
 49.1144 + /*@=boundsread@*/
 49.1145 + 
 49.1146 +     mydir->offset = i;
 49.1147 + 
 49.1148 ++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
 49.1149 ++    dp->d_ino = i + 1;
 49.1150 ++    dp->d_reclen = 0;
 49.1151 ++    dp->d_type = av[i].type;
 49.1152 ++    strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
 49.1153 ++    dp->d_name[sizeof(dp->d_name)-1] = '\0';
 49.1154 ++    dp->d_namlen = strlen(dp->d_name);
 49.1155 ++#elif defined(OPENPKG_HPUX) || defined(sun) || defined(OPENPKG_UNIXWARE) || defined(__osf__) || defined(OPENPKG_IRIX64) || defined(OPENPKG_AIX)
 49.1156 ++    /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
 49.1157 ++    dp->d_ino = i + 1;		/* W2DO? */
 49.1158 ++    dp->d_reclen = 0;		/* W2DO? */
 49.1159 ++    strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
 49.1160 ++#else
 49.1161 +     /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
 49.1162 +     dp->d_ino = i + 1;		/* W2DO? */
 49.1163 +     dp->d_reclen = 0;		/* W2DO? */
 49.1164 +-
 49.1165 +-#if !defined(hpux) && !defined(sun)
 49.1166 +     dp->d_off = 0;		/* W2DO? */
 49.1167 +-/*@-boundsread@*/
 49.1168 +-    dp->d_type = dt[i];
 49.1169 +-/*@=boundsread@*/
 49.1170 ++    dp->d_type = av[i].type;
 49.1171 ++    strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
 49.1172 + #endif
 49.1173 + 
 49.1174 +-    strncpy(dp->d_name, av[i], sizeof(dp->d_name));
 49.1175 + /*@+voidabstract@*/
 49.1176 + if (_ftp_debug)
 49.1177 + fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
 49.1178 +@@ -1313,7 +1333,7 @@
 49.1179 +     /*@+voidabstract@*/
 49.1180 + if (_ftp_debug)
 49.1181 + fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
 49.1182 +-    if (mydir == NULL || !ISFTPMAGIC(mydir)) {
 49.1183 ++    if (dir == NULL || !ISFTPMAGIC(dir)) {
 49.1184 + 	/* XXX TODO: EBADF errno. */
 49.1185 + 	return -1;
 49.1186 +     }
 49.1187 +
 49.1188 ++---------------------------------------------------------------------------
 49.1189 +| Remove inclusion of ancient (and since years deprecated) <malloc.h>
 49.1190 +| header. This especially makes sure RPM build does not break on
 49.1191 +| strict platforms like FreeBSD 5.
 49.1192 ++---------------------------------------------------------------------------
 49.1193 +Index: system.h
 49.1194 +--- system.h	1 Mar 2003 19:53:08 -0000	1.1.1.10
 49.1195 ++++ system.h	8 Jun 2005 13:15:16 -0000	1.4
 49.1196 +@@ -256,10 +256,6 @@
 49.1197 + #include <err.h>
 49.1198 + #endif
 49.1199 + 
 49.1200 +-#if HAVE_MALLOC_H && !defined(__LCLINT__)
 49.1201 +-#include <malloc.h>
 49.1202 +-#endif
 49.1203 +-
 49.1204 + /*@-declundef -incondefs @*/ /* FIX: these are macros */
 49.1205 + /**
 49.1206 +  */
 49.1207 +
 49.1208 ++---------------------------------------------------------------------------
 49.1209 +| Add support for BSD getmntinfo(3).
 49.1210 ++---------------------------------------------------------------------------
 49.1211 +Index: system.h
 49.1212 +--- system.h	1 Mar 2003 19:53:08 -0000	1.1.1.10
 49.1213 ++++ system.h	8 Jun 2005 13:15:16 -0000	1.4
 49.1214 +@@ -550,7 +546,7 @@
 49.1215 + #define lchown chown
 49.1216 + #endif
 49.1217 + 
 49.1218 +-#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
 49.1219 ++#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
 49.1220 + # define GETMNTENT_ONE 0
 49.1221 + # define GETMNTENT_TWO 0
 49.1222 + # if HAVE_SYS_MNTCTL_H
 49.1223 +
 49.1224 ++---------------------------------------------------------------------------
 49.1225 +| Drop GCC "inline" attribute if not compiling with GCC.
 49.1226 ++---------------------------------------------------------------------------
 49.1227 +Index: system.h
 49.1228 +--- system.h	1 Mar 2003 19:53:08 -0000	1.1.1.10
 49.1229 ++++ system.h	8 Jun 2005 13:15:16 -0000	1.4
 49.1230 +@@ -603,11 +599,24 @@
 49.1231 + 
 49.1232 + #if defined(__LCLINT__)
 49.1233 + #define FILE_RCSID(id)
 49.1234 +-#else
 49.1235 ++#elif defined(__GNUC__)
 49.1236 + #define FILE_RCSID(id) \
 49.1237 + static inline const char *rcsid(const char *p) { \
 49.1238 +         return rcsid(p = id); \
 49.1239 + }
 49.1240 ++#else
 49.1241 ++#define FILE_RCSID(id) \
 49.1242 ++static const char *rcsid(const char *p) { \
 49.1243 ++        return rcsid(p = id); \
 49.1244 ++}
 49.1245 ++#endif
 49.1246 ++
 49.1247 ++/* for basename(3) and dirname(3) */
 49.1248 ++#if !defined(OPENPKG_AIX)
 49.1249 ++#include <libgen.h>
 49.1250 ++#endif
 49.1251 ++#if defined(OPENPKG_AIX)
 49.1252 ++#define unsetenv(x) /* unsetenv() is used in RPM just for malloc debugging purposes */
 49.1253 + #endif
 49.1254 + 
 49.1255 + #endif	/* H_SYSTEM */
 49.1256 +
 49.1257 ++---------------------------------------------------------------------------
 49.1258 +| Remove GCC'ism.
 49.1259 ++---------------------------------------------------------------------------
 49.1260 +Index: build/rpmfile.h
 49.1261 +--- build/rpmfile.h	24 Jan 2003 19:41:56 -0000	1.1.1.1
 49.1262 ++++ build/rpmfile.h	22 Jan 2004 21:42:14 -0000	1.2
 49.1263 +@@ -95,7 +95,11 @@
 49.1264 + 	} value;		/* either number or string */
 49.1265 + 	uint32_t mask;	/* mask before comparison with value */
 49.1266 + 	char desc[MAXDESC];	/* description */
 49.1267 ++#if defined(__GNUC__)
 49.1268 + } __attribute__((__packed__));
 49.1269 ++#else
 49.1270 ++};
 49.1271 ++#endif
 49.1272 + 
 49.1273 + #define BIT(A)   (1 << (A))
 49.1274 + #define STRING_IGNORE_LOWERCASE		BIT(0)
 49.1275 +
 49.1276 ++---------------------------------------------------------------------------
 49.1277 +| Better portability for madvise(2) usage.
 49.1278 ++---------------------------------------------------------------------------
 49.1279 +Index: rpmdb/legacy.c
 49.1280 +--- rpmdb/legacy.c	18 Dec 2002 22:40:19 -0000	1.1.1.4
 49.1281 ++++ rpmdb/legacy.c	22 Jan 2004 21:42:30 -0000	1.2
 49.1282 +@@ -182,7 +182,7 @@
 49.1283 + 	    break;
 49.1284 + 	}
 49.1285 + 
 49.1286 +-#ifdef	MADV_SEQUENTIAL
 49.1287 ++#if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)
 49.1288 +         xx = madvise(mapped, fsize, MADV_SEQUENTIAL);
 49.1289 + #endif
 49.1290 + 
 49.1291 +
 49.1292 ++---------------------------------------------------------------------------
 49.1293 +| Better portability for madvise(2) usage.
 49.1294 ++---------------------------------------------------------------------------
 49.1295 +Index: lib/fsm.c
 49.1296 +--- lib/fsm.c	3 Mar 2003 21:28:12 -0000	1.1.1.5
 49.1297 ++++ lib/fsm.c	22 Jan 2004 21:42:23 -0000	1.2
 49.1298 +@@ -879,7 +879,7 @@
 49.1299 + 	    rdbuf = fsm->rdbuf;
 49.1300 + 	    fsm->rdbuf = (char *) mapped;
 49.1301 + 	    fsm->rdlen = nmapped = st->st_size;
 49.1302 +-#if defined(MADV_DONTNEED)
 49.1303 ++#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
 49.1304 + 	    xx = madvise(mapped, nmapped, MADV_DONTNEED);
 49.1305 + #endif
 49.1306 + 	}
 49.1307 +@@ -909,7 +909,7 @@
 49.1308 + #if HAVE_MMAP
 49.1309 + 	if (mapped != (void *)-1) {
 49.1310 + 	    xx = msync(mapped, nmapped, MS_ASYNC);
 49.1311 +-#if defined(MADV_DONTNEED)
 49.1312 ++#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
 49.1313 + 	    xx = madvise(mapped, nmapped, MADV_DONTNEED);
 49.1314 + #endif
 49.1315 + 	    /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
 49.1316 +
 49.1317 ++---------------------------------------------------------------------------
 49.1318 +| Support UnixWare 7.1.3 and OpenDarwin 6.6.2, too.
 49.1319 ++---------------------------------------------------------------------------
 49.1320 +Index: aclocal.m4
 49.1321 +--- aclocal.m4	16 Jul 2003 17:05:28 -0000	1.1.1.10
 49.1322 ++++ aclocal.m4	6 Jun 2005 15:53:03 -0000	1.4
 49.1323 +@@ -2838,7 +2838,7 @@
 49.1324 +     runpath_var=LD_RUN_PATH
 49.1325 +     ;;
 49.1326 + 
 49.1327 +-  sysv5uw7* | unixware7*)
 49.1328 ++  sysv5uw7* | unixware7* | sysv5UnixWare7* )
 49.1329 +     no_undefined_flag='${wl}-z ${wl}text'
 49.1330 +     if test "$GCC" = yes; then
 49.1331 +       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 49.1332 +@@ -4311,6 +4311,7 @@
 49.1333 +     ;;
 49.1334 +   *) # Darwin 1.3 on
 49.1335 +     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
 49.1336 ++    lt_cv_deplibs_check_method=pass_all
 49.1337 +     ;;
 49.1338 +   esac
 49.1339 +   ;;
 49.1340 +@@ -4336,7 +4337,7 @@
 49.1341 +   ;;
 49.1342 + 
 49.1343 + hpux10.20*|hpux11*)
 49.1344 +-  lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
 49.1345 ++  lt_cv_deplibs_check_method='pass_all'
 49.1346 +   lt_cv_file_magic_cmd=/usr/bin/file
 49.1347 +   lt_cv_file_magic_test_file=/usr/lib/libc.sl
 49.1348 +   ;;
 49.1349 +@@ -4375,11 +4376,7 @@
 49.1350 +   ;;
 49.1351 + 
 49.1352 + netbsd*)
 49.1353 +-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
 49.1354 +-    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
 49.1355 +-  else
 49.1356 +-    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
 49.1357 +-  fi
 49.1358 ++  lt_cv_deplibs_check_method='pass_all'
 49.1359 +   ;;
 49.1360 + 
 49.1361 + newos6*)
 49.1362 +@@ -4414,7 +4411,7 @@
 49.1363 +   lt_cv_file_magic_test_file=/lib/libc.so
 49.1364 +   ;;
 49.1365 + 
 49.1366 +-sysv5uw[[78]]* | sysv4*uw2*)
 49.1367 ++sysv5uw[[78]]* | sysv4*uw2* | sysv5UnixWare7* )
 49.1368 +   lt_cv_deplibs_check_method=pass_all
 49.1369 +   ;;
 49.1370 + 
 49.1371 +
 49.1372 ++---------------------------------------------------------------------------
 49.1373 +| Use Linux i386 assembly specific stuff on Linux only.
 49.1374 ++---------------------------------------------------------------------------
 49.1375 +Index: rpmio/rpmsw.c
 49.1376 +--- rpmio/rpmsw.c	5 Jun 2003 12:04:05 -0000	1.1.1.1
 49.1377 ++++ rpmio/rpmsw.c	22 Jan 2004 21:42:33 -0000	1.2
 49.1378 +@@ -27,7 +27,7 @@
 49.1379 + /*@unchecked@*/
 49.1380 + static int rpmsw_initialized = 0;
 49.1381 + 
 49.1382 +-#if defined(__i386__)
 49.1383 ++#if defined(__linux__) && defined(__i386__)
 49.1384 + /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */
 49.1385 + 
 49.1386 + #define	HP_TIMING_ZERO(Var)	(Var) = (0)
 49.1387 +
 49.1388 ++---------------------------------------------------------------------------
 49.1389 +| Fix "environ" declaration.
 49.1390 ++---------------------------------------------------------------------------
 49.1391 +Index: lib/signature.c
 49.1392 +--- lib/signature.c	29 May 2003 18:42:23 -0000	1.1.1.23
 49.1393 ++++ lib/signature.c	22 Jan 2004 21:42:25 -0000	1.2
 49.1394 +@@ -27,7 +27,7 @@
 49.1395 + /*@access pgpDigParams@*/
 49.1396 + 
 49.1397 + #if !defined(__GLIBC__)
 49.1398 +-char ** environ = NULL;
 49.1399 ++extern char ** environ;
 49.1400 + #endif
 49.1401 + 
 49.1402 + int rpmLookupSignatureType(int action)
 49.1403 +
 49.1404 ++---------------------------------------------------------------------------
 49.1405 +| Rename own mergesort(3) implementation to avoid conflicts
 49.1406 +| with a possibly existing vendor version.
 49.1407 ++---------------------------------------------------------------------------
 49.1408 +Index: rpmdb/merge.c
 49.1409 +--- rpmdb/merge.c	22 Jun 2002 18:51:58 -0000	1.1.1.2
 49.1410 ++++ rpmdb/merge.c	22 Jan 2004 21:42:30 -0000	1.2
 49.1411 +@@ -204,7 +204,7 @@
 49.1412 +  * Arguments are as for qsort.
 49.1413 +  */
 49.1414 + int
 49.1415 +-mergesort(void *base, size_t nmemb, size_t size,
 49.1416 ++rpmdb_mergesort(void *base, size_t nmemb, size_t size,
 49.1417 + 		int (*cmp) (const void *, const void *))
 49.1418 + {
 49.1419 + 	register int i, sense;
 49.1420 +
 49.1421 ++---------------------------------------------------------------------------
 49.1422 +| Rename own mergesort(3) implementation to avoid conflicts
 49.1423 +| with a possibly existing vendor version.
 49.1424 ++---------------------------------------------------------------------------
 49.1425 +Index: rpmdb/rpmdb.h
 49.1426 +--- rpmdb/rpmdb.h	18 Jan 2003 14:04:35 -0000	1.1.1.5
 49.1427 ++++ rpmdb/rpmdb.h	22 Jan 2004 21:42:31 -0000	1.2
 49.1428 +@@ -1080,7 +1080,7 @@
 49.1429 +  * Mergesort, same arguments as qsort(2).
 49.1430 +  */
 49.1431 + /*@unused@*/
 49.1432 +-int mergesort(void *base, size_t nmemb, size_t size,
 49.1433 ++int rpmdb_mergesort(void *base, size_t nmemb, size_t size,
 49.1434 +                 int (*cmp) (const void *, const void *))
 49.1435 + 	/*@globals errno @*/
 49.1436 + 	/*@modifies base, errno @*/;
 49.1437 +
 49.1438 ++---------------------------------------------------------------------------
 49.1439 +| Rename own mergesort(3) implementation to avoid conflicts
 49.1440 +| with a possibly existing vendor version.
 49.1441 ++---------------------------------------------------------------------------
 49.1442 +Index: rpmdb/rpmdb.c
 49.1443 +--- rpmdb/rpmdb.c	2 Jul 2003 19:21:54 -0000	1.1.1.6
 49.1444 ++++ rpmdb/rpmdb.c	22 Jan 2004 21:42:30 -0000	1.2
 49.1445 +@@ -2361,7 +2361,7 @@
 49.1446 + 		sizeof(*mi->mi_set->recs), hdrNumCmp);
 49.1447 + /*@=boundsread@*/
 49.1448 + #else
 49.1449 +-	mergesort(mi->mi_set->recs, mi->mi_set->count,
 49.1450 ++	rpmdb_mergesort(mi->mi_set->recs, mi->mi_set->count,
 49.1451 + 		sizeof(*mi->mi_set->recs), hdrNumCmp);
 49.1452 + #endif
 49.1453 + 	mi->mi_sorted = 1;
 49.1454 +
 49.1455 ++---------------------------------------------------------------------------
 49.1456 +| Workaround a double-inclusion problem under AIX.
 49.1457 ++---------------------------------------------------------------------------
 49.1458 +Index: lib/getdate.y
 49.1459 +--- lib/getdate.y	24 Sep 2001 21:53:15 -0000	1.1.1.2
 49.1460 ++++ lib/getdate.y	8 Jun 2005 13:16:22 -0000	1.2
 49.1461 +@@ -30,7 +30,9 @@
 49.1462 + #undef static
 49.1463 + #endif
 49.1464 + 
 49.1465 ++#ifndef OPENPKG_AIX
 49.1466 + #include <stdio.h>
 49.1467 ++#endif
 49.1468 + #include <ctype.h>
 49.1469 + 
 49.1470 + /* The code at the top of get_date which figures out the offset of the
 49.1471 +
 49.1472 ++---------------------------------------------------------------------------
 49.1473 +| Workaround a double-inclusion problem under AIX.
 49.1474 ++---------------------------------------------------------------------------
 49.1475 +Index: lib/getdate.c
 49.1476 +--- lib/getdate.c	2 Jul 2003 19:21:45 -0000	1.1.1.4
 49.1477 ++++ lib/getdate.c	8 Jun 2005 13:16:21 -0000	1.2
 49.1478 +@@ -50,7 +50,9 @@
 49.1479 + #undef static
 49.1480 + #endif
 49.1481 + 
 49.1482 ++#ifndef OPENPKG_AIX
 49.1483 + #include <stdio.h>
 49.1484 ++#endif
 49.1485 + #include <ctype.h>
 49.1486 + 
 49.1487 + /* The code at the top of get_date which figures out the offset of the
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/openpkg/rpm.patch.regen	Tue Jan 06 23:40:39 2009 +0100
    50.3 @@ -0,0 +1,1038 @@
    50.4 +##
    50.5 +##  rpm.patch.regen -- Annotated OpenPKG RPM Patch file
    50.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    50.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    50.8 +##
    50.9 +##  This file assembles changes to existing RPM source files between
   50.10 +##  the original RedHat RPM and the OpenPKG RPM variant. It can be
   50.11 +##  automatically applied to a vanilla RedHat RPM source tree with the
   50.12 +##  'patch' tool to upgrade those files. Each patch snippet is annotated
   50.13 +##  with a short description.
   50.14 +##
   50.15 +##  Created on: 13-Sep-2006
   50.16 +##
   50.17 +##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
   50.18 +##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
   50.19 +##
   50.20 +
   50.21 ++---------------------------------------------------------------------------
   50.22 +| Corresponding patches in "config.h.in" script after regeneration from
   50.23 +| patched "configure.ac" with "autoheader".
   50.24 ++---------------------------------------------------------------------------
   50.25 +Index: config.h.in
   50.26 +--- config.h.in	16 Jul 2003 17:17:13 -0000	1.1.1.18
   50.27 ++++ config.h.in	13 Sep 2006 13:41:41 -0000
   50.28 +@@ -108,6 +108,9 @@
   50.29 + /* Define if you have the getmntent() function */
   50.30 + #undef HAVE_GETMNTENT
   50.31 + 
   50.32 ++/* Define as 1 if you have the getmntinfo() function */
   50.33 ++#undef HAVE_GETMNTINFO
   50.34 ++
   50.35 + /* Define as 1 if you have getmntinfo_r() (only osf?) */
   50.36 + #undef HAVE_GETMNTINFO_R
   50.37 + 
   50.38 +@@ -181,18 +184,12 @@
   50.39 + /* Define to 1 if you have the `port' library (-lport). */
   50.40 + #undef HAVE_LIBPORT
   50.41 + 
   50.42 +-/* Define to 1 if you have the `pthread' library (-lpthread). */
   50.43 +-#undef HAVE_LIBPTHREAD
   50.44 +-
   50.45 + /* Define to 1 if you have the `rand' library (-lrand). */
   50.46 + #undef HAVE_LIBRAND
   50.47 + 
   50.48 + /* Define to 1 if you have the `socket' library (-lsocket). */
   50.49 + #undef HAVE_LIBSOCKET
   50.50 + 
   50.51 +-/* Define to 1 if you have the `thread' library (-lthread). */
   50.52 +-#undef HAVE_LIBTHREAD
   50.53 +-
   50.54 + /* Define to 1 if you have the <limits.h> header file. */
   50.55 + #undef HAVE_LIMITS_H
   50.56 + 
   50.57 +@@ -259,9 +256,6 @@
   50.58 + /* Define to 1 if you have the `regcomp' function. */
   50.59 + #undef HAVE_REGCOMP
   50.60 + 
   50.61 +-/* Define to 1 if you have the <semaphore.h> header file. */
   50.62 +-#undef HAVE_SEMAPHORE_H
   50.63 +-
   50.64 + /* Define to 1 if you have the `setenv' function. */
   50.65 + #undef HAVE_SETENV
   50.66 + 
   50.67 +@@ -323,9 +317,6 @@
   50.68 + /* Define as 1 if you have "struct mnttab" (only sco?) */
   50.69 + #undef HAVE_STRUCT_MNTTAB
   50.70 + 
   50.71 +-/* Define to 1 if you have the <synch.h> header file. */
   50.72 +-#undef HAVE_SYNCH_H
   50.73 +-
   50.74 + /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
   50.75 +    */
   50.76 + #undef HAVE_SYS_DIR_H
   50.77 +@@ -391,9 +382,6 @@
   50.78 + /* Define as 1 if <sys/stat.h> defines S_ISSOCK */
   50.79 + #undef HAVE_S_ISSOCK
   50.80 + 
   50.81 +-/* Define to 1 if you have the <thread.h> header file. */
   50.82 +-#undef HAVE_THREAD_H
   50.83 +-
   50.84 + /* Define to 1 if you have the `tsearch' function. */
   50.85 + #undef HAVE_TSEARCH
   50.86 + 
   50.87 +@@ -586,6 +574,17 @@
   50.88 + /* Define to `unsigned' if <sys/types.h> does not define. */
   50.89 + #undef size_t
   50.90 + 
   50.91 ++#ifndef HAVE_STDINT_H
   50.92 ++/* uint16_t */
   50.93 ++#undef uint16_t
   50.94 ++
   50.95 ++/* uint32_t */
   50.96 ++#undef uint32_t
   50.97 ++
   50.98 ++/* uint8_t */
   50.99 ++#undef uint8_t
  50.100 ++#endif
  50.101 ++
  50.102 + /* Define to unsigned long or unsigned long long if <inttypes.h> and
  50.103 +    <stdint.h> don't define. */
  50.104 + #undef uintmax_t
  50.105 +
  50.106 ++---------------------------------------------------------------------------
  50.107 +| Corresponding patches in "configure" script after regeneration from
  50.108 +| patched "configure.ac" with "autoconf".
  50.109 ++---------------------------------------------------------------------------
  50.110 +Index: configure
  50.111 +--- configure	16 Jul 2003 17:05:55 -0000	1.1.1.23
  50.112 ++++ configure	13 Sep 2006 13:41:43 -0000
  50.113 +@@ -467,7 +467,7 @@
  50.114 + # include <unistd.h>
  50.115 + #endif"
  50.116 + 
  50.117 +-ac_subdirs_all="$ac_subdirs_all popt beecrypt zlib elfutils file db3"
  50.118 ++ac_subdirs_all="$ac_subdirs_all popt zlib elfutils file db3"
  50.119 + ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS RPMUSER RPMUID RPMGROUP RPMGID CTAGS CSCOPE LDFLAGS_STATIC LDFLAGS_NPTL FIXPERMS MKDIR MKDIR_P U ANSI2KNR LN_S ECHO RANLIB ac_ct_RANLIB LIBTOOL AR ac_ct_AR BZIP2BIN __CAT __CHGRP __CHMOD __CHOWN __CP __CPIO __FILE __GPG __GREP GZIPBIN UNZIPBIN __ID __ID_U __INSTALL __MAKE __MKDIR __MV __PATCH __PERL PGPBIN __PYTHON __RM __RSH __SED __SSH __TAR __LD __NM __OBJCOPY __OBJDUMP __STRIP WITH_ZLIB_SUBDIR WITH_ZLIB_INCLUDE WITH_ZLIB_LIB WITH_ELFUTILS_SUBDIR WITH_LIBELF_INCLUDE WITH_LIBELF_LIB WITH_LIBDWARF_INCLUDE WITH_BEECRYPT_SUBDIR WITH_BEECRYPT_INCLUDE WITH_BEECRYPT_LIB WITH_DB_SUBDIR WITH_INTERNAL_DB DBLIBSRCS DBLIBOBJS libdb3 libdb3a WITH_BZIP2 MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON USE_NLS BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT INTLOBJS DATADIRNAME INSTOBJEXT GENCAT INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS WITH_PYTHON_SUBDIR WITH_PYTHON_SUBPACKAGE WITH_PYTHON_VERSION __DOXYGEN WITH_APIDOCS_TARGET WITH_APIDOCS __CHOWN_RHF __CHGRP_RHF ROOT_GROUP varprefix tmpdir MARK64 RPMCANONCOLOR autorelocate_path RPMCANONARCH RPMCANONVENDOR RPMCANONOS LOCALEDIR LIBDIR RPMCONFIGDIR SYSCONFIGDIR MACROFILES LIBRPMRC_FILENAME VENDORRPMRC_FILENAME LIBRPMALIAS_FILENAME FINDREQUIRES FINDPROVIDES testdir INCPATH LIBMISC RPM OBJDUMP subdirs LTLIBOBJS'
  50.120 + ac_subst_files=''
  50.121 + 
  50.122 +@@ -4040,7 +4040,7 @@
  50.123 + AS=${AS-as}
  50.124 + 
  50.125 + if test "$ac_cv_c_compiler_gnu" = yes; then
  50.126 +-    CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
  50.127 ++    CFLAGS="$CFLAGS -O2 -D_GNU_SOURCE -D_REENTRANT"
  50.128 + fi
  50.129 + export CFLAGS
  50.130 + 
  50.131 +@@ -4837,16 +4837,13 @@
  50.132 + 	# just link it dynamically
  50.133 + 	LDFLAGS_STATIC=""
  50.134 + fi
  50.135 ++LDFLAGS_STATIC="" # OpenPKG wants dynamically linked RPM tools
  50.136 + LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"	# libtool format
  50.137 + echo "$as_me:$LINENO: result: $LDFLAGS_STATIC" >&5
  50.138 + echo "${ECHO_T}$LDFLAGS_STATIC" >&6
  50.139 + 
  50.140 + 
  50.141 + LDFLAGS_NPTL=
  50.142 +-if test -f /usr/lib/nptl/libpthread.a ; then
  50.143 +-    LDFLAGS_NPTL="-L/usr/lib/nptl"
  50.144 +-#    INCPATH="$INCPATH -I/usr/include/nptl"
  50.145 +-fi
  50.146 + 
  50.147 + 
  50.148 + echo "$as_me:$LINENO: checking POSIX chmod" >&5
  50.149 +@@ -4937,7 +4934,7 @@
  50.150 + if test X"$MKDIR_P" = X0 ; then
  50.151 + 	echo "$as_me:$LINENO: result: no" >&5
  50.152 + echo "${ECHO_T}no" >&6
  50.153 +-	MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
  50.154 ++	MKDIR_P="@l_prefix@/lib/openpkg/shtool mkdir -f -p -m 755"
  50.155 + else
  50.156 + 	echo "$as_me:$LINENO: result: yes" >&5
  50.157 + echo "${ECHO_T}yes" >&6
  50.158 +@@ -5878,6 +5875,7 @@
  50.159 +     ;;
  50.160 +   *) # Darwin 1.3 on
  50.161 +     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
  50.162 ++    lt_cv_deplibs_check_method=pass_all
  50.163 +     ;;
  50.164 +   esac
  50.165 +   ;;
  50.166 +@@ -5903,7 +5901,7 @@
  50.167 +   ;;
  50.168 + 
  50.169 + hpux10.20*|hpux11*)
  50.170 +-  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
  50.171 ++  lt_cv_deplibs_check_method='pass_all'
  50.172 +   lt_cv_file_magic_cmd=/usr/bin/file
  50.173 +   lt_cv_file_magic_test_file=/usr/lib/libc.sl
  50.174 +   ;;
  50.175 +@@ -5942,11 +5940,7 @@
  50.176 +   ;;
  50.177 + 
  50.178 + netbsd*)
  50.179 +-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  50.180 +-    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  50.181 +-  else
  50.182 +-    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
  50.183 +-  fi
  50.184 ++  lt_cv_deplibs_check_method='pass_all'
  50.185 +   ;;
  50.186 + 
  50.187 + newos6*)
  50.188 +@@ -5981,7 +5975,7 @@
  50.189 +   lt_cv_file_magic_test_file=/lib/libc.so
  50.190 +   ;;
  50.191 + 
  50.192 +-sysv5uw[78]* | sysv4*uw2*)
  50.193 ++sysv5uw[78]* | sysv4*uw2* | sysv5UnixWare7* )
  50.194 +   lt_cv_deplibs_check_method=pass_all
  50.195 +   ;;
  50.196 + 
  50.197 +@@ -6682,7 +6676,7 @@
  50.198 + case $host in
  50.199 + *-*-irix6*)
  50.200 +   # Find out which ABI we are using.
  50.201 +-  echo '#line 6685 "configure"' > conftest.$ac_ext
  50.202 ++  echo '#line 6679 "configure"' > conftest.$ac_ext
  50.203 +   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  50.204 +   (eval $ac_compile) 2>&5
  50.205 +   ac_status=$?
  50.206 +@@ -7211,7 +7205,7 @@
  50.207 + save_CFLAGS="$CFLAGS"
  50.208 + CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
  50.209 + compiler_c_o=no
  50.210 +-if { (eval echo configure:7214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
  50.211 ++if { (eval echo configure:7208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
  50.212 +   # The compiler can only warn and ignore the option if not recognized
  50.213 +   # So say no if there are warnings
  50.214 +   if test -s out/conftest.err; then
  50.215 +@@ -8069,7 +8063,7 @@
  50.216 +     runpath_var=LD_RUN_PATH
  50.217 +     ;;
  50.218 + 
  50.219 +-  sysv5uw7* | unixware7*)
  50.220 ++  sysv5uw7* | unixware7* | sysv5UnixWare7* )
  50.221 +     no_undefined_flag='${wl}-z ${wl}text'
  50.222 +     if test "$GCC" = yes; then
  50.223 +       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
  50.224 +@@ -8395,7 +8389,7 @@
  50.225 +   libsuff=
  50.226 +   case "$host_cpu" in
  50.227 +   x86_64*|s390x*)
  50.228 +-    echo '#line 8398 "configure"' > conftest.$ac_ext
  50.229 ++    echo '#line 8392 "configure"' > conftest.$ac_ext
  50.230 +     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  50.231 +   (eval $ac_compile) 2>&5
  50.232 +   ac_status=$?
  50.233 +@@ -9067,7 +9061,7 @@
  50.234 +     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  50.235 +   lt_status=$lt_dlunknown
  50.236 +   cat > conftest.$ac_ext <<EOF
  50.237 +-#line 9070 "configure"
  50.238 ++#line 9064 "configure"
  50.239 + #include "confdefs.h"
  50.240 + 
  50.241 + #if HAVE_DLFCN_H
  50.242 +@@ -9165,7 +9159,7 @@
  50.243 +     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  50.244 +   lt_status=$lt_dlunknown
  50.245 +   cat > conftest.$ac_ext <<EOF
  50.246 +-#line 9168 "configure"
  50.247 ++#line 9162 "configure"
  50.248 + #include "confdefs.h"
  50.249 + 
  50.250 + #if HAVE_DLFCN_H
  50.251 +@@ -11266,7 +11260,7 @@
  50.252 + WITH_ZLIB_SUBDIR=
  50.253 + WITH_ZLIB_INCLUDE=
  50.254 + WITH_ZLIB_LIB=
  50.255 +-if test -d zlib ; then
  50.256 ++if false; then
  50.257 +   WITH_ZLIB_SUBDIR=zlib
  50.258 +   addlib \${top_builddir}/zlib
  50.259 +   WITH_ZLIB_INCLUDE="-I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
  50.260 +@@ -11284,44 +11278,6 @@
  50.261 + 
  50.262 + localdone=
  50.263 + 
  50.264 +-dirs=$prefix
  50.265 +-if test "$cross_compiling" != "yes"; then
  50.266 +-  dirs="$dirs /usr/local"
  50.267 +-fi
  50.268 +-for dir in $dirs
  50.269 +-do
  50.270 +-	case $dir in
  50.271 +-	NONE|/usr)	continue;;
  50.272 +-	/usr/local)
  50.273 +-		if test X$localdone != X ; then continue; fi
  50.274 +-		localdone="$dir"
  50.275 +-		;;
  50.276 +-	esac
  50.277 +-
  50.278 +-	echo "$as_me:$LINENO: checking for $dir/lib in LIBS" >&5
  50.279 +-echo $ECHO_N "checking for $dir/lib in LIBS... $ECHO_C" >&6
  50.280 +-	if test -d $dir/lib 2> /dev/null ; then
  50.281 +-		addlib $dir/lib
  50.282 +-		echo "$as_me:$LINENO: result: yes" >&5
  50.283 +-echo "${ECHO_T}yes" >&6
  50.284 +-	else
  50.285 +-		echo "$as_me:$LINENO: result: no" >&5
  50.286 +-echo "${ECHO_T}no" >&6
  50.287 +-	fi
  50.288 +-
  50.289 +-	echo "$as_me:$LINENO: checking for $dir/include in INCPATH" >&5
  50.290 +-echo $ECHO_N "checking for $dir/include in INCPATH... $ECHO_C" >&6
  50.291 +-	if test -d $dir/include 2>/dev/null ; then
  50.292 +-		if  "$dir" != "/usr/local"  ; then
  50.293 +-		    INCPATH="$INCPATH -I$dir/include"
  50.294 +-		fi
  50.295 +-		echo "$as_me:$LINENO: result: yes" >&5
  50.296 +-echo "${ECHO_T}yes" >&6
  50.297 +-	else
  50.298 +-		echo "$as_me:$LINENO: result: no" >&5
  50.299 +-echo "${ECHO_T}no" >&6
  50.300 +-	fi
  50.301 +-done
  50.302 + 
  50.303 + echo "$as_me:$LINENO: checking for /usr/ucblib in LIBS" >&5
  50.304 + echo $ECHO_N "checking for /usr/ucblib in LIBS... $ECHO_C" >&6
  50.305 +@@ -12051,7 +12007,7 @@
  50.306 + #define HAVE_LIBBEECRYPT 1
  50.307 + _ACEOF
  50.308 + 
  50.309 +-	    WITH_BEECRYPT_INCLUDE="-I/usr/include/beecrypt"
  50.310 ++	    WITH_BEECRYPT_INCLUDE=""
  50.311 + 	    WITH_BEECRYPT_LIB="-lbeecrypt"
  50.312 + 
  50.313 + fi
  50.314 +@@ -12647,287 +12603,13 @@
  50.315 + 
  50.316 + 
  50.317 + 
  50.318 +-
  50.319 +-
  50.320 +-
  50.321 +-for ac_header in thread.h pthread.h synch.h semaphore.h
  50.322 +-do
  50.323 +-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  50.324 +-if eval "test \"\${$as_ac_Header+set}\" = set"; then
  50.325 +-  echo "$as_me:$LINENO: checking for $ac_header" >&5
  50.326 +-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  50.327 +-if eval "test \"\${$as_ac_Header+set}\" = set"; then
  50.328 +-  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.329 +-fi
  50.330 +-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  50.331 +-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  50.332 +-else
  50.333 +-  # Is the header compilable?
  50.334 +-echo "$as_me:$LINENO: checking $ac_header usability" >&5
  50.335 +-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  50.336 +-cat >conftest.$ac_ext <<_ACEOF
  50.337 +-#line $LINENO "configure"
  50.338 +-/* confdefs.h.  */
  50.339 +-_ACEOF
  50.340 +-cat confdefs.h >>conftest.$ac_ext
  50.341 +-cat >>conftest.$ac_ext <<_ACEOF
  50.342 +-/* end confdefs.h.  */
  50.343 +-$ac_includes_default
  50.344 +-#include <$ac_header>
  50.345 +-_ACEOF
  50.346 +-rm -f conftest.$ac_objext
  50.347 +-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  50.348 +-  (eval $ac_compile) 2>&5
  50.349 +-  ac_status=$?
  50.350 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.351 +-  (exit $ac_status); } &&
  50.352 +-         { ac_try='test -s conftest.$ac_objext'
  50.353 +-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  50.354 +-  (eval $ac_try) 2>&5
  50.355 +-  ac_status=$?
  50.356 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.357 +-  (exit $ac_status); }; }; then
  50.358 +-  ac_header_compiler=yes
  50.359 +-else
  50.360 +-  echo "$as_me: failed program was:" >&5
  50.361 +-sed 's/^/| /' conftest.$ac_ext >&5
  50.362 +-
  50.363 +-ac_header_compiler=no
  50.364 +-fi
  50.365 +-rm -f conftest.$ac_objext conftest.$ac_ext
  50.366 +-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  50.367 +-echo "${ECHO_T}$ac_header_compiler" >&6
  50.368 +-
  50.369 +-# Is the header present?
  50.370 +-echo "$as_me:$LINENO: checking $ac_header presence" >&5
  50.371 +-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  50.372 +-cat >conftest.$ac_ext <<_ACEOF
  50.373 +-#line $LINENO "configure"
  50.374 +-/* confdefs.h.  */
  50.375 +-_ACEOF
  50.376 +-cat confdefs.h >>conftest.$ac_ext
  50.377 +-cat >>conftest.$ac_ext <<_ACEOF
  50.378 +-/* end confdefs.h.  */
  50.379 +-#include <$ac_header>
  50.380 +-_ACEOF
  50.381 +-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  50.382 +-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  50.383 +-  ac_status=$?
  50.384 +-  grep -v '^ *+' conftest.er1 >conftest.err
  50.385 +-  rm -f conftest.er1
  50.386 +-  cat conftest.err >&5
  50.387 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.388 +-  (exit $ac_status); } >/dev/null; then
  50.389 +-  if test -s conftest.err; then
  50.390 +-    ac_cpp_err=$ac_c_preproc_warn_flag
  50.391 +-  else
  50.392 +-    ac_cpp_err=
  50.393 +-  fi
  50.394 +-else
  50.395 +-  ac_cpp_err=yes
  50.396 +-fi
  50.397 +-if test -z "$ac_cpp_err"; then
  50.398 +-  ac_header_preproc=yes
  50.399 +-else
  50.400 +-  echo "$as_me: failed program was:" >&5
  50.401 +-sed 's/^/| /' conftest.$ac_ext >&5
  50.402 +-
  50.403 +-  ac_header_preproc=no
  50.404 +-fi
  50.405 +-rm -f conftest.err conftest.$ac_ext
  50.406 +-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  50.407 +-echo "${ECHO_T}$ac_header_preproc" >&6
  50.408 +-
  50.409 +-# So?  What about this header?
  50.410 +-case $ac_header_compiler:$ac_header_preproc in
  50.411 +-  yes:no )
  50.412 +-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  50.413 +-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  50.414 +-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  50.415 +-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  50.416 +-    (
  50.417 +-      cat <<\_ASBOX
  50.418 +-## ------------------------------------ ##
  50.419 +-## Report this to bug-autoconf@gnu.org. ##
  50.420 +-## ------------------------------------ ##
  50.421 +-_ASBOX
  50.422 +-    ) |
  50.423 +-      sed "s/^/$as_me: WARNING:     /" >&2
  50.424 +-    ;;
  50.425 +-  no:yes )
  50.426 +-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  50.427 +-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  50.428 +-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  50.429 +-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  50.430 +-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  50.431 +-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  50.432 +-    (
  50.433 +-      cat <<\_ASBOX
  50.434 +-## ------------------------------------ ##
  50.435 +-## Report this to bug-autoconf@gnu.org. ##
  50.436 +-## ------------------------------------ ##
  50.437 +-_ASBOX
  50.438 +-    ) |
  50.439 +-      sed "s/^/$as_me: WARNING:     /" >&2
  50.440 +-    ;;
  50.441 +-esac
  50.442 +-echo "$as_me:$LINENO: checking for $ac_header" >&5
  50.443 +-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  50.444 +-if eval "test \"\${$as_ac_Header+set}\" = set"; then
  50.445 +-  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.446 +-else
  50.447 +-  eval "$as_ac_Header=$ac_header_preproc"
  50.448 +-fi
  50.449 +-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  50.450 +-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  50.451 +-
  50.452 +-fi
  50.453 +-if test `eval echo '${'$as_ac_Header'}'` = yes; then
  50.454 +-  cat >>confdefs.h <<_ACEOF
  50.455 +-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  50.456 +-_ACEOF
  50.457 +-
  50.458 +-fi
  50.459 +-
  50.460 +-done
  50.461 +-
  50.462 +-
  50.463 +-
  50.464 +-echo "$as_me:$LINENO: checking for pthread_mutex_trylock in -lpthread" >&5
  50.465 +-echo $ECHO_N "checking for pthread_mutex_trylock in -lpthread... $ECHO_C" >&6
  50.466 +-if test "${ac_cv_lib_pthread_pthread_mutex_trylock+set}" = set; then
  50.467 +-  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.468 +-else
  50.469 +-  ac_check_lib_save_LIBS=$LIBS
  50.470 +-LIBS="-lpthread  $LIBS"
  50.471 +-cat >conftest.$ac_ext <<_ACEOF
  50.472 +-#line $LINENO "configure"
  50.473 +-/* confdefs.h.  */
  50.474 +-_ACEOF
  50.475 +-cat confdefs.h >>conftest.$ac_ext
  50.476 +-cat >>conftest.$ac_ext <<_ACEOF
  50.477 +-/* end confdefs.h.  */
  50.478 +-
  50.479 +-/* Override any gcc2 internal prototype to avoid an error.  */
  50.480 +-#ifdef __cplusplus
  50.481 +-extern "C"
  50.482 +-#endif
  50.483 +-/* We use char because int might match the return type of a gcc2
  50.484 +-   builtin and then its argument prototype would still apply.  */
  50.485 +-char pthread_mutex_trylock ();
  50.486 +-int
  50.487 +-main ()
  50.488 +-{
  50.489 +-pthread_mutex_trylock ();
  50.490 +-  ;
  50.491 +-  return 0;
  50.492 +-}
  50.493 +-_ACEOF
  50.494 +-rm -f conftest.$ac_objext conftest$ac_exeext
  50.495 +-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  50.496 +-  (eval $ac_link) 2>&5
  50.497 +-  ac_status=$?
  50.498 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.499 +-  (exit $ac_status); } &&
  50.500 +-         { ac_try='test -s conftest$ac_exeext'
  50.501 +-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  50.502 +-  (eval $ac_try) 2>&5
  50.503 +-  ac_status=$?
  50.504 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.505 +-  (exit $ac_status); }; }; then
  50.506 +-  ac_cv_lib_pthread_pthread_mutex_trylock=yes
  50.507 +-else
  50.508 +-  echo "$as_me: failed program was:" >&5
  50.509 +-sed 's/^/| /' conftest.$ac_ext >&5
  50.510 +-
  50.511 +-ac_cv_lib_pthread_pthread_mutex_trylock=no
  50.512 +-fi
  50.513 +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  50.514 +-LIBS=$ac_check_lib_save_LIBS
  50.515 +-fi
  50.516 +-echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_trylock" >&5
  50.517 +-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_trylock" >&6
  50.518 +-if test $ac_cv_lib_pthread_pthread_mutex_trylock = yes; then
  50.519 +-  cat >>confdefs.h <<_ACEOF
  50.520 +-#define HAVE_LIBPTHREAD 1
  50.521 +-_ACEOF
  50.522 +-
  50.523 +-  LIBS="-lpthread $LIBS"
  50.524 +-
  50.525 +-else
  50.526 +-
  50.527 +-
  50.528 +-echo "$as_me:$LINENO: checking for __pthread_mutex_trylock in -lpthread" >&5
  50.529 +-echo $ECHO_N "checking for __pthread_mutex_trylock in -lpthread... $ECHO_C" >&6
  50.530 +-if test "${ac_cv_lib_pthread___pthread_mutex_trylock+set}" = set; then
  50.531 +-  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.532 +-else
  50.533 +-  ac_check_lib_save_LIBS=$LIBS
  50.534 +-LIBS="-lpthread  $LIBS"
  50.535 +-cat >conftest.$ac_ext <<_ACEOF
  50.536 +-#line $LINENO "configure"
  50.537 +-/* confdefs.h.  */
  50.538 +-_ACEOF
  50.539 +-cat confdefs.h >>conftest.$ac_ext
  50.540 +-cat >>conftest.$ac_ext <<_ACEOF
  50.541 +-/* end confdefs.h.  */
  50.542 +-
  50.543 +-/* Override any gcc2 internal prototype to avoid an error.  */
  50.544 +-#ifdef __cplusplus
  50.545 +-extern "C"
  50.546 +-#endif
  50.547 +-/* We use char because int might match the return type of a gcc2
  50.548 +-   builtin and then its argument prototype would still apply.  */
  50.549 +-char __pthread_mutex_trylock ();
  50.550 +-int
  50.551 +-main ()
  50.552 +-{
  50.553 +-__pthread_mutex_trylock ();
  50.554 +-  ;
  50.555 +-  return 0;
  50.556 +-}
  50.557 +-_ACEOF
  50.558 +-rm -f conftest.$ac_objext conftest$ac_exeext
  50.559 +-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  50.560 +-  (eval $ac_link) 2>&5
  50.561 +-  ac_status=$?
  50.562 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.563 +-  (exit $ac_status); } &&
  50.564 +-         { ac_try='test -s conftest$ac_exeext'
  50.565 +-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  50.566 +-  (eval $ac_try) 2>&5
  50.567 +-  ac_status=$?
  50.568 +-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.569 +-  (exit $ac_status); }; }; then
  50.570 +-  ac_cv_lib_pthread___pthread_mutex_trylock=yes
  50.571 +-else
  50.572 +-  echo "$as_me: failed program was:" >&5
  50.573 +-sed 's/^/| /' conftest.$ac_ext >&5
  50.574 +-
  50.575 +-ac_cv_lib_pthread___pthread_mutex_trylock=no
  50.576 +-fi
  50.577 +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  50.578 +-LIBS=$ac_check_lib_save_LIBS
  50.579 +-fi
  50.580 +-echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_trylock" >&5
  50.581 +-echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_trylock" >&6
  50.582 +-if test $ac_cv_lib_pthread___pthread_mutex_trylock = yes; then
  50.583 +-  cat >>confdefs.h <<_ACEOF
  50.584 +-#define HAVE_LIBPTHREAD 1
  50.585 +-_ACEOF
  50.586 +-
  50.587 +-  LIBS="-lpthread $LIBS"
  50.588 +-
  50.589 +-else
  50.590 +-
  50.591 +-
  50.592 +-echo "$as_me:$LINENO: checking for mutex_lock in -lthread" >&5
  50.593 +-echo $ECHO_N "checking for mutex_lock in -lthread... $ECHO_C" >&6
  50.594 +-if test "${ac_cv_lib_thread_mutex_lock+set}" = set; then
  50.595 ++echo "$as_me:$LINENO: checking for svc_run in -lnsl" >&5
  50.596 ++echo $ECHO_N "checking for svc_run in -lnsl... $ECHO_C" >&6
  50.597 ++if test "${ac_cv_lib_nsl_svc_run+set}" = set; then
  50.598 +   echo $ECHO_N "(cached) $ECHO_C" >&6
  50.599 + else
  50.600 +   ac_check_lib_save_LIBS=$LIBS
  50.601 +-LIBS="-lthread  $LIBS"
  50.602 ++LIBS="-lnsl  $LIBS"
  50.603 + cat >conftest.$ac_ext <<_ACEOF
  50.604 + #line $LINENO "configure"
  50.605 + /* confdefs.h.  */
  50.606 +@@ -12942,11 +12624,11 @@
  50.607 + #endif
  50.608 + /* We use char because int might match the return type of a gcc2
  50.609 +    builtin and then its argument prototype would still apply.  */
  50.610 +-char mutex_lock ();
  50.611 ++char svc_run ();
  50.612 + int
  50.613 + main ()
  50.614 + {
  50.615 +-mutex_lock ();
  50.616 ++svc_run ();
  50.617 +   ;
  50.618 +   return 0;
  50.619 + }
  50.620 +@@ -12963,33 +12645,28 @@
  50.621 +   ac_status=$?
  50.622 +   echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.623 +   (exit $ac_status); }; }; then
  50.624 +-  ac_cv_lib_thread_mutex_lock=yes
  50.625 ++  ac_cv_lib_nsl_svc_run=yes
  50.626 + else
  50.627 +   echo "$as_me: failed program was:" >&5
  50.628 + sed 's/^/| /' conftest.$ac_ext >&5
  50.629 + 
  50.630 +-ac_cv_lib_thread_mutex_lock=no
  50.631 ++ac_cv_lib_nsl_svc_run=no
  50.632 + fi
  50.633 + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  50.634 + LIBS=$ac_check_lib_save_LIBS
  50.635 + fi
  50.636 +-echo "$as_me:$LINENO: result: $ac_cv_lib_thread_mutex_lock" >&5
  50.637 +-echo "${ECHO_T}$ac_cv_lib_thread_mutex_lock" >&6
  50.638 +-if test $ac_cv_lib_thread_mutex_lock = yes; then
  50.639 ++echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_svc_run" >&5
  50.640 ++echo "${ECHO_T}$ac_cv_lib_nsl_svc_run" >&6
  50.641 ++if test $ac_cv_lib_nsl_svc_run = yes; then
  50.642 +   cat >>confdefs.h <<_ACEOF
  50.643 +-#define HAVE_LIBTHREAD 1
  50.644 ++#define HAVE_LIBNSL 1
  50.645 + _ACEOF
  50.646 + 
  50.647 +-  LIBS="-lthread $LIBS"
  50.648 +-
  50.649 +-fi
  50.650 +-
  50.651 ++  LIBS="-lnsl $LIBS"
  50.652 + 
  50.653 + fi
  50.654 + 
  50.655 + 
  50.656 +-fi
  50.657 +-
  50.658 + 
  50.659 + 
  50.660 + for ac_header in aio.h
  50.661 +@@ -22911,6 +22588,86 @@
  50.662 + 
  50.663 + else
  50.664 + 
  50.665 ++ echo "$as_me:$LINENO: checking for getmntinfo" >&5
  50.666 ++echo $ECHO_N "checking for getmntinfo... $ECHO_C" >&6
  50.667 ++if test "${ac_cv_func_getmntinfo+set}" = set; then
  50.668 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.669 ++else
  50.670 ++  cat >conftest.$ac_ext <<_ACEOF
  50.671 ++#line $LINENO "configure"
  50.672 ++/* confdefs.h.  */
  50.673 ++_ACEOF
  50.674 ++cat confdefs.h >>conftest.$ac_ext
  50.675 ++cat >>conftest.$ac_ext <<_ACEOF
  50.676 ++/* end confdefs.h.  */
  50.677 ++/* System header to define __stub macros and hopefully few prototypes,
  50.678 ++    which can conflict with char getmntinfo (); below.
  50.679 ++    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  50.680 ++    <limits.h> exists even on freestanding compilers.  */
  50.681 ++#ifdef __STDC__
  50.682 ++# include <limits.h>
  50.683 ++#else
  50.684 ++# include <assert.h>
  50.685 ++#endif
  50.686 ++/* Override any gcc2 internal prototype to avoid an error.  */
  50.687 ++#ifdef __cplusplus
  50.688 ++extern "C"
  50.689 ++{
  50.690 ++#endif
  50.691 ++/* We use char because int might match the return type of a gcc2
  50.692 ++   builtin and then its argument prototype would still apply.  */
  50.693 ++char getmntinfo ();
  50.694 ++/* The GNU C library defines this for functions which it implements
  50.695 ++    to always fail with ENOSYS.  Some functions are actually named
  50.696 ++    something starting with __ and the normal name is an alias.  */
  50.697 ++#if defined (__stub_getmntinfo) || defined (__stub___getmntinfo)
  50.698 ++choke me
  50.699 ++#else
  50.700 ++char (*f) () = getmntinfo;
  50.701 ++#endif
  50.702 ++#ifdef __cplusplus
  50.703 ++}
  50.704 ++#endif
  50.705 ++
  50.706 ++int
  50.707 ++main ()
  50.708 ++{
  50.709 ++return f != getmntinfo;
  50.710 ++  ;
  50.711 ++  return 0;
  50.712 ++}
  50.713 ++_ACEOF
  50.714 ++rm -f conftest.$ac_objext conftest$ac_exeext
  50.715 ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  50.716 ++  (eval $ac_link) 2>&5
  50.717 ++  ac_status=$?
  50.718 ++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.719 ++  (exit $ac_status); } &&
  50.720 ++         { ac_try='test -s conftest$ac_exeext'
  50.721 ++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  50.722 ++  (eval $ac_try) 2>&5
  50.723 ++  ac_status=$?
  50.724 ++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.725 ++  (exit $ac_status); }; }; then
  50.726 ++  ac_cv_func_getmntinfo=yes
  50.727 ++else
  50.728 ++  echo "$as_me: failed program was:" >&5
  50.729 ++sed 's/^/| /' conftest.$ac_ext >&5
  50.730 ++
  50.731 ++ac_cv_func_getmntinfo=no
  50.732 ++fi
  50.733 ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  50.734 ++fi
  50.735 ++echo "$as_me:$LINENO: result: $ac_cv_func_getmntinfo" >&5
  50.736 ++echo "${ECHO_T}$ac_cv_func_getmntinfo" >&6
  50.737 ++if test $ac_cv_func_getmntinfo = yes; then
  50.738 ++
  50.739 ++cat >>confdefs.h <<\_ACEOF
  50.740 ++#define HAVE_GETMNTINFO 1
  50.741 ++_ACEOF
  50.742 ++
  50.743 ++else
  50.744 ++
  50.745 +   echo "$as_me:$LINENO: checking for mntctl" >&5
  50.746 + echo $ECHO_N "checking for mntctl... $ECHO_C" >&6
  50.747 + if test "${ac_cv_func_mntctl+set}" = set; then
  50.748 +@@ -23148,6 +22905,8 @@
  50.749 + 
  50.750 + fi
  50.751 + 
  50.752 ++fi
  50.753 ++
  50.754 + 
  50.755 + echo "$as_me:$LINENO: checking for lchown" >&5
  50.756 + echo $ECHO_N "checking for lchown... $ECHO_C" >&6
  50.757 +@@ -23454,9 +23213,6 @@
  50.758 + fi
  50.759 + 
  50.760 + MARK64=
  50.761 +-case "${target_cpu}" in
  50.762 +-x86_64*|ppc64*|powerpc64*|sparc64*|s390x*)	MARK64=64 ;;
  50.763 +-esac
  50.764 + 
  50.765 + 
  50.766 + autorelocate_path='%{nil}'
  50.767 +@@ -23515,7 +23271,7 @@
  50.768 + 
  50.769 + LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
  50.770 + 
  50.771 +-RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
  50.772 ++RPMCONFIGDIR="@l_prefix@/lib/openpkg"
  50.773 + 
  50.774 + cat >>confdefs.h <<_ACEOF
  50.775 + #define RPMCONFIGDIR "$RPMCONFIGDIR"
  50.776 +@@ -23523,7 +23279,7 @@
  50.777 + 
  50.778 + 
  50.779 + 
  50.780 +-SYSCONFIGDIR="`echo /etc/rpm`"
  50.781 ++SYSCONFIGDIR="@l_prefix@/etc/openpkg"
  50.782 + 
  50.783 + cat >>confdefs.h <<_ACEOF
  50.784 + #define SYSCONFIGDIR "$SYSCONFIGDIR"
  50.785 +@@ -23539,7 +23295,7 @@
  50.786 + 
  50.787 + 
  50.788 + 
  50.789 +-LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
  50.790 ++LIBRPMRC_FILENAME="${SYSCONFIGDIR}/rpmrc"
  50.791 + 
  50.792 + cat >>confdefs.h <<_ACEOF
  50.793 + #define LIBRPMRC_FILENAME "$LIBRPMRC_FILENAME"
  50.794 +@@ -23547,7 +23303,7 @@
  50.795 + 
  50.796 + 
  50.797 + 
  50.798 +-VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
  50.799 ++VENDORRPMRC_FILENAME="${SYSCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
  50.800 + 
  50.801 + cat >>confdefs.h <<_ACEOF
  50.802 + #define VENDORRPMRC_FILENAME "$VENDORRPMRC_FILENAME"
  50.803 +@@ -23555,7 +23311,7 @@
  50.804 + 
  50.805 + 
  50.806 + 
  50.807 +-LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
  50.808 ++LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
  50.809 + 
  50.810 + cat >>confdefs.h <<_ACEOF
  50.811 + #define LIBRPMALIAS_FILENAME "$LIBRPMALIAS_FILENAME"
  50.812 +@@ -23588,9 +23344,202 @@
  50.813 + 
  50.814 + 
  50.815 + 
  50.816 ++echo "$as_me:$LINENO: checking for uint8_t" >&5
  50.817 ++echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6
  50.818 ++if test "${ac_cv_type_uint8_t+set}" = set; then
  50.819 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.820 ++else
  50.821 ++  cat >conftest.$ac_ext <<_ACEOF
  50.822 ++#line $LINENO "configure"
  50.823 ++/* confdefs.h.  */
  50.824 ++_ACEOF
  50.825 ++cat confdefs.h >>conftest.$ac_ext
  50.826 ++cat >>conftest.$ac_ext <<_ACEOF
  50.827 ++/* end confdefs.h.  */
  50.828 ++#if HAVE_STDINT_H
  50.829 ++#include <stdint.h>
  50.830 ++#endif
  50.831 ++#include <sys/types.h>
  50.832 ++#if STDC_HEADERS
  50.833 ++#include <stdlib.h>
  50.834 ++#include <stddef.h>
  50.835 ++#endif
  50.836 ++_ACEOF
  50.837 ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  50.838 ++  $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  50.839 ++  ac_cv_type_uint8_t=yes
  50.840 ++else
  50.841 ++  ac_cv_type_uint8_t=no
  50.842 ++fi
  50.843 ++rm -f conftest*
  50.844 ++
  50.845 ++fi
  50.846 ++echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5
  50.847 ++echo "${ECHO_T}$ac_cv_type_uint8_t" >&6
  50.848 ++if test $ac_cv_type_uint8_t = no; then
  50.849 ++
  50.850 ++cat >>confdefs.h <<\_ACEOF
  50.851 ++#define uint8_t unsigned char
  50.852 ++_ACEOF
  50.853 ++
  50.854 ++fi
  50.855 ++echo "$as_me:$LINENO: checking for uint16_t" >&5
  50.856 ++echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6
  50.857 ++if test "${ac_cv_type_uint16_t+set}" = set; then
  50.858 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.859 ++else
  50.860 ++  cat >conftest.$ac_ext <<_ACEOF
  50.861 ++#line $LINENO "configure"
  50.862 ++/* confdefs.h.  */
  50.863 ++_ACEOF
  50.864 ++cat confdefs.h >>conftest.$ac_ext
  50.865 ++cat >>conftest.$ac_ext <<_ACEOF
  50.866 ++/* end confdefs.h.  */
  50.867 ++#if HAVE_STDINT_H
  50.868 ++#include <stdint.h>
  50.869 ++#endif
  50.870 ++#include <sys/types.h>
  50.871 ++#if STDC_HEADERS
  50.872 ++#include <stdlib.h>
  50.873 ++#include <stddef.h>
  50.874 ++#endif
  50.875 ++_ACEOF
  50.876 ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  50.877 ++  $EGREP "(^|[^a-zA-Z_0-9])uint16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  50.878 ++  ac_cv_type_uint16_t=yes
  50.879 ++else
  50.880 ++  ac_cv_type_uint16_t=no
  50.881 ++fi
  50.882 ++rm -f conftest*
  50.883 ++
  50.884 ++fi
  50.885 ++echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5
  50.886 ++echo "${ECHO_T}$ac_cv_type_uint16_t" >&6
  50.887 ++if test $ac_cv_type_uint16_t = no; then
  50.888 ++
  50.889 ++cat >>confdefs.h <<\_ACEOF
  50.890 ++#define uint16_t unsigned short
  50.891 ++_ACEOF
  50.892 ++
  50.893 ++fi
  50.894 ++echo "$as_me:$LINENO: checking for uint32_t" >&5
  50.895 ++echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6
  50.896 ++if test "${ac_cv_type_uint32_t+set}" = set; then
  50.897 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.898 ++else
  50.899 ++  cat >conftest.$ac_ext <<_ACEOF
  50.900 ++#line $LINENO "configure"
  50.901 ++/* confdefs.h.  */
  50.902 ++_ACEOF
  50.903 ++cat confdefs.h >>conftest.$ac_ext
  50.904 ++cat >>conftest.$ac_ext <<_ACEOF
  50.905 ++/* end confdefs.h.  */
  50.906 ++#if HAVE_STDINT_H
  50.907 ++#include <stdint.h>
  50.908 ++#endif
  50.909 ++#include <sys/types.h>
  50.910 ++#if STDC_HEADERS
  50.911 ++#include <stdlib.h>
  50.912 ++#include <stddef.h>
  50.913 ++#endif
  50.914 ++_ACEOF
  50.915 ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  50.916 ++  $EGREP "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  50.917 ++  ac_cv_type_uint32_t=yes
  50.918 ++else
  50.919 ++  ac_cv_type_uint32_t=no
  50.920 ++fi
  50.921 ++rm -f conftest*
  50.922 ++
  50.923 ++fi
  50.924 ++echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
  50.925 ++echo "${ECHO_T}$ac_cv_type_uint32_t" >&6
  50.926 ++if test $ac_cv_type_uint32_t = no; then
  50.927 ++
  50.928 ++cat >>confdefs.h <<\_ACEOF
  50.929 ++#define uint32_t unsigned int
  50.930 ++_ACEOF
  50.931 ++
  50.932 ++fi
  50.933 ++
  50.934 ++echo "$as_me:$LINENO: checking for madvise" >&5
  50.935 ++echo $ECHO_N "checking for madvise... $ECHO_C" >&6
  50.936 ++if test "${ac_cv_func_madvise+set}" = set; then
  50.937 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  50.938 ++else
  50.939 ++  cat >conftest.$ac_ext <<_ACEOF
  50.940 ++#line $LINENO "configure"
  50.941 ++/* confdefs.h.  */
  50.942 ++_ACEOF
  50.943 ++cat confdefs.h >>conftest.$ac_ext
  50.944 ++cat >>conftest.$ac_ext <<_ACEOF
  50.945 ++/* end confdefs.h.  */
  50.946 ++/* System header to define __stub macros and hopefully few prototypes,
  50.947 ++    which can conflict with char madvise (); below.
  50.948 ++    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  50.949 ++    <limits.h> exists even on freestanding compilers.  */
  50.950 ++#ifdef __STDC__
  50.951 ++# include <limits.h>
  50.952 ++#else
  50.953 ++# include <assert.h>
  50.954 ++#endif
  50.955 ++/* Override any gcc2 internal prototype to avoid an error.  */
  50.956 ++#ifdef __cplusplus
  50.957 ++extern "C"
  50.958 ++{
  50.959 ++#endif
  50.960 ++/* We use char because int might match the return type of a gcc2
  50.961 ++   builtin and then its argument prototype would still apply.  */
  50.962 ++char madvise ();
  50.963 ++/* The GNU C library defines this for functions which it implements
  50.964 ++    to always fail with ENOSYS.  Some functions are actually named
  50.965 ++    something starting with __ and the normal name is an alias.  */
  50.966 ++#if defined (__stub_madvise) || defined (__stub___madvise)
  50.967 ++choke me
  50.968 ++#else
  50.969 ++char (*f) () = madvise;
  50.970 ++#endif
  50.971 ++#ifdef __cplusplus
  50.972 ++}
  50.973 ++#endif
  50.974 ++
  50.975 ++int
  50.976 ++main ()
  50.977 ++{
  50.978 ++return f != madvise;
  50.979 ++  ;
  50.980 ++  return 0;
  50.981 ++}
  50.982 ++_ACEOF
  50.983 ++rm -f conftest.$ac_objext conftest$ac_exeext
  50.984 ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  50.985 ++  (eval $ac_link) 2>&5
  50.986 ++  ac_status=$?
  50.987 ++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.988 ++  (exit $ac_status); } &&
  50.989 ++         { ac_try='test -s conftest$ac_exeext'
  50.990 ++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  50.991 ++  (eval $ac_try) 2>&5
  50.992 ++  ac_status=$?
  50.993 ++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  50.994 ++  (exit $ac_status); }; }; then
  50.995 ++  ac_cv_func_madvise=yes
  50.996 ++else
  50.997 ++  echo "$as_me: failed program was:" >&5
  50.998 ++sed 's/^/| /' conftest.$ac_ext >&5
  50.999 ++
 50.1000 ++ac_cv_func_madvise=no
 50.1001 ++fi
 50.1002 ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 50.1003 ++fi
 50.1004 ++echo "$as_me:$LINENO: result: $ac_cv_func_madvise" >&5
 50.1005 ++echo "${ECHO_T}$ac_cv_func_madvise" >&6
 50.1006 ++
 50.1007 ++
 50.1008 ++
 50.1009 + 
 50.1010 + 
 50.1011 +-subdirs="$subdirs popt beecrypt zlib elfutils file db3"
 50.1012 ++subdirs="$subdirs popt zlib elfutils file db3"
 50.1013 + 
 50.1014 + 
 50.1015 +                                                                                                                                                                                                                                                                                                                                                               ac_config_files="$ac_config_files Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile scripts/Makefile scripts/brp-redhat scripts/macros.perl scripts/macros.php scripts/macros.python tools/Makefile tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile misc/Makefile intl/Makefile po/Makefile.in doc/Makefile doc/manual/Makefile doc/fr/Makefile doc/ja/Makefile doc/ko/Makefile doc/pl/Makefile doc/ru/Makefile doc/sk/Makefile python/Makefile python/rpmdb/Makefile python/test/Makefile"
 50.1016 +@@ -25157,7 +25106,6 @@
 50.1017 +       esac
 50.1018 +     done ;;
 50.1019 +     default ) 	echo timestamp > popt/stamp-h.in
 50.1020 +-	echo timestamp > beecrypt/stamp-h.in
 50.1021 + 	echo timestamp > stamp-h.in
 50.1022 + 
 50.1023 +  ;;
 50.1024 +
 50.1025 ++---------------------------------------------------------------------------
 50.1026 +| Corresponding patches in "configure" script after regeneration from
 50.1027 +| patched "configure.ac" with "autoconf".
 50.1028 ++---------------------------------------------------------------------------
 50.1029 +Index: popt/configure
 50.1030 +--- popt/configure	16 Jul 2003 17:04:51 -0000	1.1.1.16
 50.1031 ++++ popt/configure	12 May 2004 14:34:35 -0000	1.18
 50.1032 +@@ -9359,9 +9359,6 @@
 50.1033 + 
 50.1034 + 
 50.1035 + MARK64=
 50.1036 +-case "${target_cpu}" in
 50.1037 +-x86_64*|powerpc64*|ppc64*|sparc64*|s390x*)        MARK64=64 ;;
 50.1038 +-esac
 50.1039 + 
 50.1040 + 
 50.1041 + 
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/openpkg/rpmdb	Tue Jan 06 23:40:39 2009 +0100
    51.3 @@ -0,0 +1,430 @@
    51.4 +#!@l_prefix@/lib/openpkg/bash
    51.5 +##
    51.6 +##  rpmdb -- OpenPKG RPM Database Administration Utility
    51.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    51.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    51.9 +##
   51.10 +##  Permission to use, copy, modify, and distribute this software for
   51.11 +##  any purpose with or without fee is hereby granted, provided that
   51.12 +##  the above copyright notice and this permission notice appear in all
   51.13 +##  copies.
   51.14 +##
   51.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   51.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   51.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   51.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   51.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   51.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   51.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   51.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   51.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   51.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   51.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   51.26 +##  SUCH DAMAGE.
   51.27 +##
   51.28 +
   51.29 +#   program information
   51.30 +progname="rpmdb"
   51.31 +
   51.32 +#   configuration defaults
   51.33 +help=""
   51.34 +prefix="@l_prefix@"
   51.35 +dbpath=""
   51.36 +rpm=""
   51.37 +musr="@l_musr@"
   51.38 +mgrp="@l_mgrp@"
   51.39 +mode=""
   51.40 +force=no
   51.41 +verbose=2
   51.42 +
   51.43 +##
   51.44 +##  PARSE COMMAND LINE
   51.45 +##
   51.46 +
   51.47 +#   iterate over argument line
   51.48 +for opt
   51.49 +do
   51.50 +    case $opt in
   51.51 +        -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;;
   51.52 +           *) arg='' ;;
   51.53 +    esac
   51.54 +    case $opt in
   51.55 +        -h|--help      ) help="Usage"  ;;
   51.56 +        -B|--build     ) mode=build    ;;
   51.57 +        -R|--rebuild   ) mode=rebuild  ;;
   51.58 +        -C|--cleanup   ) mode=cleanup  ;;
   51.59 +        -F|--fixate    ) mode=fixate   ;;
   51.60 +        -L|--list      ) mode=list     ;;
   51.61 +        -f|--force     ) force=yes     ;;
   51.62 +        -q|--quiet     ) verbose=0     ;;
   51.63 +        -v|--verbose   ) verbose=`expr $verbose + 1` ;;
   51.64 +        --prefix=*     ) prefix=$arg   ;;
   51.65 +        --dbpath=*     ) dbpath=$arg   ;;
   51.66 +        --rpm=*        ) rpm=$arg      ;;
   51.67 +        --musr=*       ) musr=$arg     ;;
   51.68 +        --mgrp=*       ) mgrp=$arg     ;;
   51.69 +        *              ) help="Invalid option \`$opt'"; break ;;
   51.70 +    esac
   51.71 +done
   51.72 +
   51.73 +#   makre sure exactly one run-time mode is specified
   51.74 +if [ ".$mode" = . ]; then
   51.75 +    help="No or invalid run-time mode specified"
   51.76 +fi
   51.77 +
   51.78 +#   error or usage message
   51.79 +if [ ".$help" != . ]; then
   51.80 +    if [ ".$help" != ".Usage" ]; then
   51.81 +        echo "$progname:ERROR: $help" 1>&2
   51.82 +    fi
   51.83 +    cat 1>&2 <<EOT
   51.84 +$progname:USAGE: $progname [options]
   51.85 +
   51.86 +  -h, --help        print usage message (this one)
   51.87 +  -B, --build       build new RPM database from scratch
   51.88 +  -R, --rebuild     rebuild new from old RPM database
   51.89 +  -C, --cleanup     cleanup existing RPM database
   51.90 +  -F, --fixate      fixate existing RPM database
   51.91 +  -L, --list        list all RPM database files
   51.92 +  -f, --force       operate in force mode (no save operations)
   51.93 +  -q, --quiet       operate in quiet mode (no verbose messages at all)
   51.94 +  -v, --verbose     operate in more verbose mode (increase verbose level)
   51.95 +  --prefix=PREFIX   use OpenPKG instance under PREFIX
   51.96 +  --dbpath=PATH     use OpenPKG RPM database under PATH
   51.97 +  --rpm=PROG        use OpenPKG RPM executable PROG
   51.98 +  --musr=USERNAME   use OpenPKG management user USERNAME
   51.99 +  --mgrp=GROUPNAME  use OpenPKG management group GROUPNAME
  51.100 +
  51.101 +This is OpenPKG rpmdb, an RPM database administration utility, providing
  51.102 +lower-level maintainance functions for the Berkeley-DB 4.1 based RPM 4.2
  51.103 +database. It allows building new RPM databases from scratch, rebuilding
  51.104 +a new from an old RPM database (content dumping and reloading),
  51.105 +cleaning up problems on an existing RPM database (removal of DB region
  51.106 +files, etc) and fixating the files in an existing RPM database (file
  51.107 +attributes).
  51.108 +
  51.109 +EOT
  51.110 +    if [ ".$help" != ".Usage" ]; then
  51.111 +        exit 2
  51.112 +    else
  51.113 +        exit 0
  51.114 +    fi
  51.115 +fi
  51.116 +
  51.117 +#   delayed determination of variables
  51.118 +if [ ".$dbpath" = . ]; then
  51.119 +    dbpath="$prefix/RPM/DB"
  51.120 +fi
  51.121 +if [ ".$rpm" = . ]; then
  51.122 +    rpm="$prefix/bin/openpkg rpm"
  51.123 +fi
  51.124 +
  51.125 +##
  51.126 +##  DATABASE FILE INFORMATION
  51.127 +##
  51.128 +
  51.129 +dbfiles="
  51.130 +    hash:Basenames
  51.131 +    hash:Conflictname
  51.132 +    hash:Depends
  51.133 +    btree:Dirnames
  51.134 +    hash:Filemd5s
  51.135 +    hash:Group
  51.136 +    btree:Installtid
  51.137 +    hash:Name
  51.138 +    hash:Packages
  51.139 +    hash:Providename
  51.140 +    btree:Provideversion
  51.141 +    hash:Pubkeys
  51.142 +    hash:Requirename
  51.143 +    btree:Requireversion
  51.144 +    hash:Sha1header
  51.145 +    hash:Sigmd5
  51.146 +    hash:Triggername
  51.147 +    region:__db.001
  51.148 +    region:__db.002
  51.149 +    region:__db.003
  51.150 +    region:__db.004
  51.151 +    region:__db.005
  51.152 +    region:__db.006
  51.153 +    region:__db.007
  51.154 +    region:__db.008
  51.155 +    region:__db.009
  51.156 +"
  51.157 +
  51.158 +##
  51.159 +##  HELPER FUNCTIONS
  51.160 +##
  51.161 +
  51.162 +error () {
  51.163 +    echo "$progname:ERROR: $*" 1>&2
  51.164 +    exit 1
  51.165 +}
  51.166 +
  51.167 +warning () {
  51.168 +    echo "$progname:WARNING: $*" 1>&2
  51.169 +}
  51.170 +
  51.171 +verbose () {
  51.172 +    local level=$1
  51.173 +    shift
  51.174 +    if [ $level -le $verbose ]; then
  51.175 +        local lead=""
  51.176 +        case "$level" in
  51.177 +            1 ) lead="" ;;
  51.178 +            2 ) lead="" ;;
  51.179 +            3 ) lead="  " ;;
  51.180 +            * ) lead="    " ;;
  51.181 +        esac
  51.182 +        echo "$progname: $lead$*" 1>&2
  51.183 +    fi
  51.184 +}
  51.185 +
  51.186 +rpm () {
  51.187 +    local opts="--dbpath `echo $dbpath | sed -e 's;/*$;;' -e 's;$;/;'`"
  51.188 +    if [ ".$force" = .yes ]; then
  51.189 +        opts="$opts --define '__dbi_private yes'"
  51.190 +    fi
  51.191 +    verbose 3 "run: $rpm $opts $@"
  51.192 +    eval "$rpm $opts \"\$@\""
  51.193 +}
  51.194 +
  51.195 +rpmdb_load () {
  51.196 +    $prefix/lib/openpkg/rpmdb_load ${1+"$@"}
  51.197 +}
  51.198 +
  51.199 +rpmdb_dump () {
  51.200 +    $prefix/lib/openpkg/rpmdb_dump ${1+"$@"}
  51.201 +}
  51.202 +
  51.203 +##
  51.204 +##  RPM DATABASE OPERATIONS
  51.205 +##
  51.206 +
  51.207 +db_wait () {
  51.208 +    #   wait until RPM has released the database in case we are called
  51.209 +    #   asynchronously to RPM (especially important when upgrading from
  51.210 +    #   RPM 4.0 where concurrent access is still not possible)
  51.211 +    verbose 2 "waiting for RPM database to be available"
  51.212 +    local i=0
  51.213 +    while [ $i -lt 10 ]; do
  51.214 +        if $prefix/libexec/openpkg/rpm -q openpkg >/dev/null 2>&1; then
  51.215 +            break
  51.216 +        fi
  51.217 +        sleep 1
  51.218 +        i=`expr $i + 1`
  51.219 +    done
  51.220 +    if [ $i -eq 10 ]; then
  51.221 +        exit 1
  51.222 +    else
  51.223 +        exit 0
  51.224 +    fi
  51.225 +}
  51.226 +
  51.227 +db_remove () {
  51.228 +    #   remove all known files
  51.229 +    verbose 2 "removing (possibly existing) old RPM database DB files"
  51.230 +    for dbfile in $dbfiles; do
  51.231 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  51.232 +        verbose 3 "removing database file: $dbpath/$dbfile ($dbtype)"
  51.233 +        rm -f $dbpath/$dbfile
  51.234 +    done
  51.235 +}
  51.236 +
  51.237 +db_init () {
  51.238 +    #   perform official "initdb" operation
  51.239 +    #   (is mostly a no-operation in RPM 4.2, but anyway)
  51.240 +    verbose 2 "creating new RPM database (built-in RPM procedure)"
  51.241 +    rpm --initdb
  51.242 +
  51.243 +    #   perform some real RPM work, so more database files
  51.244 +    #   magically spring into existence
  51.245 +    verbose 2 "operating on new RPM database"
  51.246 +    rpm --import $prefix/etc/openpkg/openpkg.org.pgp || true
  51.247 +    rpm -e gpg-pubkey-63c4cb9f-3c591eda --allmatches || true
  51.248 +
  51.249 +    #   perform official "rebuilddb" operation in the hope it
  51.250 +    #   creates even more database files now that we have some content
  51.251 +    verbose 2 "rebuilding new RPM database (built-in RPM procedure)"
  51.252 +    rpm --rebuilddb
  51.253 +}
  51.254 +
  51.255 +db_unbreak () {
  51.256 +    #   cleanup DB region files
  51.257 +    verbose 2 "cleaning up RPM database DB region files"
  51.258 +    for dbfile in $dbfiles; do
  51.259 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  51.260 +        if [ ".$dbtype" = .region ]; then
  51.261 +            verbose 3 "cleaning up DB file: $dbpath/$dbfile ($dbtype)"
  51.262 +            rm -f $dbpath/$dbfile || true
  51.263 +            touch $dbpath/$dbfile || true
  51.264 +        fi
  51.265 +    done
  51.266 +}
  51.267 +
  51.268 +db_extend () {
  51.269 +    #   make sure all RPM database DB files are present
  51.270 +    verbose 2 "making sure RPM database contains all possible DB files"
  51.271 +    for dbfile in $dbfiles; do
  51.272 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  51.273 +        if [ ! -f $dbpath/$dbfile ]; then
  51.274 +            verbose 3 "creating DB file: $dbpath/$dbfile ($dbtype)"
  51.275 +            if [ ".$dbtype" = .hash -o ".$dbtype" = .btree ]; then
  51.276 +                ( echo "VERSION=3"
  51.277 +                  echo "format=bytevalue"
  51.278 +                  echo "type=$dbtype"
  51.279 +                  echo "db_pagesize=16384"
  51.280 +                  echo "HEADER=END"
  51.281 +                  echo "DATA=END"
  51.282 +                ) | rpmdb_load $dbpath/$dbfile || true
  51.283 +            else
  51.284 +                touch $dbpath/$dbfile || true
  51.285 +            fi
  51.286 +        fi
  51.287 +    done
  51.288 +}
  51.289 +
  51.290 +db_reload () {
  51.291 +    #   rebuilding new from old RPM database DB files by dumping and
  51.292 +    #   reloading their entire content
  51.293 +    verbose 2 "dumping and reloading RPM database DB file contents"
  51.294 +    for dbfile in $dbfiles; do
  51.295 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  51.296 +        verbose 3 "dumping and reloading DB file: $dbpath/$dbfile ($dbtype)"
  51.297 +        if [ -f $dbpath/$dbfile ]; then
  51.298 +            if [ ".$dbtype" = .hash -o ".$dbtype" = .btree ]; then
  51.299 +                rpmdb_dump $dbpath/$dbfile |\
  51.300 +                rpmdb_load $dbpath/$dbfile.new
  51.301 +                rm -f $dbpath/$dbfile
  51.302 +                mv $dbpath/$dbfile.new $dbpath/$dbfile
  51.303 +            else
  51.304 +                rm -f $dbpath/$dbfile || true
  51.305 +                touch $dbpath/$dbfile || true
  51.306 +            fi
  51.307 +        fi
  51.308 +    done
  51.309 +}
  51.310 +
  51.311 +db_rebuild () {
  51.312 +    #   perform official "rebuilddb" operation
  51.313 +    verbose 2 "rebuilding RPM database (built-in RPM procedure)"
  51.314 +    rpm --rebuilddb
  51.315 +}
  51.316 +
  51.317 +db_operate () {
  51.318 +    #   perform some read/write operation on RPM database
  51.319 +    #   (we have no package available, but removing and reimporting
  51.320 +    #   the OpenPKG OpenPGP keys is a harmless thing and always possible)
  51.321 +    verbose 2 "performing read/write operation on RPM database"
  51.322 +    for spec in \
  51.323 +        openpkg.org.pgp:gpg-pubkey-63c4cb9f-3c591eda \
  51.324 +        openpkg.com.pgp:gpg-pubkey-61b7ae34-4544a6af \
  51.325 +        openpkg.net.pgp:gpg-pubkey-52197903-4544a74d \
  51.326 +    ; do
  51.327 +        eval `echo "$spec" | sed -e 's/^\(.*\):\(.*\)$/file="\1"; package="\2"/'`
  51.328 +        rpm -q $package >/dev/null 2>&1 && rpm -e $package --allmatches || true
  51.329 +        rpm -q $package >/dev/null 2>&1 || rpm --import $prefix/etc/openpkg/$file || true
  51.330 +    done
  51.331 +    rpm -qa >/dev/null 2>&1
  51.332 +}
  51.333 +
  51.334 +db_fixate () {
  51.335 +    #   fix ownership and permissions of (especially newly created)
  51.336 +    #   RPM database files to make sure they are consistent
  51.337 +    verbose 2 "making sure RPM database files have consistent attributes"
  51.338 +    for dbfile in $dbfiles; do
  51.339 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  51.340 +        verbose 3 "fixating DB file: $dbpath/$dbfile ($dbtype)"
  51.341 +        chown $musr:$mgrp $dbpath/$dbfile 2>/dev/null || true
  51.342 +        chmod 644 $dbpath/$dbfile 2>/dev/null || true
  51.343 +    done
  51.344 +}
  51.345 +
  51.346 +db_list () {
  51.347 +    #   list all database files
  51.348 +    for dbfile in $dbfiles; do
  51.349 +        eval `echo $dbfile | sed -e 's/^\(.*\):\(.*\)$/dbtype="\1"; dbfile="\2";/'`
  51.350 +        if [ $verbose -eq 0 ]; then
  51.351 +            echo "$dbfile"
  51.352 +        elif [ $verbose -eq 1 ]; then
  51.353 +            echo "$dbpath/$dbfile"
  51.354 +        elif [ $verbose -ge 2 ]; then
  51.355 +            echo "$dbpath/$dbfile ($dbtype)"
  51.356 +        fi
  51.357 +    done
  51.358 +}
  51.359 +
  51.360 +##
  51.361 +##  ENVIRONMENT CONSISTENCY CHECKS
  51.362 +##
  51.363 +
  51.364 +#   sanity check OpenPKG instance
  51.365 +if [ ".$prefix" = . ]; then
  51.366 +    error "OpenPKG instance directory is empty"
  51.367 +fi
  51.368 +if [ ! -d $prefix ]; then
  51.369 +    error "OpenPKG instance directory \"$prefix\" not found"
  51.370 +fi
  51.371 +if [ ! -x $prefix/bin/openpkg ]; then
  51.372 +    error "OpenPKG instance directory \"$prefix\" not valid"
  51.373 +fi
  51.374 +
  51.375 +#   sanity check OpenPKG RPM database
  51.376 +if [ ".$dbpath" = . ]; then
  51.377 +    error "OpenPKG RPM database directory is empty"
  51.378 +fi
  51.379 +if [ ! -d $dbpath ]; then
  51.380 +    error "OpenPKG RPM database directory \"$dbpath\" not found"
  51.381 +fi
  51.382 +if [ ! -w $dbpath ]; then
  51.383 +    error "OpenPKG RPM database directory \"$dbpath\" not writable"
  51.384 +fi
  51.385 +
  51.386 +##
  51.387 +##  DISPATCH INTO COMMANDS
  51.388 +##
  51.389 +
  51.390 +case "$mode" in
  51.391 +    build )
  51.392 +        verbose 1 "BUILDING NEW RPM DATABASE FROM SCRATCH ($dbpath)"
  51.393 +        db_remove
  51.394 +        db_init
  51.395 +        db_extend
  51.396 +        db_rebuild
  51.397 +        db_fixate
  51.398 +        db_operate
  51.399 +        ;;
  51.400 +
  51.401 +    rebuild )
  51.402 +        verbose 1 "REBUILDING NEW FROM OLD RPM DATABASE ($dbpath)"
  51.403 +        db_unbreak
  51.404 +        db_extend
  51.405 +        db_reload
  51.406 +        db_rebuild
  51.407 +        db_fixate
  51.408 +        db_operate
  51.409 +        ;;
  51.410 +
  51.411 +    cleanup )
  51.412 +        verbose 1 "CLEANING UP EXISTING RPM DATABASE ($dbpath)"
  51.413 +        db_unbreak
  51.414 +        db_extend
  51.415 +        db_rebuild
  51.416 +        db_fixate
  51.417 +        db_operate
  51.418 +        ;;
  51.419 +
  51.420 +    fixate )
  51.421 +        verbose 1 "FIXATING EXISTING RPM DATABASE ($dbpath)"
  51.422 +        db_extend
  51.423 +        db_fixate
  51.424 +        db_operate
  51.425 +        ;;
  51.426 +
  51.427 +    list )
  51.428 +        db_list
  51.429 +        ;;
  51.430 +esac
  51.431 +
  51.432 +exit 0
  51.433 +
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/openpkg/rpmmacros	Tue Jan 06 23:40:39 2009 +0100
    52.3 @@ -0,0 +1,432 @@
    52.4 +##
    52.5 +##  rpmmacros -- OpenPKG RPM Macros
    52.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    52.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    52.8 +##
    52.9 +##  Permission to use, copy, modify, and distribute this software for
   52.10 +##  any purpose with or without fee is hereby granted, provided that
   52.11 +##  the above copyright notice and this permission notice appear in all
   52.12 +##  copies.
   52.13 +##
   52.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   52.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   52.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   52.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   52.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   52.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   52.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   52.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   52.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   52.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   52.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   52.25 +##  SUCH DAMAGE.
   52.26 +##
   52.27 +##  The purpose of this macro set is to override the default
   52.28 +##  macros in the OpenPKG RPM installation for the @l_prefix@ hierarchy.
   52.29 +##
   52.30 +
   52.31 +#   the OpenPKG release identification (for the current package or as a fallback for the bootstrap package)
   52.32 +%l_openpkg_release(F:)   %(%{l_prefix}/libexec/openpkg/release --release="%{?release}%{!?release:%(%{l_rpm} -q --qf '%{release}' openpkg)}" %{?-F:-F "%{-F*}"}%{!?-F:-F "OpenPKG-%%t"})
   52.33 +
   52.34 +#   the OpenPKG OIDs (root is officially registered at IANA)
   52.35 +%l_openpkg_oid           1.3.6.1.4.1.18749
   52.36 +%l_openpkg_oid_bootstrap %{l_openpkg_oid}.4.1
   52.37 +%l_openpkg_oid_instance  %{l_openpkg_oid_bootstrap}.1
   52.38 +%l_openpkg_oid_platform  %{l_openpkg_oid_bootstrap}.2
   52.39 +%l_openpkg_oid_tagfmtopt %{l_openpkg_oid_bootstrap}.3
   52.40 +
   52.41 +#   the OpenPKG package tagging
   52.42 +%l_tag_fmt               @TAG@
   52.43 +%l_tag_fmt_compat        %(prefix="%{l_prefix_static}"; if [ ".`expr $prefix : '/[^/][^/]*$'`" != .0 ]; then loc=`echo $prefix | cut -c2-4`; else loc=`echo $prefix | sed -e 's;/\\(.\\)[^/]*;\\1;g' | cut -c1-3`; fi; echo $loc)
   52.44 +%l_tag_fmt_loc           %(echo "%{l_prefix_static}" | sed -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2\\3;' -e 's;^/\\([^/]\\)[^/]*/\\([^/][^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/]\\)[^/]*/\\([^/]\\).*;\\1\\2;' -e 's;^/\\([^/][^/][^/]\\).*;\\1;' -e 's;^/\\([^/][^/]\\).*;\\1;' -e 's;^/\\([^/]\\).*;\\1;')
   52.45 +%l_tag_fmt_opt           %(uuid_ns="`%{l_uuid} -v3 ns:OID %{l_openpkg_oid_tagfmtopt}`"; %{l_uuid} -v3 $uuid_ns '%{?_options}')
   52.46 +%l_tag_fmt_uuid          %(%{l_uuid} -v1)
   52.47 +%l_tag_fmt_time          %(date '+%%Y%%m%%d%%H%%M%%S')
   52.48 +%l_tag_fmt_user          %(%{l_shtool} echo -e '%%u')
   52.49 +%l_tag_fmt_host          %(%{l_shtool} echo -e '%%h%%d')
   52.50 +%l_tag_gen               %{expand:%(echo '%{l_tag_fmt}' | sed -e 's/<\\([a-zA-Z][_a-zA-Z0-9]*\\)>/%%{l_tag_fmt_\\1}/g')}
   52.51 +%l_tag                   %(echo "%{l_tag_gen}" | sed -e 's;-;;g')
   52.52 +
   52.53 +#   the OpenPKG instance location (backward compatibility only)
   52.54 +%l_location              %{l_tag}
   52.55 +
   52.56 +#   standard RPM host platform identification
   52.57 +#   (defaults via "shtool platform" and uname(3); used internally)
   52.58 +#%_host_cpu              ...USE INTERNAL DEFAULT...
   52.59 +#%_host_vendor           ...USE INTERNAL DEFAULT...
   52.60 +#%_host_os               ...USE INTERNAL DEFAULT...
   52.61 +%_host_alias             %{nil}
   52.62 +%_host                   %{_host_cpu}-%{_host_os}
   52.63 +
   52.64 +#   standard RPM build platform identification
   52.65 +#   (defaults via %{_host*} macros; not used internally AFAIK)
   52.66 +%_build_cpu              %{_host_cpu}
   52.67 +%_build_vendor           %{_host_vendor}
   52.68 +%_build_os               %{_host_os}
   52.69 +%_build_alias            %{_host_alias}
   52.70 +%_build                  %{_host}
   52.71 +
   52.72 +#   standard RPM target platform identification
   52.73 +#   (defaults via %{_host*} macros; used internally for %ifarch/%ifnarch)
   52.74 +%_target_cpu             %{_host_cpu}
   52.75 +%_target_vendor          %{_host_vendor}
   52.76 +%_target_os              %{_host_os}
   52.77 +%_target_alias           %{_host_alias}
   52.78 +%_target                 %{_host}
   52.79 +
   52.80 +#   legacy RPM platform macros
   52.81 +#   (defaults via config.guess/config.sub under RPM build-time)
   52.82 +%_arch                   %{_host_cpu}
   52.83 +%_vendor                 %{_host_vendor}
   52.84 +%_os                     %{_host_os}
   52.85 +
   52.86 +#   legacy RPM platform macros
   52.87 +#   (defaults via various other macros; partly used internally)
   52.88 +%_build_arch             %{_arch}
   52.89 +%_target_platform        %{_target_cpu}-%{_target_vendor}-%{_target_os}
   52.90 +%_gnu                    %{nil}
   52.91 +
   52.92 +#   official OpenPKG host platform identification
   52.93 +%l_host_arch             %{_host_cpu}
   52.94 +%l_host_vendor           %{_host_vendor}
   52.95 +%l_host_os               %{_host_os}
   52.96 +%l_host                  %{_host_cpu}-%{_host_os}
   52.97 +
   52.98 +#   new OpenPKG platform identification
   52.99 +%l_platform(cptF:)       %(if [ ".%{?-F}" != . ]; then fmt="%{-F*}"; else T="%{?-c:c}%{?-p:p}%{?-t:t}"; [ ".$T" = . ] && T="p"; fmt="%%<a$T>-%%<s$T>"; fi; %{l_shtool} platform -n -L -S "" -C "+" -F "$fmt")
  52.100 +
  52.101 +#   old OpenPKG platform identification
  52.102 +%l_target                %{l_platform -t}
  52.103 +
  52.104 +#   the *S*uper-user user/group name/id pair
  52.105 +%l_susr                  @SUSR@
  52.106 +%l_sgrp                  @SGRP@
  52.107 +%l_suid                  %((getent passwd "%{l_susr}"; grep "^%{l_susr}:" /etc/passwd; ypmatch "%{l_susr}" passwd; nismatch "%{l_susr}" passwd; nidump passwd . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.108 +%l_sgid                  %((getent group  "%{l_sgrp}"; grep "^%{l_sgrp}:" /etc/group;  ypmatch "%{l_sgrp}" group;  nismatch "%{l_sgrp}" group;  nidump group  . | grep "^%{l_susr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.109 +
  52.110 +#   the *M*anagement user/group name/id pair
  52.111 +%l_musr                  @MUSR@
  52.112 +%l_mgrp                  @MGRP@
  52.113 +%l_muid                  %((getent passwd "%{l_musr}"; grep "^%{l_musr}:" /etc/passwd; ypmatch "%{l_musr}" passwd; nismatch "%{l_musr}" passwd; nidump passwd . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.114 +%l_mgid                  %((getent group  "%{l_mgrp}"; grep "^%{l_mgrp}:" /etc/group;  ypmatch "%{l_mgrp}" group;  nismatch "%{l_mgrp}" group;  nidump group  . | grep "^%{l_musr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.115 +
  52.116 +#   the *R*restricted user/group name/id pair
  52.117 +%l_rusr                  @RUSR@
  52.118 +%l_rgrp                  @RGRP@
  52.119 +%l_ruid                  %((getent passwd "%{l_rusr}"; grep "^%{l_rusr}:" /etc/passwd; ypmatch "%{l_rusr}" passwd; nismatch "%{l_rusr}" passwd; nidump passwd . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.120 +%l_rgid                  %((getent group  "%{l_rgrp}"; grep "^%{l_rgrp}:" /etc/group;  ypmatch "%{l_rgrp}" group;  nismatch "%{l_rgrp}" group;  nidump group  . | grep "^%{l_rusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.121 +
  52.122 +#   the *N*on-privileged user/group name/id pair
  52.123 +%l_nusr                  @NUSR@
  52.124 +%l_ngrp                  @NGRP@
  52.125 +%l_nuid                  %((getent passwd "%{l_nusr}"; grep "^%{l_nusr}:" /etc/passwd; ypmatch "%{l_nusr}" passwd; nismatch "%{l_nusr}" passwd; nidump passwd . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.126 +%l_ngid                  %((getent group  "%{l_ngrp}"; grep "^%{l_ngrp}:" /etc/group;  ypmatch "%{l_ngrp}" group;  nismatch "%{l_ngrp}" group;  nidump group  . | grep "^%{l_nusr}:") 2>/dev/null | sed -e 'q' | awk -F: '{ print $3; }')
  52.127 +
  52.128 +#   backward compatibility (openpkg < 20020204)
  52.129 +%l_fsusr                 %{l_musr}
  52.130 +%l_fsgrp                 %{l_mgrp}
  52.131 +%l_npuid                 %{l_nuid}
  52.132 +%l_npgid                 %{l_ngid}
  52.133 +
  52.134 +#   define the installation hierarchy (used parts)
  52.135 +%l_prefix                @l_prefix@
  52.136 +%l_prefix_static         @l_prefix_static@
  52.137 +
  52.138 +#   define the installation hierarchy (unused parts)
  52.139 +%l_exec_prefix           %{l_prefix}
  52.140 +%l_bindir                %{l_prefix}/bin
  52.141 +%l_sbindir               %{l_prefix}/sbin
  52.142 +%l_libexecdir            %{l_prefix}/libexec
  52.143 +%l_datadir               %{l_prefix}/share
  52.144 +%l_sysconfdir            %{l_prefix}/etc
  52.145 +%l_sharedstatedir        %{l_prefix}/com
  52.146 +%l_localstatedir         %{l_prefix}/var
  52.147 +%l_libdir                %{l_prefix}/lib
  52.148 +%l_includedir            %{l_prefix}/include
  52.149 +%l_infodir               %{l_prefix}/info
  52.150 +%l_mandir                %{l_prefix}/man
  52.151 +%l_docdir                %{l_prefix}/doc
  52.152 +
  52.153 +#   provide killer macro "%{l_value -s|-b|-c (l_xxx ...|-a|-A)}" which
  52.154 +#   expands to the values of previous l_xxx variables in this file. With
  52.155 +#   option "-s" it expands into a chain of "-e 's;<name>;<value>;g'"
  52.156 +#   constructs for used with Stream Editor sed(1), with option "-b" it
  52.157 +#   expands into a chain of "<name>='<value>';" constructs for use with
  52.158 +#   Bourne-Shell sh(1), with option "-c" it expands into a chain of "set
  52.159 +#   <name> = '<value>';" constructs for use with C-Shell csh(1). But
  52.160 +#   be careful, <value> currently (for expansion speed reasons) is not
  52.161 +#   escaped, so make sure the values of the above macros do not contain
  52.162 +#   ";" for "-s" and ";" for "-b" and "-c". You can either specify one
  52.163 +#   or more names of variables to expand or use "-a" for mostly all
  52.164 +#   variables and "-A" for really all variables.
  52.165 +%l_value(sbcaA)          %{expand:%(l=""; for x in `if [ ".%*" != . ]; then echo "%* "; else p=""; if [ ".%{-a:yes}" = .yes ]; then p="^%%l_(prefix|[smrn](usr|grp|uid|gid))"; elif [ ".%{-A:yes}" = .yes ]; then p="^%%l_"; fi; if [ ".$p" != . ]; then egrep "$p" %{l_prefix}/etc/openpkg/rpmmacros | sed -e '/^%%l_value/,$d' -e 's;^%%\\(l_[a-z1-9_]*\\).*;\\1;'; fi; fi`; do e=""; if [ ".%{-s:yes}" = .yes ]; then e="-e 's;@$x@;%%{$x};g'"; elif [ ".%{-b:yes}" = .yes ]; then e="$x='%%{$x}';"; elif [ ".%{-c:yes}" = .yes ]; then e="set $x = '%%{$x}';"; else e="%%{$x}"; fi; if [ ".$l" = . ]; then l="$e"; else l="$l $e"; fi; done; echo "$l")}
  52.166 +
  52.167 +#   local version of the empty macro
  52.168 +%l_nil                   %{nil}
  52.169 +
  52.170 +#   override the internal RPM hierarchy variables
  52.171 +%_usr                    %{nil}
  52.172 +%_var                    %{nil}
  52.173 +%_usrsrc                 %{nil}
  52.174 +%_topdir                 %{nil}
  52.175 +%_dbpath                 %{l_prefix}/RPM/DB
  52.176 +%_builddir               %{l_prefix}/RPM/TMP
  52.177 +%_tmppath                %{l_prefix}/RPM/TMP
  52.178 +%_sourcedir              %{l_prefix}/RPM/SRC/%{name}
  52.179 +%_specdir                %{l_prefix}/RPM/SRC/%{name}
  52.180 +%_rpmdir                 %{l_prefix}/RPM/PKG
  52.181 +%_srcrpmdir              %{l_prefix}/RPM/PKG
  52.182 +%_repackage_dir          %{l_prefix}/RPM/PKG
  52.183 +%_cache_dbpath           %{l_prefix}/RPM/PKG
  52.184 +%_solve_dbpath           %{l_prefix}/RPM/PKG
  52.185 +%_solve_pkgsdir          %{l_prefix}/RPM/PKG
  52.186 +%_defaultdocdir          %{l_docdir}
  52.187 +
  52.188 +#   complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH <file>}
  52.189 +%SOURCE()                %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
  52.190 +%PATCH()                 %(f="%1"; if [ -f "%{_specdir}/$f" ]; then echo "%{_specdir}/$f"; else echo "%{_sourcedir}/$f"; fi)
  52.191 +
  52.192 +#   override RPM's absolute tool paths with relative ones
  52.193 +#   (because if you upgrade RPM it would hard-code tools in own hierarchy, too)
  52.194 +%__awk                   awk
  52.195 +%__bzip2                 %{_bzip2bin}
  52.196 +%__cat                   cat
  52.197 +%__chgrp                 chgrp
  52.198 +%__chmod                 chmod
  52.199 +%__chown                 chown
  52.200 +%__cp                    cp
  52.201 +%__cpio                  cpio
  52.202 +%__grep                  grep
  52.203 +%__gzip                  %{_gzipbin}
  52.204 +%__id                    id
  52.205 +%__install               install
  52.206 +%__ln_s                  ln -s
  52.207 +%__make                  make
  52.208 +%__mkdir                 mkdir
  52.209 +%__mkdir_p               %{l_shtool} mkdir -p
  52.210 +%__mv                    mv
  52.211 +%__patch                 %{_patchbin}
  52.212 +%__perl                  perl
  52.213 +%__pgp                   %{_pgpbin}
  52.214 +%__rm                    rm
  52.215 +%__rsh                   rsh
  52.216 +%__sed                   sed
  52.217 +%__ssh                   ssh
  52.218 +%__tar                   %{_tarbin}
  52.219 +%__unzip                 %{_unzipbin}
  52.220 +
  52.221 +#   override some more RPM macros where the default value is not acceptable
  52.222 +%_dependency_whiteout    %{nil}
  52.223 +%__debug_install_post    %{nil}
  52.224 +%_unpackaged_files_terminate_build 0
  52.225 +
  52.226 +#   provide fixed paths to tools (standard)
  52.227 +%_gzipbin                %{l_prefix}/lib/openpkg/gzip
  52.228 +%_bzip2bin               %{l_prefix}/lib/openpkg/bzip2
  52.229 +%_patchbin               %{l_prefix}/lib/openpkg/patch
  52.230 +%_tarbin                 %{l_prefix}/lib/openpkg/tar
  52.231 +%_unzipbin               %{l_prefix}/lib/openpkg/unzip
  52.232 +
  52.233 +#   provide path to platform identification file
  52.234 +%__platform              %{l_prefix}/etc/openpkg/platform
  52.235 +
  52.236 +#   provide fixed paths to tools (additional)
  52.237 +%l_rc                    %{l_prefix}/etc/rc
  52.238 +%l_rpm                   %{l_prefix}/libexec/openpkg/rpm
  52.239 +%l_rpm2cpio              %{l_prefix}/libexec/openpkg/rpm2cpio
  52.240 +%l_rpm_config            %{l_prefix}/libexec/openpkg/rpm-config
  52.241 +%l_lsync                 %{l_prefix}/libexec/openpkg/lsync
  52.242 +%l_rpmtool               %{l_prefix}/lib/openpkg/rpmtool
  52.243 +%l_shtool                %{l_prefix}/lib/openpkg/shtool
  52.244 +%l_curl                  %{l_prefix}/lib/openpkg/curl
  52.245 +%l_bash                  %{l_prefix}/lib/openpkg/bash
  52.246 +%l_uuid                  %{l_prefix}/lib/openpkg/uuid
  52.247 +
  52.248 +#   provide smart paths to tools
  52.249 +%l_tool_locate()         %(if [ ".%{expand:%%{?use_%1}}" != . ]; then tool="%{expand:%%{use_%1}}"; elif [ -f "%{l_prefix}/bin/%2" ]; then tool="%{l_prefix}/bin/%2"; elif [ -f "%{l_prefix}/lib/openpkg/%2" ]; then tool="%{l_prefix}/lib/openpkg/%2"; else tool="%2"; fi; echo $tool)
  52.250 +%l_gzip                  %{l_tool_locate gzip     gzip}
  52.251 +%l_bzip2                 %{l_tool_locate bzip2    bzip2}
  52.252 +%l_tar                   %{l_tool_locate tar      tar}
  52.253 +%l_make                  %{l_tool_locate make     make}
  52.254 +%l_cc                    %{l_tool_locate cc       cc}
  52.255 +%l_ar                    %{l_tool_locate ar       ar}
  52.256 +%l_ld                    %{l_tool_locate ld       ld}
  52.257 +%l_as                    %{l_tool_locate as       as}
  52.258 +%l_strip                 %{l_tool_locate strip    strip}
  52.259 +%l_cxx                   %{l_tool_locate cxx      c++}
  52.260 +%l_patch                 %{l_tool_locate patch    patch}
  52.261 +%l_sed                   %{l_tool_locate sed      sed}
  52.262 +%l_grep                  %{l_tool_locate grep     grep}
  52.263 +%l_awk                   %{l_tool_locate awk      awk}
  52.264 +%l_autoconf              %{l_tool_locate autoconf autoconf}
  52.265 +%l_automake              %{l_tool_locate automake automake}
  52.266 +%l_libtool               %{l_tool_locate libtool  libtool}
  52.267 +%l_flex                  %{l_tool_locate flex     flex}
  52.268 +%l_bison                 %{l_tool_locate bison    bison}
  52.269 +%l_perl                  %{l_tool_locate perl     perl}
  52.270 +%l_miniperl              %{l_tool_locate miniperl miniperl}
  52.271 +%l_openssl               %{l_tool_locate openssl  openssl}
  52.272 +%l_xmkmf                 %{l_tool_locate xmkmf    xmkmf}
  52.273 +%l_vcheck                %{l_tool_locate vcheck   vcheck}
  52.274 +
  52.275 +#   tool options
  52.276 +%l_mflags(O)             %(%{l_sane_env}; %{l_rpmtool} mflags %{-O:-O} "%{l_make}")
  52.277 +%l_cflags(O)             %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cc}")
  52.278 +%l_cxxflags(O)           %(%{l_sane_env}; %{l_rpmtool} cflags %{-O:-O} "%{l_cxx}")
  52.279 +%l_cppflags(i)           %(%{l_sane_env}; %{l_rpmtool} cppflags -p%{l_prefix} %{-i:-i} -- %*)
  52.280 +%l_ldflags()             %(%{l_sane_env}; %{l_rpmtool} ldflags  -p%{l_prefix}          -- %*)
  52.281 +
  52.282 +#   OSSP fake syslog library
  52.283 +%l_fsl_ldflags()         %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --ldflags) 2>/dev/null`; else flags=''; fi; echo $flags)
  52.284 +%l_fsl_libs()            %(if [ ".%{with_fsl}" = ".yes" ]; then flags=`(%{l_prefix}/bin/fsl-config --all --libs   ) 2>/dev/null`; else flags=''; fi; echo $flags)
  52.285 +
  52.286 +#   determine the current username
  52.287 +%l_whoami                %((id -un) 2>/dev/null || (whoami) 2>/dev/null || (who am i | cut "-d " -f1) 2>/dev/null || echo $LOGNAME)
  52.288 +
  52.289 +#   macros for dynamically generating a %files list
  52.290 +%l_files_defattr         '%%defattr(-,%{l_musr},%{l_mgrp})'
  52.291 +%l_files_all             '%{l_prefix}'
  52.292 +%l_files_noshared        '%%not %%dir {%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
  52.293 +%l_files_std()           %l_files_defattr %l_files_all %l_files_noshared
  52.294 +
  52.295 +#   path to local build root
  52.296 +%l_buildroot             %{_tmppath}/%{name}-%{version}-root
  52.297 +
  52.298 +#   path to local temporary location
  52.299 +%l_tmpdir()              %{_tmppath}
  52.300 +%l_tmpfile()             %{l_tmpdir}/%{name}-%{version}-%{release}-tmp%{?1:-%1}
  52.301 +
  52.302 +#   executable path for %post/%pre
  52.303 +%_install_script_path    %{l_prefix}/bin:%{l_prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
  52.304 +
  52.305 +#   names of RPM files
  52.306 +%l_srcrpmfilename        %%{NAME}-%%{VERSION}-%%{RELEASE}.src.rpm
  52.307 +%l_binrpmfilename        %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-%%{OS}-%{l_tag}.rpm
  52.308 +
  52.309 +#   override the name scheme for RPM files
  52.310 +%_rpmfilename            %{l_binrpmfilename}
  52.311 +%_build_name_fmt         %{l_binrpmfilename}
  52.312 +%_repackage_name_fmt     %{l_binrpmfilename}
  52.313 +%_solve_name_fmt         %{_solve_pkgsdir}/%{l_binrpmfilename}
  52.314 +
  52.315 +#   override the payload compression for the CPIO parts of an RPM
  52.316 +#   (we use the equivalent of "bzip2 -9")
  52.317 +%_source_payload         w9.bzdio
  52.318 +%_binary_payload         w9.bzdio
  52.319 +
  52.320 +#   package signature type is OpenPGP via GnuPG
  52.321 +%__gpg                   %{l_prefix}/bin/gpg
  52.322 +%_signature              gpg
  52.323 +%__vsflags               1
  52.324 +
  52.325 +#   two macro-processor add-ons (should be part of forthcoming RPM releases)
  52.326 +%ifdef()                 %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
  52.327 +%ifndef()                %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
  52.328 +
  52.329 +#   macro for package option configuration
  52.330 +%option()                %{expand:%%{!?%{1}:%%global %*}} %{expand:%%global _options %{?_options:%{_options}:}%{1}=%%%{1}} \
  52.331 +Provides: %{name}::%{1} = %(echo '%{expand:%%{%{1}}}' | sed -e 's;%%;%%%%;g' -e 's; ;%%20;g' -e 's;	;%%09;g')
  52.332 +
  52.333 +#   macros for NoSource/NoPatch (distribution restriction) integrity handling
  52.334 +%NoSource()              %(if [ ".%{?restriction}" != ".no" ]; then echo "NoSource: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{SOURCEURL%1}}
  52.335 +%NoPatch()               %(if [ ".%{?restriction}" != ".no" ]; then echo "NoPatch: %1"; fi)%{expand:%%global _restricted %{?_restricted:%{_restricted}} %%{PATCHURL%1}}
  52.336 +%integrity()             %{l_check_nosource}
  52.337 +
  52.338 +#   macros for checking build environment
  52.339 +%l_check_nosource()      %(%{l_sane_env}; checkok=1; checkinfo=`echo "Sorry, this OpenPKG package contains a DISTRIBUTION RESTRICTED source file."; echo "Before you can proceed building this package, fetch missing files MANUALLY:"`; for url in . %{?_restricted}; do [ ".$url" = .. ] && continue; eval `echo "$url" | sed -e 's!^\\(.*\\)::/\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's!^\\([^:;][^:]*://.*/\\)\\([^/][^/]*\\)$!;url=\\"\\1\\"; file=\\"\\2\\"!' -e 's:^\\([^;].*\\)$:;url="(unknown location) "; file="\\1":' -e 's:^;::'`; if [ ! -f "%{_specdir}/$file" ] && [ ! -f "%{_sourcedir}/$file" ]; then checkok=0; checkinfo=`echo "${checkinfo}"; echo ""; echo "from ${url}"; echo "file ${file}"; echo "here %{_sourcedir}/$file"`; fi; done; if [ $checkok -ne 1 ]; then echo "set +x"; echo "$checkinfo" | %{l_rpmtool} msg -b -t error | sed -e 's;^;echo ";' -e 's;$;";'; echo "exit 1"; fi)
  52.340 +%l_check_class()         %(%{l_sane_env}; class=`echo "@:%{?class}:%{?distribution}" | sed -e 's;^@:\\([^:][^:]*\\):.*$;\\1;' -e 's;^@:.*\\[\\(.*\\)\\].*$;\\1;' -e 's;^@:.*$;JUNK;'`; %{l_rpmtool} check-class "$class")
  52.341 +%prep %%prep\
  52.342 +    %{l_check_nosource} \
  52.343 +    %{l_check_class} \
  52.344 +    %{nil}
  52.345 +
  52.346 +#   macro-processor add-on for testing external conditions
  52.347 +%l_test(pfd)             %(if [ ".%{?-p:yes}" = .yes ]; then %{l_rpm} -q %1 >/dev/null 2>&1; rc=$?; elif [ ".%{?-f:yes}" = .yes ]; then test -f %1; rc=$?; elif [ ".%{?-d:yes}" = .yes ]; then test -d %1; rc=$?; fi; if [ ".$rc" = .0 ]; then echo "yes"; else echo "no"; fi)
  52.348 +
  52.349 +#   default list of vendor source fetching locations
  52.350 +%l_fetch_mirror_0        -
  52.351 +%l_fetch_mirror_1        -
  52.352 +%l_fetch_mirror_2        -
  52.353 +%l_fetch_mirror_3        -
  52.354 +%l_fetch_mirror_4        -
  52.355 +%l_fetch_mirror_5        -
  52.356 +%l_fetch_mirror_6        -
  52.357 +%l_fetch_mirror_7        -
  52.358 +%l_fetch_mirror_8        -
  52.359 +%l_fetch_mirror_9        -
  52.360 +%l_fetch_backup_0        -
  52.361 +%l_fetch_backup_1        -
  52.362 +%l_fetch_backup_2        -
  52.363 +%l_fetch_backup_3        -
  52.364 +%l_fetch_backup_4        -
  52.365 +%l_fetch_backup_5        -
  52.366 +%l_fetch_backup_6        -
  52.367 +%l_fetch_backup_7        -
  52.368 +%l_fetch_backup_8        -
  52.369 +%l_fetch_backup_9        ftp://ftp.openpkg.org/sources/DST/%{name}/
  52.370 +
  52.371 +#   sane build environment setup
  52.372 +%l_build_path            %(if [ -d %{l_prefix}/lib/openpkg/override ]; then echo "%{l_prefix}/lib/openpkg/override:"; fi)%{l_prefix}/bin:%{l_prefix}/sbin:@l_build_path@%(if [ -d %{l_prefix}/lib/openpkg/fallback ]; then echo ":%{l_prefix}/lib/openpkg/fallback"; fi)
  52.373 +%l_build_ldlp            %{l_prefix}/lib:@l_build_ldlp@
  52.374 +%l_build_ulim            @l_build_ulim@
  52.375 +%l_build_shell_cmd       %{l_prefix}/lib/openpkg/bash
  52.376 +%l_build_shell_opt       --norc --noprofile --posix
  52.377 +
  52.378 +#   sane build environment for manual usage in macros (currently just $PATH)
  52.379 +%l_sane_env              PATH="%{l_build_path}"; export PATH; LD_LIBRARY_PATH="%{l_build_ldlp}"; export LD_LIBRARY_PATH
  52.380 +
  52.381 +#   sane build environment for %prep/%build/%install
  52.382 +%_buildshell             env -i %{l_build_shell_cmd} %{l_build_shell_opt}
  52.383 +%___build_pre \
  52.384 +HOME="%{l_prefix}"\
  52.385 +SHELL="%{l_build_shell_cmd}"\
  52.386 +TERM="%(echo $TERM)"\
  52.387 +TMPDIR="%{_tmppath}"\
  52.388 +USER="%(echo $USER)"\
  52.389 +LOGNAME="%(echo $LOGNAME)"\
  52.390 +PATH="%{l_build_path}"\
  52.391 +LD_LIBRARY_PATH="%{l_build_ldlp}"\
  52.392 +export HOME SHELL TMPDIR USER LOGNAME PATH LD_LIBRARY_PATH\
  52.393 +RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
  52.394 +RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
  52.395 +RPM_OPT_FLAGS=\"%{optflags}\"\
  52.396 +RPM_ARCH=\"%{l_host_arch}\"\
  52.397 +RPM_OS=\"%{l_host_os}\"\
  52.398 +RPM_DOC_DIR=\"%{_docdir}\"\
  52.399 +RPM_PACKAGE_NAME=\"%{name}\"\
  52.400 +RPM_PACKAGE_VERSION=\"%{version}\"\
  52.401 +RPM_PACKAGE_RELEASE=\"%{release}\"\
  52.402 +export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS RPM_DOC_DIR\
  52.403 +export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
  52.404 +%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
  52.405 +export RPM_BUILD_ROOT}\
  52.406 +%{l_build_ulim}\
  52.407 +umask 022\
  52.408 +%{verbose:set -x}%{!verbose:exec >/dev/null}\
  52.409 +cd %{u2p:%{_builddir}}
  52.410 +
  52.411 +#   special %track section support
  52.412 +%__spec_track_template VCFILE="%{_tmppath}/%{name}-%{version}-%{release}.vc"\
  52.413 +rm -f $VCFILE\
  52.414 +set -o noclobber\
  52.415 +sed -e 's;^ *#.*$;;' -e 's;^    ;;' >$VCFILE <<'EOF'\
  52.416 +%{nil}
  52.417 +%__spec_track_post EOF\
  52.418 +if [ ".%{?___track_dump}" = .yes ]; then\
  52.419 +    cat $VCFILE\
  52.420 +else\
  52.421 +    if [ ! -f "%{l_vcheck}" ]; then\
  52.422 +        echo "rpm:ERROR: Vendor source tracking functionality currently not available because"\
  52.423 +        echo "rpm:ERROR: URL tracking tool vcheck(1) not found under \\"%{l_vcheck}\\"."\
  52.424 +        echo "rpm:ERROR: You have to install the OpenPKG \\"vcheck\\" package first or set"\
  52.425 +        echo "rpm:ERROR: the RPM macro \\"%%{l_vcheck}\\" to the path of your vcheck(1) tool."\
  52.426 +        exit 0\
  52.427 +    fi\
  52.428 +    ( echo "config = {"\
  52.429 +      echo "}"\
  52.430 +    ) >>$VCFILE\
  52.431 +    %{l_vcheck} -v -f $VCFILE || true\
  52.432 +fi\
  52.433 +rm -f $VCFILE\
  52.434 +%{nil}
  52.435 +
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/openpkg/rpmpopt	Tue Jan 06 23:40:39 2009 +0100
    53.3 @@ -0,0 +1,114 @@
    53.4 +##
    53.5 +##  rpmpopt -- OpenPKG RPM POPT Configuration
    53.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    53.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    53.8 +##
    53.9 +##  Permission to use, copy, modify, and distribute this software for
   53.10 +##  any purpose with or without fee is hereby granted, provided that
   53.11 +##  the above copyright notice and this permission notice appear in all
   53.12 +##  copies.
   53.13 +##
   53.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   53.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   53.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   53.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   53.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   53.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   53.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   53.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   53.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   53.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   53.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   53.25 +##  SUCH DAMAGE.
   53.26 +##
   53.27 +##  The purpose of this configuration file is to extend and override
   53.28 +##  the "rpmpopt" directives in the default RPM POPT configuration with
   53.29 +##  OpenPKG specific extensions and adjustments.
   53.30 +##
   53.31 +
   53.32 +#   backward compatibility for old RPM extensions
   53.33 +rpm exec --stowaway  echo "install \"openpkg-tools\" and use \"openpkg stowaway\" now please."
   53.34 +rpm exec --makeproxy echo "install \"openpkg-tools\" and use \"openpkg makeproxy\" now please."
   53.35 +rpm exec --fetch     echo "install \"openpkg-tools\" and use \"openpkg fetch\" now please."
   53.36 +
   53.37 +#   RPM exentsion: "rpm -bs --[no]restriction"
   53.38 +rpm alias --restriction   --define "restriction yes" \
   53.39 +    --POPTdesc=$"exclude %NoSource files in .src.rpm"
   53.40 +rpm alias --norestriction --define "restriction no" \
   53.41 +    --POPTdesc=$"include %NoSource files in .src.rpm"
   53.42 +
   53.43 +#   RPM extension: "rpm --with[out] <name>"
   53.44 +rpm alias --with --define "with_!#:+ yes" \
   53.45 +    --POPTdesc=$"set '%option with_<name> yes'" \
   53.46 +    --POPTargs=$"<name>"
   53.47 +rpm alias --without --define "with_!#:+ no" \
   53.48 +    --POPTdesc=$"set '%option with_<name> no'" \
   53.49 +    --POPTargs=$"<name>"
   53.50 +
   53.51 +#   RPM extension: "rpm --option <name> <value>"
   53.52 +rpm alias --option --define "!#:+ !#:+" \
   53.53 +    --POPTdesc=$"set '%option <name> <value>'" \
   53.54 +    --POPTargs=$"<name> <value>"
   53.55 +
   53.56 +#   RPM extension: "rpm --tag <string>"
   53.57 +rpm alias --tag --define "l_tag_fmt !#:+" \
   53.58 +    --POPTdesc=$"set 'binary package filename tag'" \
   53.59 +    --POPTargs=$"<string>"
   53.60 +
   53.61 +#   RPM extension: "rpm --db-{build,rebuild,cleanup,fixate}"
   53.62 +rpm exec --db-build   rpmdb --build \
   53.63 +    --POPTdesc=$"RPM database administration: build new database (destructive operation; you have to know what you are doing)"
   53.64 +rpm exec --db-rebuild rpmdb --rebuild \
   53.65 +    --POPTdesc=$"RPM database administration: rebuild new from old database (upgrading operation; reasonable after upgrades or on DB corruption)"
   53.66 +rpm exec --db-cleanup rpmdb --cleanup \
   53.67 +    --POPTdesc=$"RPM database administration: cleanup existing database (cleaning operation; reasonable after DB out-of-sync situations)"
   53.68 +rpm exec --db-fixate  rpmdb --fixate \
   53.69 +    --POPTdesc=$"RPM database administration: fixate existing database (harmless operation; for fixating files only)"
   53.70 +
   53.71 +#   RPM extension: "rpm --db-private ..."
   53.72 +rpm alias --db-private --define "_rpmdb_private yes" \
   53.73 +    --POPTdesc=$"operate RPM database in Berkeley-DB DB_PRIVATE mode"
   53.74 +
   53.75 +#   RPM extension: "rpm --track"
   53.76 +rpm alias --track -bt \
   53.77 +    --POPTdesc=$"run package vendor source tracking script (%track)"
   53.78 +
   53.79 +#   RPM extension: "rpm --track-dump"
   53.80 +rpm alias --track-dump -bt --define '___track_dump yes' \
   53.81 +    --POPTdesc=$"dump the vendor source tracking script (%track)"
   53.82 +
   53.83 +#   RPM extension: "rpm --test"
   53.84 +rpm alias --test -q --qf '%{TEST}\n' \
   53.85 +    --pipe "grep -v \(none\) | @l_prefix@/lib/openpkg/bash" \
   53.86 +    --POPTdesc=$"run package run-time test script (%test)"
   53.87 +
   53.88 +#   RPM adjustment: "rpm --setperms ..."
   53.89 +rpm alias --setperms -q --qf \
   53.90 +    '[\[ -h %{FILENAMES:shescape} \] || chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
   53.91 +    --pipe "grep -v '(none)' | sed 's/chmod .../chmod /' | @l_prefix@/lib/openpkg/bash" \
   53.92 +    --POPTdesc=$"set permissions of files in a package"
   53.93 +
   53.94 +#   RPM adjustment: "rpm --setugids ..."
   53.95 +rpm alias --setugids -q --qf \
   53.96 +    '[run %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape}\n]' \
   53.97 +    --pipe "(echo 'run () { chown -- \"$1\" \"$3\"; chgrp -- \"$2\" \"$3\"; }'; grep -v '(none)') | @l_prefix@/lib/openpkg/bash" \
   53.98 +    --POPTdesc=$"set user/group ownership of files in a package"
   53.99 +
  53.100 +#   RPM adjustment: improved and cleaned up "rpm -i/--info"
  53.101 +rpmq alias --info --qf '\
  53.102 +Name:     %-25{NAME} Source RPM:   %{SOURCERPM}\n\
  53.103 +Version:  %-25{VERSION} Signature:    %|DSAHEADER?{dsa:%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{rsa:%{RSAHEADER:pgpsig}}:{%|SIGGPG?{gpg:%{SIGGPG:pgpsig}}:{%|SIGPGP?{pgp:%{SIGPGP:pgpsig}}:{%|SIGMD5?{md5:%{SIGMD5}}:{(none)}|}|}|}|}|\n\
  53.104 +Release:  %-25{RELEASE} Build Host:   %{BUILDHOST}\n\
  53.105 +Group:    %-25{GROUP} Build System: %{ARCH}-%{OS}\n\
  53.106 +Class:    %-25{CLASS} Build Time:   %{BUILDTIME:date}\n\
  53.107 +Distrib:  %-25{DISTRIBUTION} Install Time: %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n\
  53.108 +License:  %-25{LICENSE} Install Size: %{SIZE} bytes\n\
  53.109 +Packager: %-25{PACKAGER} Relocations:  %|PREFIXES?{[%{PREFIXES} ]}:{(not relocateable)}|\n\
  53.110 +Vendor:   %{VENDOR}\n\
  53.111 +Summary:  %{SUMMARY}\n\
  53.112 +URL:      %{URL}\n\
  53.113 +Description:\n%{DESCRIPTION}\n\
  53.114 +%|PROVIDENAME?{Provides:\n\
  53.115 +[    %{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]}:{}|\
  53.116 +' --POPTdesc=$"list descriptive information from package(s)"
  53.117 +
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/openpkg/rpmrc	Tue Jan 06 23:40:39 2009 +0100
    54.3 @@ -0,0 +1,76 @@
    54.4 +##
    54.5 +##  rpmrc -- OpenPKG RPM Configuration
    54.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    54.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    54.8 +##
    54.9 +##  Permission to use, copy, modify, and distribute this software for
   54.10 +##  any purpose with or without fee is hereby granted, provided that
   54.11 +##  the above copyright notice and this permission notice appear in all
   54.12 +##  copies.
   54.13 +##
   54.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   54.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   54.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   54.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   54.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   54.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   54.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   54.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   54.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   54.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   54.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   54.25 +##  SUCH DAMAGE.
   54.26 +##
   54.27 +##  The purpose of this configuration file is to override the
   54.28 +##  "macrofiles" directive in the default RPM configuration in order
   54.29 +##  to direct RPM to the special macro definitions for the @l_prefix@
   54.30 +##  hierarchy.
   54.31 +##
   54.32 +
   54.33 +#
   54.34 +#   Macro Sets
   54.35 +#
   54.36 +
   54.37 +macrofiles: @l_prefix@/lib/openpkg/macros:@l_prefix@/etc/openpkg/rpmmacros:~/.rpmmacros:~/.openpkg/rpmmacros
   54.38 +
   54.39 +#
   54.40 +#   CPU Architecture Mappings
   54.41 +#   (most important architectures only)
   54.42 +#
   54.43 +
   54.44 +#   Intel IA32/IA64
   54.45 +arch_canon:         ix86:       ix86 1
   54.46 +arch_canon:         ia64:       ia64 9
   54.47 +arch_compat:        ix86:       ix86 noarch
   54.48 +buildarch_compat:   ix86:       ix86 noarch
   54.49 +arch_compat:        ia64:       ia64 ix86 noarch
   54.50 +buildarch_compat:   ia64:       ia64 ix86 noarch
   54.51 +
   54.52 +#   AMD/Intel AMD64/EM64T
   54.53 +arch_canon:         amd64:      amd64 2
   54.54 +arch_compat:        amd64:      amd64 ix86 noarch
   54.55 +buildarch_compat:   amd64:      amd64 ix86 noarch
   54.56 +
   54.57 +#   Sun SPARC
   54.58 +arch_canon:         sparc:      sparc   3
   54.59 +arch_canon:         sparc64:    sparc64 3
   54.60 +arch_compat:        sparc:      sparc noarch
   54.61 +buildarch_compat:   sparc:      sparc noarch
   54.62 +arch_compat:        sparc64:    sparc64 sparc noarch
   54.63 +buildarch_compat:   sparc64:    sparc64 sparc noarch
   54.64 +
   54.65 +#   HP PA-RISC
   54.66 +arch_canon:         hppa:       hppa 4
   54.67 +arch_compat:        hppa:       hppa noarch
   54.68 +buildarch_compat:   hppa:       hppa noarch
   54.69 +
   54.70 +#   IBM PowerPC
   54.71 +arch_canon:         ppc:        ppc 5
   54.72 +arch_compat:        ppc:        ppc noarch
   54.73 +buildarch_compat:   ppc:        ppc noarch
   54.74 +
   54.75 +#
   54.76 +#   Operating System Mappings
   54.77 +#   (currently intentionally left out to avoid any magic)
   54.78 +#
   54.79 +
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/openpkg/rpmtool	Tue Jan 06 23:40:39 2009 +0100
    55.3 @@ -0,0 +1,1155 @@
    55.4 +#!@l_prefix@/lib/openpkg/bash
    55.5 +##
    55.6 +##  rpmtool -- OpenPKG RPM Auxiliary Tool
    55.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    55.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    55.9 +##
   55.10 +##  Permission to use, copy, modify, and distribute this software for
   55.11 +##  any purpose with or without fee is hereby granted, provided that
   55.12 +##  the above copyright notice and this permission notice appear in all
   55.13 +##  copies.
   55.14 +##
   55.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   55.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   55.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   55.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   55.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   55.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   55.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   55.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   55.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   55.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   55.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   55.26 +##  SUCH DAMAGE.
   55.27 +##
   55.28 +
   55.29 +prog_path="$0"
   55.30 +prog_name="rpmtool"
   55.31 +prog_vers="1.1.0"
   55.32 +prog_date="05-Mar-2007"
   55.33 +
   55.34 +if [ $# -eq 0 ]; then
   55.35 +    echo "$0:Error: invalid command line" 1>&2
   55.36 +    echo "$0:Hint:  run \`$0 -h' for usage" 1>&2
   55.37 +    exit 1
   55.38 +fi
   55.39 +if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
   55.40 +    echo "This is $prog_name, version $prog_vers ($prog_date)"
   55.41 +    echo "Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>"
   55.42 +    echo ''
   55.43 +    echo "Usage: $prog_name [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
   55.44 +    echo ''
   55.45 +    echo 'Available global <options>:'
   55.46 +    echo '  -d, --debug     enable internal debugging'
   55.47 +    echo '  -v, --version   display version information'
   55.48 +    echo '  -h, --help      display usage help page (this one)'
   55.49 +    echo ''
   55.50 +    echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
   55.51 +    echo '  platform'
   55.52 +    echo '  mflags [-O] <tool>'
   55.53 +    echo '  cflags [-O] <tool>'
   55.54 +    echo '  cppflags [-p <prefix>] [<subdir> ...]'
   55.55 +    echo '  ldflags  [-p <prefix>] [<subdir> ...]'
   55.56 +    echo '  files  [-v] [-o <outfile>] [-r <buildroot>] [<filelist>]'
   55.57 +    echo '  signal [-v] [-t] [-n] [-c] [-d <delay>] [-p <pid>] [-m <pattern>] <sig> [<sig> ...]'
   55.58 +    echo '  config [-v] [-s] [-a] [-r] [-b <ext>] [-p <tagprefix>] [-t <tagname>] [-i <tagid>] <file>'
   55.59 +    echo '  msg    [-b] [-r] [-t <type>]'
   55.60 +    echo ''
   55.61 +    exit 0
   55.62 +fi
   55.63 +if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
   55.64 +    echo "$prog_name $prog_vers ($prog_date)"
   55.65 +    exit 0
   55.66 +fi
   55.67 +if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
   55.68 +    shift
   55.69 +    set -x
   55.70 +fi
   55.71 +
   55.72 +tool="$1"
   55.73 +shift
   55.74 +arg_spec=""
   55.75 +opt_spec=""
   55.76 +gen_tmpfile=no
   55.77 +
   55.78 +#   configure tool specific option parsing
   55.79 +case $tool in
   55.80 +    platform )
   55.81 +        str_usage=""
   55.82 +        arg_spec="0="
   55.83 +        opt_spec=""
   55.84 +        ;;
   55.85 +    mflags )
   55.86 +        str_usage="[-O] <tool>"
   55.87 +        arg_spec="1="
   55.88 +        opt_spec="O."
   55.89 +        opt_O=no
   55.90 +        ;;
   55.91 +    cflags )
   55.92 +        str_usage="[-O] <tool>"
   55.93 +        arg_spec="1="
   55.94 +        opt_spec="O."
   55.95 +        opt_O=no
   55.96 +        ;;
   55.97 +    cppflags )
   55.98 +        str_usage="[-p <prefix>] [-i] [<subdir> ...]"
   55.99 +        arg_spec="0+"
  55.100 +        opt_spec="p:i."
  55.101 +        opt_p="/"
  55.102 +        ;;
  55.103 +    ldflags )
  55.104 +        str_usage="[-p <prefix>] [<subdir> ...]"
  55.105 +        arg_spec="0+"
  55.106 +        opt_spec="p:"
  55.107 +        opt_p="/"
  55.108 +        ;;
  55.109 +    files )
  55.110 +        gen_tmpfile=yes
  55.111 +        str_usage="[-v] [-o <outfile>] [-r <buildroot>] [<filelist>]"
  55.112 +        arg_spec="0+"
  55.113 +        opt_spec="v.o:r:"
  55.114 +        opt_v=no
  55.115 +        opt_o=''
  55.116 +        opt_r=''
  55.117 +        ;;
  55.118 +    signal )
  55.119 +        str_usage="[-v] [-t] [-n] [-c] [-d <delay>] [-p <pid>] [-m <pattern>] <sig> [<sig> ...]"
  55.120 +        arg_spec="1+"
  55.121 +        opt_spec="v.t.n.c.d:p:m:"
  55.122 +        opt_v=no
  55.123 +        opt_t=no
  55.124 +        opt_n=no
  55.125 +        opt_c=no
  55.126 +        opt_d=1
  55.127 +        opt_p=""
  55.128 +        opt_m=""
  55.129 +        ;;
  55.130 +    config )
  55.131 +        str_usage="[-v] [-s] [-a] [-r] [-b <ext>] [-p <tagprefix>] [-t <tagname>] [-i <tagid>] <file>"
  55.132 +        arg_spec="1="
  55.133 +        opt_spec="v.s.a.r.b:p:t:i:c:"
  55.134 +        opt_v=no
  55.135 +        opt_s=no
  55.136 +        opt_a=no
  55.137 +        opt_r=no
  55.138 +        opt_b=""
  55.139 +        opt_p="#"
  55.140 +        opt_t="OpenPKG"
  55.141 +        opt_i=""
  55.142 +        gen_tmpfile=yes
  55.143 +        ;;
  55.144 +    msg )
  55.145 +        str_usage="[-b] [-r] [-t <type>]"
  55.146 +        arg_spec="0="
  55.147 +        opt_spec="b.r.t:"
  55.148 +        opt_b=no
  55.149 +        opt_r=no
  55.150 +        opt_t=info
  55.151 +        ;;
  55.152 +    check-class )
  55.153 +        str_usage=""
  55.154 +        arg_spec="1="
  55.155 +        opt_spec=""
  55.156 +        ;;
  55.157 +    -* )
  55.158 +        echo "$prog_name:Error: unknown option \`$tool'" 2>&1
  55.159 +        echo "$prog_name:Hint:  run \`$0 -h' for usage" 2>&1
  55.160 +        exit 1
  55.161 +        ;;
  55.162 +    * )
  55.163 +        echo "$prog_name:Error: unknown command \`$tool'" 2>&1
  55.164 +        echo "$prog_name:Hint:  run \`$0 -h' for usage" 2>&1
  55.165 +        exit 1
  55.166 +        ;;
  55.167 +esac
  55.168 +
  55.169 +#   tool information
  55.170 +toolcmd="$0 $tool"
  55.171 +toolcmdhelp="$prog_name $tool"
  55.172 +msgprefix="$prog_name:$tool"
  55.173 +
  55.174 +#   parse argument specification string
  55.175 +eval `echo $arg_spec |\
  55.176 +      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
  55.177 +
  55.178 +#   parse option specification string
  55.179 +eval `echo h.$opt_spec |\
  55.180 +      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
  55.181 +
  55.182 +#   iterate over argument line
  55.183 +opt_PREV=''
  55.184 +while [ $# -gt 0 ]; do
  55.185 +    #   special option stops processing
  55.186 +    if [ ".$1" = ".--" ]; then
  55.187 +        shift
  55.188 +        break
  55.189 +    fi
  55.190 +
  55.191 +    #   determine option and argument
  55.192 +    opt_ARG_OK=no
  55.193 +    if [ ".$opt_PREV" != . ]; then
  55.194 +        #   merge previous seen option with argument
  55.195 +        opt_OPT="$opt_PREV"
  55.196 +        opt_ARG="$1"
  55.197 +        opt_ARG_OK=yes
  55.198 +        opt_PREV=''
  55.199 +    else
  55.200 +        #   split argument into option and argument
  55.201 +        case "$1" in
  55.202 +            -[a-zA-Z0-9]*)
  55.203 +                eval `echo "x$1" |\
  55.204 +                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
  55.205 +                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
  55.206 +                ;;
  55.207 +            -[a-zA-Z0-9])
  55.208 +                opt_OPT=`echo "x$1" | cut -c3-`
  55.209 +                opt_ARG=''
  55.210 +                ;;
  55.211 +            *)
  55.212 +                break
  55.213 +                ;;
  55.214 +        esac
  55.215 +    fi
  55.216 +
  55.217 +    #   eat up option
  55.218 +    shift
  55.219 +
  55.220 +    #   determine whether option needs an argument
  55.221 +    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
  55.222 +    if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
  55.223 +        if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
  55.224 +            opt_PREV="$opt_OPT"
  55.225 +            continue
  55.226 +        fi
  55.227 +    fi
  55.228 +
  55.229 +    #   process option
  55.230 +    case $opt_MODE in
  55.231 +        '.' )
  55.232 +            #   boolean option
  55.233 +            eval "opt_${opt_OPT}=yes"
  55.234 +            ;;
  55.235 +        ':' )
  55.236 +            #   option with argument (multiple occurances override)
  55.237 +            eval "opt_${opt_OPT}=\"\$opt_ARG\""
  55.238 +            ;;
  55.239 +        '+' )
  55.240 +            #   option with argument (multiple occurances append)
  55.241 +            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
  55.242 +            ;;
  55.243 +        * )
  55.244 +            echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
  55.245 +            echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man $prog_name' for details" 1>&2
  55.246 +            exit 1
  55.247 +            ;;
  55.248 +    esac
  55.249 +done
  55.250 +if [ ".$opt_PREV" != . ]; then
  55.251 +    echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
  55.252 +    echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man $prog_name' for details" 1>&2
  55.253 +    exit 1
  55.254 +fi
  55.255 +
  55.256 +#   process help option
  55.257 +if [ ".$opt_h" = .yes ]; then
  55.258 +    echo "Usage: $toolcmdhelp $str_usage"
  55.259 +    exit 0
  55.260 +fi
  55.261 +
  55.262 +#   complain about incorrect number of arguments
  55.263 +case $arg_MODE in
  55.264 +    '=' )
  55.265 +        if [ $# -ne $arg_NUMS ]; then
  55.266 +            echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
  55.267 +            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man $prog_name' for details" 1>&2
  55.268 +            exit 1
  55.269 +        fi
  55.270 +        ;;
  55.271 +    '+' )
  55.272 +        if [ $# -lt $arg_NUMS ]; then
  55.273 +            echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
  55.274 +            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man $prog_name' for details" 1>&2
  55.275 +            exit 1
  55.276 +        fi
  55.277 +        ;;
  55.278 +esac
  55.279 +
  55.280 +#   establish a temporary file on request
  55.281 +if [ ".$gen_tmpfile" = .yes ]; then
  55.282 +    if [ ".$TMPDIR" != . ]; then
  55.283 +        tmpdir="$TMPDIR"
  55.284 +    else
  55.285 +        tmpdir="/tmp"
  55.286 +    fi
  55.287 +    tmpfile="$tmpdir/.$prog_name.$$"
  55.288 +    rm -f $tmpfile >/dev/null 2>&1
  55.289 +    touch $tmpfile
  55.290 +fi
  55.291 +
  55.292 +#   provide a few useful variables
  55.293 +NL="
  55.294 +"
  55.295 +TAB="	"
  55.296 +DIFS=" ${TAB}${NL}"
  55.297 +
  55.298 +#   determine platform information
  55.299 +platform_machine=`(uname -m) 2>/dev/null` ||\
  55.300 +platform_machine=`(uname -p) 2>/dev/null` ||\
  55.301 +platform_machine='unknown'
  55.302 +if [ ".$platform_machine" = ".Power Macintosh" ]; then
  55.303 +    platform_machine=`(uname -p) 2>/dev/null`
  55.304 +fi
  55.305 +platform_release=`(uname -r) 2>/dev/null` ||\
  55.306 +platform_release='unknown'
  55.307 +platform_system=`(uname -s) 2>/dev/null` ||\
  55.308 +platform_system='unknown'
  55.309 +platform_version=`(uname -v) 2>/dev/null` ||\
  55.310 +platform_version='unknown'
  55.311 +platform="${platform_machine}:${platform_system}:${platform_release}:${platform_version}"
  55.312 +
  55.313 +#   dispatch into tools
  55.314 +case $tool in
  55.315 +    platform )
  55.316 +        #    provide unique platform id
  55.317 +        m=`echo "$platform_machine" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  55.318 +        s=`echo "$platform_system"  | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  55.319 +        r=`echo "$platform_release" | sed -e 's;-.*$;;'`
  55.320 +        echo "${m}-${s}${r}"
  55.321 +        ;;
  55.322 +
  55.323 +    mflags )
  55.324 +        tool="$1"
  55.325 +        isgmake=no
  55.326 +        if [ ".`$tool -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" != . ]; then
  55.327 +            isgmake=yes
  55.328 +        fi
  55.329 +        mflags=''
  55.330 +        if [ ".$isgmake" = .yes ]; then
  55.331 +            mflags="--no-print-directory"
  55.332 +        fi
  55.333 +        if [ ".$opt_O" = .yes ]; then
  55.334 +            case $platform in
  55.335 +                *:SunOS:5.*:* | *:OSF1:*:* )
  55.336 +                    if [ ".$isgmake" = .yes ]; then
  55.337 +                        n=`(/bin/uname -X) 2>/dev/null | grep -i NumCPU | awk '{ print $3; }'`
  55.338 +                        if [ ".$n" != . ]; then
  55.339 +                            if [ $n -gt 1 ]; then
  55.340 +                                n=`expr $n \* 2`
  55.341 +                                mflags="$mflags -j$n"
  55.342 +                            fi
  55.343 +                        fi
  55.344 +                    fi
  55.345 +                    ;;
  55.346 +                *:FreeBSD:[4-8].*:* )
  55.347 +                    n=`/sbin/sysctl -n hw.ncpu`
  55.348 +                    if [ ".$n" != . ]; then
  55.349 +                        if [ $n -gt 1 ]; then
  55.350 +                            n=`expr $n \* 2`
  55.351 +                            mflags="$mflags -j$n"
  55.352 +                            if [ ".$isgmake" = .no ]; then
  55.353 +                                mflags="$mflags -B"
  55.354 +                            fi
  55.355 +                        fi
  55.356 +                    fi
  55.357 +                    ;;
  55.358 +                *:NetBSD:1.[56]*:* | *:NetBSD:[2345].*:* )
  55.359 +                    n=`/sbin/sysctl -n hw.ncpu`
  55.360 +                    if [ ".$n" != . ]; then
  55.361 +                        if [ $n -gt 1 ]; then
  55.362 +                            n=`expr $n \* 2`
  55.363 +                            mflags="$mflags -j$n"
  55.364 +                            if [ ".$isgmake" = .no ]; then
  55.365 +                                mflags="$mflags -B"
  55.366 +                            fi
  55.367 +                        fi
  55.368 +                    fi
  55.369 +                    ;;
  55.370 +                *:Linux:*:* )
  55.371 +                    n=`grep ^processor /proc/cpuinfo | wc -l | awk '{ print $1; }'`
  55.372 +                    if [ ".$n" != . ]; then
  55.373 +                        if [ $n -gt 1 ]; then
  55.374 +                            n=`expr $n \* 2`
  55.375 +                            mflags="$mflags -j$n"
  55.376 +                        fi
  55.377 +                    fi
  55.378 +                    ;;
  55.379 +                *:HP-UX:*:* )
  55.380 +                    if [ ".$isgmake" = .yes ]; then
  55.381 +                        n=`ioscan -d processor -k -F | wc -l`
  55.382 +                        if [ ".$n" != . ]; then
  55.383 +                            if [ $n -gt 1 ]; then
  55.384 +                                n=`expr $n \* 2`
  55.385 +                                mflags="$mflags -j$n"
  55.386 +                            fi
  55.387 +                        fi
  55.388 +                    fi
  55.389 +                    ;;
  55.390 +                *:IRIX64:6.*:* )
  55.391 +                    if [ ".$isgmake" = .yes ]; then
  55.392 +                        n=`/usr/sbin/sysconf | awk '/NUM_PROCESSORS/ { print $2; }'`
  55.393 +                        if [ ".$n" != . ]; then
  55.394 +                            if [ $n -gt 1 ]; then
  55.395 +                                n=`expr $n \* 2`
  55.396 +                                mflags="$mflags -j$n"
  55.397 +                            fi
  55.398 +                        fi
  55.399 +                    fi
  55.400 +                    ;;
  55.401 +                *:Darwin:*:* )
  55.402 +                    n=`/usr/sbin/sysctl hw.ncpu | awk '{ print $3; }'`
  55.403 +                    if [ ".$n" != . ]; then
  55.404 +                        if [ $n -gt 1 ]; then
  55.405 +                            n=`expr $n \* 2`
  55.406 +                            mflags="$mflags -j$n"
  55.407 +                            if [ ".$isgmake" = .no ]; then
  55.408 +                                mflags="$mflags -B"
  55.409 +                            fi
  55.410 +                        fi
  55.411 +                    fi
  55.412 +                    ;;
  55.413 +                *:AIX:*:* )
  55.414 +                    if [ ".$isgmake" = .yes ]; then
  55.415 +                        if [ -x /usr/sbin/lsdev ]; then
  55.416 +                            n=`/usr/sbin/lsdev -C -c processor -S available | wc -l | awk '{ print $1; }'`
  55.417 +                            if [ ".$n" != . ]; then
  55.418 +                                if [ $n -gt 1 ]; then
  55.419 +                                    n=`expr $n \* 2`
  55.420 +                                    mflags="$mflags -j$n"
  55.421 +                                fi
  55.422 +                            fi
  55.423 +                        fi
  55.424 +                    fi
  55.425 +                    ;;
  55.426 +            esac
  55.427 +        fi
  55.428 +        echo "x$mflags" | sed -e 's;^x;;'
  55.429 +        ;;
  55.430 +
  55.431 +    cflags )
  55.432 +        tool="$1"
  55.433 +        echo $tool | grep ^/ >/dev/null
  55.434 +        if [ $? -eq 0 ]; then
  55.435 +            if [ ! -x "$tool" -o -d "$tool" ]; then
  55.436 +                echo "$msgprefix:Error: specified tool \`$tool' not found or not executable" 1>&2
  55.437 +                exit 1
  55.438 +            fi
  55.439 +        else
  55.440 +            shtool=`echo $prog_path | sed -e 's;/[^/]*$;/shtool;'`
  55.441 +            sh $shtool path --suppress $tool
  55.442 +            if [ $? -ne 0 ]; then
  55.443 +                echo "$msgprefix:Error: specified tool \`$tool' not found in PATH" 1>&2
  55.444 +                exit 1
  55.445 +            fi
  55.446 +        fi
  55.447 +        isgcc=no
  55.448 +        if [ ".`($tool -v; $tool --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
  55.449 +            isgcc=yes
  55.450 +        fi
  55.451 +        cflags=''
  55.452 +        if [ ".$opt_O" = .yes ]; then
  55.453 +            if [ ".$isgcc" = .yes ]; then
  55.454 +                case "$platform:`$tool -dumpversion 2>/dev/null`" in
  55.455 +                    *:NetBSD:1.6*:*:2.* )
  55.456 +                        #   NetBSD 1.6.x with GCC 2.95.x suffers from memory
  55.457 +                        #   exhaustion problems under GCC optimizations.
  55.458 +                        ;;
  55.459 +                    * )
  55.460 +                        cflags="-O2"
  55.461 +                        ;;
  55.462 +                esac
  55.463 +                if [ ".`$tool -v 2>/dev/null | grep 'with-gnu-as'`" != . ] || \
  55.464 +                   [ ".`(as --version </dev/null) 2>/dev/null | grep 'GNU'`" != . ]; then
  55.465 +                    cflags="$cflags -pipe"
  55.466 +                fi
  55.467 +            else
  55.468 +                cflags="-O"
  55.469 +            fi
  55.470 +        fi
  55.471 +        case "$platform" in
  55.472 +            amd64:FreeBSD:*:* | ia64:FreeBSD:*:* | sparc64:FreeBSD:*:* | x86_64:Linux:*:* )
  55.473 +                #   at least under FreeBSD on amd64, ia64 and sparc64
  55.474 +                #   the GNU binutils strictly require Position In-
  55.475 +                #   dependent Code (PIC) when Dynamic Shared Objects
  55.476 +                #   (DSO) are involved. As an ugly workaround we
  55.477 +                #   build everything with PIC there, although this is
  55.478 +                #   more than required. We also can assume that the C
  55.479 +                #   compiler is always GCC, either the OpenPKG one or
  55.480 +                #   the FreeBSD one.
  55.481 +                cflags="-fPIC"
  55.482 +                ;;
  55.483 +        esac
  55.484 +        echo "x$cflags" | sed -e 's;^x;;'
  55.485 +        ;;
  55.486 +
  55.487 +     cppflags )
  55.488 +        std=0
  55.489 +        cppflags=""
  55.490 +        for pkg in .. $*; do
  55.491 +            [ ".$pkg" = ... ] && continue
  55.492 +            if [ ".$pkg" = .. ]; then
  55.493 +                cppflags="$cppflags -I${opt_p}/include"
  55.494 +                std=1
  55.495 +            else
  55.496 +                cppflags="$cppflags -I${opt_p}/include/$pkg"
  55.497 +            fi
  55.498 +        done
  55.499 +        if [ $std -eq 0 ]; then
  55.500 +            cppflags="-I${opt_p}/include$cppflags"
  55.501 +        fi
  55.502 +        if [ ".$opt_i" = .yes ]; then
  55.503 +            arch="unknown"; os_name="unknown"; os_vers="0"
  55.504 +            shtool=`echo $prog_path | sed -e 's;/[^/]*$;/shtool;'`
  55.505 +            eval `sh $shtool platform -U -S ":" -C "" -F "%<ac>:%<st>" |\
  55.506 +                  sed -e 's/^\(.*\):\(.*\):\(.*\)$/arch="\1"; os_name="\2"; os_vers="\3";/'`
  55.507 +            V=0; R=0; L=0
  55.508 +            eval `echo "$os_vers" |\
  55.509 +                  sed -e 's/^/X/' \
  55.510 +                      -e 's/^X[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/V="\1"; R="\2"; L="\3";/' \
  55.511 +                      -e 's/^X[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/V="\1"; R="\2";/' \
  55.512 +                      -e 's/^X[^0-9]*\([0-9][0-9]*\).*$/V="\1";/' \
  55.513 +                      -e 's/^X.*$/:/'`
  55.514 +            os_vers=`echo . | awk '{ printf("%02d%02d%02d", V, R, L); }' V="$V" R="$R" L="$L"`
  55.515 +            cppflags="$cppflags -D__OPENPKG_${arch} -D__OPENPKG_${os_name}=${os_vers}"
  55.516 +        fi
  55.517 +        echo "x$cppflags" | sed -e 's;^x;;' -e 's;^ *;;'
  55.518 +        ;;
  55.519 +
  55.520 +     ldflags )
  55.521 +        std=0
  55.522 +        ldflags=""
  55.523 +        for pkg in .. $*; do
  55.524 +            [ ".$pkg" = ... ] && continue
  55.525 +            if [ ".$pkg" = .. ]; then
  55.526 +                ldflags="$ldflags -L${opt_p}/lib"
  55.527 +                std=1
  55.528 +            else
  55.529 +                ldflags="$ldflags -L${opt_p}/lib/$pkg"
  55.530 +            fi
  55.531 +        done
  55.532 +        if [ $std -eq 0 ]; then
  55.533 +            ldflags="-L${opt_p}/lib$ldflags"
  55.534 +        fi
  55.535 +        echo "x$ldflags" | sed -e 's;^x;;' -e 's;^ *;;'
  55.536 +        ;;
  55.537 +
  55.538 +     files )
  55.539 +        #   if a Perl interpreter is available, we perform the operation
  55.540 +        #   with it because Perl is a magnitude (factor 10!) faster than
  55.541 +        #   what we can do here in Bourne-Shell.
  55.542 +        perl=''
  55.543 +        for dir in `echo "$PATH:@l_prefix@/lib/openpkg" | sed -e 's/:/ /g'` .; do
  55.544 +            [ ".$dir" = .. -o ".$dir" = . ] && continue
  55.545 +            for tool in perl5 perl miniperl; do
  55.546 +                if [ -f "$dir/$tool" ]; then
  55.547 +                    perl="$dir/$tool"
  55.548 +                    break
  55.549 +                fi
  55.550 +            done
  55.551 +            if [ ".$perl" != . ]; then
  55.552 +                break
  55.553 +            fi
  55.554 +        done
  55.555 +        if [ ".$perl" != . ]; then
  55.556 +            cat >$tmpfile <<'EOT'
  55.557 +            ##
  55.558 +            ##  PERL IMPLEMENTATION (FAST)
  55.559 +            ##
  55.560 +
  55.561 +            my $opt_v = 0;
  55.562 +            my $opt_o = '';
  55.563 +            my $opt_r = '';
  55.564 +            while ($ARGV[0] =~ m|^-(.)(.*)$|) {
  55.565 +                my ($opt, $arg) = ($1, $2);
  55.566 +                shift(@ARGV);
  55.567 +                unshift(@ARGV, $arg)  if ($arg ne '');
  55.568 +                $opt_v = 1            if ($opt eq 'v');
  55.569 +                $opt_o = shift(@ARGV) if ($opt eq 'o');
  55.570 +                $opt_r = shift(@ARGV) if ($opt eq 'r');
  55.571 +            }
  55.572 +
  55.573 +            #   remember the build root in a reasonable short variable ;)
  55.574 +            my $br = "$opt_r";
  55.575 +
  55.576 +            #   read input file list
  55.577 +            my @L = ();
  55.578 +            if ($#ARGV == -1 or ($#ARGV == 0 and $ARGV[0] eq "-")) {
  55.579 +                #    read file list from stdin
  55.580 +                while (<STDIN>) {
  55.581 +                    s/\n$//s;
  55.582 +                    push(@L, $_);
  55.583 +                }
  55.584 +            }
  55.585 +            else {
  55.586 +                #    read file list from argument line
  55.587 +                @L = @ARGV;
  55.588 +            }
  55.589 +
  55.590 +            #   PASS 1: PREPARATION AND SYNTACTICAL EXPANSION
  55.591 +            if ($opt_v == 1) {
  55.592 +                print STDERR "rpmtool:files: pass 1 (preparation and syntactical expansions)\n";
  55.593 +            }
  55.594 +            my @T = ();
  55.595 +            my $l;
  55.596 +            foreach $l (@L) {
  55.597 +                #   replace tabs with spaces, reduce multiple spaces to single
  55.598 +                #   spaces, and remove leading and trailing spaces
  55.599 +                $l =~ s|[ \t\n]+| |sg;
  55.600 +                $l =~ s|^[ \t]+||sg;
  55.601 +                $l =~ s|[ \t]+$||sg;
  55.602 +
  55.603 +                #   move tags to end of entry for easier parsing
  55.604 +                1 while ($l =~ s|^(%\S+) (.+)|$2 $1|);
  55.605 +
  55.606 +                #   use `:' as a dummy path for tag-only entries (like `%defattr')
  55.607 +                #   to avoid special cases in the later processing
  55.608 +                if ($l =~ m|^%.+|) {
  55.609 +                    $l = ": $l";
  55.610 +                }
  55.611 +
  55.612 +                #   split entry into path and optional tags
  55.613 +                my ($p, $t) = ($l =~ m|^(\S+)(.*)$|);
  55.614 +
  55.615 +                #   expand `{foo,bar,quux}' constructs in path (silent
  55.616 +                #   assumtion to make life easier is that the constructs
  55.617 +                #   occurs only once in a path!)
  55.618 +                if ($p =~ m|^(.*)\{([^\}]+)\}(.*)$|) {
  55.619 +                    #   split path into prolog, the set construct, and the epilog
  55.620 +                    my ($pro, $set, $epi) = ($1, $2, $3);
  55.621 +
  55.622 +                    #   repeat prolog and epilog for all elements in set
  55.623 +                    my $x;
  55.624 +                    foreach $x (split(/,/, $set)) {
  55.625 +                        push(@T, "${pro}${x}${epi}${t}");
  55.626 +                    }
  55.627 +                }
  55.628 +                else {
  55.629 +                    #   else just take over the entry as is
  55.630 +                    push(@T, $l);
  55.631 +                }
  55.632 +            }
  55.633 +            @L = @T;
  55.634 +
  55.635 +            #   PASS 2: FILESYSTEM-BASED EXPANSIONS
  55.636 +            if ($opt_v == 1) {
  55.637 +                print STDERR "rpmtool:files: pass 2 (filesystem-based expansions)\n";
  55.638 +            }
  55.639 +            @T = ();
  55.640 +            foreach $l (@L) {
  55.641 +                #   split entry into path and optional tags
  55.642 +                my ($p, $t) = ($l =~ m|^(\S*)(.*)$|);
  55.643 +
  55.644 +                #   expand...
  55.645 +                if (-d "$br$p" and $t !~ m|.*%dir.*|) {
  55.646 +                    #   expand path because it is not tagged with %dir
  55.647 +                    my @X = `cd "$br$p" && find . -print`;
  55.648 +                    my $x;
  55.649 +                    foreach $x (@X) {
  55.650 +                        $x =~ s|\n$||s;
  55.651 +                        $x =~ s|^\.|$p|s;
  55.652 +                        push(@T, "${x}${t}");
  55.653 +                    }
  55.654 +                }
  55.655 +                else {
  55.656 +                    #   expand path wildcards (`*' and `[..]')
  55.657 +                    #   (if not wildcards are present, this doesn't harm)
  55.658 +                    my @X = glob("$br$p");
  55.659 +                    my $x;
  55.660 +                    foreach $x (@X) {
  55.661 +                        my $brqm = quotemeta($br);
  55.662 +                        $x =~ s|^$brqm||s;
  55.663 +                        push(@T, "${x}${t}");
  55.664 +                    }
  55.665 +                }
  55.666 +            }
  55.667 +            @L = @T;
  55.668 +
  55.669 +            #   PASS 3: DUPLICATION REMOVAL AND CLEANUP
  55.670 +            if ($opt_v == 1) {
  55.671 +                print STDERR "rpmtool:files: pass 3 (duplication removal and cleanup)\n";
  55.672 +            }
  55.673 +            @T = ();
  55.674 +            foreach $l (@L) {
  55.675 +                #   split entry into path and optional tags
  55.676 +                my ($p, $t) = ($l =~ m|^(\S*)(.*)$|);
  55.677 +
  55.678 +                #   add %dir tag if entry is a directory, but still not
  55.679 +                #   tagged as such (else RPM would again expand it recursively)
  55.680 +                if (-d "$br$p") {
  55.681 +                    if ($t !~ m|%dir|) {
  55.682 +                        $t .= " %dir";
  55.683 +                    }
  55.684 +                }
  55.685 +
  55.686 +                #   remove duplicate entries in already processed part
  55.687 +                #   (but make sure we keep the entries with the dummy tags)
  55.688 +                if ($p ne ":") {
  55.689 +                    my @T2 = ();
  55.690 +                    foreach $t (@T) {
  55.691 +                        my $pqm = quotemeta($p);
  55.692 +                        next if ($t =~ m|^$pqm | or $t eq $p);
  55.693 +                        push(@T2, $t);
  55.694 +                    }
  55.695 +                    @T = @T2;
  55.696 +                }
  55.697 +
  55.698 +                #   keep entry only if no %not tag is present
  55.699 +                #   (else all entries are removed)
  55.700 +                if ($t !~ m|.*%not.*|) {
  55.701 +                    push(@T, "${p}${t}");
  55.702 +                }
  55.703 +            }
  55.704 +            @L = @T;
  55.705 +
  55.706 +            #   write out new file list
  55.707 +            @T = ();
  55.708 +            foreach $l (@L) {
  55.709 +                $l =~ s|^(\S+) (.*)$|$2 $1|sg;
  55.710 +                $l =~ s|^\s+||s;
  55.711 +                $l =~ s|\s+$||s;
  55.712 +                $l =~ s|\s+:$||s;
  55.713 +                push(@T, $l);
  55.714 +            }
  55.715 +            @L = @T;
  55.716 +            if ($opt_o eq '' or $opt_o eq '-') {
  55.717 +                print STDOUT join("\n", @L)."\n";
  55.718 +            }
  55.719 +            else {
  55.720 +                open(FP, ">$opt_o");
  55.721 +                print FP join("\n", @L)."\n";
  55.722 +                close(FP);
  55.723 +            }
  55.724 +EOT
  55.725 +            cmd="$perl $tmpfile";
  55.726 +            if [ ".$opt_v" = .yes ]; then
  55.727 +                cmd="$cmd -v"
  55.728 +            fi
  55.729 +            if [ ".$opt_o" != . ]; then
  55.730 +                cmd="$cmd -o \"$opt_o\""
  55.731 +            fi
  55.732 +            if [ ".$opt_r" != . ]; then
  55.733 +                cmd="$cmd -r \"$opt_r\""
  55.734 +            fi
  55.735 +            for arg
  55.736 +            do
  55.737 +                cmd="$cmd \"$arg\""
  55.738 +            done
  55.739 +            eval "$cmd"
  55.740 +        else
  55.741 +            ##
  55.742 +            ##  BOURNE-SHELL IMPLEMENTATION (PORTABLE)
  55.743 +            ##
  55.744 +
  55.745 +            #   remember the build root in a reasonable short variable ;)
  55.746 +            br="$opt_r"
  55.747 +
  55.748 +            #   make sure filename expansion is disabled per default
  55.749 +            set -f
  55.750 +
  55.751 +            #    read input file list
  55.752 +            L=''
  55.753 +            if [ $# -eq 0 ] || [ $# -eq 1 -a ".$1" = ".-" ]; then
  55.754 +                #    read file list from stdin
  55.755 +                L=`cat`
  55.756 +            else
  55.757 +                #    read file list from argument line
  55.758 +                for arg
  55.759 +                do
  55.760 +                    L="$L$NL$arg"
  55.761 +                done
  55.762 +            fi
  55.763 +
  55.764 +            #   PASS 1: PREPARATION AND SYNTACTICAL EXPANSION
  55.765 +            if [ ".$opt_v" = .yes ]; then
  55.766 +                echo "rpmtool:files: pass 1 (preparation and syntactical expansions)" 1>&2
  55.767 +            fi
  55.768 +            T=''
  55.769 +            OIFS="$IFS"; IFS="$NL"
  55.770 +            for l in $L; do
  55.771 +                [ ".$l" = . ] && continue
  55.772 +
  55.773 +                #   replace tabs with spaces, reduce multiple spaces to single
  55.774 +                #   spaces, and remove leading and trailing spaces
  55.775 +                l=`echo "$l" | sed -e "s;${TAB}; ;g" -e 's;  *; ;g' -e 's;^ *;;' -e 's; *$;;'`
  55.776 +
  55.777 +                #   move tags to end of entry for easier parsing
  55.778 +                while [ ".`echo \"$l\" | grep '^%[^ ]* .*'`" != . ]; do
  55.779 +                    l=`echo "$l" | sed -e 's;^\(%[^ ]*\) \(.*\);\2 \1;'`
  55.780 +                done
  55.781 +
  55.782 +                #   use `:' as a dummy path for tag-only entries (like `%defattr')
  55.783 +                #   to avoid special cases in the later processing
  55.784 +                if [ ".`echo \"$l\" | grep '^%.*'`" != . ]; then
  55.785 +                    l=": $l"
  55.786 +                fi
  55.787 +
  55.788 +                #   split entry into path and optional tags
  55.789 +                eval `echo ".$l" | sed -e 's;^\.\([^ ]*\)\(.*\)$;p="\1" t="\2";'`
  55.790 +
  55.791 +                #   expand `{foo,bar,quux}' constructs in path (silent
  55.792 +                #   assumtion to make life easier is that the constructs
  55.793 +                #   occurs only once in a path!)
  55.794 +                if [ ".`echo \".$p\" | grep '^\..*{[^}]*}.*$'`" != . ]; then
  55.795 +
  55.796 +                    #   split path into prolog, the set construct, and the epilog
  55.797 +                    eval `echo ".$p" | sed -e 's;^\.\(.*\){\([^}]*\)}\(.*\)$;pro="\1" set="\2" epi="\3";'`
  55.798 +
  55.799 +                    #   repeat prolog and epilog for all elements in set
  55.800 +                    OIFS2="$IFS"; IFS=","
  55.801 +                    for x in $set; do
  55.802 +                        T="$T$NL${pro}${x}${epi}${t}"
  55.803 +                    done
  55.804 +                    IFS="$OIFS2"
  55.805 +                else
  55.806 +                    #   else just take over the entry as is
  55.807 +                    T="$T$NL$l"
  55.808 +                fi
  55.809 +            done
  55.810 +            L="$T"
  55.811 +            IFS="$OIFS"
  55.812 +
  55.813 +            #   PASS 2: FILESYSTEM-BASED EXPANSIONS
  55.814 +            if [ ".$opt_v" = .yes ]; then
  55.815 +                echo "rpmtool:files: pass 2 (filesystem-based expansions)" 1>&2
  55.816 +            fi
  55.817 +            T=''
  55.818 +            OIFS="$IFS"; IFS="$NL"
  55.819 +            for l in $L; do
  55.820 +                [ ".$l" = . ] && continue
  55.821 +
  55.822 +                #   split entry into path and optional tags
  55.823 +                eval `echo ".$l" | sed -e 's;^\.\([^ ]*\)\(.*\)$;p="\1" t="\2";'`
  55.824 +
  55.825 +                #   expand...
  55.826 +                if [ -d "$br$p" -a ".`expr \".$t\" : '\..*%dir.*'`" = .0 ]; then
  55.827 +                    #   expand path because it is not tagged with %dir
  55.828 +                    OIFS2="$IFS"; IFS="$DIFS"
  55.829 +                    for x in `cd "$br$p" && find . -print | sed -e "s;^\\.;$p;"`; do
  55.830 +                        T="$T$NL${x}${t}"
  55.831 +                    done
  55.832 +                    IFS="$OIFS2"
  55.833 +                else
  55.834 +                    #   expand path wildcards (`*' and `[..]')
  55.835 +                    #   (if not wildcards are present, this doesn't harm)
  55.836 +                    OIFS2="$IFS"; IFS="$DIFS"
  55.837 +                    for x in `(set +f; echo $br$p) | sed -e "s;^$br;;" -e "s; $br; ;g"`; do
  55.838 +                        T="$T$NL${x}${t}"
  55.839 +                    done
  55.840 +                    IFS="$OIFS2"
  55.841 +                fi
  55.842 +            done
  55.843 +            IFS="$OIFS"
  55.844 +            L="$T"
  55.845 +
  55.846 +            #   PASS 3: DUPLICATION REMOVAL AND CLEANUP
  55.847 +            if [ ".$opt_v" = .yes ]; then
  55.848 +                echo "rpmtool:files: pass 3 (duplication removal and cleanup)" 1>&2
  55.849 +            fi
  55.850 +            T=''
  55.851 +            OIFS="$IFS"; IFS="$NL"
  55.852 +            for l in $L; do
  55.853 +                [ ".$l" = . ] && continue
  55.854 +
  55.855 +                #   split entry into path and optional tags
  55.856 +                eval `echo ".$l" | sed -e 's;^\.\([^ ]*\)\(.*\)$;p="\1" t="\2";'`
  55.857 +
  55.858 +                #   add %dir tag if entry is a directory, but still not
  55.859 +                #   tagged as such (else RPM would again expand it recursively)
  55.860 +                if [ -d "$br$p" ]; then
  55.861 +                    if [ ".`expr \".$t\" : '\..*%dir.*'`" = .0 ]; then
  55.862 +                        t="$t %dir"
  55.863 +                    fi
  55.864 +                fi
  55.865 +
  55.866 +                #   remove duplicate entries in already processed part
  55.867 +                #   (but make sure we keep the entries with the dummy tags)
  55.868 +                if [ ".$p" != ".:" ]; then
  55.869 +                    T=`echo "$T" | grep -v "^$p " | grep -v "^$p\$"`
  55.870 +                fi
  55.871 +
  55.872 +                #   keep entry only if no %not tag is present
  55.873 +                #   (else all entries are removed)
  55.874 +                if [ ".`expr \".$t\" : '\..*%not.*'`" = .0 ]; then
  55.875 +                    T="$T$NL${p}${t}"
  55.876 +                fi
  55.877 +            done
  55.878 +            IFS="$OIFS"
  55.879 +            L="$T"
  55.880 +
  55.881 +            #   write out new file list
  55.882 +            if [ ".$opt_o" = . -o ".$opt_o" = ".-" ]; then
  55.883 +                outcmd="cat"
  55.884 +            else
  55.885 +                outcmd="cat > $opt_o"
  55.886 +            fi
  55.887 +            echo "$L" |\
  55.888 +            sed -e '/^$/d' \
  55.889 +                -e 's;^\([^ ]*\) *\(.*\)$;\2 \1;g' \
  55.890 +                -e 's;^ *;;' \
  55.891 +                -e 's; *$;;' \
  55.892 +                -e 's; *:$;;' | eval $outcmd
  55.893 +        fi
  55.894 +        ;;
  55.895 +
  55.896 +    signal )
  55.897 +        if [ ".$opt_p" = . -a ".$opt_m" = . ]; then
  55.898 +            echo "$msgprefix:Error: either option -p or -m has to be specified" 1>&2
  55.899 +            exit 1
  55.900 +        fi
  55.901 +        case "$platform" in
  55.902 +            *:FreeBSD:*:* | *:NetBSD:*:* )
  55.903 +                cmd0="ps -ax -o pid"
  55.904 +                cmd1="ps -ax -o command"
  55.905 +                cmd2="ps -ax -o pid,command"
  55.906 +                cmd3="ps -ax -o pid,ppid"
  55.907 +                ;;
  55.908 +            *:Linux:*:* | *:OSF1:5.*:* )
  55.909 +                cmd0="ps axo pid"
  55.910 +                cmd1="ps axo cmd"
  55.911 +                cmd2="ps axo pid,cmd"
  55.912 +                cmd3="ps axo pid,ppid"
  55.913 +                ;;
  55.914 +            *:SunOS:5.*:* )
  55.915 +                cmd0="ps -ef -o pid"
  55.916 +                cmd1="ps -ef -o args"
  55.917 +                cmd2="ps -ef -o pid,args"
  55.918 +                cmd3="ps -ef -o pid,ppid"
  55.919 +                ;;
  55.920 +            *:HP-UX:*:* )
  55.921 +                cmd0="ps -ef" # FIXME
  55.922 +                cmd1="ps -ef" # FIXME
  55.923 +                cmd2="ps -ef" # FIXME
  55.924 +                cmd3="ps -ef" # FIXME
  55.925 +                ;;
  55.926 +            *:IRIX64:6.*:* )
  55.927 +                cmd0="ps -ef -o pid"
  55.928 +                cmd1="ps -ef -o args"
  55.929 +                cmd2="ps -ef -o pid,args"
  55.930 +                cmd3="ps -ef -o pid,ppid"
  55.931 +                ;;
  55.932 +            *:Darwin:*:* )
  55.933 +                cmd0="ps -ax -opid"
  55.934 +                cmd1="ps -ax -ocommand"
  55.935 +                cmd2="ps -ax -opid,command"
  55.936 +                cmd3="ps -ax -opid,ppid"
  55.937 +        esac
  55.938 +        #   try all signals in order
  55.939 +        i=$#
  55.940 +        for sig in "$@"; do
  55.941 +            #   check whether program is still running/active
  55.942 +            active=""
  55.943 +            if [ ".$opt_p" != . ]; then
  55.944 +                active=`$cmd0 | grep "$opt_p" | grep -v grep | grep -v rpmtool`
  55.945 +            elif [ ".$opt_m" != . ]; then
  55.946 +                active=`$cmd1 | grep "$opt_m" | grep -v grep | grep -v rpmtool`
  55.947 +            fi
  55.948 +            if [ ".$active" = . ]; then
  55.949 +                break
  55.950 +            fi
  55.951 +
  55.952 +            #   send signal to program
  55.953 +            if [ ".$opt_p" != . ]; then
  55.954 +                pids="$opt_p"
  55.955 +            elif [ ".$opt_m" != . ]; then
  55.956 +                pids=`$cmd2 | sed -e "s;^[ ${TAB}]*;;" | egrep "[0-9]* .*$opt_m" |\
  55.957 +                      grep -v grep | grep -v rpmtool |\
  55.958 +                      awk '{ printf("%s\n", $1); }'`
  55.959 +            fi
  55.960 +            for pid in $pids; do
  55.961 +                if [ ".$opt_v" = .yes ]; then
  55.962 +                    echo "sending $sig signal to process $pid"
  55.963 +                fi
  55.964 +                if [ ".$opt_t" = .yes ]; then
  55.965 +                    echo "kill -$sig $pid"
  55.966 +                fi
  55.967 +                if [ ".$opt_n" = .no ]; then
  55.968 +                    eval "kill -$sig $pid"
  55.969 +                fi
  55.970 +            done
  55.971 +
  55.972 +            #   optionally send signal to childs of program
  55.973 +            if [ ".$opt_c" = .yes ]; then
  55.974 +                for pid in $pids; do
  55.975 +                    cpids=`$cmd3 | sed -e "s;^[ ${TAB}]*;;" | egrep "[0-9]* $pid" |\
  55.976 +                           grep -v grep | grep -v rpmtool |\
  55.977 +                           awk '{ printf("%s\n", $1); }'`
  55.978 +                    for cpid in $cpids; do
  55.979 +                        if [ ".$opt_v" = .yes ]; then
  55.980 +                            echo "sending $sig signal to child process $cpid"
  55.981 +                        fi
  55.982 +                        if [ ".$opt_t" = .yes ]; then
  55.983 +                            echo "kill -$sig $cpid"
  55.984 +                        fi
  55.985 +                        if [ ".$opt_n" = .no ]; then
  55.986 +                            eval "kill -$sig $cpid >/dev/null 2>&1"
  55.987 +                        fi
  55.988 +                    done
  55.989 +                done
  55.990 +            fi
  55.991 +
  55.992 +            #   perform optional delay
  55.993 +            i=`expr $i - 1`
  55.994 +            if [ $i -gt 0 ]; then
  55.995 +                if [ ".$opt_d" != . -a ".$opt_d" != . ]; then
  55.996 +                    sleep $opt_d
  55.997 +                fi
  55.998 +            fi
  55.999 +        done
 55.1000 +        ;;
 55.1001 +
 55.1002 +    config )
 55.1003 +        #   usage consistency
 55.1004 +        if [ ".$opt_a" = .no -a ".$opt_r" = .no ]; then
 55.1005 +            echo "$msgprefix:Error: either option -a or -r has to be specified" 1>&2
 55.1006 +            exit 1
 55.1007 +        fi
 55.1008 +        configfile="$1"
 55.1009 +
 55.1010 +        #   determine block markers
 55.1011 +        block_start="${opt_p}<${opt_t}"
 55.1012 +        if [ ".$opt_i" != . ]; then
 55.1013 +            block_start="${block_start} id=\"${opt_i}\""
 55.1014 +        fi
 55.1015 +        block_start="${block_start}>"
 55.1016 +        block_end="${opt_p}</${opt_t}>"
 55.1017 +
 55.1018 +        #   slash-escaped versions of block markers (for sed(3) call)
 55.1019 +        block_start_esc=`echo "$block_start" | sed -e 's;/;\\\\/;g'`
 55.1020 +        block_end_esc=`echo "$block_end" | sed -e 's;/;\\\\/;g'`
 55.1021 +
 55.1022 +        #   determine backup extension
 55.1023 +        case "X$opt_b" in
 55.1024 +            X   ) ext=".bak"    ;;
 55.1025 +            X.* ) ext="$opt_b"  ;;
 55.1026 +            X*  ) ext=".$opt_b" ;;
 55.1027 +        esac
 55.1028 +
 55.1029 +        #   check for block in config file
 55.1030 +        if [ -f $configfile ]; then
 55.1031 +            check=`grep "^${block_start}" $configfile`
 55.1032 +        else
 55.1033 +            touch $configfile
 55.1034 +            check=""
 55.1035 +        fi
 55.1036 +
 55.1037 +        #   add entry
 55.1038 +        if [ ".$opt_a" = .yes ]; then
 55.1039 +            if [ ".$check" != . ]; then
 55.1040 +                if [ ".$opt_s" = .yes ]; then
 55.1041 +                    exit 0
 55.1042 +                else
 55.1043 +                    echo "$msgprefix:Error: config entry already exists" 1>&2
 55.1044 +                    exit 1
 55.1045 +                fi
 55.1046 +            fi
 55.1047 +            cp $configfile $configfile$ext
 55.1048 +            echo "${block_start}" >$tmpfile
 55.1049 +            cat >>$tmpfile
 55.1050 +            echo "${block_end}" >>$tmpfile
 55.1051 +            cat $tmpfile >>$configfile
 55.1052 +
 55.1053 +        #   remove entry
 55.1054 +        elif [ ".$opt_r" = .yes ]; then
 55.1055 +            if [ ".$check" = . ]; then
 55.1056 +                if [ ".$opt_s" = .yes ]; then
 55.1057 +                    exit 0
 55.1058 +                else
 55.1059 +                    echo "$msgprefix:Error: config entry does not exist" 1>&2
 55.1060 +                    exit 1
 55.1061 +                fi
 55.1062 +            fi
 55.1063 +            cp $configfile $configfile$ext
 55.1064 +            sed -e "/^${block_start_esc}/,/^${block_end_esc}/d" \
 55.1065 +                <$configfile$ext >$configfile
 55.1066 +        fi
 55.1067 +
 55.1068 +        #   verbosity
 55.1069 +        if [ ".$opt_v" = .yes ]; then
 55.1070 +            (diff -u1 $configfile$ext $configfile >$tmpfile) 2>/dev/null
 55.1071 +            if [ ".`cat $tmpfile`" = . ]; then
 55.1072 +                (diff -C1 $configfile$ext $configfile >$tmpfile) 2>/dev/null
 55.1073 +                if [ ".`cat $tmpfile`" = . ]; then
 55.1074 +                    if [ ".$opt_s" = .no ]; then
 55.1075 +                        echo "$msgprefix:Warning: unable to show difference for config file \`$configfile'" 1>&2
 55.1076 +                    fi
 55.1077 +                fi
 55.1078 +            fi
 55.1079 +            echo "editing $configfile:"
 55.1080 +            cat $tmpfile
 55.1081 +        fi
 55.1082 +
 55.1083 +        #   optionally remove backup file
 55.1084 +        if [ ".$opt_b" = . ]; then
 55.1085 +            rm -f $configfile$ext
 55.1086 +        fi
 55.1087 +        ;;
 55.1088 +
 55.1089 +    msg )
 55.1090 +        #   optionally beep before message
 55.1091 +        if [ ".$opt_b" = .yes ]; then
 55.1092 +            echo . | awk '{ printf("%c", 7); }'
 55.1093 +        fi
 55.1094 +        title=""
 55.1095 +        case $opt_t in
 55.1096 +            info   ) title="-------" ;;
 55.1097 +            notice ) title="Notice-" ;;
 55.1098 +            warn   ) title="Warning" ;;
 55.1099 +            error  ) title="Error--" ;;
 55.1100 +            *      ) echo "$msgprefix:Error: invalid message type \`$opt_t'" 1>&2; exit 1 ;;
 55.1101 +        esac
 55.1102 +
 55.1103 +        #   display message
 55.1104 +        if [ ".$opt_r" != .yes ]; then
 55.1105 +            echo . | awk '{ printf("\r"); }'
 55.1106 +        fi
 55.1107 +        echo "+----------------------------------${title}------------------------------------+"
 55.1108 +        expand -t 8 | sed -e 's; *$;;' | awk '{ printf("| %-75s |\n", substr($0, 0, 75)); }'
 55.1109 +        echo "+-----------------------------------------------------------------------------+"
 55.1110 +        ;;
 55.1111 +    check-class )
 55.1112 +        #   check package class from within .spec file macro expansion for %prep section
 55.1113 +        class="$1"; shift
 55.1114 +        case "$class" in
 55.1115 +            CORE|BASE )
 55.1116 +                ;;
 55.1117 +            PLUS )
 55.1118 +                echo "set +x"
 55.1119 +                ( echo "This OpenPKG package is of class PLUS."
 55.1120 +                  echo "This means it is still in extended QUALITY ASSURANCE state."
 55.1121 +                  echo "Hence it is still NOT ready for careless use."
 55.1122 +                  echo "Do not use it in critical production environments."
 55.1123 +                  echo "It might be still potentially unstable under run-time."
 55.1124 +                ) | sh $prog_path msg -r -t notice | sed -e 's;^;echo ";' -e 's;$;";'
 55.1125 +                echo "set -x"
 55.1126 +                ;;
 55.1127 +            EVAL )
 55.1128 +                echo "set +x"
 55.1129 +                ( echo "This OpenPKG package is of class EVAL."
 55.1130 +                  echo "This means it is still in EVALUATION and QUALITY ASSURANCE state."
 55.1131 +                  echo "Hence it is still NOT ready for general use."
 55.1132 +                  echo "Do not use it in production environments."
 55.1133 +                  echo "It might be unstable under run-time or still incompletely packaged."
 55.1134 +                ) | sh $prog_path msg -r -t warn | sed -e 's;^;echo ";' -e 's;$;";'
 55.1135 +                echo "set -x"
 55.1136 +                ;;
 55.1137 +            JUNK )
 55.1138 +                echo "set +x"
 55.1139 +                ( echo "This OpenPKG package is of class JUNK."
 55.1140 +                  echo "This means it is still in DEVELOPMENT state."
 55.1141 +                  echo "Hence it is still NOT ready even for general evaluation."
 55.1142 +                  echo "Do not use it at all, except in development environments!"
 55.1143 +                  echo "It is definitely unstable and incompletely packaged."
 55.1144 +                ) | sh $prog_path msg -r -t warn | sed -e 's;^;echo ";' -e 's;$;";'
 55.1145 +                echo "set -x"
 55.1146 +                ;;
 55.1147 +        esac
 55.1148 +        ;;
 55.1149 +esac
 55.1150 +
 55.1151 +#   cleanup
 55.1152 +if [ ".$gen_tmpfile" = .yes ]; then
 55.1153 +    rm -f $tmpfile >/dev/null 2>&1
 55.1154 +fi
 55.1155 +
 55.1156 +#   die gracefully ;)
 55.1157 +exit 0
 55.1158 +
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/openpkg/rpmtool.8	Tue Jan 06 23:40:39 2009 +0100
    56.3 @@ -0,0 +1,291 @@
    56.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    56.5 +.\"
    56.6 +.\" Standard preamble:
    56.7 +.\" ========================================================================
    56.8 +.de Sh \" Subsection heading
    56.9 +.br
   56.10 +.if t .Sp
   56.11 +.ne 5
   56.12 +.PP
   56.13 +\fB\\$1\fR
   56.14 +.PP
   56.15 +..
   56.16 +.de Sp \" Vertical space (when we can't use .PP)
   56.17 +.if t .sp .5v
   56.18 +.if n .sp
   56.19 +..
   56.20 +.de Vb \" Begin verbatim text
   56.21 +.ft CW
   56.22 +.nf
   56.23 +.ne \\$1
   56.24 +..
   56.25 +.de Ve \" End verbatim text
   56.26 +.ft R
   56.27 +.fi
   56.28 +..
   56.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   56.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   56.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   56.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   56.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   56.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   56.35 +.tr \(*W-|\(bv\*(Tr
   56.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   56.37 +.ie n \{\
   56.38 +.    ds -- \(*W-
   56.39 +.    ds PI pi
   56.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   56.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   56.42 +.    ds L" ""
   56.43 +.    ds R" ""
   56.44 +.    ds C` 
   56.45 +.    ds C' 
   56.46 +'br\}
   56.47 +.el\{\
   56.48 +.    ds -- \|\(em\|
   56.49 +.    ds PI \(*p
   56.50 +.    ds L" ``
   56.51 +.    ds R" ''
   56.52 +'br\}
   56.53 +.\"
   56.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   56.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   56.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   56.57 +.\" output yourself in some meaningful fashion.
   56.58 +.if \nF \{\
   56.59 +.    de IX
   56.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   56.61 +..
   56.62 +.    nr % 0
   56.63 +.    rr F
   56.64 +.\}
   56.65 +.\"
   56.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   56.67 +.\" way too many mistakes in technical documents.
   56.68 +.hy 0
   56.69 +.if n .na
   56.70 +.\"
   56.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   56.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   56.73 +.    \" fudge factors for nroff and troff
   56.74 +.if n \{\
   56.75 +.    ds #H 0
   56.76 +.    ds #V .8m
   56.77 +.    ds #F .3m
   56.78 +.    ds #[ \f1
   56.79 +.    ds #] \fP
   56.80 +.\}
   56.81 +.if t \{\
   56.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   56.83 +.    ds #V .6m
   56.84 +.    ds #F 0
   56.85 +.    ds #[ \&
   56.86 +.    ds #] \&
   56.87 +.\}
   56.88 +.    \" simple accents for nroff and troff
   56.89 +.if n \{\
   56.90 +.    ds ' \&
   56.91 +.    ds ` \&
   56.92 +.    ds ^ \&
   56.93 +.    ds , \&
   56.94 +.    ds ~ ~
   56.95 +.    ds /
   56.96 +.\}
   56.97 +.if t \{\
   56.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   56.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  56.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  56.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  56.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  56.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  56.104 +.\}
  56.105 +.    \" troff and (daisy-wheel) nroff accents
  56.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  56.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  56.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  56.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  56.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  56.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  56.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  56.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  56.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  56.115 +.    \" corrections for vroff
  56.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  56.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  56.118 +.    \" for low resolution devices (crt and lpr)
  56.119 +.if \n(.H>23 .if \n(.V>19 \
  56.120 +\{\
  56.121 +.    ds : e
  56.122 +.    ds 8 ss
  56.123 +.    ds o a
  56.124 +.    ds d- d\h'-1'\(ga
  56.125 +.    ds D- D\h'-1'\(hy
  56.126 +.    ds th \o'bp'
  56.127 +.    ds Th \o'LP'
  56.128 +.    ds ae ae
  56.129 +.    ds Ae AE
  56.130 +.\}
  56.131 +.rm #[ #] #H #V #F C
  56.132 +.\" ========================================================================
  56.133 +.\"
  56.134 +.IX Title "RPMTOOL 8"
  56.135 +.TH RPMTOOL 8 "OpenPKG" "RPMTOOL(8)" "OpenPKG"
  56.136 +.SH "NAME"
  56.137 +\&\fBrpmtool\fR \- RPM Auxiliary Tool
  56.138 +.SH "SYNOPSIS"
  56.139 +.IX Header "SYNOPSIS"
  56.140 +\&\fBrpmtool\fR
  56.141 +\&\fIcommand\fR
  56.142 +[\fIcommand-options\fR]
  56.143 +.SH "DESCRIPTION"
  56.144 +.IX Header "DESCRIPTION"
  56.145 +This is an auxiliary tool to the RedHat Package Manager (\s-1RPM\s0). It
  56.146 +provides additional functionality for use in \s-1RPM\s0 \fIspec\fR files while
  56.147 +building packages. The following \fIcommand\fRs are available:
  56.148 +.IP "\fBplatform\fR" 4
  56.149 +.IX Item "platform"
  56.150 +This command outputs a unique platform id in the format
  56.151 +\&\*(L"<architecture>\-<system><release>\*(R". For instance, the output on a
  56.152 +FreeBSD platform can be \*(L"i386\-freebsd4.2\*(R", the output on a Linux
  56.153 +platform can be \*(L"i686\-linux2.2.16\*(R", the output on a Solaris platform can
  56.154 +be \*(L"sun4u\-sunos5.8\*(R", etc.
  56.155 +.Sp
  56.156 +Example:
  56.157 +.Sp
  56.158 +.Vb 5
  56.159 +\& case `rpmtool platform`; in
  56.160 +\&     *-freebsd[34].* ) ... ;;
  56.161 +\&     *-sunos5.[678]  ) ... ;;
  56.162 +\&     *-linux2.[24].* ) ... ;;
  56.163 +\& esac
  56.164 +.Ve
  56.165 +.IP "\fBmflags\fR [\fB\-O\fR] \fItool\fR" 4
  56.166 +.IX Item "mflags [-O] tool"
  56.167 +This command outputs additional flags for \fImake\fR\|(1) for
  56.168 +use with the program \fItool\fR. It provides only standard flags which
  56.169 +always can be used. In conjunction with \fB\-O\fR (optimization), it also provides
  56.170 +reasonable job control for use on multi-processor platforms (for instance it
  56.171 +outputs \*(L"\-j4\*(R" on an \s-1SMP\s0 system with 2 CPUs if \s-1GNU\s0 make or \s-1BSD\s0 pmake is used).
  56.172 +.Sp
  56.173 +Example:
  56.174 +.Sp
  56.175 +.Vb 1
  56.176 +\& make `rpmtool mflags -O make`
  56.177 +.Ve
  56.178 +.IP "\fBcflags\fR [\fB\-O\fR] \fItool\fR" 4
  56.179 +.IX Item "cflags [-O] tool"
  56.180 +This command outputs additional flags for \fIcc\fR\|(1) for use with the program
  56.181 +\&\fItool\fR. It provides only standard flags which always can be used.
  56.182 +conjunction with \fB\-O\fR it provides also optimization flags (for instance
  56.183 +it outputs \*(L"\-O2 \-pipe\*(R" for \s-1GNU\s0 C/\*(C+ compiler).
  56.184 +.Sp
  56.185 +Example:
  56.186 +.Sp
  56.187 +.Vb 1
  56.188 +\& CC="$CC" CFLAGS=`rpmtool cflags -O $CC` ./configure ...
  56.189 +.Ve
  56.190 +.ie n .IP "\fBcppflags\fR [\fB\-p\fR \fIprefix\fR] [[\*(C`+|\-\*(C'\fR\fIsubdir ...]" 4
  56.191 +.el .IP "\fBcppflags\fR [\fB\-p\fR \fIprefix\fR] [[\f(CW\*(C`+|\-\*(C'\fR\fIsubdir\fR ...]" 4
  56.192 +.IX Item "cppflags [-p prefix] [[+|-subdir ...]"
  56.193 +This command output \fIcpp\fR\|(1) \f(CW\*(C`\-I\*(C'\fR options for the OpenPKG instance
  56.194 +\&\fIprefix\fR. It optionally can prefix or suffix with one or more \fIsubdir\fR
  56.195 +related options, too. If \fIsubdir\fR is prefixed with \f(CW\*(C`+\*(C'\fR (or not
  56.196 +prefixed at all), the generated option is appended. If \fIsubdir\fR is
  56.197 +prefixed with \f(CW\*(C`\-\*(C'\fR the generated option is prepended.
  56.198 +.Sp
  56.199 +Example:
  56.200 +.Sp
  56.201 +.Vb 1
  56.202 +\& rpmtool cppflags -p /foo bar -baz +quux
  56.203 +.Ve
  56.204 +.ie n .IP "\fBldflags\fR [\fB\-p\fR \fIprefix\fR] [[\*(C`+|\-\*(C'\fR\fIsubdir ...]" 4
  56.205 +.el .IP "\fBldflags\fR [\fB\-p\fR \fIprefix\fR] [[\f(CW\*(C`+|\-\*(C'\fR\fIsubdir\fR ...]" 4
  56.206 +.IX Item "ldflags [-p prefix] [[+|-subdir ...]"
  56.207 +This command output \fIld\fR\|(1) \f(CW\*(C`\-L\*(C'\fR options for the OpenPKG instance
  56.208 +\&\fIprefix\fR. It optionally can prefix or suffix with one or more \fIsubdir\fR
  56.209 +related options, too. If \fIsubdir\fR is prefixed with \f(CW\*(C`+\*(C'\fR (or not
  56.210 +prefixed at all), the generated option is appended. If \fIsubdir\fR is
  56.211 +prefixed with \f(CW\*(C`\-\*(C'\fR the generated option is prepended.
  56.212 +.Sp
  56.213 +Example:
  56.214 +.Sp
  56.215 +.Vb 1
  56.216 +\& rpmtool ldflags -p /foo bar -baz +quux
  56.217 +.Ve
  56.218 +.IP "\fBfiles\fR [\fB\-v\fR] [\fB\-o\fR \fIoutfile\fR] [\fB\-r\fR \fIbuild-root\fR] [\fIentry\fR ...]" 4
  56.219 +.IX Item "files [-v] [-o outfile] [-r build-root] [entry ...]"
  56.220 +This is a dynamic variant of the \s-1RPM\s0 \f(CW%files\fR section, i.e., it
  56.221 +dynamically creates the contents of the \f(CW%files\fR section for use with
  56.222 +the \f(CW\*(C`%files \-f\*(C'\fR command. For this the file list entries are read from
  56.223 +the command line (or from stdin if no arguments are given or a single
  56.224 +argument \f(CW\*(C`\-\*(C'\fR is given) and written to stdout (if no \fB\-o\fR option is
  56.225 +given or its \fIoutfile\fR argument is \f(CW\*(C`\-\*(C'\fR) or to \fIoutfile\fR.
  56.226 +.Sp
  56.227 +The trick of this approach is to be able to use additional features in
  56.228 +the file list which \s-1RPM\s0 does not provide. The following features are
  56.229 +provided:
  56.230 +.RS 4
  56.231 +.IP "\fBTrailing Tags\fR" 4
  56.232 +.IX Item "Trailing Tags"
  56.233 +\&\s-1RPM\s0 requires that all tags (like \f(CW\*(C`%attr(...)\*(C'\fR or \f(CW%dir\fR) preceed the
  56.234 +path in a file list entry. This sometimes leads to ugly and unreadable
  56.235 +file lists, because all paths cannot be left\-aligned. With \fIrpmtool\fR\|(8)
  56.236 +tags in the input file list can be at leading and trailing positions.
  56.237 +The output file list will nevertheless have all tags in leading
  56.238 +positions for \s-1RPM\s0.
  56.239 +.IP "\fBSyntactical Set Pattern\fR" 4
  56.240 +.IX Item "Syntactical Set Pattern"
  56.241 +\&\s-1RPM\s0 supports simple wildcard patterns like \f(CW\*(C`/path/*\*(C'\fR or \f(CW\*(C`/path/[a\-z]\*(C'\fR,
  56.242 +etc. Sometimes it is convenient, to also have (in addition to character
  56.243 +sets) string sets like \f(CW\*(C`/path/{foo,bar,quux}\*(C'\fR. \fIrpmtool\fR\|(8) provides this
  56.244 +by syntactically (without checking the filesystem) expanding those
  56.245 +string sets.
  56.246 +.IP "\fBOverriding Entries\fR" 4
  56.247 +.IX Item "Overriding Entries"
  56.248 +This is the most important feature and the reason why \fIshtool\fR\|(1)'s
  56.249 +\&\fBfiles\fR command was implemented. Although \s-1RPM\s0 allows one to specify a
  56.250 +directory in a file list and then implicitly expands this recursively
  56.251 +into its contents, it unfortunately does not allow one to later
  56.252 +explcitly override particular entries (usually if an individual
  56.253 +\&\f(CW\*(C`%attr(...)\*(C'\fR tag is required). \fIrpmtool\fR\|(8) now supports overriding
  56.254 +entries, i.e., if a path occurs multiple times, only the last occurance
  56.255 +is kept.
  56.256 +.IP "\fBNegation Tag\fR" 4
  56.257 +.IX Item "Negation Tag"
  56.258 +This provides an additional tag \f(CW%not\fR which can be used to explicitly
  56.259 +exclude a previously implicitly added entry.
  56.260 +.RE
  56.261 +.RS 4
  56.262 +.Sp
  56.263 +Example:
  56.264 +.Sp
  56.265 +.Vb 8
  56.266 +\& %install
  56.267 +\&   :
  56.268 +\& rpmtool files -o files -r$RPM_BUILD_ROOT \e
  56.269 +\&     '%defattr(-,foo,foo)' \e
  56.270 +\&     '%{prefix}' \e
  56.271 +\&     '%attr(1755,root,foo) %{prefix}/bin/bar' \e
  56.272 +\&     '%not %dir {%{prefix},%{prefix}/*,%{prefix}/man/*}' \e
  56.273 +\&     '%not %{prefix}/info/dir'
  56.274 +.Ve
  56.275 +.Sp
  56.276 +.Vb 1
  56.277 +\& %files -f files
  56.278 +.Ve
  56.279 +.RE
  56.280 +.IP "\fBmsg\fR [\fB\-b\fR]" 4
  56.281 +.IX Item "msg [-b]"
  56.282 +This displays the contents of \fIstdin\fR as a boxed message. If option
  56.283 +\&\fB\-b\fR is given it additionally beeps once before displaying the box.
  56.284 +.SH "HISTORY"
  56.285 +.IX Header "HISTORY"
  56.286 +This tool was created in November 2000 for use in OpenPKG, the
  56.287 +cross-platform RPM-based Unix software packaging facility.
  56.288 +.SH "AUTHOR"
  56.289 +.IX Header "AUTHOR"
  56.290 +.Vb 3
  56.291 +\& Ralf S. Engelschall
  56.292 +\& rse@engelschall.com
  56.293 +\& www.engelschall.com
  56.294 +.Ve
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/openpkg/rpmtool.pod	Tue Jan 06 23:40:39 2009 +0100
    57.3 @@ -0,0 +1,190 @@
    57.4 +##
    57.5 +##  rpmtool.pod -- OpenPKG RPM Auxiliary Tool (Manual Page)
    57.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    57.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    57.8 +##
    57.9 +##  Permission to use, copy, modify, and distribute this software for
   57.10 +##  any purpose with or without fee is hereby granted, provided that
   57.11 +##  the above copyright notice and this permission notice appear in all
   57.12 +##  copies.
   57.13 +##
   57.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   57.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   57.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   57.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   57.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   57.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   57.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   57.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   57.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   57.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   57.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   57.25 +##  SUCH DAMAGE.
   57.26 +##
   57.27 +
   57.28 +=pod
   57.29 +
   57.30 +=head1 NAME
   57.31 +
   57.32 +B<rpmtool> - RPM Auxiliary Tool
   57.33 +
   57.34 +=head1 SYNOPSIS
   57.35 +
   57.36 +B<rpmtool>
   57.37 +I<command>
   57.38 +[I<command-options>]
   57.39 +
   57.40 +=head1 DESCRIPTION
   57.41 +
   57.42 +This is an auxiliary tool to the RedHat Package Manager (RPM). It
   57.43 +provides additional functionality for use in RPM I<spec> files while
   57.44 +building packages. The following I<command>s are available:
   57.45 +
   57.46 +=over 4
   57.47 +
   57.48 +=item B<platform>
   57.49 +
   57.50 +This command outputs a unique platform id in the format
   57.51 +"<architecture>-<system><release>". For instance, the output on a
   57.52 +FreeBSD platform can be "i386-freebsd4.2", the output on a Linux
   57.53 +platform can be "i686-linux2.2.16", the output on a Solaris platform can
   57.54 +be "sun4u-sunos5.8", etc.
   57.55 +
   57.56 +Example:
   57.57 +
   57.58 + case `rpmtool platform`; in
   57.59 +     *-freebsd[34].* ) ... ;;
   57.60 +     *-sunos5.[678]  ) ... ;;
   57.61 +     *-linux2.[24].* ) ... ;;
   57.62 + esac
   57.63 +
   57.64 +=item B<mflags> [B<-O>] I<tool>
   57.65 +
   57.66 +This command outputs additional flags for make(1) for
   57.67 +use with the program I<tool>. It provides only standard flags which
   57.68 +always can be used. In conjunction with B<-O> (optimization), it also provides
   57.69 +reasonable job control for use on multi-processor platforms (for instance it
   57.70 +outputs "-j4" on an SMP system with 2 CPUs if GNU make or BSD pmake is used).
   57.71 +
   57.72 +Example:
   57.73 +
   57.74 + make `rpmtool mflags -O make`
   57.75 +
   57.76 +=item B<cflags> [B<-O>] I<tool>
   57.77 +
   57.78 +This command outputs additional flags for cc(1) for use with the program
   57.79 +I<tool>. It provides only standard flags which always can be used.
   57.80 +conjunction with B<-O> it provides also optimization flags (for instance
   57.81 +it outputs "-O2 -pipe" for GNU C/C++ compiler).
   57.82 +
   57.83 +Example:
   57.84 +
   57.85 + CC="$CC" CFLAGS=`rpmtool cflags -O $CC` ./configure ...
   57.86 +
   57.87 +=item B<cppflags> [B<-p> I<prefix>] [[C<+|->I<subdir> ...]
   57.88 +
   57.89 +This command output cpp(1) C<-I> options for the OpenPKG instance
   57.90 +I<prefix>. It optionally can prefix or suffix with one or more I<subdir>
   57.91 +related options, too. If I<subdir> is prefixed with C<+> (or not
   57.92 +prefixed at all), the generated option is appended. If I<subdir> is
   57.93 +prefixed with C<-> the generated option is prepended.
   57.94 +
   57.95 +Example:
   57.96 +
   57.97 + rpmtool cppflags -p /foo bar -baz +quux
   57.98 +
   57.99 +=item B<ldflags> [B<-p> I<prefix>] [[C<+|->I<subdir> ...]
  57.100 +
  57.101 +This command output ld(1) C<-L> options for the OpenPKG instance
  57.102 +I<prefix>. It optionally can prefix or suffix with one or more I<subdir>
  57.103 +related options, too. If I<subdir> is prefixed with C<+> (or not
  57.104 +prefixed at all), the generated option is appended. If I<subdir> is
  57.105 +prefixed with C<-> the generated option is prepended.
  57.106 +
  57.107 +Example:
  57.108 +
  57.109 + rpmtool ldflags -p /foo bar -baz +quux
  57.110 +
  57.111 +=item B<files> [B<-v>] [B<-o> I<outfile>] [B<-r> I<build-root>] [I<entry> ...]
  57.112 +
  57.113 +This is a dynamic variant of the RPM C<%files> section, i.e., it
  57.114 +dynamically creates the contents of the C<%files> section for use with
  57.115 +the C<%files -f> command. For this the file list entries are read from
  57.116 +the command line (or from stdin if no arguments are given or a single
  57.117 +argument C<-> is given) and written to stdout (if no B<-o> option is
  57.118 +given or its I<outfile> argument is C<->) or to I<outfile>.
  57.119 +
  57.120 +The trick of this approach is to be able to use additional features in
  57.121 +the file list which RPM does not provide. The following features are
  57.122 +provided:
  57.123 +
  57.124 +=over 4
  57.125 +
  57.126 +=item B<Trailing Tags>
  57.127 +
  57.128 +RPM requires that all tags (like C<%attr(...)> or C<%dir>) preceed the
  57.129 +path in a file list entry. This sometimes leads to ugly and unreadable
  57.130 +file lists, because all paths cannot be left-aligned. With rpmtool(8)
  57.131 +tags in the input file list can be at leading and trailing positions.
  57.132 +The output file list will nevertheless have all tags in leading
  57.133 +positions for RPM.
  57.134 +
  57.135 +=item B<Syntactical Set Pattern>
  57.136 +
  57.137 +RPM supports simple wildcard patterns like C</path/*> or C</path/[a-z]>,
  57.138 +etc. Sometimes it is convenient, to also have (in addition to character
  57.139 +sets) string sets like C</path/{foo,bar,quux}>. rpmtool(8) provides this
  57.140 +by syntactically (without checking the filesystem) expanding those
  57.141 +string sets.
  57.142 +
  57.143 +=item B<Overriding Entries>
  57.144 +
  57.145 +This is the most important feature and the reason why shtool(1)'s
  57.146 +B<files> command was implemented. Although RPM allows one to specify a
  57.147 +directory in a file list and then implicitly expands this recursively
  57.148 +into its contents, it unfortunately does not allow one to later
  57.149 +explcitly override particular entries (usually if an individual
  57.150 +C<%attr(...)> tag is required). rpmtool(8) now supports overriding
  57.151 +entries, i.e., if a path occurs multiple times, only the last occurance
  57.152 +is kept.
  57.153 +
  57.154 +=item B<Negation Tag>
  57.155 +
  57.156 +This provides an additional tag C<%not> which can be used to explicitly
  57.157 +exclude a previously implicitly added entry.
  57.158 +
  57.159 +=back
  57.160 +
  57.161 +Example:
  57.162 +
  57.163 + %install
  57.164 +   :
  57.165 + rpmtool files -o files -r$RPM_BUILD_ROOT \
  57.166 +     '%defattr(-,foo,foo)' \
  57.167 +     '%{prefix}' \
  57.168 +     '%attr(1755,root,foo) %{prefix}/bin/bar' \
  57.169 +     '%not %dir {%{prefix},%{prefix}/*,%{prefix}/man/*}' \
  57.170 +     '%not %{prefix}/info/dir'
  57.171 +
  57.172 + %files -f files
  57.173 +
  57.174 +=item B<msg> [B<-b>]
  57.175 +
  57.176 +This displays the contents of F<stdin> as a boxed message. If option
  57.177 +B<-b> is given it additionally beeps once before displaying the box.
  57.178 +
  57.179 +=back
  57.180 +
  57.181 +=head1 HISTORY
  57.182 +
  57.183 +This tool was created in November 2000 for use in OpenPKG, the
  57.184 +cross-platform RPM-based Unix software packaging facility.
  57.185 +
  57.186 +=head1 AUTHOR
  57.187 +
  57.188 + Ralf S. Engelschall
  57.189 + rse@engelschall.com
  57.190 + www.engelschall.com
  57.191 +
  57.192 +=cut
  57.193 +
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/openpkg/shtool	Tue Jan 06 23:40:39 2009 +0100
    58.3 @@ -0,0 +1,4037 @@
    58.4 +#!/bin/sh
    58.5 +##
    58.6 +##  GNU shtool -- The GNU Portable Shell Tool
    58.7 +##  Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>
    58.8 +##
    58.9 +##  See http://www.gnu.org/software/shtool/ for more information.
   58.10 +##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
   58.11 +##
   58.12 +##  Version:  2.0.7 (19-May-2007)
   58.13 +##  Contents: all available modules
   58.14 +##
   58.15 +
   58.16 +##
   58.17 +##  This program is free software; you can redistribute it and/or modify
   58.18 +##  it under the terms of the GNU General Public License as published by
   58.19 +##  the Free Software Foundation; either version 2 of the License, or
   58.20 +##  (at your option) any later version.
   58.21 +##
   58.22 +##  This program is distributed in the hope that it will be useful,
   58.23 +##  but WITHOUT ANY WARRANTY; without even the implied warranty of
   58.24 +##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   58.25 +##  General Public License for more details.
   58.26 +##
   58.27 +##  You should have received a copy of the GNU General Public License
   58.28 +##  along with this program; if not, write to the Free Software
   58.29 +##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   58.30 +##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
   58.31 +##
   58.32 +##  NOTICE: Given that you include this file verbatim into your own
   58.33 +##  source tree, you are justified in saying that it remains separate
   58.34 +##  from your package, and that this way you are simply just using GNU
   58.35 +##  shtool. So, in this situation, there is no requirement that your
   58.36 +##  package itself is licensed under the GNU General Public License in
   58.37 +##  order to take advantage of GNU shtool.
   58.38 +##
   58.39 +
   58.40 +##
   58.41 +##  Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
   58.42 +##
   58.43 +##  Available commands:
   58.44 +##    echo       Print string with optional construct expansion
   58.45 +##    mdate      Pretty-print modification time of a file or dir
   58.46 +##    table      Pretty-print a field-separated list as a table
   58.47 +##    prop       Display progress with a running propeller
   58.48 +##    move       Move files with simultaneous substitution
   58.49 +##    install    Install a program, script or datafile
   58.50 +##    mkdir      Make one or more directories
   58.51 +##    mkln       Make link with calculation of relative paths
   58.52 +##    mkshadow   Make a shadow tree through symbolic links
   58.53 +##    fixperm    Fix file permissions inside a source tree
   58.54 +##    rotate     Logfile rotation
   58.55 +##    tarball    Roll distribution tarballs
   58.56 +##    subst      Apply sed(1) substitution operations
   58.57 +##    platform   Platform Identification Utility
   58.58 +##    arx        Extended archive command
   58.59 +##    slo        Separate linker options by library class
   58.60 +##    scpp       Sharing C Pre-Processor
   58.61 +##    version    Maintain a version information file
   58.62 +##    path       Deal with program paths
   58.63 +##
   58.64 +
   58.65 +#   maximum Bourne-Shell compatibility
   58.66 +if [ ".$ZSH_VERSION" != . ] && (emulate sh) >/dev/null 2>&1; then
   58.67 +    #   reconfigure zsh(1)
   58.68 +    emulate sh
   58.69 +    NULLCMD=:
   58.70 +    alias -g '${1+"$@"}'='"$@"'
   58.71 +elif [ ".$BASH_VERSION" != . ] && (set -o posix) >/dev/null 2>&1; then
   58.72 +    #   reconfigure bash(1)
   58.73 +    set -o posix
   58.74 +fi
   58.75 +
   58.76 +#   maximum independence of NLS nuisances
   58.77 +for var in \
   58.78 +    LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
   58.79 +    LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   58.80 +    LC_TELEPHONE LC_TIME
   58.81 +do
   58.82 +    if (set +x; test -z "`(eval $var=C; export $var) 2>&1`"); then
   58.83 +        eval $var=C; export $var
   58.84 +    else
   58.85 +        unset $var
   58.86 +    fi
   58.87 +done
   58.88 +
   58.89 +#   initial command line handling
   58.90 +if [ $# -eq 0 ]; then
   58.91 +    echo "$0:Error: invalid command line" 1>&2
   58.92 +    echo "$0:Hint:  run \`$0 -h' for usage" 1>&2
   58.93 +    exit 1
   58.94 +fi
   58.95 +if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
   58.96 +    echo "This is GNU shtool, version 2.0.7 (19-May-2007)"
   58.97 +    echo 'Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>'
   58.98 +    echo 'Report bugs to <bug-shtool@gnu.org>'
   58.99 +    echo ''
  58.100 +    echo 'Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]'
  58.101 +    echo ''
  58.102 +    echo 'Available global <options>:'
  58.103 +    echo '  -v, --version   display shtool version information'
  58.104 +    echo '  -h, --help      display shtool usage help page (this one)'
  58.105 +    echo '  -d, --debug     display shell trace information'
  58.106 +    echo '  -r, --recreate  recreate this shtool script via shtoolize'
  58.107 +    echo ''
  58.108 +    echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
  58.109 +    echo '  echo     [-n|--newline] [-e|--expand] [<string> ...]'
  58.110 +    echo '  mdate    [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]'
  58.111 +    echo '           [-f|--field-sep <str>] [-o|--order <spec>] <path>'
  58.112 +    echo '  table    [-F|--field-sep <sep>] [-w|--width <width>] [-c|--columns'
  58.113 +    echo '           <cols>] [-s|--strip <strip>] <str><sep><str>...'
  58.114 +    echo '  prop     [-p|--prefix <str>]'
  58.115 +    echo '  move     [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]'
  58.116 +    echo '           <src-file> <dst-file>'
  58.117 +    echo '  install  [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]'
  58.118 +    echo '           [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>]'
  58.119 +    echo '           [-o|--owner <owner>] [-g|--group <group>] [-e|--exec'
  58.120 +    echo '           <sed-cmd>] <file> [<file> ...] <path>'
  58.121 +    echo '  mkdir    [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode'
  58.122 +    echo '           <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir>'
  58.123 +    echo '           [<dir> ...]'
  58.124 +    echo '  mkln     [-t|--trace] [-f|--force] [-s|--symbolic] <src-path>'
  58.125 +    echo '           [<src-path> ...] <dst-path>'
  58.126 +    echo '  mkshadow [-v|--verbose] [-t|--trace] [-a|--all] <src-dir> <dst-dir>'
  58.127 +    echo '  fixperm  [-v|--verbose] [-t|--trace] <path> [<path> ...]'
  58.128 +    echo '  rotate   [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files'
  58.129 +    echo '           <count>] [-s|--size <size>] [-c|--copy] [-r|--remove]'
  58.130 +    echo '           [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>]'
  58.131 +    echo '           [-b|--background] [-d|--delay] [-p|--pad <len>] [-m|--mode'
  58.132 +    echo '           <mode>] [-o|--owner <owner>] [-g|--group <group>] [-M|--migrate'
  58.133 +    echo '           <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]'
  58.134 +    echo '  tarball  [-t|--trace] [-v|--verbose] [-o|--output <tarball>]'
  58.135 +    echo '           [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user'
  58.136 +    echo '           <user>] [-g|--group <group>] [-e|--exclude <pattern>]'
  58.137 +    echo '           <path> [<path> ...]'
  58.138 +    echo '  subst    [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning]'
  58.139 +    echo '           [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup'
  58.140 +    echo '           <ext>] [-e|--exec <cmd>] [-f|--file <cmd-file>] [<file>]'
  58.141 +    echo '           [...]'
  58.142 +    echo '  platform [-F|--format <format>] [-S|--sep <string>] [-C|--conc'
  58.143 +    echo '           <string>] [-L|--lower] [-U|--upper] [-v|--verbose]'
  58.144 +    echo '           [-c|--concise] [-n|--no-newline] [-t|--type <type>]'
  58.145 +    echo '           [-V|--version] [-h|--help]'
  58.146 +    echo '  arx      [-t|--trace] [-C|--command <cmd>] <op> <archive> [<file>'
  58.147 +    echo '           ...]'
  58.148 +    echo '  slo      [-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib>'
  58.149 +    echo '           ...]'
  58.150 +    echo '  scpp     [-v|--verbose] [-p|--preserve] [-f|--filter <filter>]'
  58.151 +    echo '           [-o|--output <ofile>] [-t|--template <tfile>] [-M|--mark'
  58.152 +    echo '           <mark>] [-D|--define <dname>] [-C|--class <cname>]'
  58.153 +    echo '           <file> [<file> ...]'
  58.154 +    echo '  version  [-l|--language <lang>] [-n|--name <name>] [-p|--prefix'
  58.155 +    echo '           <prefix>] [-s|--set <version>] [-e|--edit] [-i|--increase'
  58.156 +    echo '           <knob>] [-d|--display <type>] <file>'
  58.157 +    echo '  path     [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]'
  58.158 +    echo '           [-m|--magic] [-p|--path <path>] <str> [<str> ...]'
  58.159 +    echo ''
  58.160 +    exit 0
  58.161 +fi
  58.162 +if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
  58.163 +    echo "GNU shtool 2.0.7 (19-May-2007)"
  58.164 +    exit 0
  58.165 +fi
  58.166 +if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
  58.167 +    shtoolize -oshtool all
  58.168 +    exit 0
  58.169 +fi
  58.170 +if [ ".$1" = ".-d" ] || [ ".$1" = ".--debug" ]; then
  58.171 +    shift
  58.172 +    set -x
  58.173 +fi
  58.174 +name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
  58.175 +case "$name" in
  58.176 +    echo|mdate|table|prop|move|install|mkdir|mkln|mkshadow|fixperm|rotate|tarball|subst|platform|arx|slo|scpp|version|path )
  58.177 +        #   implicit tool command selection
  58.178 +        tool="$name"
  58.179 +        ;;
  58.180 +    * )
  58.181 +        #   explicit tool command selection
  58.182 +        tool="$1"
  58.183 +        shift
  58.184 +        ;;
  58.185 +esac
  58.186 +arg_spec=""
  58.187 +opt_spec=""
  58.188 +gen_tmpfile=no
  58.189 +
  58.190 +##
  58.191 +##  DISPATCH INTO SCRIPT PROLOG
  58.192 +##
  58.193 +
  58.194 +case $tool in
  58.195 +    echo )
  58.196 +        str_tool="echo"
  58.197 +        str_usage="[-n|--newline] [-e|--expand] [<string> ...]"
  58.198 +        arg_spec="0+"
  58.199 +        opt_spec="n.e."
  58.200 +        opt_alias="n:newline,e:expand"
  58.201 +        opt_n=no
  58.202 +        opt_e=no
  58.203 +        ;;
  58.204 +    mdate )
  58.205 +        str_tool="mdate"
  58.206 +        str_usage="[-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits] [-f|--field-sep <str>] [-o|--order <spec>] <path>"
  58.207 +        arg_spec="1="
  58.208 +        opt_spec="n.z.s.d.f:o:"
  58.209 +        opt_alias="n:newline,z:zero,s:shorten,d:digits,f:field-sep,o:order"
  58.210 +        opt_n=no
  58.211 +        opt_z=no
  58.212 +        opt_s=no
  58.213 +        opt_d=no
  58.214 +        opt_f=" "
  58.215 +        opt_o="dmy"
  58.216 +        ;;
  58.217 +    table )
  58.218 +        str_tool="table"
  58.219 +        str_usage="[-F|--field-sep <sep>] [-w|--width <width>] [-c|--columns <cols>] [-s|--strip <strip>] <str><sep><str>..."
  58.220 +        arg_spec="1+"
  58.221 +        opt_spec="F:w:c:s:"
  58.222 +        opt_alias="F:field-sep,w:width,c:columns,s:strip"
  58.223 +        opt_F=":"
  58.224 +        opt_w=15
  58.225 +        opt_c=3
  58.226 +        opt_s=79
  58.227 +        ;;
  58.228 +    prop )
  58.229 +        str_tool="prop"
  58.230 +        str_usage="[-p|--prefix <str>]"
  58.231 +        arg_spec="0="
  58.232 +        opt_spec="p:"
  58.233 +        opt_alias="p:prefix"
  58.234 +        opt_p=""
  58.235 +        ;;
  58.236 +    move )
  58.237 +        str_tool="move"
  58.238 +        str_usage="[-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve] <src-file> <dst-file>"
  58.239 +        arg_spec="2="
  58.240 +        opt_spec="v.t.e.p."
  58.241 +        opt_alias="v:verbose,t:trace,e:expand,p:preserve"
  58.242 +        opt_v=no
  58.243 +        opt_t=no
  58.244 +        opt_e=no
  58.245 +        opt_p=no
  58.246 +        ;;
  58.247 +    install )
  58.248 +        str_tool="install"
  58.249 +        str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] [-e|--exec <sed-cmd>] <file> [<file> ...] <path>"
  58.250 +        arg_spec="1+"
  58.251 +        opt_spec="v.t.d.c.C.s.m:o:g:e+"
  58.252 +        opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec"
  58.253 +        opt_v=no
  58.254 +        opt_t=no
  58.255 +        opt_d=no
  58.256 +        opt_c=no
  58.257 +        opt_C=no
  58.258 +        opt_s=no
  58.259 +        opt_m="0755"
  58.260 +        opt_o=""
  58.261 +        opt_g=""
  58.262 +        opt_e=""
  58.263 +        ;;
  58.264 +    mkdir )
  58.265 +        str_tool="mkdir"
  58.266 +        str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir> [<dir> ...]"
  58.267 +        arg_spec="1+"
  58.268 +        opt_spec="t.f.p.m:o:g:"
  58.269 +        opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group"
  58.270 +        opt_t=no
  58.271 +        opt_f=no
  58.272 +        opt_p=no
  58.273 +        opt_m=""
  58.274 +        opt_o=""
  58.275 +        opt_g=""
  58.276 +        ;;
  58.277 +    mkln )
  58.278 +        str_tool="mkln"
  58.279 +        str_usage="[-t|--trace] [-f|--force] [-s|--symbolic] <src-path> [<src-path> ...] <dst-path>"
  58.280 +        arg_spec="2+"
  58.281 +        opt_spec="t.f.s."
  58.282 +        opt_alias="t:trace,f:force,s:symbolic"
  58.283 +        opt_t=no
  58.284 +        opt_f=no
  58.285 +        opt_s=no
  58.286 +        ;;
  58.287 +    mkshadow )
  58.288 +        str_tool="mkshadow"
  58.289 +        str_usage="[-v|--verbose] [-t|--trace] [-a|--all] <src-dir> <dst-dir>"
  58.290 +        arg_spec="2="
  58.291 +        opt_spec="v.t.a."
  58.292 +        opt_alias="v:verbose,t:trace,a:all"
  58.293 +        opt_v=no
  58.294 +        opt_t=no
  58.295 +        opt_a=no
  58.296 +        ;;
  58.297 +    fixperm )
  58.298 +        str_tool="fixperm"
  58.299 +        str_usage="[-v|--verbose] [-t|--trace] <path> [<path> ...]"
  58.300 +        arg_spec="1+"
  58.301 +        opt_spec="v.t."
  58.302 +        opt_alias="v:verbose,t:trace"
  58.303 +        opt_v=no
  58.304 +        opt_t=no
  58.305 +        ;;
  58.306 +    rotate )
  58.307 +        str_tool="rotate"
  58.308 +        str_usage="[-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files <count>] [-s|--size <size>] [-c|--copy] [-r|--remove] [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>] [-b|--background] [-d|--delay] [-p|--pad <len>] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] [-M|--migrate <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]"
  58.309 +        arg_spec="1+"
  58.310 +        opt_spec="v.t.f.n:s:c.r.a:z:b.d.p:o:g:m:M:P:E:"
  58.311 +        opt_alias="v:verbose,t:trace,f:force,n:num-files,s:size,c:copy,r:remove,a:archive-dir,z:compress,b:background,d:delay,p:pad,o:owner,g:group,m:mode,M:migrate,P:prolog,E:epilog"
  58.312 +        opt_v=no
  58.313 +        opt_t=no
  58.314 +        opt_f=no
  58.315 +        opt_n=10
  58.316 +        opt_s=""
  58.317 +        opt_c=no
  58.318 +        opt_r=no
  58.319 +        opt_a=""
  58.320 +        opt_z=""
  58.321 +        opt_b=no
  58.322 +        opt_d=no
  58.323 +        opt_p=1
  58.324 +        opt_o=""
  58.325 +        opt_g=""
  58.326 +        opt_m=""
  58.327 +        opt_M=""
  58.328 +        opt_P=""
  58.329 +        opt_E=""
  58.330 +        ;;
  58.331 +    tarball )
  58.332 +        str_tool="tarball"
  58.333 +        str_usage="[-t|--trace] [-v|--verbose] [-o|--output <tarball>] [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user <user>] [-g|--group <group>] [-e|--exclude <pattern>] <path> [<path> ...]"
  58.334 +        gen_tmpfile=yes
  58.335 +        arg_spec="1+"
  58.336 +        opt_spec="t.v.o:c:d:u:g:e:"
  58.337 +        opt_alias="t:trace,v:verbose,o:output,c:compress,d:directory,u:user,g:group,e:exclude"
  58.338 +        opt_t=no
  58.339 +        opt_v=no
  58.340 +        opt_o=""
  58.341 +        opt_c=""
  58.342 +        opt_d=""
  58.343 +        opt_u=""
  58.344 +        opt_g=""
  58.345 +        opt_e="CVS,\\.cvsignore,\\.svn,\\.[oa]\$"
  58.346 +        ;;
  58.347 +    subst )
  58.348 +        str_tool="subst"
  58.349 +        str_usage="[-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup <ext>] [-e|--exec <cmd>] [-f|--file <cmd-file>] [<file>] [...]"
  58.350 +        gen_tmpfile=yes
  58.351 +        arg_spec="0+"
  58.352 +        opt_spec="v.t.n.w.q.s.i.b:e+f:"
  58.353 +        opt_alias="v:verbose,t:trace,n:nop,w:warning,q:quiet,s:stealth,i:interactive,b:backup,e:exec,f:file"
  58.354 +        opt_v=no
  58.355 +        opt_t=no
  58.356 +        opt_n=no
  58.357 +        opt_w=no
  58.358 +        opt_q=no
  58.359 +        opt_s=no
  58.360 +        opt_i=no
  58.361 +        opt_b=""
  58.362 +        opt_e=""
  58.363 +        opt_f=""
  58.364 +        ;;
  58.365 +    platform )
  58.366 +        str_tool="platform"
  58.367 +        str_usage="[-F|--format <format>] [-S|--sep <string>] [-C|--conc <string>] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--no-newline] [-t|--type <type>] [-V|--version] [-h|--help]"
  58.368 +        arg_spec="0="
  58.369 +        opt_spec="F:S:C:L.U.v.c.n.t:d.V.h."
  58.370 +        opt_alias="F:format,S:sep,C:conc,L:lower,U:upper,v:verbose,c:consise,t:type,n:no-newline,V:version,h:help"
  58.371 +        opt_F="%{sp} (%{ap})"
  58.372 +        opt_S=" "
  58.373 +        opt_C="/"
  58.374 +        opt_L=no
  58.375 +        opt_U=no
  58.376 +        opt_t=""
  58.377 +        opt_v=no
  58.378 +        opt_c=no
  58.379 +        opt_n=no
  58.380 +        opt_V=no
  58.381 +        opt_h=no
  58.382 +        ;;
  58.383 +    arx )
  58.384 +        str_tool="arx"
  58.385 +        str_usage="[-t|--trace] [-C|--command <cmd>] <op> <archive> [<file> ...]"
  58.386 +        arg_spec="2+"
  58.387 +        opt_spec="t.C:"
  58.388 +        opt_alias="t:trace,C:command"
  58.389 +        opt_t=no
  58.390 +        opt_C="ar"
  58.391 +        ;;
  58.392 +    slo )
  58.393 +        str_tool="slo"
  58.394 +        str_usage="[-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]"
  58.395 +        arg_spec="1+"
  58.396 +        opt_spec="p:"
  58.397 +        opt_alias="p:prefix"
  58.398 +        opt_p="SLO_"
  58.399 +        ;;
  58.400 +    scpp )
  58.401 +        str_tool="scpp"
  58.402 +        str_usage="[-v|--verbose] [-p|--preserve] [-f|--filter <filter>] [-o|--output <ofile>] [-t|--template <tfile>] [-M|--mark <mark>] [-D|--define <dname>] [-C|--class <cname>] <file> [<file> ...]"
  58.403 +        gen_tmpfile=yes
  58.404 +        arg_spec="1+"
  58.405 +        opt_spec="v.p.f+o:t:M:D:C:"
  58.406 +        opt_alias="v:verbose,p:preserve,f:filter,o:output,t:template,M:mark,D:define,C:class"
  58.407 +        opt_v=no
  58.408 +        opt_p=no
  58.409 +        opt_f=""
  58.410 +        opt_o="lib.h"
  58.411 +        opt_t="lib.h.in"
  58.412 +        opt_M="%%MARK%%"
  58.413 +        opt_D="cpp"
  58.414 +        opt_C="intern"
  58.415 +        ;;
  58.416 +    version )
  58.417 +        str_tool="version"
  58.418 +        str_usage="[-l|--language <lang>] [-n|--name <name>] [-p|--prefix <prefix>] [-s|--set <version>] [-e|--edit] [-i|--increase <knob>] [-d|--display <type>] <file>"
  58.419 +        arg_spec="1="
  58.420 +        opt_spec="l:n:p:s:i:e.d:"
  58.421 +        opt_alias="l:language,n:name,p:prefix,s:set,e:edit,i:increase,d:display"
  58.422 +        opt_l="txt"
  58.423 +        opt_n="unknown"
  58.424 +        opt_p=""
  58.425 +        opt_s=""
  58.426 +        opt_e="no"
  58.427 +        opt_i=""
  58.428 +        opt_d="short"
  58.429 +        ;;
  58.430 +    path )
  58.431 +        str_tool="path"
  58.432 +        str_usage="[-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path <path>] <str> [<str> ...]"
  58.433 +        gen_tmpfile=yes
  58.434 +        arg_spec="1+"
  58.435 +        opt_spec="s.r.d.b.m.p:"
  58.436 +        opt_alias="s:suppress,r:reverse,d:dirname,b:basename,m:magic,p:path"
  58.437 +        opt_s=no
  58.438 +        opt_r=no
  58.439 +        opt_d=no
  58.440 +        opt_b=no
  58.441 +        opt_m=no
  58.442 +        opt_p="$PATH"
  58.443 +        ;;
  58.444 +    -* )
  58.445 +        echo "$0:Error: unknown option \`$tool'" 2>&1
  58.446 +        echo "$0:Hint:  run \`$0 -h' for usage" 2>&1
  58.447 +        exit 1
  58.448 +        ;;
  58.449 +    * )
  58.450 +        echo "$0:Error: unknown command \`$tool'" 2>&1
  58.451 +        echo "$0:Hint:  run \`$0 -h' for usage" 2>&1
  58.452 +        exit 1
  58.453 +        ;;
  58.454 +esac
  58.455 +
  58.456 +##
  58.457 +##  COMMON UTILITY CODE
  58.458 +##
  58.459 +
  58.460 +#   commonly used ASCII values
  58.461 +ASC_TAB="	"
  58.462 +ASC_NL="
  58.463 +"
  58.464 +
  58.465 +#   determine name of tool
  58.466 +if [ ".$tool" != . ]; then
  58.467 +    #   used inside shtool script
  58.468 +    toolcmd="$0 $tool"
  58.469 +    toolcmdhelp="shtool $tool"
  58.470 +    msgprefix="shtool:$tool"
  58.471 +else
  58.472 +    #   used as standalone script
  58.473 +    toolcmd="$0"
  58.474 +    toolcmdhelp="sh $0"
  58.475 +    msgprefix="$str_tool"
  58.476 +fi
  58.477 +
  58.478 +#   parse argument specification string
  58.479 +eval `echo $arg_spec |\
  58.480 +      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
  58.481 +
  58.482 +#   parse option specification string
  58.483 +eval `echo h.$opt_spec |\
  58.484 +      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
  58.485 +
  58.486 +#   parse option alias string
  58.487 +eval `echo h:help,$opt_alias |\
  58.488 +      sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
  58.489 +
  58.490 +#   interate over argument line
  58.491 +opt_PREV=''
  58.492 +while [ $# -gt 0 ]; do
  58.493 +    #   special option stops processing
  58.494 +    if [ ".$1" = ".--" ]; then
  58.495 +        shift
  58.496 +        break
  58.497 +    fi
  58.498 +
  58.499 +    #   determine option and argument
  58.500 +    opt_ARG_OK=no
  58.501 +    if [ ".$opt_PREV" != . ]; then
  58.502 +        #   merge previous seen option with argument
  58.503 +        opt_OPT="$opt_PREV"
  58.504 +        opt_ARG="$1"
  58.505 +        opt_ARG_OK=yes
  58.506 +        opt_PREV=''
  58.507 +    else
  58.508 +        #   split argument into option and argument
  58.509 +        case "$1" in
  58.510 +            --[a-zA-Z0-9]*=*)
  58.511 +                eval `echo "x$1" |\
  58.512 +                      sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
  58.513 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
  58.514 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
  58.515 +                ;;
  58.516 +            --[a-zA-Z0-9]*)
  58.517 +                opt_OPT=`echo "x$1" | cut -c4-`
  58.518 +                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
  58.519 +                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
  58.520 +                opt_ARG=''
  58.521 +                ;;
  58.522 +            -[a-zA-Z0-9]*)
  58.523 +                eval `echo "x$1" |\
  58.524 +                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
  58.525 +                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
  58.526 +                ;;
  58.527 +            -[a-zA-Z0-9])
  58.528 +                opt_OPT=`echo "x$1" | cut -c3-`
  58.529 +                opt_ARG=''
  58.530 +                ;;
  58.531 +            *)
  58.532 +                break
  58.533 +                ;;
  58.534 +        esac
  58.535 +    fi
  58.536 +
  58.537 +    #   eat up option
  58.538 +    shift
  58.539 +
  58.540 +    #   determine whether option needs an argument
  58.541 +    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
  58.542 +    if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
  58.543 +        if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
  58.544 +            opt_PREV="$opt_OPT"
  58.545 +            continue
  58.546 +        fi
  58.547 +    fi
  58.548 +
  58.549 +    #   process option
  58.550 +    case $opt_MODE in
  58.551 +        '.' )
  58.552 +            #   boolean option
  58.553 +            eval "opt_${opt_OPT}=yes"
  58.554 +            ;;
  58.555 +        ':' )
  58.556 +            #   option with argument (multiple occurances override)
  58.557 +            eval "opt_${opt_OPT}=\"\$opt_ARG\""
  58.558 +            ;;
  58.559 +        '+' )
  58.560 +            #   option with argument (multiple occurances append)
  58.561 +            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\""
  58.562 +            ;;
  58.563 +        * )
  58.564 +            echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2
  58.565 +            echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
  58.566 +            exit 1
  58.567 +            ;;
  58.568 +    esac
  58.569 +done
  58.570 +if [ ".$opt_PREV" != . ]; then
  58.571 +    echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2
  58.572 +    echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
  58.573 +    exit 1
  58.574 +fi
  58.575 +
  58.576 +#   process help option
  58.577 +if [ ".$opt_h" = .yes ]; then
  58.578 +    echo "Usage: $toolcmdhelp $str_usage"
  58.579 +    exit 0
  58.580 +fi
  58.581 +
  58.582 +#   complain about incorrect number of arguments
  58.583 +case $arg_MODE in
  58.584 +    '=' )
  58.585 +        if [ $# -ne $arg_NUMS ]; then
  58.586 +            echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
  58.587 +            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man shtool' for details" 1>&2
  58.588 +            exit 1
  58.589 +        fi
  58.590 +        ;;
  58.591 +    '+' )
  58.592 +        if [ $# -lt $arg_NUMS ]; then
  58.593 +            echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
  58.594 +            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man shtool' for details" 1>&2
  58.595 +            exit 1
  58.596 +        fi
  58.597 +        ;;
  58.598 +esac
  58.599 +
  58.600 +#   establish a temporary file on request
  58.601 +if [ ".$gen_tmpfile" = .yes ]; then
  58.602 +    #   create (explicitly) secure temporary directory
  58.603 +    if [ ".$TMPDIR" != . ]; then
  58.604 +        tmpdir="$TMPDIR"
  58.605 +    elif [ ".$TEMPDIR" != . ]; then
  58.606 +        tmpdir="$TEMPDIR"
  58.607 +    else
  58.608 +        tmpdir="/tmp"
  58.609 +    fi
  58.610 +    tmpdir="$tmpdir/.shtool.$$"
  58.611 +    ( umask 077
  58.612 +      rm -rf "$tmpdir" >/dev/null 2>&1 || true
  58.613 +      mkdir  "$tmpdir" >/dev/null 2>&1
  58.614 +      if [ $? -ne 0 ]; then
  58.615 +          echo "$msgprefix:Error: failed to create temporary directory \`$tmpdir'" 1>&2
  58.616 +          exit 1
  58.617 +      fi
  58.618 +    )
  58.619 +
  58.620 +    #   create (implicitly) secure temporary file
  58.621 +    tmpfile="$tmpdir/shtool.tmp"
  58.622 +    touch "$tmpfile"
  58.623 +fi
  58.624 +
  58.625 +#   utility function: map string to lower case
  58.626 +util_lower () {
  58.627 +    echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
  58.628 +}
  58.629 +
  58.630 +#   utility function: map string to upper case
  58.631 +util_upper () {
  58.632 +    echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  58.633 +}
  58.634 +
  58.635 +#   cleanup procedure
  58.636 +shtool_exit () {
  58.637 +    rc="$1"
  58.638 +    if [ ".$gen_tmpfile" = .yes ]; then
  58.639 +        rm -rf "$tmpdir" >/dev/null 2>&1 || true
  58.640 +    fi
  58.641 +    exit $rc
  58.642 +}
  58.643 +
  58.644 +##
  58.645 +##  DISPATCH INTO SCRIPT BODY
  58.646 +##
  58.647 +
  58.648 +case $tool in
  58.649 +
  58.650 +echo )
  58.651 +    ##
  58.652 +    ##  echo -- Print string with optional construct expansion
  58.653 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
  58.654 +    ##
  58.655 +
  58.656 +    text="$*"
  58.657 +
  58.658 +    #   check for broken escape sequence expansion
  58.659 +    seo=''
  58.660 +    bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
  58.661 +    if [ ".$bytes" != .3 ]; then
  58.662 +        bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
  58.663 +        if [ ".$bytes" = .3 ]; then
  58.664 +            seo='-E'
  58.665 +        fi
  58.666 +    fi
  58.667 +
  58.668 +    #   check for existing -n option (to suppress newline)
  58.669 +    minusn=''
  58.670 +    bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
  58.671 +    if [ ".$bytes" = .3 ]; then
  58.672 +        minusn='-n'
  58.673 +    fi
  58.674 +
  58.675 +    #   determine terminal bold sequence
  58.676 +    term_bold=''
  58.677 +    term_norm=''
  58.678 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then
  58.679 +        case $TERM in
  58.680 +            #   for the most important terminal types we directly know the sequences
  58.681 +            xterm|xterm*|vt220|vt220*)
  58.682 +                term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
  58.683 +                term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
  58.684 +                ;;
  58.685 +            vt100|vt100*|cygwin)
  58.686 +                term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
  58.687 +                term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
  58.688 +                ;;
  58.689 +            #   for all others, we try to use a possibly existing `tput' or `tcout' utility
  58.690 +            * )
  58.691 +                paths=`echo $PATH | sed -e 's/:/ /g'`
  58.692 +                for tool in tput tcout; do
  58.693 +                    for dir in $paths; do
  58.694 +                        if [ -r "$dir/$tool" ]; then
  58.695 +                            for seq in bold md smso; do # 'smso' is last
  58.696 +                                bold="`$dir/$tool $seq 2>/dev/null`"
  58.697 +                                if [ ".$bold" != . ]; then
  58.698 +                                    term_bold="$bold"
  58.699 +                                    break
  58.700 +                                fi
  58.701 +                            done
  58.702 +                            if [ ".$term_bold" != . ]; then
  58.703 +                                for seq in sgr0 me rmso init reset; do # 'reset' is last
  58.704 +                                    norm="`$dir/$tool $seq 2>/dev/null`"
  58.705 +                                    if [ ".$norm" != . ]; then
  58.706 +                                        term_norm="$norm"
  58.707 +                                        break
  58.708 +                                    fi
  58.709 +                                done
  58.710 +                            fi
  58.711 +                            break
  58.712 +                        fi
  58.713 +                    done
  58.714 +                    if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then
  58.715 +                        break;
  58.716 +                    fi
  58.717 +                done
  58.718 +                ;;
  58.719 +        esac
  58.720 +        if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then
  58.721 +            echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
  58.722 +            term_bold=''
  58.723 +            term_norm=''
  58.724 +        fi
  58.725 +    fi
  58.726 +
  58.727 +    #   determine user name
  58.728 +    username=''
  58.729 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then
  58.730 +        username="`(id -un) 2>/dev/null`"
  58.731 +        if [ ".$username" = . ]; then
  58.732 +            str="`(id) 2>/dev/null`"
  58.733 +            if [ ".`echo $str | grep '^uid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
  58.734 +                username=`echo $str | sed -e 's/^uid[ 	]*=[ 	]*[0-9]*(//' -e 's/).*$//'`
  58.735 +            fi
  58.736 +            if [ ".$username" = . ]; then
  58.737 +                username="$LOGNAME"
  58.738 +                if [ ".$username" = . ]; then
  58.739 +                    username="$USER"
  58.740 +                    if [ ".$username" = . ]; then
  58.741 +                        username="`(whoami) 2>/dev/null |\
  58.742 +                                   awk '{ printf("%s", $1); }'`"
  58.743 +                        if [ ".$username" = . ]; then
  58.744 +                            username="`(who am i) 2>/dev/null |\
  58.745 +                                       awk '{ printf("%s", $1); }'`"
  58.746 +                            if [ ".$username" = . ]; then
  58.747 +                                username='unknown'
  58.748 +                            fi
  58.749 +                        fi
  58.750 +                    fi
  58.751 +                fi
  58.752 +            fi
  58.753 +        fi
  58.754 +    fi
  58.755 +
  58.756 +    #   determine user id
  58.757 +    userid=''
  58.758 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then
  58.759 +        userid="`(id -u) 2>/dev/null`"
  58.760 +        if [ ".$userid" = . ]; then
  58.761 +            userid="`(id -u ${username}) 2>/dev/null`"
  58.762 +            if [ ".$userid" = . ]; then
  58.763 +                str="`(id) 2>/dev/null`"
  58.764 +                if [ ".`echo $str | grep '^uid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
  58.765 +                    userid=`echo $str | sed -e 's/^uid[ 	]*=[ 	]*//' -e 's/(.*$//'`
  58.766 +                fi
  58.767 +                if [ ".$userid" = . ]; then
  58.768 +                    userid=`(getent passwd ${username}) 2>/dev/null | \
  58.769 +                            sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
  58.770 +                    if [ ".$userid" = . ]; then
  58.771 +                        userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
  58.772 +                                sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
  58.773 +                        if [ ".$userid" = . ]; then
  58.774 +                            userid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
  58.775 +                                    sed -e 'q' | sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
  58.776 +                            if [ ".$userid" = . ]; then
  58.777 +                                userid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
  58.778 +                                        sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
  58.779 +                                if [ ".$userid" = . ]; then
  58.780 +                                    userid='?'
  58.781 +                                fi
  58.782 +                            fi
  58.783 +                        fi
  58.784 +                    fi
  58.785 +                fi
  58.786 +            fi
  58.787 +        fi
  58.788 +    fi
  58.789 +
  58.790 +    #   determine (primary) group id
  58.791 +    groupid=''
  58.792 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then
  58.793 +        groupid="`(id -g ${username}) 2>/dev/null`"
  58.794 +        if [ ".$groupid" = . ]; then
  58.795 +            str="`(id) 2>/dev/null`"
  58.796 +            if [ ".`echo $str | grep 'gid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
  58.797 +                groupid=`echo $str | sed -e 's/^.*gid[ 	]*=[ 	]*//' -e 's/(.*$//'`
  58.798 +            fi
  58.799 +            if [ ".$groupid" = . ]; then
  58.800 +                groupid=`(getent passwd ${username}) 2>/dev/null | \
  58.801 +                         sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
  58.802 +                if [ ".$groupid" = . ]; then
  58.803 +                    groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
  58.804 +                             sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
  58.805 +                    if [ ".$groupid" = . ]; then
  58.806 +                        groupid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
  58.807 +                                 sed -e 'q' | sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
  58.808 +                        if [ ".$groupid" = . ]; then
  58.809 +                            groupid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
  58.810 +                                     sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
  58.811 +                            if [ ".$groupid" = . ]; then
  58.812 +                                groupid='?'
  58.813 +                            fi
  58.814 +                        fi
  58.815 +                    fi
  58.816 +                fi
  58.817 +            fi
  58.818 +        fi
  58.819 +    fi
  58.820 +
  58.821 +    #   determine (primary) group name
  58.822 +    groupname=''
  58.823 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then
  58.824 +        groupname="`(id -gn ${username}) 2>/dev/null`"
  58.825 +        if [ ".$groupname" = . ]; then
  58.826 +            str="`(id) 2>/dev/null`"
  58.827 +            if [ ".`echo $str | grep 'gid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
  58.828 +                groupname=`echo $str | sed -e 's/^.*gid[ 	]*=[ 	]*[0-9]*(//' -e 's/).*$//'`
  58.829 +            fi
  58.830 +            if [ ".$groupname" = . ]; then
  58.831 +                groupname=`(getent group) 2>/dev/null | \
  58.832 +                           grep "^[^:]*:[^:]*:${groupid}:" | \
  58.833 +                           sed -e 's/:.*$//'`
  58.834 +                if [ ".$groupname" = . ]; then
  58.835 +                    groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
  58.836 +                               sed -e 's/:.*$//'`
  58.837 +                    if [ ".$groupname" = . ]; then
  58.838 +                        groupname=`(ypcat group; niscat group) 2>/dev/null | \
  58.839 +                                   sed -e 'q' | grep "^[^:]*:[^:]*:${groupid}:" | \
  58.840 +                                   sed -e 's/:.*$//'`
  58.841 +                        if [ ".$groupname" = . ]; then
  58.842 +                            groupname=`(nidump group .) 2>/dev/null | \
  58.843 +                                       grep "^[^:]*:[^:]*:${groupid}:" | \
  58.844 +                                       sed -e 's/:.*$//'`
  58.845 +                            if [ ".$groupname" = . ]; then
  58.846 +                                groupname='?'
  58.847 +                            fi
  58.848 +                        fi
  58.849 +                    fi
  58.850 +                fi
  58.851 +            fi
  58.852 +        fi
  58.853 +    fi
  58.854 +
  58.855 +    #   determine host and domain name
  58.856 +    hostname=''
  58.857 +    domainname=''
  58.858 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then
  58.859 +        hostname="`(uname -n) 2>/dev/null |\
  58.860 +                   awk '{ printf("%s", $1); }'`"
  58.861 +        if [ ".$hostname" = . ]; then
  58.862 +            hostname="`(hostname) 2>/dev/null |\
  58.863 +                       awk '{ printf("%s", $1); }'`"
  58.864 +            if [ ".$hostname" = . ]; then
  58.865 +                hostname='unknown'
  58.866 +            fi
  58.867 +        fi
  58.868 +        case $hostname in
  58.869 +            *.* )
  58.870 +                domainname=".`echo $hostname | cut -d. -f2-`"
  58.871 +                hostname="`echo $hostname | cut -d. -f1`"
  58.872 +                ;;
  58.873 +        esac
  58.874 +    fi
  58.875 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then
  58.876 +        if [ ".$domainname" = . ]; then
  58.877 +            if [ -f /etc/resolv.conf ]; then
  58.878 +                domainname="`grep '^[ 	]*domain' /etc/resolv.conf | sed -e 'q' |\
  58.879 +                             sed -e 's/.*domain//' \
  58.880 +                                 -e 's/^[ 	]*//' -e 's/^ *//' -e 's/^	*//' \
  58.881 +                                 -e 's/^\.//' -e 's/^/./' |\
  58.882 +                             awk '{ printf("%s", $1); }'`"
  58.883 +                if [ ".$domainname" = . ]; then
  58.884 +                    domainname="`grep '^[ 	]*search' /etc/resolv.conf | sed -e 'q' |\
  58.885 +                                 sed -e 's/.*search//' \
  58.886 +                                     -e 's/^[ 	]*//' -e 's/^ *//' -e 's/^	*//' \
  58.887 +                                     -e 's/ .*//' -e 's/	.*//' \
  58.888 +                                     -e 's/^\.//' -e 's/^/./' |\
  58.889 +                                 awk '{ printf("%s", $1); }'`"
  58.890 +                fi
  58.891 +            fi
  58.892 +        fi
  58.893 +    fi
  58.894 +
  58.895 +    #   determine current time
  58.896 +    time_day=''
  58.897 +    time_month=''
  58.898 +    time_year=''
  58.899 +    time_monthname=''
  58.900 +    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then
  58.901 +        time_day=`date '+%d'`
  58.902 +        time_month=`date '+%m'`
  58.903 +        time_year=`date '+%Y' 2>/dev/null`
  58.904 +        if [ ".$time_year" = . ]; then
  58.905 +            time_year=`date '+%y'`
  58.906 +            case $time_year in
  58.907 +                [5-9][0-9]) time_year="19$time_year" ;;
  58.908 +                [0-4][0-9]) time_year="20$time_year" ;;
  58.909 +            esac
  58.910 +        fi
  58.911 +        case $time_month in
  58.912 +            1|01) time_monthname='Jan' ;;
  58.913 +            2|02) time_monthname='Feb' ;;
  58.914 +            3|03) time_monthname='Mar' ;;
  58.915 +            4|04) time_monthname='Apr' ;;
  58.916 +            5|05) time_monthname='May' ;;
  58.917 +            6|06) time_monthname='Jun' ;;
  58.918 +            7|07) time_monthname='Jul' ;;
  58.919 +            8|08) time_monthname='Aug' ;;
  58.920 +            9|09) time_monthname='Sep' ;;
  58.921 +              10) time_monthname='Oct' ;;
  58.922 +              11) time_monthname='Nov' ;;
  58.923 +              12) time_monthname='Dec' ;;
  58.924 +        esac
  58.925 +    fi
  58.926 +
  58.927 +    #   expand special ``%x'' constructs
  58.928 +    if [ ".$opt_e" = .yes ]; then
  58.929 +        text=`echo $seo "$text" |\
  58.930 +              sed -e "s/%B/${term_bold}/g" \
  58.931 +                  -e "s/%b/${term_norm}/g" \
  58.932 +                  -e "s/%u/${username}/g" \
  58.933 +                  -e "s/%U/${userid}/g" \
  58.934 +                  -e "s/%g/${groupname}/g" \
  58.935 +                  -e "s/%G/${groupid}/g" \
  58.936 +                  -e "s/%h/${hostname}/g" \
  58.937 +                  -e "s/%d/${domainname}/g" \
  58.938 +                  -e "s/%D/${time_day}/g" \
  58.939 +                  -e "s/%M/${time_month}/g" \
  58.940 +                  -e "s/%Y/${time_year}/g" \
  58.941 +                  -e "s/%m/${time_monthname}/g" 2>/dev/null`
  58.942 +    fi
  58.943 +
  58.944 +    #   create output
  58.945 +    if [ .$opt_n = .no ]; then
  58.946 +        echo $seo "$text"
  58.947 +    else
  58.948 +        #   the harder part: echo -n is best, because
  58.949 +        #   awk may complain about some \xx sequences.
  58.950 +        if [ ".$minusn" != . ]; then
  58.951 +            echo $seo $minusn "$text"
  58.952 +        else
  58.953 +            echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
  58.954 +        fi
  58.955 +    fi
  58.956 +
  58.957 +    shtool_exit 0
  58.958 +    ;;
  58.959 +
  58.960 +mdate )
  58.961 +    ##
  58.962 +    ##  mdate -- Pretty-print modification time of a file or dir
  58.963 +    ##  Copyright (c) 1995-1997 Free Software Foundation, Inc.
  58.964 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
  58.965 +    ##
  58.966 +
  58.967 +    fod="$1"
  58.968 +    case "$opt_o" in
  58.969 +        [dmy][dmy][dmy] )
  58.970 +            ;;
  58.971 +        * ) echo "$msgprefix:Error: invalid argument to option \`-o': $opt_o" 1>&2
  58.972 +            shtool_exit 1
  58.973 +            ;;
  58.974 +    esac
  58.975 +    if [ ! -r "$fod" ]; then
  58.976 +        echo "$msgprefix:Error: file or directory not found: $fod" 1>&2
  58.977 +        shtool_exit 1
  58.978 +    fi
  58.979 +
  58.980 +    #   GNU ls changes its time format in response to the TIME_STYLE
  58.981 +    #   variable. Since we cannot assume "unset" works, revert this
  58.982 +    #   variable to its documented default.
  58.983 +    if [ ".$TIME_STYLE" != . ]; then
  58.984 +        TIME_STYLE=posix-long-iso
  58.985 +        export TIME_STYLE
  58.986 +    fi
  58.987 +
  58.988 +    #   get the extended ls output of the file or directory.
  58.989 +    if /bin/ls -L /dev/null >/dev/null 2>&1; then
  58.990 +        set - x`/bin/ls -L -l -d $fod`
  58.991 +    else
  58.992 +        set - x`/bin/ls -l -d $fod`
  58.993 +    fi
  58.994 +
  58.995 +    #   The month is at least the fourth argument
  58.996 +    #   (3 shifts here, the next inside the loop).
  58.997 +    shift; shift; shift
  58.998 +
  58.999 +    #   Find the month. Next argument is day, followed by the year or time.
 58.1000 +    month=""
 58.1001 +    while [ ".$month" = . ]; do
 58.1002 +        shift
 58.1003 +        case $1 in
 58.1004 +            Jan) month=January;   nummonth=1  ;;
 58.1005 +            Feb) month=February;  nummonth=2  ;;
 58.1006 +            Mar) month=March;     nummonth=3  ;;
 58.1007 +            Apr) month=April;     nummonth=4  ;;
 58.1008 +            May) month=May;       nummonth=5  ;;
 58.1009 +            Jun) month=June;      nummonth=6  ;;
 58.1010 +            Jul) month=July;      nummonth=7  ;;
 58.1011 +            Aug) month=August;    nummonth=8  ;;
 58.1012 +            Sep) month=September; nummonth=9  ;;
 58.1013 +            Oct) month=October;   nummonth=10 ;;
 58.1014 +            Nov) month=November;  nummonth=11 ;;
 58.1015 +            Dec) month=December;  nummonth=12 ;;
 58.1016 +        esac
 58.1017 +    done
 58.1018 +    day="$2"
 58.1019 +    year="$3"
 58.1020 +
 58.1021 +    #   We finally have to deal with the problem that the "ls" output
 58.1022 +    #   gives either the time of the day or the year.
 58.1023 +    case $year in
 58.1024 +        *:*)
 58.1025 +            this_year=`date '+%Y' 2>/dev/null`
 58.1026 +            if [ ".$this_year" = . ]; then
 58.1027 +                this_year=`date '+%y'`
 58.1028 +                case $this_year in
 58.1029 +                    [5-9][0-9]) this_year="19$this_year" ;;
 58.1030 +                    [0-4][0-9]) this_year="20$this_year" ;;
 58.1031 +                esac
 58.1032 +            fi
 58.1033 +            #   for the following months of the last year the time notation
 58.1034 +            #   is usually also used for files modified in the last year.
 58.1035 +            this_month=`date '+%m'`
 58.1036 +            if (expr $nummonth \> $this_month) >/dev/null; then
 58.1037 +                this_year=`expr $this_year - 1`
 58.1038 +            fi
 58.1039 +            year="$this_year"
 58.1040 +            ;;
 58.1041 +    esac
 58.1042 +
 58.1043 +    #   Optionally fill day and month with leeding zeros
 58.1044 +    if [ ".$opt_z" = .yes ]; then
 58.1045 +        case $day in
 58.1046 +            [0-9][0-9] ) ;;
 58.1047 +                 [0-9] ) day="0$day" ;;
 58.1048 +        esac
 58.1049 +        case $nummonth in
 58.1050 +            [0-9][0-9] ) ;;
 58.1051 +                 [0-9] ) nummonth="0$nummonth" ;;
 58.1052 +        esac
 58.1053 +    fi
 58.1054 +
 58.1055 +    #   Optionally use digits for month
 58.1056 +    if [ ".$opt_d" = .yes ]; then
 58.1057 +        month="$nummonth"
 58.1058 +    fi
 58.1059 +
 58.1060 +    #   Optionally shorten the month name to three characters
 58.1061 +    if [ ".$opt_s" = .yes ]; then
 58.1062 +        month=`echo $month | cut -c1-3`
 58.1063 +    fi
 58.1064 +
 58.1065 +    #   Output the resulting date string
 58.1066 +    echo dummy | awk '{
 58.1067 +        for (i = 0; i < 3; i++) {
 58.1068 +            now = substr(order, 1, 1);
 58.1069 +            order = substr(order, 2);
 58.1070 +            if (now == "d")
 58.1071 +                out = day;
 58.1072 +            else if (now == "m")
 58.1073 +                out = month;
 58.1074 +            else if (now == "y")
 58.1075 +                out = year;
 58.1076 +            if (i < 2)
 58.1077 +                printf("%s%s", out, field);
 58.1078 +            else
 58.1079 +                printf("%s", out);
 58.1080 +        }
 58.1081 +        if (newline != "yes")
 58.1082 +            printf("\n");
 58.1083 +    }' "day=$day" "month=$month" "year=$year" \
 58.1084 +       "field=$opt_f" "order=$opt_o" "newline=$opt_n"
 58.1085 +
 58.1086 +    shtool_exit 0
 58.1087 +    ;;
 58.1088 +
 58.1089 +table )
 58.1090 +    ##
 58.1091 +    ##  table -- Pretty-print a field-separated list as a table
 58.1092 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1093 +    ##
 58.1094 +
 58.1095 +    if [ $opt_c -gt 4 ]; then
 58.1096 +        echo "$msgprefix:Error: Invalid number of colums (1..4 allowed only)" 1>&2
 58.1097 +        shtool_exit 1
 58.1098 +    fi
 58.1099 +    case "x$opt_F" in
 58.1100 +        x? ) ;;
 58.1101 +        *  ) echo "$msgprefix:Error: Invalid separator (one char allowed only)" 1>&2; shtool_exit 1 ;;
 58.1102 +    esac
 58.1103 +
 58.1104 +    #   split the list into a table
 58.1105 +    list=`
 58.1106 +        IFS="$opt_F"
 58.1107 +        for entry in $*; do
 58.1108 +            if [ ".$entry" != . ]; then
 58.1109 +                echo "$entry"
 58.1110 +            fi
 58.1111 +        done |\
 58.1112 +        awk "
 58.1113 +            BEGIN { list = \"\"; n = 0; }
 58.1114 +            {
 58.1115 +                list = list \\$1;
 58.1116 +                n = n + 1;
 58.1117 +                if (n < $opt_c) {
 58.1118 +                    list = list \":\";
 58.1119 +                }
 58.1120 +                if (n == $opt_c) {
 58.1121 +                    list = list \"\\n\";
 58.1122 +                    n = 0;
 58.1123 +                }
 58.1124 +            }
 58.1125 +            END { print list; }
 58.1126 +         "
 58.1127 +    `
 58.1128 +
 58.1129 +    #   format table cells and make sure table
 58.1130 +    #   doesn't exceed maximum width
 58.1131 +    OIFS="$IFS"
 58.1132 +    IFS='
 58.1133 +'
 58.1134 +    for entry in $list; do
 58.1135 +        case $opt_c in
 58.1136 +            1 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s\\n\", \$1); }'" ;;
 58.1137 +            2 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s\\n\", \$1, \$2); }'" ;;
 58.1138 +            3 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3); }'" ;;
 58.1139 +            4 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3, \$4); }'" ;;
 58.1140 +        esac
 58.1141 +    done |\
 58.1142 +    awk "{
 58.1143 +        if (length(\$0) > $opt_s) {
 58.1144 +            printf(\"%s\\n\", substr(\$0, 0, $opt_s-1));
 58.1145 +        } else {
 58.1146 +            print \$0;
 58.1147 +        }
 58.1148 +    }"
 58.1149 +    IFS="$OIFS"
 58.1150 +
 58.1151 +    shtool_exit 0
 58.1152 +    ;;
 58.1153 +
 58.1154 +prop )
 58.1155 +    ##
 58.1156 +    ##  prop -- Display progress with a running propeller
 58.1157 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1158 +    ##
 58.1159 +
 58.1160 +    perl=''
 58.1161 +    for dir in `echo $PATH | sed -e 's/:/ /g'` .; do
 58.1162 +        if [ -f "$dir/perl" ]; then
 58.1163 +            perl="$dir/perl"
 58.1164 +            break
 58.1165 +        fi
 58.1166 +    done
 58.1167 +    if [ ".$perl" != . ]; then
 58.1168 +        #   Perl is preferred because writing to STDERR in
 58.1169 +        #   Perl really writes immediately as one would expect
 58.1170 +        $perl -e '
 58.1171 +            @p = ("|","/","-","\\");
 58.1172 +            $i = 0;
 58.1173 +            while (<STDIN>) {
 58.1174 +                printf(STDERR "\r%s...%s\b", $ARGV[0], $p[$i++]);
 58.1175 +                $i = 0 if ($i > 3);
 58.1176 +            }
 58.1177 +            printf(STDERR "\r%s    \n", $ARGV[0]);
 58.1178 +        ' "$opt_p"
 58.1179 +    else
 58.1180 +        #   But if Perl doesn't exists we use Awk even
 58.1181 +        #   some Awk's buffer even the /dev/stderr writing :-(
 58.1182 +        awk '
 58.1183 +            BEGIN {
 58.1184 +                split("|#/#-#\\", p, "#");
 58.1185 +                i = 1;
 58.1186 +            }
 58.1187 +            {
 58.1188 +                printf("\r%s%c\b", prefix, p[i++]) > "/dev/stderr";
 58.1189 +                if (i > 4) { i = 1; }
 58.1190 +            }
 58.1191 +            END {
 58.1192 +                printf("\r%s    \n", prefix) > "/dev/stderr";
 58.1193 +            }
 58.1194 +        ' "prefix=$opt_p"
 58.1195 +    fi
 58.1196 +
 58.1197 +    shtool_exit 0
 58.1198 +    ;;
 58.1199 +
 58.1200 +move )
 58.1201 +    ##
 58.1202 +    ##  move -- Move files with simultaneous substitution
 58.1203 +    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1204 +    ##
 58.1205 +
 58.1206 +    src="$1"
 58.1207 +    dst="$2"
 58.1208 +
 58.1209 +    #   consistency checks
 58.1210 +    if [ ".$src" = . ] || [ ".$dst" = . ]; then
 58.1211 +        echo "$msgprefix:Error: Invalid arguments" 1>&2
 58.1212 +        shtool_exit 1
 58.1213 +    fi
 58.1214 +    if [ ".$src" = ".$dst" ]; then
 58.1215 +        echo "$msgprefix:Error: Source and destination files are the same" 1>&2
 58.1216 +        shtool_exit 1
 58.1217 +    fi
 58.1218 +    expsrc="$src"
 58.1219 +    if [ ".$opt_e" = .yes ]; then
 58.1220 +        expsrc="`echo $expsrc`"
 58.1221 +    fi
 58.1222 +    if [ ".$opt_e" = .yes ]; then
 58.1223 +        if [ ".`echo "$src" | sed -e 's;^.*\\*.*$;;'`" = ".$src" ]; then
 58.1224 +            echo "$msgprefix:Error: Source doesn't contain wildcard ('*'): $dst" 1>&2
 58.1225 +            shtool_exit 1
 58.1226 +        fi
 58.1227 +        if [ ".`echo "$dst" | sed -e 's;^.*%[1-9].*$;;'`" = ".$dst" ]; then
 58.1228 +            echo "$msgprefix:Error: Destination doesn't contain substitution ('%N'): $dst" 1>&2
 58.1229 +            shtool_exit 1
 58.1230 +        fi
 58.1231 +        if [ ".$expsrc" = ".$src" ]; then
 58.1232 +            echo "$msgprefix:Error: Sources not found or no asterisk : $src" 1>&2
 58.1233 +            shtool_exit 1
 58.1234 +        fi
 58.1235 +    else
 58.1236 +        if [ ! -r "$src" ]; then
 58.1237 +            echo "$msgprefix:Error: Source not found: $src" 1>&2
 58.1238 +            shtool_exit 1
 58.1239 +        fi
 58.1240 +    fi
 58.1241 +
 58.1242 +    #   determine substitution patterns
 58.1243 +    if [ ".$opt_e" = .yes ]; then
 58.1244 +        srcpat=`echo "$src" | sed -e 's/\\./\\\\./g' -e 's/;/\\;/g' -e 's;\\*;\\\\(.*\\\\);g'`
 58.1245 +        dstpat=`echo "$dst" | sed -e 's;%\([1-9]\);\\\\\1;g'`
 58.1246 +    fi
 58.1247 +
 58.1248 +    #   iterate over source(s)
 58.1249 +    for onesrc in $expsrc; do
 58.1250 +        if [ .$opt_e = .yes ]; then
 58.1251 +            onedst=`echo $onesrc | sed -e "s;$srcpat;$dstpat;"`
 58.1252 +        else
 58.1253 +            onedst="$dst"
 58.1254 +        fi
 58.1255 +        errorstatus=0
 58.1256 +        if [ ".$opt_v" = .yes ]; then
 58.1257 +            echo "$onesrc -> $onedst"
 58.1258 +        fi
 58.1259 +        if [ ".$opt_p" = .yes ]; then
 58.1260 +            if [ -r $onedst ]; then
 58.1261 +                if cmp -s $onesrc $onedst; then
 58.1262 +                    if [ ".$opt_t" = .yes ]; then
 58.1263 +                        echo "rm -f $onesrc" 1>&2
 58.1264 +                    fi
 58.1265 +                    rm -f $onesrc || errorstatus=$?
 58.1266 +                else
 58.1267 +                    if [ ".$opt_t" = .yes ]; then
 58.1268 +                        echo "mv -f $onesrc $onedst" 1>&2
 58.1269 +                    fi
 58.1270 +                    mv -f $onesrc $onedst || errorstatus=$?
 58.1271 +                fi
 58.1272 +            else
 58.1273 +                if [ ".$opt_t" = .yes ]; then
 58.1274 +                    echo "mv -f $onesrc $onedst" 1>&2
 58.1275 +                fi
 58.1276 +                mv -f $onesrc $onedst || errorstatus=$?
 58.1277 +            fi
 58.1278 +        else
 58.1279 +            if [ ".$opt_t" = .yes ]; then
 58.1280 +                echo "mv -f $onesrc $onedst" 1>&2
 58.1281 +            fi
 58.1282 +            mv -f $onesrc $onedst || errorstatus=$?
 58.1283 +        fi
 58.1284 +        if [ $errorstatus -ne 0 ]; then
 58.1285 +            break;
 58.1286 +        fi
 58.1287 +    done
 58.1288 +
 58.1289 +    shtool_exit $errorstatus
 58.1290 +    ;;
 58.1291 +
 58.1292 +install )
 58.1293 +    ##
 58.1294 +    ##  install -- Install a program, script or datafile
 58.1295 +    ##  Copyright (c) 1997-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1296 +    ##
 58.1297 +
 58.1298 +    #   special case: "shtool install -d <dir> [...]" internally
 58.1299 +    #   maps to "shtool mkdir -f -p -m 755 <dir> [...]"
 58.1300 +    if [ "$opt_d" = yes ]; then
 58.1301 +        cmd="$0 mkdir -f -p -m 755"
 58.1302 +        if [ ".$opt_o" != . ]; then
 58.1303 +            cmd="$cmd -o '$opt_o'"
 58.1304 +        fi
 58.1305 +        if [ ".$opt_g" != . ]; then
 58.1306 +            cmd="$cmd -g '$opt_g'"
 58.1307 +        fi
 58.1308 +        if [ ".$opt_v" = .yes ]; then
 58.1309 +            cmd="$cmd -v"
 58.1310 +        fi
 58.1311 +        if [ ".$opt_t" = .yes ]; then
 58.1312 +            cmd="$cmd -t"
 58.1313 +        fi
 58.1314 +        for dir in "$@"; do
 58.1315 +            eval "$cmd $dir" || shtool_exit $?
 58.1316 +        done
 58.1317 +        shtool_exit 0
 58.1318 +    fi
 58.1319 +
 58.1320 +    #   determine source(s) and destination
 58.1321 +    argc=$#
 58.1322 +    srcs=""
 58.1323 +    while [ $# -gt 1 ]; do
 58.1324 +        srcs="$srcs $1"
 58.1325 +        shift
 58.1326 +    done
 58.1327 +    dstpath="$1"
 58.1328 +
 58.1329 +    #   type check for destination
 58.1330 +    dstisdir=0
 58.1331 +    if [ -d $dstpath ]; then
 58.1332 +        dstpath=`echo "$dstpath" | sed -e 's:/$::'`
 58.1333 +        dstisdir=1
 58.1334 +    fi
 58.1335 +
 58.1336 +    #   consistency check for destination
 58.1337 +    if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then
 58.1338 +        echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
 58.1339 +        shtool_exit 1
 58.1340 +    fi
 58.1341 +
 58.1342 +    #   iterate over all source(s)
 58.1343 +    for src in $srcs; do
 58.1344 +        dst=$dstpath
 58.1345 +
 58.1346 +        #   if destination is a directory, append the input filename
 58.1347 +        if [ $dstisdir = 1 ]; then
 58.1348 +            dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
 58.1349 +            dst="$dst/$dstfile"
 58.1350 +        fi
 58.1351 +
 58.1352 +        #   check for correct arguments
 58.1353 +        if [ ".$src" = ".$dst" ]; then
 58.1354 +            echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
 58.1355 +            continue
 58.1356 +        fi
 58.1357 +        if [ -d "$src" ]; then
 58.1358 +            echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
 58.1359 +            continue
 58.1360 +        fi
 58.1361 +
 58.1362 +        #   make a temp file name in the destination directory
 58.1363 +        dsttmp=`echo $dst |\
 58.1364 +                sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
 58.1365 +                    -e "s;\$;/#INST@$$#;"`
 58.1366 +
 58.1367 +        #   verbosity
 58.1368 +        if [ ".$opt_v" = .yes ]; then
 58.1369 +            echo "$src -> $dst" 1>&2
 58.1370 +        fi
 58.1371 +
 58.1372 +        #   copy or move the file name to the temp name
 58.1373 +        #   (because we might be not allowed to change the source)
 58.1374 +        if [ ".$opt_C" = .yes ]; then
 58.1375 +            opt_c=yes
 58.1376 +        fi
 58.1377 +        if [ ".$opt_c" = .yes ]; then
 58.1378 +            if [ ".$opt_t" = .yes ]; then
 58.1379 +                echo "cp $src $dsttmp" 1>&2
 58.1380 +            fi
 58.1381 +            cp "$src" "$dsttmp" || shtool_exit $?
 58.1382 +        else
 58.1383 +            if [ ".$opt_t" = .yes ]; then
 58.1384 +                echo "mv $src $dsttmp" 1>&2
 58.1385 +            fi
 58.1386 +            mv "$src" "$dsttmp" || shtool_exit $?
 58.1387 +        fi
 58.1388 +
 58.1389 +        #   adjust the target file
 58.1390 +        if [ ".$opt_e" != . ]; then
 58.1391 +            sed='sed'
 58.1392 +            OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS"
 58.1393 +            for e
 58.1394 +            do
 58.1395 +                sed="$sed -e '$e'"
 58.1396 +            done
 58.1397 +            cp "$dsttmp" "$dsttmp.old"
 58.1398 +            chmod u+w $dsttmp
 58.1399 +            eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $?
 58.1400 +            rm -f $dsttmp.old
 58.1401 +        fi
 58.1402 +        if [ ".$opt_s" = .yes ]; then
 58.1403 +            if [ ".$opt_t" = .yes ]; then
 58.1404 +                echo "strip $dsttmp" 1>&2
 58.1405 +            fi
 58.1406 +            strip $dsttmp || shtool_exit $?
 58.1407 +        fi
 58.1408 +        if [ ".$opt_o" != . ]; then
 58.1409 +            if [ ".$opt_t" = .yes ]; then
 58.1410 +                echo "chown $opt_o $dsttmp" 1>&2
 58.1411 +            fi
 58.1412 +            chown $opt_o $dsttmp || shtool_exit $?
 58.1413 +        fi
 58.1414 +        if [ ".$opt_g" != . ]; then
 58.1415 +            if [ ".$opt_t" = .yes ]; then
 58.1416 +                echo "chgrp $opt_g $dsttmp" 1>&2
 58.1417 +            fi
 58.1418 +            chgrp $opt_g $dsttmp || shtool_exit $?
 58.1419 +        fi
 58.1420 +        if [ ".$opt_m" != ".-" ]; then
 58.1421 +            if [ ".$opt_t" = .yes ]; then
 58.1422 +                echo "chmod $opt_m $dsttmp" 1>&2
 58.1423 +            fi
 58.1424 +            chmod $opt_m $dsttmp || shtool_exit $?
 58.1425 +        fi
 58.1426 +
 58.1427 +        #   determine whether to do a quick install
 58.1428 +        #   (has to be done _after_ the strip was already done)
 58.1429 +        quick=no
 58.1430 +        if [ ".$opt_C" = .yes ]; then
 58.1431 +            if [ -r $dst ]; then
 58.1432 +                if cmp -s "$src" "$dst"; then
 58.1433 +                    quick=yes
 58.1434 +                fi
 58.1435 +            fi
 58.1436 +        fi
 58.1437 +
 58.1438 +        #   finally, install the file to the real destination
 58.1439 +        if [ $quick = yes ]; then
 58.1440 +            if [ ".$opt_t" = .yes ]; then
 58.1441 +                echo "rm -f $dsttmp" 1>&2
 58.1442 +            fi
 58.1443 +            rm -f $dsttmp
 58.1444 +        else
 58.1445 +            if [ ".$opt_t" = .yes ]; then
 58.1446 +                echo "rm -f $dst && mv $dsttmp $dst" 1>&2
 58.1447 +            fi
 58.1448 +            rm -f $dst && mv $dsttmp $dst
 58.1449 +        fi
 58.1450 +    done
 58.1451 +
 58.1452 +    shtool_exit 0
 58.1453 +    ;;
 58.1454 +
 58.1455 +mkdir )
 58.1456 +    ##
 58.1457 +    ##  mkdir -- Make one or more directories
 58.1458 +    ##  Copyright (c) 1996-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1459 +    ##
 58.1460 +
 58.1461 +    errstatus=0
 58.1462 +    for p in ${1+"$@"}; do
 58.1463 +        #   if the directory already exists...
 58.1464 +        if [ -d "$p" ]; then
 58.1465 +            if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
 58.1466 +                echo "$msgprefix:Error: directory already exists: $p" 1>&2
 58.1467 +                errstatus=1
 58.1468 +                break
 58.1469 +            else
 58.1470 +                continue
 58.1471 +            fi
 58.1472 +        fi
 58.1473 +        #   if the directory has to be created...
 58.1474 +        if [ ".$opt_p" = .no ]; then
 58.1475 +            if [ ".$opt_t" = .yes ]; then
 58.1476 +                echo "mkdir $p" 1>&2
 58.1477 +            fi
 58.1478 +            mkdir $p || errstatus=$?
 58.1479 +            if [ ".$opt_o" != . ]; then
 58.1480 +                if [ ".$opt_t" = .yes ]; then
 58.1481 +                    echo "chown $opt_o $p" 1>&2
 58.1482 +                fi
 58.1483 +                chown $opt_o $p || errstatus=$?
 58.1484 +            fi
 58.1485 +            if [ ".$opt_g" != . ]; then
 58.1486 +                if [ ".$opt_t" = .yes ]; then
 58.1487 +                    echo "chgrp $opt_g $p" 1>&2
 58.1488 +                fi
 58.1489 +                chgrp $opt_g $p || errstatus=$?
 58.1490 +            fi
 58.1491 +            if [ ".$opt_m" != . ]; then
 58.1492 +                if [ ".$opt_t" = .yes ]; then
 58.1493 +                    echo "chmod $opt_m $p" 1>&2
 58.1494 +                fi
 58.1495 +                chmod $opt_m $p || errstatus=$?
 58.1496 +            fi
 58.1497 +        else
 58.1498 +            #   the smart situation
 58.1499 +            set fnord `echo ":$p" |\
 58.1500 +                       sed -e 's/^:\//%/' \
 58.1501 +                           -e 's/^://' \
 58.1502 +                           -e 's/\// /g' \
 58.1503 +                           -e 's/^%/\//'`
 58.1504 +            shift
 58.1505 +            pathcomp=''
 58.1506 +            for d in ${1+"$@"}; do
 58.1507 +                pathcomp="$pathcomp$d"
 58.1508 +                case "$pathcomp" in
 58.1509 +                    -* ) pathcomp="./$pathcomp" ;;
 58.1510 +                esac
 58.1511 +                if [ ! -d "$pathcomp" ]; then
 58.1512 +                    if [ ".$opt_t" = .yes ]; then
 58.1513 +                        echo "mkdir $pathcomp" 1>&2
 58.1514 +                    fi
 58.1515 +                    mkdir $pathcomp || errstatus=$?
 58.1516 +                    if [ ".$opt_o" != . ]; then
 58.1517 +                        if [ ".$opt_t" = .yes ]; then
 58.1518 +                            echo "chown $opt_o $pathcomp" 1>&2
 58.1519 +                        fi
 58.1520 +                        chown $opt_o $pathcomp || errstatus=$?
 58.1521 +                    fi
 58.1522 +                    if [ ".$opt_g" != . ]; then
 58.1523 +                        if [ ".$opt_t" = .yes ]; then
 58.1524 +                            echo "chgrp $opt_g $pathcomp" 1>&2
 58.1525 +                        fi
 58.1526 +                        chgrp $opt_g $pathcomp || errstatus=$?
 58.1527 +                    fi
 58.1528 +                    if [ ".$opt_m" != . ]; then
 58.1529 +                        if [ ".$opt_t" = .yes ]; then
 58.1530 +                            echo "chmod $opt_m $pathcomp" 1>&2
 58.1531 +                        fi
 58.1532 +                        chmod $opt_m $pathcomp || errstatus=$?
 58.1533 +                    fi
 58.1534 +                fi
 58.1535 +                pathcomp="$pathcomp/"
 58.1536 +            done
 58.1537 +        fi
 58.1538 +    done
 58.1539 +
 58.1540 +    shtool_exit $errstatus
 58.1541 +    ;;
 58.1542 +
 58.1543 +mkln )
 58.1544 +    ##
 58.1545 +    ##  mkln -- Make link with calculation of relative paths
 58.1546 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1547 +    ##
 58.1548 +
 58.1549 +    #   determine source(s) and destination
 58.1550 +    args=$?
 58.1551 +    srcs=""
 58.1552 +    while [ $# -gt 1 ]; do
 58.1553 +        srcs="$srcs $1"
 58.1554 +        shift
 58.1555 +    done
 58.1556 +    dst="$1"
 58.1557 +    if [ ! -d $dst ]; then
 58.1558 +        if [ $args -gt 2 ]; then
 58.1559 +            echo "$msgprefix:Error: multiple sources not allowed when target isn't a directory" 1>&2
 58.1560 +            shtool_exit 1
 58.1561 +        fi
 58.1562 +    fi
 58.1563 +
 58.1564 +    #   determine link options
 58.1565 +    lnopt=""
 58.1566 +    if [ ".$opt_f" = .yes ]; then
 58.1567 +        lnopt="$lnopt -f"
 58.1568 +    fi
 58.1569 +    if [ ".$opt_s" = .yes ]; then
 58.1570 +        lnopt="$lnopt -s"
 58.1571 +    fi
 58.1572 +
 58.1573 +    #   iterate over sources
 58.1574 +    for src in $srcs; do
 58.1575 +        #   determine if one of the paths is an absolute path,
 58.1576 +        #   because then we _have_ to use an absolute symlink
 58.1577 +        oneisabs=0
 58.1578 +        srcisabs=0
 58.1579 +        dstisabs=0
 58.1580 +        case $src in
 58.1581 +            /* ) oneisabs=1; srcisabs=1 ;;
 58.1582 +        esac
 58.1583 +        case $dst in
 58.1584 +            /* ) oneisabs=1; dstisabs=1 ;;
 58.1585 +        esac
 58.1586 +
 58.1587 +        #   split source and destination into dir and base name
 58.1588 +        if [ -d $src ]; then
 58.1589 +            srcdir=`echo $src | sed -e 's;/*$;;'`
 58.1590 +            srcbase=""
 58.1591 +        else
 58.1592 +            srcdir=`echo  $src | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'`
 58.1593 +            srcbase=`echo $src | sed -e 's;.*/\([^/]*\)$;\1;'`
 58.1594 +        fi
 58.1595 +        if [ -d $dst ]; then
 58.1596 +            dstdir=`echo $dst | sed -e 's;/*$;;'`
 58.1597 +            dstbase=""
 58.1598 +        else
 58.1599 +            dstdir=`echo  $dst | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'`
 58.1600 +            dstbase=`echo $dst | sed -e 's;.*/\([^/]*\)$;\1;'`
 58.1601 +        fi
 58.1602 +
 58.1603 +        #   consistency check
 58.1604 +        if [ ".$dstdir" != . ]; then
 58.1605 +            if [ ! -d $dstdir ]; then
 58.1606 +                echo "$msgprefix:Error: destination directory not found: $dstdir" 1>&2
 58.1607 +                shtool_exit 1
 58.1608 +            fi
 58.1609 +        fi
 58.1610 +
 58.1611 +        #   make sure the source is reachable from the destination
 58.1612 +        if [ $dstisabs = 1 ]; then
 58.1613 +            if [ $srcisabs = 0 ]; then
 58.1614 +                if [ ".$srcdir" = . ]; then
 58.1615 +                    srcdir="`pwd | sed -e 's;/*$;;'`"
 58.1616 +                    srcisabs=1
 58.1617 +                    oneisabs=1
 58.1618 +                elif [ -d $srcdir ]; then
 58.1619 +                    srcdir="`cd $srcdir; pwd | sed -e 's;/*$;;'`"
 58.1620 +                    srcisabs=1
 58.1621 +                    oneisabs=1
 58.1622 +                fi
 58.1623 +            fi
 58.1624 +        fi
 58.1625 +
 58.1626 +        #   split away a common prefix
 58.1627 +        prefix=""
 58.1628 +        if [ ".$srcdir" = ".$dstdir" ] && [ ".$srcdir" != . ]; then
 58.1629 +            prefix="$srcdir/"
 58.1630 +            srcdir=""
 58.1631 +            dstdir=""
 58.1632 +        else
 58.1633 +            while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do
 58.1634 +                presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'`
 58.1635 +                predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'`
 58.1636 +                if [ ".$presrc" != ".$predst" ]; then
 58.1637 +                    break
 58.1638 +                fi
 58.1639 +                prefix="$prefix$presrc/"
 58.1640 +                srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'`
 58.1641 +                dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'`
 58.1642 +            done
 58.1643 +        fi
 58.1644 +
 58.1645 +        #   destination prefix is just the common prefix
 58.1646 +        dstpre="$prefix"
 58.1647 +
 58.1648 +        #   determine source prefix which is the reverse directory
 58.1649 +        #   step-up corresponding to the destination directory
 58.1650 +        srcpre=""
 58.1651 +        allow_relative_srcpre=no
 58.1652 +        if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then
 58.1653 +            allow_relative_srcpre=yes
 58.1654 +        fi  
 58.1655 +        if [ $oneisabs = 0 ]; then
 58.1656 +            allow_relative_srcpre=yes
 58.1657 +        fi  
 58.1658 +        if [ ".$opt_s" != .yes ]; then
 58.1659 +            allow_relative_srcpre=no
 58.1660 +        fi  
 58.1661 +        if [ ".$allow_relative_srcpre" = .yes ]; then
 58.1662 +            pl="$dstdir/"
 58.1663 +            OIFS="$IFS"; IFS='/'
 58.1664 +            for pe in $pl; do
 58.1665 +                [ ".$pe" = .  ] && continue
 58.1666 +                [ ".$pe" = .. ] && continue
 58.1667 +                srcpre="../$srcpre"
 58.1668 +            done
 58.1669 +            IFS="$OIFS"
 58.1670 +        else
 58.1671 +            if [ $srcisabs = 1 ]; then
 58.1672 +                srcpre="$prefix"
 58.1673 +            fi
 58.1674 +        fi
 58.1675 +
 58.1676 +        #   determine destination symlink name
 58.1677 +        if [ ".$dstbase" = . ]; then
 58.1678 +            if [ ".$srcbase" != . ]; then
 58.1679 +                dstbase="$srcbase"
 58.1680 +            else
 58.1681 +                dstbase=`echo "$prefix$srcdir" | sed -e 's;/*$;;' -e 's;.*/\([^/]*\)$;\1;'`
 58.1682 +            fi
 58.1683 +        fi
 58.1684 +
 58.1685 +        #   now finalize source and destination directory paths
 58.1686 +        srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'`
 58.1687 +        dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'`
 58.1688 +
 58.1689 +        #   run the final link command
 58.1690 +        if [ ".$opt_t" = .yes ]; then
 58.1691 +            echo "ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase"
 58.1692 +        fi
 58.1693 +        eval ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase
 58.1694 +    done
 58.1695 +
 58.1696 +    shtool_exit 0
 58.1697 +    ;;
 58.1698 +
 58.1699 +mkshadow )
 58.1700 +    ##
 58.1701 +    ##  mkshadow -- Make a shadow tree through symbolic links
 58.1702 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1703 +    ##
 58.1704 +
 58.1705 +    #   source and destination directory
 58.1706 +    src=`echo "$1" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'`
 58.1707 +    dst=`echo "$2" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'`
 58.1708 +
 58.1709 +    #   check whether source exists
 58.1710 +    if [ ! -d $src ]; then
 58.1711 +        echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2
 58.1712 +        shtool_exit 1
 58.1713 +    fi
 58.1714 +
 58.1715 +    #   determine if one of the paths is an absolute path,
 58.1716 +    #   because then we have to use an absolute symlink
 58.1717 +    oneisabs=0
 58.1718 +    case $src in
 58.1719 +        /* ) oneisabs=1 ;;
 58.1720 +    esac
 58.1721 +    case $dst in
 58.1722 +        /* ) oneisabs=1 ;;
 58.1723 +    esac
 58.1724 +
 58.1725 +    #   determine reverse directory for destination directory
 58.1726 +    dstrevdir=''
 58.1727 +    if [ $oneisabs = 0 ]; then
 58.1728 +        #   derive reverse path from forward path
 58.1729 +        pwd=`pwd`
 58.1730 +        OIFS="$IFS"; IFS='/'
 58.1731 +        for pe in $dst; do
 58.1732 +            if [ "x$pe" = "x.." ]; then
 58.1733 +                OIFS2="$IFS"; IFS="$DIFS"
 58.1734 +                eval `echo "$pwd" |\
 58.1735 +                      sed -e 's:\([^/]*\)$:; dir="\1":' \
 58.1736 +                          -e 's:^\(.*\)/[^/]*;:pwd="\1";:'\
 58.1737 +                          -e 's:^;:pwd="";:'`
 58.1738 +                dstrevdir="$dir/$dstrevdir"
 58.1739 +                IFS="$OIFS2"
 58.1740 +            else
 58.1741 +                dstrevdir="../$dstrevdir"
 58.1742 +            fi
 58.1743 +        done
 58.1744 +        IFS="$OIFS"
 58.1745 +    else
 58.1746 +        src="`cd $src; pwd`";
 58.1747 +    fi
 58.1748 +
 58.1749 +    #   create directory tree at destination
 58.1750 +    if [ ! -d $dst ]; then
 58.1751 +        if [ ".$opt_t" = .yes ]; then
 58.1752 +            echo "mkdir $dst" 1>&2
 58.1753 +        fi
 58.1754 +        mkdir $dst
 58.1755 +    fi
 58.1756 +    if [ ".$opt_a" = .yes ]; then
 58.1757 +        DIRS=`cd $src; find . -type d -print |\
 58.1758 +              sed -e '/^\.$/d' -e 's:^\./::'`
 58.1759 +    else
 58.1760 +        DIRS=`cd $src; find . -type d -print |\
 58.1761 +              sed -e '/\/CVS/d' -e '/^\.$/d' -e 's:^\./::'`
 58.1762 +    fi
 58.1763 +    for dir in $DIRS; do
 58.1764 +        if [ ".$opt_t" = .yes ]; then
 58.1765 +            echo "mkdir $dst/$dir" 1>&2
 58.1766 +        fi
 58.1767 +        mkdir $dst/$dir
 58.1768 +    done
 58.1769 +
 58.1770 +    #   fill directory tree with symlinks to files
 58.1771 +    if [ ".$opt_a" = .yes ]; then
 58.1772 +        FILES="`cd $src; find . -depth -print |\
 58.1773 +                sed -e 's/^\.\///'`"
 58.1774 +    else
 58.1775 +        FILES="`cd $src; find . -depth -print |\
 58.1776 +                sed -e '/\.o$/d' -e '/\.a$/d' -e '/\.so$/d' \
 58.1777 +                    -e '/\.cvsignore$/d' -e '/\/CVS/d' \
 58.1778 +                    -e '/\/\.#/d' -e '/\.orig$/d' \
 58.1779 +                    -e 's/^\.\///'`"
 58.1780 +    fi
 58.1781 +    for file in $FILES; do
 58.1782 +         #  don't use `-type f' above for find because of symlinks
 58.1783 +         if [ -d "$src/$file" ]; then
 58.1784 +             continue
 58.1785 +         fi
 58.1786 +         basename=`echo $file | sed -e 's:^.*/::'`
 58.1787 +         dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'`
 58.1788 +         from=`echo "$src/$file" | sed -e 's/^\.\///'`
 58.1789 +         to="$dst/$dir$basename"
 58.1790 +         if [ $oneisabs = 0 ]; then
 58.1791 +             if [ ".$dir" != . ]; then
 58.1792 +                 subdir=`echo $dir | sed -e 's:/$::'`
 58.1793 +                 #   derive reverse path from forward path
 58.1794 +                 revdir=''
 58.1795 +                 OIFS="$IFS"; IFS='/'
 58.1796 +                 for pe in $subdir; do
 58.1797 +                     revdir="../$revdir"
 58.1798 +                 done
 58.1799 +                 IFS="$OIFS"
 58.1800 +                 #   finalize from
 58.1801 +                 from="$revdir$from"
 58.1802 +             fi
 58.1803 +             from="$dstrevdir$from"
 58.1804 +         fi
 58.1805 +         if [ ".$opt_v" = .yes ]; then
 58.1806 +             echo "    $to" 1>&2
 58.1807 +         fi
 58.1808 +         if [ ".$opt_t" = .yes ]; then
 58.1809 +             echo "ln -s $from $to" 1>&2
 58.1810 +         fi
 58.1811 +         ln -s $from $to
 58.1812 +    done
 58.1813 +
 58.1814 +    shtool_exit 0
 58.1815 +    ;;
 58.1816 +
 58.1817 +fixperm )
 58.1818 +    ##
 58.1819 +    ##  fixperm -- Fix file permissions inside a source tree
 58.1820 +    ##  Copyright (c) 1996-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1821 +    ##
 58.1822 +
 58.1823 +    paths="$*"
 58.1824 +
 58.1825 +    #   check whether the test command supports the -x option
 58.1826 +    if [ -x /bin/sh ] 2>/dev/null; then
 58.1827 +        minusx="-x"
 58.1828 +    else
 58.1829 +        minusx="-r"
 58.1830 +    fi
 58.1831 +
 58.1832 +    #   iterate over paths
 58.1833 +    for p in $paths; do
 58.1834 +        for file in `find $p -depth -print`; do
 58.1835 +            if [ -f $file ]; then
 58.1836 +                if [ $minusx $file ]; then
 58.1837 +                    if [ ".$opt_v" = .yes ]; then
 58.1838 +                        echo "-rwxr-xr-x $file" 2>&1
 58.1839 +                    fi
 58.1840 +                    if [ ".$opt_t" = .yes ]; then
 58.1841 +                        echo "chmod 755 $file" 2>&1
 58.1842 +                    fi
 58.1843 +                    chmod 755 $file
 58.1844 +                else
 58.1845 +                    if [ ".$opt_v" = .yes ]; then
 58.1846 +                        echo "-rw-r--r-- $file" 2>&1
 58.1847 +                    fi
 58.1848 +                    if [ ".$opt_t" = .yes ]; then
 58.1849 +                        echo "chmod 644 $file" 2>&1
 58.1850 +                    fi
 58.1851 +                    chmod 644 $file
 58.1852 +                fi
 58.1853 +                continue
 58.1854 +            fi
 58.1855 +            if [ -d $file ]; then
 58.1856 +                if [ ".$opt_v" = .yes ]; then
 58.1857 +                    echo "drwxr-xr-x $file" 2>&1
 58.1858 +                fi
 58.1859 +                if [ ".$opt_t" = .yes ]; then
 58.1860 +                    echo "chmod 755 $file" 2>&1
 58.1861 +                fi
 58.1862 +                chmod 755 $file
 58.1863 +                continue
 58.1864 +            fi
 58.1865 +            if [ ".$opt_v" = .yes ]; then
 58.1866 +                echo "?????????? $file" 2>&1
 58.1867 +            fi
 58.1868 +        done
 58.1869 +    done
 58.1870 +
 58.1871 +    shtool_exit 0
 58.1872 +    ;;
 58.1873 +
 58.1874 +rotate )
 58.1875 +    ##
 58.1876 +    ##  rotate -- Logfile rotation
 58.1877 +    ##  Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.1878 +    ##
 58.1879 +
 58.1880 +    #   make sure we have at least one file to rotate
 58.1881 +    if [ ".$opt_n" = .0 ]; then
 58.1882 +        echo "$msgprefix:Error: invalid argument \`$opt_n' to option -n." 1>&2
 58.1883 +        shtool_exit 1
 58.1884 +    fi
 58.1885 +
 58.1886 +    #   canonicalize -s option argument
 58.1887 +    if [ ".$opt_s" != . ]; then
 58.1888 +        if [ ".`expr $opt_s : '[0-9]*$'`" != .0 ]; then
 58.1889 +            :
 58.1890 +        elif [ ".`expr $opt_s : '[0-9]*[Kk]$'`" != .0 ]; then
 58.1891 +            opt_s=`expr $opt_s : '\([0-9]*\)[Kk]$'`
 58.1892 +            opt_s=`expr $opt_s \* 1024`
 58.1893 +        elif [ ".`expr $opt_s : '[0-9]*[Mm]$'`" != .0 ]; then
 58.1894 +            opt_s=`expr $opt_s : '\([0-9]*\)[Mm]$'`
 58.1895 +            opt_s=`expr $opt_s \* 1048576` # 1024*1024
 58.1896 +        elif [ ".`expr $opt_s : '[0-9]*[Gg]$'`" != .0 ]; then
 58.1897 +            opt_s=`expr $opt_s : '\([0-9]*\)[Gg]$'`
 58.1898 +            opt_s=`expr $opt_s \* 1073741824` # 1024*1024*1024
 58.1899 +        else
 58.1900 +            echo "$msgprefix:Error: invalid argument \`$opt_s' to option -s." 1>&2
 58.1901 +            shtool_exit 1
 58.1902 +        fi
 58.1903 +    fi
 58.1904 +
 58.1905 +    #   option -d/-z consistency
 58.1906 +    if [ ".$opt_d" = .yes ] && [ ".$opt_z" = . ]; then
 58.1907 +        echo "$msgprefix:Error: option -d requires option -z." 1>&2
 58.1908 +        shtool_exit 1
 58.1909 +    fi
 58.1910 +
 58.1911 +    #   make sure target directory exists
 58.1912 +    if [ ".$opt_a" != . ]; then
 58.1913 +        if [ ! -d $opt_a ]; then
 58.1914 +            if [ ".$opt_f" = .no ]; then
 58.1915 +                echo "$msgprefix:Error: archive directory \`$opt_a' does not exist." 1>&2
 58.1916 +                shtool_exit 1
 58.1917 +            fi
 58.1918 +            mkdir $opt_a || shtool_exit $?
 58.1919 +            chmod 755 $opt_a
 58.1920 +        fi
 58.1921 +        if [ ! -w $opt_a ]; then
 58.1922 +            echo "$msgprefix:Error: archive directory \`$opt_a' not writable." 1>&2
 58.1923 +            shtool_exit 1
 58.1924 +        fi
 58.1925 +    fi
 58.1926 +
 58.1927 +    #   determine compression approach
 58.1928 +    if [ ".$opt_z" != . ]; then
 58.1929 +        comp_lvl="$opt_z"
 58.1930 +        comp_prg=""
 58.1931 +        case $comp_lvl in
 58.1932 +            *:* ) eval `echo $comp_lvl |\
 58.1933 +                        sed -e 's%^\(.*\):\(.*\)$%comp_prg="\1"; comp_lvl="\2"%'` ;;
 58.1934 +        esac
 58.1935 +
 58.1936 +        #   compression level consistency
 58.1937 +        case $comp_lvl in
 58.1938 +            [0-9] )
 58.1939 +                ;;
 58.1940 +            * ) echo "$msgprefix:Error: invalid compression level \`$comp_lvl'" 1>&2
 58.1941 +                shtool_exit 1
 58.1942 +                ;;
 58.1943 +        esac
 58.1944 +
 58.1945 +        #   determine a suitable compression tool
 58.1946 +        if [ ".$comp_prg" = . ]; then
 58.1947 +            #   check whether the test command supports the -x option
 58.1948 +            if [ -x /bin/sh ] 2>/dev/null; then
 58.1949 +                minusx="-x"
 58.1950 +            else
 58.1951 +                minusx="-r"
 58.1952 +            fi
 58.1953 +            #   search for tools in $PATH
 58.1954 +            paths="`echo $PATH |\
 58.1955 +                    sed -e 's%/*:%:%g' -e 's%/*$%%' \
 58.1956 +                        -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
 58.1957 +                        -e 's/:/ /g'`"
 58.1958 +            for prg in bzip2 gzip compress; do
 58.1959 +                for path in $paths; do
 58.1960 +                    if [ $minusx "$path/$prg" ] && [ ! -d "$path/$prg" ]; then
 58.1961 +                        comp_prg="$prg"
 58.1962 +                        break
 58.1963 +                    fi
 58.1964 +                done
 58.1965 +                if [ ".$comp_prg" != . ]; then
 58.1966 +                    break
 58.1967 +                fi
 58.1968 +            done
 58.1969 +            if [ ".$comp_prg" = . ]; then
 58.1970 +                echo "$msgprefix:Error: no suitable compression tool found in \$PATH" 1>&2
 58.1971 +                shtool_exit 1
 58.1972 +            fi
 58.1973 +        fi
 58.1974 +
 58.1975 +        #   determine standard compression extension
 58.1976 +        #   and make sure it is a known tool
 58.1977 +        case $comp_prg in
 58.1978 +            */bzip2    | bzip2    ) comp_ext="bz2" comp_lvl="-$comp_lvl" ;;
 58.1979 +            */gzip     | gzip     ) comp_ext="gz"  comp_lvl="-$comp_lvl" ;;
 58.1980 +            */compress | compress ) comp_ext="Z";  comp_lvl=""           ;;
 58.1981 +            * ) echo "$msgprefix:Error: tool \`$comp_prg' is not a known compression tool" 1>&2
 58.1982 +                shtool_exit 1
 58.1983 +                ;;
 58.1984 +        esac
 58.1985 +        comp_suf=".$comp_ext"
 58.1986 +    fi
 58.1987 +
 58.1988 +    #   iterate over all given logfile arguments
 58.1989 +    for file in $*; do
 58.1990 +        #   make sure the logfile exists
 58.1991 +        if [ ! -f $file ]; then
 58.1992 +            if [ ".$opt_f" = .yes ]; then
 58.1993 +                continue
 58.1994 +            fi
 58.1995 +            echo "$msgprefix:Error: logfile \`$file' not found" 1>&2
 58.1996 +            shtool_exit 1
 58.1997 +        fi
 58.1998 +
 58.1999 +        #   determine log directory (where original logfile is placed)
 58.2000 +        ldir="."
 58.2001 +        case $file in
 58.2002 +            */* ) eval `echo $file | sed -e 's%^\(.*\)/\([^/]*\)$%ldir="\1"; file="\2";%'` ;;
 58.2003 +        esac
 58.2004 +
 58.2005 +        #   determine archive directory (where rotated logfiles are placed)
 58.2006 +        adir="$ldir"
 58.2007 +        if [ ".$opt_a" != . ]; then
 58.2008 +            case "$opt_a" in
 58.2009 +                /* | ./* ) adir="$opt_a" ;;
 58.2010 +                * ) adir="$ldir/$opt_a"  ;;
 58.2011 +            esac
 58.2012 +        fi
 58.2013 +
 58.2014 +        #   optionally take logfile size into account
 58.2015 +        if [ ".$opt_s" != . ]; then
 58.2016 +            #   determine size of logfile
 58.2017 +            set -- `env -i /bin/ls -l "$ldir/$file" | sed -e "s;$ldir/$file;;" |\
 58.2018 +                    sed -e 's; -> .*$;;' -e 's;[ 	][ 	]*; ;g'`
 58.2019 +            n=`expr $# - 3`
 58.2020 +            eval "size=\`echo \${$n}\`"
 58.2021 +
 58.2022 +            #   skip logfile if size is still too small
 58.2023 +            if [ $size -lt $opt_s ]; then
 58.2024 +                if [ ".$opt_v" = .yes ]; then
 58.2025 +                    echo "$ldir/$file: still too small in size -- skipping"
 58.2026 +                fi
 58.2027 +                continue
 58.2028 +            fi
 58.2029 +        fi
 58.2030 +
 58.2031 +        #   verbosity
 58.2032 +        if [ ".$opt_v" = .yes ]; then
 58.2033 +            echo "rotating $ldir/$file"
 58.2034 +        fi
 58.2035 +
 58.2036 +        #   execute prolog
 58.2037 +        if [ ".$opt_P" != . ]; then
 58.2038 +            if [ ".$opt_t" = .yes ]; then
 58.2039 +                echo "$opt_P"
 58.2040 +            fi
 58.2041 +            eval $opt_P
 58.2042 +            [ $? -ne 0 ] && shtool_exit $?
 58.2043 +        fi
 58.2044 +
 58.2045 +        #   kick away out-rotated logfile
 58.2046 +        n=`expr $opt_n - 1`
 58.2047 +        n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n`
 58.2048 +        if [ -f "${adir}/${file}.${n}${comp_suf}" ]; then
 58.2049 +            #   optionally migrate away the out-rotated logfile
 58.2050 +            if [ ".$opt_M" != . ]; then
 58.2051 +                if [ ".$opt_t" = .yes ]; then
 58.2052 +                    echo "$opt_M ${adir}/${file}.${n}${comp_suf}"
 58.2053 +                fi
 58.2054 +                eval "$opt_M ${adir}/${file}.${n}${comp_suf}"
 58.2055 +                [ $? -ne 0 ] && shtool_exit $?
 58.2056 +            fi
 58.2057 +            #   finally get rid of the out-rotated logfile
 58.2058 +            if [ ".$opt_t" = .yes ]; then
 58.2059 +                echo "rm -f ${adir}/${file}.${n}${comp_suf}"
 58.2060 +            fi
 58.2061 +            rm -f ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
 58.2062 +        fi
 58.2063 +
 58.2064 +        #   rotate already archived logfiles
 58.2065 +        while [ $n -gt 0 ]; do
 58.2066 +            m=$n
 58.2067 +            n=`expr $n - 1`
 58.2068 +            n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n`
 58.2069 +            if [ $n -eq 0 ] && [ ".$opt_d" = .yes ]; then
 58.2070 +                #   special case: first rotation file under delayed compression situation
 58.2071 +                if [ ! -f "${adir}/${file}.${n}" ]; then
 58.2072 +                    continue
 58.2073 +                fi
 58.2074 +
 58.2075 +                #   compress file (delayed)
 58.2076 +                if [ ".$opt_b" = .yes ]; then
 58.2077 +                    if [ ".$opt_t" = .yes ]; then
 58.2078 +                        echo "mv ${adir}/${file}.${n} ${adir}/${file}.${m}"
 58.2079 +                    fi
 58.2080 +                    mv ${adir}/${file}.${n} ${adir}/${file}.${m} || shtool_exit $?
 58.2081 +                    if [ ".$opt_t" = .yes ]; then
 58.2082 +                        echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${m} >${adir}/${file}.${m}${comp_suf}; rm -f ${adir}/${file}.${m}) &"
 58.2083 +                    fi
 58.2084 +                    ( ${comp_prg} ${comp_lvl} \
 58.2085 +                          <${adir}/${file}.${m} \
 58.2086 +                          >${adir}/${file}.${m}${comp_suf} || shtool_exit $?
 58.2087 +                      rm -f ${adir}/${file}.${m} || shtool_exit $?
 58.2088 +                    ) </dev/null >/dev/null 2>&1 &
 58.2089 +                else
 58.2090 +                    if [ ".$opt_t" = .yes ]; then
 58.2091 +                        echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${m}${comp_suf}"
 58.2092 +                    fi
 58.2093 +                    ${comp_prg} ${comp_lvl} \
 58.2094 +                        <${adir}/${file}.${n} \
 58.2095 +                        >${adir}/${file}.${m}${comp_suf} || shtool_exit $?
 58.2096 +                    if [ ".$opt_t" = .yes ]; then
 58.2097 +                        echo "rm -f ${adir}/${file}.${n}"
 58.2098 +                    fi
 58.2099 +                    rm -f ${adir}/${file}.${n} || shtool_exit $?
 58.2100 +                fi
 58.2101 +
 58.2102 +                #   fix file attributes
 58.2103 +                if [ ".$opt_o" != . ]; then
 58.2104 +                    if [ ".$opt_t" = .yes ]; then
 58.2105 +                        echo "chown $opt_o ${adir}/${file}.${m}${comp_suf}"
 58.2106 +                    fi
 58.2107 +                    chown $opt_o ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
 58.2108 +                fi
 58.2109 +                if [ ".$opt_g" != . ]; then
 58.2110 +                    if [ ".$opt_t" = .yes ]; then
 58.2111 +                        echo "chgrp $opt_g ${adir}/${file}.${m}${comp_suf}"
 58.2112 +                    fi
 58.2113 +                    chgrp $opt_g ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
 58.2114 +                fi
 58.2115 +                if [ ".$opt_m" != . ]; then
 58.2116 +                    if [ ".$opt_t" = .yes ]; then
 58.2117 +                        echo "chmod $opt_m ${adir}/${file}.${m}${comp_suf}"
 58.2118 +                    fi
 58.2119 +                    chmod $opt_m ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
 58.2120 +                fi
 58.2121 +            else
 58.2122 +                #   standard case: second and following rotation file
 58.2123 +                if [ ! -f "${adir}/${file}.${n}${comp_suf}" ]; then
 58.2124 +                    continue
 58.2125 +                fi
 58.2126 +                if [ ".$opt_t" = .yes ]; then
 58.2127 +                    echo "mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf}"
 58.2128 +                fi
 58.2129 +                mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
 58.2130 +            fi
 58.2131 +        done
 58.2132 +
 58.2133 +        #   move away current logfile
 58.2134 +        if [ ".$opt_c" = .yes ]; then
 58.2135 +            #   approach: copy[+truncate]
 58.2136 +            if [ ".$opt_t" = .yes ]; then
 58.2137 +                echo "cp -p ${ldir}/${file} ${adir}/${file}.${n}"
 58.2138 +            fi
 58.2139 +            cp -p ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $?
 58.2140 +            if [ ".$opt_r" = .no ]; then
 58.2141 +                if [ ".$opt_t" = .yes ]; then
 58.2142 +                    echo "cp /dev/null ${ldir}/${file}"
 58.2143 +                fi
 58.2144 +                cp /dev/null ${ldir}/${file} || shtool_exit $?
 58.2145 +            fi
 58.2146 +        else
 58.2147 +            #   approach: move[+touch]
 58.2148 +            if [ ".$opt_t" = .yes ]; then
 58.2149 +                echo "mv ${ldir}/${file} ${adir}/${file}.${n}"
 58.2150 +            fi
 58.2151 +            mv ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $?
 58.2152 +            if [ ".$opt_r" = .no ]; then
 58.2153 +                if [ ".$opt_t" = .yes ]; then
 58.2154 +                    echo "touch ${ldir}/${file}"
 58.2155 +                fi
 58.2156 +                touch ${ldir}/${file} || shtool_exit $?
 58.2157 +                #   fix file attributes
 58.2158 +                if [ ".$opt_o" != . ]; then
 58.2159 +                    if [ ".$opt_t" = .yes ]; then
 58.2160 +                        echo "chown $opt_o ${ldir}/${file}"
 58.2161 +                    fi
 58.2162 +                    chown $opt_o ${ldir}/${file} || shtool_exit $?
 58.2163 +                fi
 58.2164 +                if [ ".$opt_g" != . ]; then
 58.2165 +                    if [ ".$opt_t" = .yes ]; then
 58.2166 +                        echo "chgrp $opt_g ${ldir}/${file}"
 58.2167 +                    fi
 58.2168 +                    chgrp $opt_g ${ldir}/${file} || shtool_exit $?
 58.2169 +                fi
 58.2170 +                if [ ".$opt_m" != . ]; then
 58.2171 +                    if [ ".$opt_t" = .yes ]; then
 58.2172 +                        echo "chmod $opt_m ${ldir}/${file}"
 58.2173 +                    fi
 58.2174 +                    chmod $opt_m ${ldir}/${file} || shtool_exit $?
 58.2175 +                fi
 58.2176 +            fi
 58.2177 +        fi
 58.2178 +
 58.2179 +        #   regular compression step
 58.2180 +        if [ ".$opt_z" != . ] && [ ".$opt_d" = .no ]; then
 58.2181 +            #   compress file
 58.2182 +            if [ ".$opt_b" = .yes ]; then
 58.2183 +                if [ ".$opt_t" = .yes ]; then
 58.2184 +                    echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}; rm -f ${adir}/${file}.${n}) &"
 58.2185 +                fi
 58.2186 +                ( ${comp_prg} ${comp_lvl} \
 58.2187 +                      <${adir}/${file}.${n} \
 58.2188 +                      >${adir}/${file}.${n}${comp_suf} || shtool_exit $?
 58.2189 +                  rm -f ${adir}/${file}.${n} || shtool_exit $?
 58.2190 +                ) </dev/null >/dev/null 2>&1 &
 58.2191 +            else
 58.2192 +                if [ ".$opt_t" = .yes ]; then
 58.2193 +                    echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}"
 58.2194 +                fi
 58.2195 +                ${comp_prg} ${comp_lvl} \
 58.2196 +                    <${adir}/${file}.${n} \
 58.2197 +                    >${adir}/${file}.${n}${comp_suf} || shtool_exit $?
 58.2198 +                if [ ".$opt_t" = .yes ]; then
 58.2199 +                    echo "rm -f ${opt_a}${file}.${n}"
 58.2200 +                fi
 58.2201 +                rm -f ${adir}/${file}.${n} || shtool_exit $?
 58.2202 +            fi
 58.2203 +
 58.2204 +            #   fix file attributes
 58.2205 +            if [ ".$opt_o" != . ]; then
 58.2206 +                if [ ".$opt_t" = .yes ]; then
 58.2207 +                    echo "chown $opt_o ${adir}/${file}.${n}${comp_suf}"
 58.2208 +                fi
 58.2209 +                chown $opt_o ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
 58.2210 +            fi
 58.2211 +            if [ ".$opt_g" != . ]; then
 58.2212 +                if [ ".$opt_t" = .yes ]; then
 58.2213 +                    echo "chgrp $opt_g ${adir}/${file}.${n}${comp_suf}"
 58.2214 +                fi
 58.2215 +                chgrp $opt_g ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
 58.2216 +            fi
 58.2217 +            if [ ".$opt_m" != . ]; then
 58.2218 +                if [ ".$opt_t" = .yes ]; then
 58.2219 +                    echo "chmod $opt_m ${adir}/${file}.${n}${comp_suf}"
 58.2220 +                fi
 58.2221 +                chmod $opt_m ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
 58.2222 +            fi
 58.2223 +        fi
 58.2224 +
 58.2225 +        #   execute epilog
 58.2226 +        if [ ".$opt_E" != . ]; then
 58.2227 +            if [ ".$opt_t" = .yes ]; then
 58.2228 +                echo "$opt_E"
 58.2229 +            fi
 58.2230 +            eval $opt_E
 58.2231 +            [ $? -ne 0 ] && shtool_exit $?
 58.2232 +        fi
 58.2233 +    done
 58.2234 +
 58.2235 +    shtool_exit 0
 58.2236 +    ;;
 58.2237 +
 58.2238 +tarball )
 58.2239 +    ##
 58.2240 +    ##  tarball -- Roll distribution tarballs
 58.2241 +    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.2242 +    ##
 58.2243 +
 58.2244 +    srcs="$*"
 58.2245 +
 58.2246 +    #   check whether the test command supports the -x option
 58.2247 +    if [ -x /bin/sh ] 2>/dev/null; then
 58.2248 +        minusx="-x"
 58.2249 +    else
 58.2250 +        minusx="-r"
 58.2251 +    fi
 58.2252 +
 58.2253 +    #   find the tools
 58.2254 +    paths="`echo $PATH |\
 58.2255 +            sed -e 's%/*:%:%g' -e 's%/*$%%' \
 58.2256 +                -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
 58.2257 +                -e 's/:/ /g'`"
 58.2258 +    for spec in find:gfind,find tar:gtar,tar tardy:tardy,tarcust; do
 58.2259 +        prg=`echo $spec | sed -e 's/:.*$//'`
 58.2260 +        tools=`echo $spec | sed -e 's/^.*://'`
 58.2261 +        eval "prg_${prg}=''"
 58.2262 +        #   iterate over tools
 58.2263 +        for tool in `echo $tools | sed -e 's/,/ /g'`; do
 58.2264 +            #   iterate over paths
 58.2265 +            for path in $paths; do
 58.2266 +                if [ $minusx "$path/$tool" ] && [ ! -d "$path/$tool" ]; then
 58.2267 +                    eval "prg_${prg}=\"$path/$tool\""
 58.2268 +                    break
 58.2269 +                fi
 58.2270 +            done
 58.2271 +            eval "val=\$prg_${prg}"
 58.2272 +            if [ ".$val" != . ]; then
 58.2273 +                break
 58.2274 +            fi
 58.2275 +        done
 58.2276 +    done
 58.2277 +
 58.2278 +    #   expand source paths
 58.2279 +    exclude=''
 58.2280 +    for pat in `echo $opt_e | sed 's/,/ /g'`; do
 58.2281 +        exclude="$exclude | grep -v '$pat'"
 58.2282 +    done
 58.2283 +    if [ ".$opt_t" = .yes ]; then
 58.2284 +        echo "cp /dev/null $tmpfile.lst" 1>&2
 58.2285 +    fi
 58.2286 +    cp /dev/null $tmpfile.lst
 58.2287 +    for src in $srcs; do
 58.2288 +        if [ -d $src ]; then
 58.2289 +            if [ ".$opt_t" = .yes ]; then
 58.2290 +                echo "(cd $src && $prg_find . -type f -depth -print) | sed -e 's:^\\.\$::' -e 's:^\\./::' | cat $exclude >>$tmpfile.lst" 1>&2
 58.2291 +            fi
 58.2292 +            (cd $src && $prg_find . -type f -depth -print) |\
 58.2293 +            sed -e 's:^\.$::' -e 's:^\./::' | eval cat $exclude >>$tmpfile.lst
 58.2294 +        else
 58.2295 +            if [ ".$opt_t" = .yes ]; then
 58.2296 +                echo "echo $src >>$tmpfile.lst" 1>&2
 58.2297 +            fi
 58.2298 +            echo $src >>$tmpfile.lst
 58.2299 +        fi
 58.2300 +    done
 58.2301 +    sort <$tmpfile.lst >$tmpfile.lst.n
 58.2302 +    mv $tmpfile.lst.n $tmpfile.lst
 58.2303 +    if [ ".$opt_v" = .yes ]; then
 58.2304 +        cat $tmpfile.lst | sed -e 's/^/  /' 1>&2
 58.2305 +    fi
 58.2306 +
 58.2307 +    #   determine tarball file and directory name
 58.2308 +    if [ ".$opt_o" != . ]; then
 58.2309 +        tarfile="$opt_o"
 58.2310 +        if [ ".$opt_d" != . ]; then
 58.2311 +            tarname="$opt_d"
 58.2312 +        else
 58.2313 +            tarname=`echo $tarfile | sed -e 's/\.tar.*$//' -e 's;.*/\([^/]*\)$;\1;'`
 58.2314 +        fi
 58.2315 +    else
 58.2316 +        if [ ".$opt_d" != . ]; then
 58.2317 +            tarname="$opt_d"
 58.2318 +        elif [ -d "$from" ]; then
 58.2319 +            tarname=`echo $from | sed -e 's;.*/\([^/]*\)$;\1;'`
 58.2320 +        else
 58.2321 +            tarname="out"
 58.2322 +        fi
 58.2323 +        tarfile="$tarname.tar"
 58.2324 +    fi
 58.2325 +
 58.2326 +    #   roll the tarball
 58.2327 +    compress=''
 58.2328 +    if [ ".$opt_c" != . ]; then
 58.2329 +        compress="| $opt_c"
 58.2330 +    fi
 58.2331 +    if [ ".$prg_tardy" != . ]; then
 58.2332 +        #   the elegant hackers way
 58.2333 +        tardy_opt="--prefix=$tarname"
 58.2334 +        tardy_opt="$tardy_opt --user_number=0 --group_number=0" # security!
 58.2335 +        if [ ".$opt_u" != . ]; then
 58.2336 +            tardy_opt="$tardy_opt --user_name=$opt_u"
 58.2337 +        fi
 58.2338 +        if [ ".$opt_g" != . ]; then
 58.2339 +            tardy_opt="$tardy_opt --group_name=$opt_g"
 58.2340 +        fi
 58.2341 +        if [ ".$opt_t" = .yes ]; then
 58.2342 +            echo "cat $tmpfile.lst | xargs $prg_tar cf - | $prg_tardy $tardy_opt | cat $compress >$tmpfile.out" 1>&2
 58.2343 +        fi
 58.2344 +        cat $tmpfile.lst |\
 58.2345 +        xargs $prg_tar cf - |\
 58.2346 +        $prg_tardy $tardy_opt |\
 58.2347 +        eval cat $compress >$tmpfile.out
 58.2348 +        if [ ".$opt_t" = .yes ]; then
 58.2349 +            echo "cp $tmpfile.out $tarfile" 1>&2
 58.2350 +        fi
 58.2351 +        cp $tmpfile.out $tarfile
 58.2352 +    else
 58.2353 +        #  the portable standard way
 58.2354 +        if [ ".$opt_t" = .yes ]; then
 58.2355 +            echo "mkdir $tmpdir/$tarname" 1>&2
 58.2356 +        fi
 58.2357 +        mkdir $tmpdir/$tarname || shtool_exit 1
 58.2358 +        if [ ".$opt_t" = .yes ]; then
 58.2359 +            echo "cat $tmpfile.lst | xargs $prg_tar cf - | (cd $tmpdir/$tarname && $prg_tar xf -)" 1>&2
 58.2360 +        fi
 58.2361 +        cat $tmpfile.lst |\
 58.2362 +        xargs $prg_tar cf - |\
 58.2363 +        (cd $tmpdir/$tarname && $prg_tar xf -)
 58.2364 +        if [ ".$opt_u" != . ]; then
 58.2365 +            if [ ".$opt_t" = .yes ]; then
 58.2366 +                echo "chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1" 2>&1
 58.2367 +            fi
 58.2368 +            chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1 ||\
 58.2369 +            echo "$msgprefix:Warning: cannot set user name \`$opt_u' (would require root privileges)"
 58.2370 +        fi
 58.2371 +        if [ ".$opt_g" != . ]; then
 58.2372 +            if [ ".$opt_t" = .yes ]; then
 58.2373 +                echo "chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1" 2>&1
 58.2374 +            fi
 58.2375 +            chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1 ||\
 58.2376 +            echo "$msgprefix:Warning: cannot set group name \`$opt_g' (would require root privileges)"
 58.2377 +        fi
 58.2378 +        if [ ".$opt_t" = .yes ]; then
 58.2379 +            echo "(cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) | cat $compress >$tmpfile.out" 1>&2
 58.2380 +        fi
 58.2381 +        (cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) |\
 58.2382 +        eval cat $compress >$tmpfile.out
 58.2383 +        if [ ".$opt_t" = .yes ]; then
 58.2384 +            echo "cp $tmpfile.out $tarfile" 1>&2
 58.2385 +        fi
 58.2386 +        cp $tmpfile.out $tarfile
 58.2387 +        if [ ".$opt_t" = .yes ]; then
 58.2388 +            echo "rm -rf $tmpdir/$tarname" 1>&2
 58.2389 +        fi
 58.2390 +        rm -rf $tmpdir/$tarname
 58.2391 +    fi
 58.2392 +
 58.2393 +    #   cleanup
 58.2394 +    if [ ".$opt_t" = .yes ]; then
 58.2395 +        echo "rm -f $tmpfile.lst $tmpfile.out" 1>&2
 58.2396 +    fi
 58.2397 +    rm -f $tmpfile.lst $tmpfile.out
 58.2398 +
 58.2399 +    shtool_exit 0
 58.2400 +    ;;
 58.2401 +
 58.2402 +subst )
 58.2403 +    ##
 58.2404 +    ##  subst -- Apply sed(1) substitution operations
 58.2405 +    ##  Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.2406 +    ##
 58.2407 +
 58.2408 +    #   remember optional list of file(s)
 58.2409 +    files="$*"
 58.2410 +    files_num="$#"
 58.2411 +
 58.2412 +    #   parameter consistency check
 58.2413 +    if [ $# -eq 0 ] && [ ".$opt_b" != . ]; then
 58.2414 +        echo "$msgprefix:Error: option -b cannot be applied to stdin" 1>&2
 58.2415 +        shtool_exit 1
 58.2416 +    fi
 58.2417 +    if [ $# -eq 0 ] && [ ".$opt_s" = .yes ]; then
 58.2418 +        echo "$msgprefix:Error: option -s cannot be applied to stdin" 1>&2
 58.2419 +        shtool_exit 1
 58.2420 +    fi
 58.2421 +
 58.2422 +    #   build underlying sed(1) command
 58.2423 +    sedcmd='sed'
 58.2424 +    if [ ".$opt_e" != . ]; then
 58.2425 +        OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS"
 58.2426 +        for e
 58.2427 +        do
 58.2428 +            sedcmd="$sedcmd -e '$e'"
 58.2429 +        done
 58.2430 +    elif [ ".$opt_f" != . ]; then
 58.2431 +        if [ ! -f $opt_f ]; then
 58.2432 +            echo "$msgprefix:Error: command file \`$opt_f' not found or not a regular file" 1>&2
 58.2433 +            shtool_exit 1
 58.2434 +        fi
 58.2435 +        sedcmd="$sedcmd -f '$opt_f'"
 58.2436 +    else
 58.2437 +        echo "$msgprefix:Error: either -e option(s) or -f option required" 1>&2
 58.2438 +        shtool_exit 1
 58.2439 +    fi
 58.2440 +
 58.2441 +    #   determine extension for original file
 58.2442 +    orig=".orig"
 58.2443 +    if [ ".$opt_b" != . ]; then
 58.2444 +        orig="$opt_b"
 58.2445 +    fi
 58.2446 +
 58.2447 +    #   apply sed(1) operation(s)
 58.2448 +    if [ ".$files" != . ]; then
 58.2449 +        #   apply operation(s) to files
 58.2450 +        substdone=no
 58.2451 +        for file in $files; do
 58.2452 +            test ".$file" = . && continue
 58.2453 +            if [ ! -f $file ]; then
 58.2454 +                echo "$msgprefix:Warning: file \`$file' not found or not a regular file" 1>&2
 58.2455 +                continue
 58.2456 +            fi
 58.2457 +
 58.2458 +            #   handle interactive mode
 58.2459 +            if [ ".$opt_i" = .yes ]; then
 58.2460 +                eval "$sedcmd <$file >$file.new"
 58.2461 +                skip=no
 58.2462 +                if cmp $file $file.new >/dev/null 2>&1; then
 58.2463 +                    rm -f $file.new
 58.2464 +                    skip=yes
 58.2465 +                else
 58.2466 +                    (diff -U1 $file $file.new >$tmpfile) 2>/dev/null
 58.2467 +                    if [ ".`cat $tmpfile`" = . ]; then
 58.2468 +                        (diff -C1 $file $file.new >$tmpfile) 2>/dev/null
 58.2469 +                        if [ ".`cat $tmpfile`" = . ]; then
 58.2470 +                            echo "$msgprefix:Warning: unable to show difference for file \`$file'" 1>&2
 58.2471 +                            cp /dev/null $tmpfile
 58.2472 +                        fi
 58.2473 +                    fi
 58.2474 +                    rm -f $file.new
 58.2475 +                    cat $tmpfile
 58.2476 +                    echo dummy | awk '{ printf("%s", TEXT); }' TEXT=">>> Apply [Y/n]: "
 58.2477 +                    read input
 58.2478 +                    if [ ".$input" != .Y ] &&\
 58.2479 +                       [ ".$input" != .y ] &&\
 58.2480 +                       [ ".$input" != . ]; then
 58.2481 +                       skip=yes
 58.2482 +                    fi
 58.2483 +                fi
 58.2484 +                if [ ".$skip" = .yes ]; then
 58.2485 +                    if [ ".$opt_v" = .yes ]; then
 58.2486 +                        echo "file \`$file' -- skipped" 1>&2
 58.2487 +                    fi
 58.2488 +                    continue
 58.2489 +                fi
 58.2490 +            fi
 58.2491 +
 58.2492 +            #   apply sed(1) operation(s)
 58.2493 +            if [ ".$opt_v" = .yes ]; then
 58.2494 +                echo "patching \`$file'" 1>&2
 58.2495 +            fi
 58.2496 +            if [ ".$opt_t" = .yes ]; then
 58.2497 +                echo "\$ cp -p $file $file$orig"
 58.2498 +                echo "\$ chmod u+w $file"
 58.2499 +                echo "\$ $sedcmd <$file$orig >$file"
 58.2500 +            fi
 58.2501 +            if [ ".$opt_n" = .no ]; then
 58.2502 +                cp -p $file $file$orig
 58.2503 +                chmod u+w $file >/dev/null 2>&1 || true
 58.2504 +                eval "$sedcmd <$file$orig >$file"
 58.2505 +            fi
 58.2506 +
 58.2507 +            #   optionally fix timestamp
 58.2508 +            if [ ".$opt_s" = .yes ]; then
 58.2509 +                if [ ".$opt_t" = .yes ]; then
 58.2510 +                    echo "\$ touch -r $file$orig $file"
 58.2511 +                fi
 58.2512 +                if [ ".$opt_n" = .no ]; then
 58.2513 +                    touch -r $file$orig $file
 58.2514 +                fi
 58.2515 +            fi
 58.2516 +
 58.2517 +            #   optionally check whether any content change actually occurred 
 58.2518 +            if [ ".$opt_q" = .no ]; then
 58.2519 +                if cmp $file$orig $file >/dev/null 2>&1; then
 58.2520 +                    if [ ".$opt_w" = .yes ]; then
 58.2521 +                        echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2
 58.2522 +                    fi
 58.2523 +                else
 58.2524 +                    substdone=yes
 58.2525 +                fi
 58.2526 +            fi
 58.2527 +
 58.2528 +            #   optionally remove preserved original file
 58.2529 +            if [ ".$opt_b" = . ]; then
 58.2530 +                if [ ".$opt_t" = .yes ]; then
 58.2531 +                    echo "\$ rm -f $file$orig"
 58.2532 +                fi
 58.2533 +                if [ ".$opt_n" = .no ]; then
 58.2534 +                    rm -f $file$orig
 58.2535 +                fi
 58.2536 +            fi
 58.2537 +        done
 58.2538 +        if [ ".$opt_q" = .no ] && [ ".$opt_w" = .no ]; then
 58.2539 +            if [ ".$substdone" = .no ]; then
 58.2540 +                if [ ".$files_num" = .1 ]; then
 58.2541 +                    echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2
 58.2542 +                else
 58.2543 +                    echo "$msgprefix:Warning: substitution resulted in no content change on any file" 1>&2
 58.2544 +                fi
 58.2545 +            fi
 58.2546 +        fi
 58.2547 +    else
 58.2548 +        #   apply operation(s) to stdin/stdout
 58.2549 +        if [ ".$opt_v" = .yes ]; then
 58.2550 +            echo "patching <stdin>" 1>&2
 58.2551 +        fi
 58.2552 +        if [ ".$opt_t" = .yes ]; then
 58.2553 +            echo "\$ $sedcmd"
 58.2554 +        fi
 58.2555 +        if [ ".$opt_n" = .no ]; then
 58.2556 +            eval "$sedcmd"
 58.2557 +        fi
 58.2558 +    fi
 58.2559 +
 58.2560 +    shtool_exit 0
 58.2561 +    ;;
 58.2562 +
 58.2563 +platform )
 58.2564 +    ##
 58.2565 +    ##  platform -- Platform Identification Utility
 58.2566 +    ##  Copyright (c) 2003-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.2567 +    ##
 58.2568 +
 58.2569 +    #   option post-processing
 58.2570 +    if [ ".$opt_t" != . ]; then
 58.2571 +        case "$opt_t" in
 58.2572 +            binary )
 58.2573 +                #   binary package id (OpenPKG RPM)
 58.2574 +                opt_F="%<ap>-%<sp>"
 58.2575 +                opt_L=yes
 58.2576 +                opt_S=""
 58.2577 +                opt_C="+"
 58.2578 +                ;;
 58.2579 +            build )
 58.2580 +                #   build time checking (OpenPKG RPM)
 58.2581 +                opt_F="%<at>-%<st>"
 58.2582 +                opt_L=yes
 58.2583 +                opt_S=""
 58.2584 +                opt_C="+"
 58.2585 +                ;;
 58.2586 +            gnu )
 58.2587 +                #   GNU config.guess style <arch>-<vendor>-<os><osversion>
 58.2588 +                opt_F="%<at>-unknown-%<st>"
 58.2589 +                opt_L=yes
 58.2590 +                opt_S=""
 58.2591 +                opt_C="+"
 58.2592 +                ;;
 58.2593 +            web )
 58.2594 +                #   non-whitespace HTTP Server-header id
 58.2595 +                opt_F="%<sp>-%<ap>"
 58.2596 +                opt_S="/"
 58.2597 +                opt_C="+"
 58.2598 +                ;;
 58.2599 +            summary)
 58.2600 +                #   human readable verbose summary information
 58.2601 +                opt_F="Class:      %[sc] (%[ac])\\nProduct:    %[sp] (%[ap])\\nTechnology: %[st] (%[at])"
 58.2602 +                opt_S=" "
 58.2603 +                opt_C="/"
 58.2604 +                ;;
 58.2605 +            all-in-one )
 58.2606 +                #   full-table all-in-one information
 58.2607 +                opt_F=""
 58.2608 +                opt_F="${opt_F}concise architecture class:      %<ac>\\n"
 58.2609 +                opt_F="${opt_F}regular architecture class:      %{ac}\\n"
 58.2610 +                opt_F="${opt_F}verbose architecture class:      %[ac]\\n"
 58.2611 +                opt_F="${opt_F}concise architecture product:    %<ap>\\n"
 58.2612 +                opt_F="${opt_F}regular architecture product:    %{ap}\\n"
 58.2613 +                opt_F="${opt_F}verbose architecture product:    %[ap]\\n"
 58.2614 +                opt_F="${opt_F}concise architecture technology: %<at>\\n"
 58.2615 +                opt_F="${opt_F}regular architecture technology: %{at}\\n"
 58.2616 +                opt_F="${opt_F}verbose architecture technology: %[at]\\n"
 58.2617 +                opt_F="${opt_F}concise system class:            %<sc>\\n"
 58.2618 +                opt_F="${opt_F}regular system class:            %{sc}\\n"
 58.2619 +                opt_F="${opt_F}verbose system class:            %[sc]\\n"
 58.2620 +                opt_F="${opt_F}concise system product:          %<sp>\\n"
 58.2621 +                opt_F="${opt_F}regular system product:          %{sp}\\n"
 58.2622 +                opt_F="${opt_F}verbose system product:          %[sp]\\n"
 58.2623 +                opt_F="${opt_F}concise system technology:       %<st>\\n"
 58.2624 +                opt_F="${opt_F}regular system technology:       %{st}\\n"
 58.2625 +                opt_F="${opt_F}verbose system technology:       %[st]"
 58.2626 +                ;;
 58.2627 +            * )
 58.2628 +                echo "$msgprefix:Error: invalid type \`$opt_t'" 1>&2
 58.2629 +                exit 1
 58.2630 +                ;;
 58.2631 +        esac
 58.2632 +    fi
 58.2633 +
 58.2634 +    #   assemble initial platform information
 58.2635 +    UNAME_MACHINE=`(uname -m) 2>/dev/null` ||\
 58.2636 +    UNAME_MACHINE=`(uname -p) 2>/dev/null` ||\
 58.2637 +    UNAME_MACHINE='unknown'
 58.2638 +    UNAME_SYSTEM=`(uname -s) 2>/dev/null`  ||\
 58.2639 +    UNAME_SYSTEM='unknown'
 58.2640 +    UNAME_RELEASE=`(uname -r) 2>/dev/null` ||\
 58.2641 +    UNAME_RELEASE=`(uname -v) 2>/dev/null` ||\
 58.2642 +    UNAME_RELEASE='unknown'
 58.2643 +
 58.2644 +    UNAME="${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}"
 58.2645 +
 58.2646 +    AC=""; AP=""; AT=""
 58.2647 +    SC=""; SP=""; ST=""
 58.2648 +
 58.2649 +    #    dispatch into platform specific sections
 58.2650 +    case "${UNAME}" in
 58.2651 +
 58.2652 +        #   FreeBSD
 58.2653 +        *:FreeBSD:* )
 58.2654 +            #   determine architecture
 58.2655 +            AC="${UNAME_MACHINE}"
 58.2656 +            case "${AC}" in
 58.2657 +                i386 ) AC="iX86" ;;
 58.2658 +            esac
 58.2659 +            AP="${AC}"
 58.2660 +            AT="${AP}"
 58.2661 +            if [ ".${AT}" = ".iX86" ]; then
 58.2662 +                case "`(/sbin/sysctl -n hw.model) 2>&1`" in
 58.2663 +                    *"Xeon"* | *"Pentium Pro"* | *"Cyrix 6x86MX"* | *"Pentium II"* | *"Pentium III"* | *"Pentium 4"* | *"Celeron"* ) AT="i686" ;;
 58.2664 +                    *"Pentium"* ) AT="i586" ;; *"i486[SD]X"* | *"Cyrix 486"* | *"Cyrix [56]x86"* | *"Blue Lightning" | *"Cyrix 486S/DX" ) AT="i486" ;;
 58.2665 +                    *"i386[SD]X"* | *"NexGen 586"* ) AT="i386" ;;
 58.2666 +                esac
 58.2667 +            fi
 58.2668 +            #   determine system
 58.2669 +            r=`echo "${UNAME_RELEASE}" |\
 58.2670 +               sed -e 's;[()];;' -e 's/\(-.*\)$/[\1]/'`
 58.2671 +            ST="FreeBSD ${r}"
 58.2672 +            SP="${ST}"
 58.2673 +            case "${r}" in
 58.2674 +                1.* ) SC="4.3BSD" ;;
 58.2675 +                *   ) SC="4.4BSD" ;;
 58.2676 +            esac
 58.2677 +            ;;
 58.2678 +
 58.2679 +        #   NetBSD
 58.2680 +        *:NetBSD:* )
 58.2681 +            #   determine architecture
 58.2682 +            AT="${UNAME_MACHINE}"
 58.2683 +            AP="${AT}"
 58.2684 +            case "${AP}" in
 58.2685 +                i[3-6]86 ) AP="iX86" ;;
 58.2686 +            esac
 58.2687 +            AC="${AP}"
 58.2688 +            #   determine system
 58.2689 +            r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
 58.2690 +            ST="NetBSD ${r}"
 58.2691 +            SP="${ST}"
 58.2692 +            case "${r}" in
 58.2693 +                0.* ) SC="4.3BSD" ;;
 58.2694 +                *   ) SC="4.4BSD" ;;
 58.2695 +            esac
 58.2696 +            ;;
 58.2697 +
 58.2698 +        #   OpenBSD
 58.2699 +        *:OpenBSD:* )
 58.2700 +            #   determine architecture
 58.2701 +            AT="${UNAME_MACHINE}"
 58.2702 +            AP="${AT}"
 58.2703 +            case "${AP}" in
 58.2704 +                i[3-6]86 ) AP="iX86" ;;
 58.2705 +            esac
 58.2706 +            AC="${AP}"
 58.2707 +            #   determine system
 58.2708 +            r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
 58.2709 +            ST="OpenBSD ${r}"
 58.2710 +            SP="${ST}"
 58.2711 +            SC="4.4BSD"
 58.2712 +            ;;
 58.2713 +
 58.2714 +        #   GNU/Linux
 58.2715 +        *:Linux:* )
 58.2716 +            #   determine architecture
 58.2717 +            AT="${UNAME_MACHINE}"
 58.2718 +            case "${AT}" in
 58.2719 +               ia64     ) AT="IA64"   ;;
 58.2720 +               x86_64   ) AT='AMD64'  ;;
 58.2721 +               parisc   ) AT="HPPA32" ;;
 58.2722 +               parisc64 ) AT="HPPA64" ;;
 58.2723 +            esac
 58.2724 +            AP="${AT}"
 58.2725 +            case "${AP}" in
 58.2726 +               i[3-6]86 ) AP='iX86' ;;
 58.2727 +            esac
 58.2728 +            AC="${AP}"
 58.2729 +            #   determine system
 58.2730 +            v_kern=`echo "${UNAME_RELEASE}" |\
 58.2731 +                sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
 58.2732 +            v_libc=`(strings /lib/libc.so.* | grep '^GLIBC_' | sed -e 's/^GLIBC_//' |\
 58.2733 +                env -i sort -n | sed -n -e '$p' | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') 2>/dev/null`
 58.2734 +            ST="GNU/<Linux >${v_libc}/<${v_kern}>"
 58.2735 +            if [ -f /etc/lsb-release ]; then
 58.2736 +                eval `( . /etc/lsb-release
 58.2737 +                    echo "SC=\"LSB${LSB_VERSION}\""
 58.2738 +                    if [ ".${DISTRIB_ID}" != . -a ".${DISTRIB_RELEASE}" != . ]; then
 58.2739 +                        echo "SP=\"${DISTRIB_ID} ${DISTRIB_RELEASE}\""
 58.2740 +                    fi
 58.2741 +                ) 2>/dev/null`
 58.2742 +            fi
 58.2743 +            if [ ".$SP" = . ]; then
 58.2744 +                for tagfile in x \
 58.2745 +                    `cd /etc && \
 58.2746 +                    /bin/ls *[_-]release *[_-]version 2>/dev/null | env -i sort | \
 58.2747 +                    sed -e '/^redhat-release$/d' -e '/^lsb-release$/d'; \
 58.2748 +                    echo redhat-release lsb-release`
 58.2749 +                do
 58.2750 +                    [ ".${tagfile}" = .x ] && continue
 58.2751 +                    [ ! -f "/etc/${tagfile}" ] && continue
 58.2752 +                    n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'`
 58.2753 +                    v=`(grep VERSION /etc/${tagfile}; cat /etc/${tagfile}) | grep '[0-9]' | sed -e 'q' |\
 58.2754 +                       sed -e 's/^/#/' \
 58.2755 +                           -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
 58.2756 +                           -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
 58.2757 +                           -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
 58.2758 +                           -e 's/^#.*$//'`
 58.2759 +                    case "`util_lower ${n}`" in
 58.2760 +                        redhat )
 58.2761 +                            if [ ".`egrep '(Red Hat Enterprise Linux|CentOS)' /etc/${tagfile}`" != . ]; then
 58.2762 +                                n="<R>ed <H>at <E>nterprise <L>inux"
 58.2763 +                            else
 58.2764 +                                n="<R>ed <H>at <L>inux"
 58.2765 +                            fi
 58.2766 +                            ;;
 58.2767 +                        debian             ) n="Debian[ GNU/Linux]"        ;;
 58.2768 +                        ubuntu             ) n="Ubuntu[ GNU/Linux]"        ;;
 58.2769 +                        fedora             ) n="<Fedora> Core[ GNU/Linux]" ;;
 58.2770 +                        suse               ) n="[Novell ]SUSE[ Linux]"     ;;
 58.2771 +                        mandrake*|mandriva ) n="Mandriva[ Linux]"          ;;
 58.2772 +                        gentoo             ) n="Gentoo[ GNU/Linux]"        ;;
 58.2773 +                        slackware          ) n="Slackware[ Linux]"         ;;
 58.2774 +                        turbolinux         ) n="TurboLinux"                ;;
 58.2775 +                        unitedlinux        ) n="UnitedLinux"               ;;
 58.2776 +                        *                  ) n="${n}[ GNU/Linux]"          ;;
 58.2777 +                    esac
 58.2778 +                    case "$n" in
 58.2779 +                        *"<"*">"* ) SP="$n <$v>" ;;
 58.2780 +                        *         ) SP="$n $v"   ;;
 58.2781 +                    esac
 58.2782 +                    break
 58.2783 +                done
 58.2784 +            fi
 58.2785 +            [ ".$SP" = . ] && SP="${ST}"
 58.2786 +            [ ".$SC" = . ] && SC="LSB"
 58.2787 +            ;;
 58.2788 +
 58.2789 +        #   Sun Solaris
 58.2790 +        *:SunOS:* )
 58.2791 +            #   determine architecture
 58.2792 +            AT="${UNAME_MACHINE}"
 58.2793 +            case "${AT}" in
 58.2794 +                i86pc )
 58.2795 +                    AT="iX86"
 58.2796 +                    case "`(/bin/isainfo -k) 2>&1`" in
 58.2797 +                        amd64 ) AT="AMD64" ;;
 58.2798 +                    esac
 58.2799 +                    ;;
 58.2800 +            esac
 58.2801 +            AP="${AT}"
 58.2802 +            case "${AP}" in
 58.2803 +                sun4[cdm] ) AP="SPARC32" ;;
 58.2804 +                sun4[uv]  ) AP="SPARC64" ;;
 58.2805 +                sun4*     ) AP="SPARC"   ;;
 58.2806 +            esac
 58.2807 +            AC="${AP}"
 58.2808 +            case "${AC}" in
 58.2809 +                SPARC* ) AC="SPARC" ;;
 58.2810 +            esac
 58.2811 +            #   determine system
 58.2812 +            ST="[Sun ]SunOS ${UNAME_RELEASE}"
 58.2813 +            v=`echo "${UNAME_RELEASE}" |\
 58.2814 +               sed -e 's;^4\.;1.;' \
 58.2815 +                   -e 's;^5\.\([0-6]\)[^0-9]*$;2.\1;' \
 58.2816 +                   -e 's;^5\.\([0-9][0-9]*\).*;\1;'`
 58.2817 +            SP="[Sun ]Solaris $v"
 58.2818 +            case "${UNAME_RELEASE}" in
 58.2819 +                4.* ) SC="4.3BSD" ;;
 58.2820 +                5.* ) SC="SVR4"   ;;
 58.2821 +            esac
 58.2822 +            ;;
 58.2823 +
 58.2824 +        #   SCO UnixWare
 58.2825 +        *:UnixWare:* )
 58.2826 +            #   determine architecture
 58.2827 +            AT="${UNAME_MACHINE}"
 58.2828 +            case "${AT}" in
 58.2829 +                i[3-6]86 | ix86at ) AT="iX86" ;;
 58.2830 +            esac
 58.2831 +            AP="${AT}"
 58.2832 +            #   determine system
 58.2833 +            v=`/sbin/uname -v`
 58.2834 +            ST="[SCO ]UnixWare ${v}"
 58.2835 +            SP="${ST}"
 58.2836 +            SC="SVR${UNAME_RELEASE}"
 58.2837 +            ;;
 58.2838 +
 58.2839 +        #   QNX
 58.2840 +        *:QNX:* )
 58.2841 +            #   determine architecture
 58.2842 +            AT="${UNAME_MACHINE}"
 58.2843 +            case "${AT}" in
 58.2844 +                x86pc ) AT="iX86" ;;
 58.2845 +            esac
 58.2846 +            AP="${AT}"
 58.2847 +            #   determine system
 58.2848 +            v="${UNAME_RELEASE}"
 58.2849 +            ST="QNX[ Neutrino RTOS] ${v}"
 58.2850 +            v=`echo "${v}" | sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;'`
 58.2851 +            SP="QNX[ Neutrino RTOS] ${v}"
 58.2852 +            SC="QNX"
 58.2853 +            ;;
 58.2854 +
 58.2855 +        #   SGI IRIX
 58.2856 +        *:IRIX*:* )
 58.2857 +            #   determine architecture
 58.2858 +            AT="${UNAME_MACHINE}"
 58.2859 +            AP="${AT}"
 58.2860 +            case "${AP}:${UNAME_SYSTEM}" in
 58.2861 +                IP*:IRIX64 ) AP="MIPS64" ;;
 58.2862 +                IP*:*      ) AP="MIPS"   ;;
 58.2863 +            esac
 58.2864 +            AC="${AP}"
 58.2865 +            #   determine system
 58.2866 +            v=`(/bin/uname -R || /bin/uname -r) 2>/dev/null | sed -e 's;[0-9.]* ;;'`
 58.2867 +            ST="[SGI ]IRIX ${v}"
 58.2868 +            v="${UNAME_RELEASE}"
 58.2869 +            SP="[SGI ]IRIX ${v}"
 58.2870 +            SC="4.2BSD/SVR3"
 58.2871 +            ;;
 58.2872 +
 58.2873 +        #   HP HP-UX
 58.2874 +        *:HP-UX:* )
 58.2875 +            #   determine architecture
 58.2876 +            AT="${UNAME_MACHINE}"
 58.2877 +            case "${AT}" in
 58.2878 +                ia64 ) AT="IA64" ;;
 58.2879 +                9000/[34]?? ) AT=M68K ;;
 58.2880 +                9000/[678][0-9][0-9])
 58.2881 +                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 58.2882 +                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 58.2883 +                    case "${sc_cpu_version}" in
 58.2884 +                        523 ) AT="HPPA1.0" ;;
 58.2885 +                        528 ) AT="HPPA1.1" ;;
 58.2886 +                        532 ) AT="HPPA2.0"
 58.2887 +                            case "${sc_kernel_bits}" in
 58.2888 +                                32 ) AT="${AT}n" ;;
 58.2889 +                                64 ) AT="${AT}w" ;;
 58.2890 +                            esac
 58.2891 +                            ;;
 58.2892 +                    esac
 58.2893 +                    ;;
 58.2894 +            esac
 58.2895 +            AP="${AT}"
 58.2896 +            case "${AP}" in
 58.2897 +                HPPA* ) AP="HPPA" ;;
 58.2898 +            esac
 58.2899 +            AC="${AP}"
 58.2900 +            #   determine system
 58.2901 +            v=`echo "${UNAME_RELEASE}" | sed -e 's;^[^0-9]*;;'`
 58.2902 +            ST="[HP ]<HP>-<UX ${v}>"
 58.2903 +            SP="${ST}"
 58.2904 +            case "${v}" in
 58.2905 +                10.*   ) SC="SVR4.2" ;;
 58.2906 +                [7-9]* ) SC="SVR4"   ;;
 58.2907 +            esac
 58.2908 +            ;;
 58.2909 +
 58.2910 +        #   HP Tru64 (OSF1)
 58.2911 +        *:OSF1:* )
 58.2912 +            #   determine architecture
 58.2913 +            AP="${UNAME_MACHINE}"
 58.2914 +            case "${AP}" in
 58.2915 +                alpha ) AP="Alpha" ;;
 58.2916 +            esac
 58.2917 +            alpha_type=`(/usr/sbin/psrinfo -v) 2>/dev/null |\
 58.2918 +                sed -n -e 's/^.*The alpha \([^ ][^ ]*\).*processor.*$/\1/p' | sed -e 'q'`
 58.2919 +            AT="${AP}${alpha_type}"
 58.2920 +            AC="${AP}"
 58.2921 +            #   determine system
 58.2922 +            v=`echo "${UNAME_RELEASE}" | sed -e 's;^[VTX];;'`
 58.2923 +            ST="[HP ]Tru64 ${v}"
 58.2924 +            SP="${ST}"
 58.2925 +            SC="OSF1"
 58.2926 +            ;;
 58.2927 +
 58.2928 +        #   IBM AIX
 58.2929 +        *:AIX:* )
 58.2930 +            #   determine architecture
 58.2931 +            cpu_arch=rs6000
 58.2932 +            if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then
 58.2933 +                cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 58.2934 +                if [ ".`/usr/sbin/lsattr -El ${cpu_id} | grep -i powerpc`" != . ]; then
 58.2935 +                    cpu_arch=powerpc
 58.2936 +                fi
 58.2937 +            elif [ -d /QOpenSys ]; then
 58.2938 +                #   IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment)
 58.2939 +                cpu_arch=powerpc
 58.2940 +            fi
 58.2941 +            if [ -x /usr/bin/oslevel ]; then
 58.2942 +                os_level=`/usr/bin/oslevel`
 58.2943 +            else
 58.2944 +                os_level="`uname -v`.`uname -r`"
 58.2945 +            fi
 58.2946 +            os_level=`echo "${os_level}" |\
 58.2947 +                      sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(\.[0-9][0-9]*\)\(.*\)$;<\1>\2[\3];' \
 58.2948 +                          -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(.*\)$;<\1>\2;'`
 58.2949 +            AT="${cpu_arch}"
 58.2950 +            AP="${AT}"
 58.2951 +            AC="${AP}"
 58.2952 +            #   determine system
 58.2953 +            ST="[IBM ]<AIX >${os_level}"
 58.2954 +            SP="${ST}"
 58.2955 +            case "${os_level}" in
 58.2956 +                [12]* ) SC="SVR2" ;;
 58.2957 +                *     ) SC="SVR4" ;;
 58.2958 +            esac
 58.2959 +            ;;
 58.2960 +
 58.2961 +        #   Apple Mac OS X (Darwin)
 58.2962 +        *:Darwin:* )
 58.2963 +            #   determine architecture
 58.2964 +            AT="`uname -p`"
 58.2965 +            case "${AT}" in
 58.2966 +                powerpc ) AT="PPC" ;;
 58.2967 +            esac
 58.2968 +            AP="${AT}"
 58.2969 +            case "${AP}" in
 58.2970 +                i?86 ) AP="iX86" ;;
 58.2971 +            esac
 58.2972 +            AC="${AP}"
 58.2973 +            #   determine system
 58.2974 +            unset v1; unset v2; unset v3
 58.2975 +            eval `echo "${UNAME_RELEASE}" |\
 58.2976 +                  sed -e 's/^/#/' \
 58.2977 +                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
 58.2978 +                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
 58.2979 +                      -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
 58.2980 +                      -e 's/^#.*$/v1="0"/'`
 58.2981 +            ST="[Apple ]<${UNAME_SYSTEM} ${v1}>${v2+.$v2}${v3+[.$v3]}"
 58.2982 +            SP="$ST"
 58.2983 +            v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion:[^0-9]*\([0-9][0-9.]*\).*$/\1/'`"
 58.2984 +            if [ ".$v" = . ]; then
 58.2985 +                for name in System Server; do
 58.2986 +                    if [ -f /System/Library/CoreServices/${name}Version.plist ]; then
 58.2987 +                        v=`(defaults read "/System/Library/CoreServices/${name}Version" "ProductVersion") 2>/dev/null`
 58.2988 +                        [ ".$v" != . ] && break
 58.2989 +                    fi
 58.2990 +                done
 58.2991 +            fi
 58.2992 +            if [ ".$v" != . ]; then
 58.2993 +                unset v1; unset v2; unset v3
 58.2994 +                eval `echo "${v}" |\
 58.2995 +                      sed -e 's/^/#/' \
 58.2996 +                          -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
 58.2997 +                          -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
 58.2998 +                          -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
 58.2999 +                          -e 's/^#.*$/v1="0"/'`
 58.3000 +                SP="[Apple ]Mac OS X ${v1}${v2+.$v2}${v3+[.$v3]}"
 58.3001 +            fi
 58.3002 +            SC="4.4BSD/Mach3.0"
 58.3003 +            ;;
 58.3004 +
 58.3005 +        #   TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO
 58.3006 +        # *:XXX:* )
 58.3007 +        #   ...
 58.3008 +        #   ;;
 58.3009 +
 58.3010 +        #   ...A STILL UNKNOWN PLATFORM...
 58.3011 +        * )
 58.3012 +            AT=`echo "${UNAME_MACHINE}" | sed -e "s; ;${opt_C};g"`
 58.3013 +            AP="${AT}"
 58.3014 +            AC="${AP}"
 58.3015 +            v=`echo "${UNAME_RELEASE}" |\
 58.3016 +               sed -e 's/^/#/' \
 58.3017 +                   -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
 58.3018 +                   -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
 58.3019 +                   -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
 58.3020 +                   -e 's/^#.*$/?/'`
 58.3021 +            ST="${UNAME_SYSTEM} ${v}"
 58.3022 +            SP="${ST}"
 58.3023 +            SC="${SP}"
 58.3024 +            ;;
 58.3025 +
 58.3026 +    esac
 58.3027 +
 58.3028 +    #   provide fallback values
 58.3029 +    [ ".$AT" = . ] && AT="${AP:-${AC}}"
 58.3030 +    [ ".$AP" = . ] && AP="${AT:-${AC}}"
 58.3031 +    [ ".$AC" = . ] && AC="${AP:-${AT}}"
 58.3032 +    [ ".$ST" = . ] && ST="${SP:-${SC}}"
 58.3033 +    [ ".$SP" = . ] && SP="${ST:-${SC}}"
 58.3034 +    [ ".$SC" = . ] && SC="${SP:-${ST}}"
 58.3035 +
 58.3036 +    #   support explicit enforced verbose/concise output
 58.3037 +    if [ ".$opt_v" = .yes ]; then
 58.3038 +        opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%[\1]/g'`
 58.3039 +    elif [ ".$opt_c" = .yes ]; then
 58.3040 +        opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%<\1>/g'`
 58.3041 +    fi
 58.3042 +
 58.3043 +    #   provide verbose and concise variants
 58.3044 +    AC_V=""; AC_N=""; AC_C=""
 58.3045 +    AP_V=""; AP_N=""; AP_C=""
 58.3046 +    AT_V=""; AT_N=""; AT_C=""
 58.3047 +    SC_V=""; SC_N=""; SC_C=""
 58.3048 +    SP_V=""; SP_N=""; SP_C=""
 58.3049 +    ST_V=""; ST_N=""; ST_C=""
 58.3050 +    for var_lc in at ap ac st sp sc; do
 58.3051 +        case "$opt_F" in
 58.3052 +            *"%[${val_lc}]"* | *"%{${val_lc}}"* | *"%${val_lc}"* | *"%<${val_lc}>"* )
 58.3053 +            var_uc=`util_upper "$var_lc"`
 58.3054 +            eval "val=\"\$${var_uc}\""
 58.3055 +            val_V=""; val_N=""; val_C=""
 58.3056 +            case "$opt_F" in
 58.3057 +                *"%[${var_lc}]"* )
 58.3058 +                    val_V=`echo ":$val" | \
 58.3059 +                           sed -e 's/^://' \
 58.3060 +                               -e 's;\[\([^]]*\)\];\1;g' \
 58.3061 +                               -e 's;<\([^>]*\)>;\1;g' \
 58.3062 +                               -e "s; ;§§;g" \
 58.3063 +                               -e "s;/;%%;g" \
 58.3064 +                               -e "s;§§;${opt_S};g" \
 58.3065 +                               -e "s;%%;${opt_C};g"`
 58.3066 +                    eval "${var_uc}_V=\"\${val_V}\""
 58.3067 +                    ;;
 58.3068 +            esac
 58.3069 +            case "$opt_F" in
 58.3070 +                *"%{${var_lc}}"* | *"%${var_lc}"* )
 58.3071 +                    val_N=`echo ":$val" | \
 58.3072 +                           sed -e 's/^://' \
 58.3073 +                               -e 's;\[\([^]]*\)\];;g' \
 58.3074 +                               -e 's;<\([^>]*\)>;\1;g' \
 58.3075 +                               -e "s; ;§§;g" \
 58.3076 +                               -e "s;/;%%;g" \
 58.3077 +                               -e "s;§§;${opt_S};g" \
 58.3078 +                               -e "s;%%;${opt_C};g"`
 58.3079 +                    eval "${var_uc}_N=\"\${val_N}\""
 58.3080 +                    ;;
 58.3081 +            esac
 58.3082 +            case "$opt_F" in
 58.3083 +                *"%<${var_lc}>"* )
 58.3084 +                    val_C=`echo ":$val" | \
 58.3085 +                           sed -e 's/^://' \
 58.3086 +                               -e 's;\[\([^]]*\)\];;g' \
 58.3087 +                               -e 's;[^<]*<\([^>]*\)>[^<]*;\1;g' \
 58.3088 +                               -e "s; ;§§;g" \
 58.3089 +                               -e "s;/;%%;g" \
 58.3090 +                               -e "s;§§;${opt_S};g" \
 58.3091 +                               -e "s;%%;${opt_C};g"`
 58.3092 +                    eval "${var_uc}_C=\"\${val_C}\""
 58.3093 +                    ;;
 58.3094 +            esac
 58.3095 +            ;;
 58.3096 +        esac
 58.3097 +    done
 58.3098 +
 58.3099 +    #   create output string
 58.3100 +    output=`echo ":$opt_F" |\
 58.3101 +            sed -e "s/^://" \
 58.3102 +                -e "s;%\\[ac\\];${AC_V};g" \
 58.3103 +                -e "s;%{ac};${AC_N};g" \
 58.3104 +                -e "s;%ac;${AC_N};g" \
 58.3105 +                -e "s;%<ac>;${AC_C};g" \
 58.3106 +                -e "s;%\\[ap\\];${AP_V};g" \
 58.3107 +                -e "s;%{ap};${AP_N};g" \
 58.3108 +                -e "s;%ap;${AP_N};g" \
 58.3109 +                -e "s;%<ap>;${AP_C};g" \
 58.3110 +                -e "s;%\\[at\\];${AT_V};g" \
 58.3111 +                -e "s;%{at};${AT_N};g" \
 58.3112 +                -e "s;%at;${AT_N};g" \
 58.3113 +                -e "s;%<at>;${AT_C};g" \
 58.3114 +                -e "s;%\\[sc\\];${SC_V};g" \
 58.3115 +                -e "s;%{sc};${SC_N};g" \
 58.3116 +                -e "s;%sc;${SC_N};g" \
 58.3117 +                -e "s;%<sc>;${SC_C};g" \
 58.3118 +                -e "s;%\\[sp\\];${SP_V};g" \
 58.3119 +                -e "s;%{sp};${SP_N};g" \
 58.3120 +                -e "s;%sp;${SP_N};g" \
 58.3121 +                -e "s;%<sp>;${SP_C};g" \
 58.3122 +                -e "s;%\\[st\\];${ST_V};g" \
 58.3123 +                -e "s;%{st};${ST_N};g" \
 58.3124 +                -e "s;%st;${ST_N};g" \
 58.3125 +                -e "s;%<st>;${ST_C};g" \
 58.3126 +                -e 's/\\\\n/^/g' |\
 58.3127 +             tr '^' '\012'`
 58.3128 +
 58.3129 +    #   support lower/upper-case mapping
 58.3130 +    if [ ".$opt_L" = .yes ]; then
 58.3131 +        output=`util_lower "$output"`
 58.3132 +    elif [ ".$opt_U" = .yes ]; then
 58.3133 +        output=`util_upper "$output"`
 58.3134 +    fi
 58.3135 +
 58.3136 +    #   display output string
 58.3137 +    if [ ".$opt_n" = .yes ]; then
 58.3138 +        echo . | awk '{ printf("%s", output); }' output="$output"
 58.3139 +    else
 58.3140 +        echo "$output"
 58.3141 +    fi
 58.3142 +
 58.3143 +    shtool_exit 0
 58.3144 +    ;;
 58.3145 +
 58.3146 +arx )
 58.3147 +    ##
 58.3148 +    ##  arx -- Extended archive command
 58.3149 +    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.3150 +    ##
 58.3151 +
 58.3152 +    ar_prg="$opt_C"
 58.3153 +    ar_cmd="$1"; shift
 58.3154 +    archive="$1"; shift
 58.3155 +    files="$*"
 58.3156 +
 58.3157 +    #   walk through the file list and expand archives members
 58.3158 +    ar_tmpdir=`echo $archive | sed -e 's;[^/]*$;.arx;'`
 58.3159 +    nfiles=''
 58.3160 +    if [ ".$files" != . ]; then
 58.3161 +        for file in $files; do
 58.3162 +            if [ ! -f $file ]; then
 58.3163 +                echo "$msgprefix:Error: input file not found: $file" 1>&2
 58.3164 +                shtool_exit 1
 58.3165 +            fi
 58.3166 +            case $file in
 58.3167 +                *.a )
 58.3168 +                    if [ ! -d $ar_tmpdir ]; then
 58.3169 +                        if [ ".$opt_t" = .yes ]; then
 58.3170 +                            echo "mkdir $ar_tmpdir" 1>&2
 58.3171 +                        fi
 58.3172 +                        mkdir $ar_tmpdir
 58.3173 +                    fi
 58.3174 +                    case $ar_tmpdir in
 58.3175 +                         .arx )
 58.3176 +                             from="../$file"
 58.3177 +                             ;;
 58.3178 +                         * )
 58.3179 +                             dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'`
 58.3180 +                             base=`echo $file | sed -e 's;.*/\([^/]*\)$;\1;'`
 58.3181 +                             from="`cd $dir; pwd`/$base"
 58.3182 +                             ;;
 58.3183 +                    esac
 58.3184 +                    if [ ".$opt_t" = .yes ]; then
 58.3185 +                        echo "(cd $ar_tmpdir && $ar_prg x $from)" 1>&2
 58.3186 +                    fi
 58.3187 +                    (cd $ar_tmpdir && eval $ar_prg x $from)
 58.3188 +                    if [ $? -ne 0 ]; then
 58.3189 +                        echo "$msgprefix:Error: member extraction failed for archive: $file" 1>&2
 58.3190 +                        shtool_exit 1
 58.3191 +                    fi
 58.3192 +                    for member in - `eval $ar_prg t $file | sed -e '/_\.SYMDEF/d'`; do
 58.3193 +                        [ ".$member" = .- ] && continue
 58.3194 +                        nfiles="$nfiles $ar_tmpdir/$member"
 58.3195 +                    done
 58.3196 +                    ;;
 58.3197 +                * )
 58.3198 +                    nfiles="$nfiles $file"
 58.3199 +                    ;;
 58.3200 +            esac
 58.3201 +        done
 58.3202 +    fi
 58.3203 +
 58.3204 +    #   run the final archive command
 58.3205 +    if [ ".$opt_t" = .yes ]; then
 58.3206 +        echo "$ar_prg $ar_cmd $archive $nfiles" 1>&2
 58.3207 +    fi
 58.3208 +    eval $ar_prg $ar_cmd $archive $nfiles
 58.3209 +    if [ $? -ne 0 ]; then
 58.3210 +        echo "$msgprefix:Error: archive command failed" 1>&2
 58.3211 +        shtool_exit $?
 58.3212 +    fi
 58.3213 +
 58.3214 +    #   cleanup and die gracefully
 58.3215 +    if [ -d $ar_tmpdir ]; then
 58.3216 +        if [ ".$opt_t" = .yes ]; then
 58.3217 +            echo "rm -rf $ar_tmpdir" 1>&2
 58.3218 +        fi
 58.3219 +        rm -rf $ar_tmpdir
 58.3220 +    fi
 58.3221 +
 58.3222 +    shtool_exit 0
 58.3223 +    ;;
 58.3224 +
 58.3225 +slo )
 58.3226 +    ##
 58.3227 +    ##  slo -- Separate linker options by library class
 58.3228 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.3229 +    ##
 58.3230 +
 58.3231 +    DIFS="$IFS"
 58.3232 +
 58.3233 +    #   parse out -L and -l options from command line
 58.3234 +    DIRS=''
 58.3235 +    LIBS=''
 58.3236 +    ARGV=''
 58.3237 +    optprev=''
 58.3238 +    for opt
 58.3239 +    do
 58.3240 +        #   concatenate with previous option if exists
 58.3241 +        if [ ".$optprev" != . ]; then
 58.3242 +            opt="${optprev}${opt}";
 58.3243 +            optprev=''
 58.3244 +        fi
 58.3245 +        #   remember options for arg if used stand-alone
 58.3246 +        if [ ".$opt" = ".-L" ] || [ ".$opt" = ".-l" ]; then
 58.3247 +            optprev="$opt"
 58.3248 +            continue;
 58.3249 +        fi
 58.3250 +        #   split argument into option plus option argument
 58.3251 +        arg="`echo $opt | cut -c3-`"
 58.3252 +        opt="`echo $opt | cut -c1-2`"
 58.3253 +        #   store into containers
 58.3254 +        case $opt in
 58.3255 +            -L) DIRS="$DIRS:$arg" ;;
 58.3256 +            -l) LIBS="$LIBS:$arg" ;;
 58.3257 +             *) ARGV="$ARGV $opt" ;;
 58.3258 +        esac
 58.3259 +    done
 58.3260 +
 58.3261 +    #   set linker default directories
 58.3262 +    DIRS_DEFAULT='/lib:/usr/lib'
 58.3263 +    if [ ".$LD_LIBRARY_PATH" != . ]; then
 58.3264 +        DIRS_DEFAULT="$DIRS_DEFAULT:$LD_LIBRARY_PATH"
 58.3265 +    fi
 58.3266 +
 58.3267 +    #   sort options by class
 58.3268 +    DIRS_OBJ=''
 58.3269 +    LIBS_OBJ=''
 58.3270 +    DIRS_PIC=''
 58.3271 +    LIBS_PIC=''
 58.3272 +    DIRS_DSO=''
 58.3273 +    LIBS_DSO=''
 58.3274 +
 58.3275 +    #    for each library...
 58.3276 +    OIFS="$IFS"; IFS=':'
 58.3277 +    for lib in $LIBS; do
 58.3278 +        [ ".$lib" = . ] && continue
 58.3279 +
 58.3280 +        found='no'
 58.3281 +        found_indefdir='no'
 58.3282 +        found_type=''
 58.3283 +        found_dir=''
 58.3284 +
 58.3285 +        #    for each directory...
 58.3286 +        OIFS2="$IFS"; IFS=":$DIFS"
 58.3287 +        for dir in ${DIRS} switch-to-defdirs ${DIRS_DEFAULT}; do
 58.3288 +            [ ".$dir" = . ] && continue
 58.3289 +            [ ".$dir" = .switch-to-defdirs ] && found_indefdir=yes
 58.3290 +            [ ! -d $dir ] && continue
 58.3291 +
 58.3292 +            #    search the file
 58.3293 +            OIFS3="$IFS"; IFS="$DIFS"
 58.3294 +            for file in '' `cd $dir && env -i /bin/ls lib${lib}.* 2>/dev/null`; do
 58.3295 +                 [ ".$file" = . ] && continue
 58.3296 +                 case $file in
 58.3297 +                     *.so|*.so.[0-9]*|*.sl|*.sl.[0-9]* )
 58.3298 +                          found=yes;
 58.3299 +                          found_type=DSO;
 58.3300 +                          break
 58.3301 +                          ;;
 58.3302 +                     *.lo|*.la )
 58.3303 +                          found=yes;
 58.3304 +                          found_type=PIC
 58.3305 +                          ;;
 58.3306 +                     *.a )
 58.3307 +                          if [ ".$found_type" = . ]; then
 58.3308 +                              found=yes
 58.3309 +                              found_type=OBJ
 58.3310 +                          fi
 58.3311 +                          ;;
 58.3312 +                 esac
 58.3313 +            done
 58.3314 +            IFS="$OIFS3"
 58.3315 +            if [ ".$found" = .yes ]; then
 58.3316 +                found_dir="$dir"
 58.3317 +                break
 58.3318 +            fi
 58.3319 +        done
 58.3320 +        IFS="$OIFS2"
 58.3321 +
 58.3322 +        if [ ".$found" = .yes ]; then
 58.3323 +            if [ ".$found_indefdir" != .yes ]; then
 58.3324 +                eval "dirlist=\"\${DIRS_${found_type}}:\""
 58.3325 +                case "$dirlist" in
 58.3326 +                    *:$found_dir:* ) ;;
 58.3327 +                    * ) eval "DIRS_${found_type}=\"\$DIRS_${found_type}:${found_dir}\"" ;;
 58.3328 +                esac
 58.3329 +                eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\""
 58.3330 +            else
 58.3331 +                eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\""
 58.3332 +            fi
 58.3333 +        else
 58.3334 +            LIBS_OBJ="$LIBS_OBJ:$lib"
 58.3335 +            #dirlist="`echo $DIRS $DIRS_DEFAULT | sed -e 's/:/ /g'`"
 58.3336 +            #echo "slo:Warning: library \"$lib\" not found in any of the following dirs:" 2>&1
 58.3337 +            #echo "slo:Warning: $dirlist" 1>&1
 58.3338 +        fi
 58.3339 +    done
 58.3340 +    IFS="$OIFS"
 58.3341 +
 58.3342 +    #   also pass-through unused dirs even if it's useless
 58.3343 +    OIFS="$IFS"; IFS=':'
 58.3344 +    for dir in $DIRS; do
 58.3345 +        dirlist="${DIRS_OBJ}:${DIRS_PIC}:${DIRS_DSO}:"
 58.3346 +        case "$dirlist" in
 58.3347 +            *:$dir:* ) ;;
 58.3348 +            * ) DIRS_OBJ="$DIRS_OBJ:$dir" ;;
 58.3349 +        esac
 58.3350 +    done
 58.3351 +    IFS="$OIFS"
 58.3352 +
 58.3353 +    #   reassemble the options but separated by type
 58.3354 +    for type in OBJ PIC DSO; do
 58.3355 +        OIFS="$IFS"; IFS=':'
 58.3356 +        eval "libs=\"\$LIBS_${type}\""
 58.3357 +        opts=''
 58.3358 +        for lib in $libs; do
 58.3359 +            [ ".$lib" = . ] && continue
 58.3360 +            opts="$opts -l$lib"
 58.3361 +        done
 58.3362 +        eval "LIBS_${type}=\"$opts\""
 58.3363 +
 58.3364 +        eval "dirs=\"\$DIRS_${type}\""
 58.3365 +        opts=''
 58.3366 +        for dir in $dirs; do
 58.3367 +            [ ".$dir" = . ] && continue
 58.3368 +            opts="$opts -L$dir"
 58.3369 +        done
 58.3370 +        eval "DIRS_${type}=\"$opts\""
 58.3371 +        IFS="$OIFS"
 58.3372 +    done
 58.3373 +
 58.3374 +    #   give back results
 58.3375 +    for var in ARGV DIRS_OBJ LIBS_OBJ DIRS_PIC LIBS_PIC DIRS_DSO LIBS_DSO; do
 58.3376 +        eval "val=\"\$${var}\""
 58.3377 +        val="`echo $val | sed -e 's/^ *//'`"
 58.3378 +        echo "${opt_p}${var}=\"${val}\""
 58.3379 +    done
 58.3380 +
 58.3381 +    shtool_exit 0
 58.3382 +    ;;
 58.3383 +
 58.3384 +scpp )
 58.3385 +    ##
 58.3386 +    ##  scpp -- Sharing C Pre-Processor
 58.3387 +    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.3388 +    ##
 58.3389 +
 58.3390 +    srcs="$*"
 58.3391 +    output="${opt_o}.n"
 58.3392 +
 58.3393 +    #   find a reasonable Awk
 58.3394 +    awk=''
 58.3395 +    paths=`echo $PATH |\
 58.3396 +           sed -e 's%/*:%:%g' -e 's%/$%%' \
 58.3397 +               -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
 58.3398 +               -e 's/:/ /g'`
 58.3399 +    for name in gawk nawk awk; do
 58.3400 +        for path in $paths; do
 58.3401 +            if [ -r "$path/$name" ]; then
 58.3402 +                awk="$path/$name"
 58.3403 +                break
 58.3404 +            fi
 58.3405 +        done
 58.3406 +        if [ ".$awk" != . ]; then
 58.3407 +            break
 58.3408 +        fi
 58.3409 +    done
 58.3410 +    if [ ".$awk" = . ]; then
 58.3411 +        echo "$msgprefix:Error: cannot find a reasonable Awk" 1>&2
 58.3412 +        shtool_exit 1
 58.3413 +    fi
 58.3414 +
 58.3415 +    #   parse source file(s)
 58.3416 +    if [ ".$opt_v" = .yes ]; then
 58.3417 +        echo "Parsing:" | $awk '{ printf("%s", $0); }' 1>&2
 58.3418 +    fi
 58.3419 +    for src in $srcs; do
 58.3420 +        if [ ".$opt_v" = .yes ]; then
 58.3421 +            echo $src | $awk '{ printf(" %s", $0); }' 1>&2
 58.3422 +        fi
 58.3423 +        if [ ".$opt_f" != . ]; then
 58.3424 +            inputcmd="sed"
 58.3425 +            OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_f; IFS="$OIFS"
 58.3426 +            for e
 58.3427 +            do
 58.3428 +                inputcmd="$inputcmd -e '$e'"
 58.3429 +            done
 58.3430 +            inputcmd="$inputcmd '$src'"
 58.3431 +        else
 58.3432 +            inputcmd="cat '$src'"
 58.3433 +        fi
 58.3434 +        eval $inputcmd |\
 58.3435 +        $awk '
 58.3436 +           BEGIN {
 58.3437 +               ln    = 0;
 58.3438 +               fln   = 0;
 58.3439 +               level = 0;
 58.3440 +               mode  = "";
 58.3441 +               store = "";
 58.3442 +           }
 58.3443 +           {
 58.3444 +               ln++;
 58.3445 +           }
 58.3446 +           /^#if.*/ {
 58.3447 +               level++;
 58.3448 +           }
 58.3449 +           /^#if [a-zA-Z_][a-zA-Z0-9_]* *$/ {
 58.3450 +               if ($2 == define) {
 58.3451 +                   mode = "D";
 58.3452 +                   printf("D:#line %d \"%s\"\n", ln, src);
 58.3453 +                   next;
 58.3454 +               }
 58.3455 +           }
 58.3456 +           /^#endif.*/ {
 58.3457 +               level--;
 58.3458 +               if (mode == "D" && level == 0) {
 58.3459 +                   mode = "";
 58.3460 +                   next;
 58.3461 +               }
 58.3462 +           }
 58.3463 +           /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ {
 58.3464 +               if ($1 == class) {
 58.3465 +                   printf("V:#line %d \"%s\"\n", ln, src);
 58.3466 +                   printf("V:%s\n", $0);
 58.3467 +                   printf("J:%s\n", $0);
 58.3468 +                   next;
 58.3469 +               }
 58.3470 +           }
 58.3471 +           /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ {
 58.3472 +               if ($1 == class) {
 58.3473 +                   printf("V:#line %d \"%s\"\n", ln, src);
 58.3474 +                   printf("V:%s\n", $0);
 58.3475 +                   printf("J:%s\n", $0);
 58.3476 +                   next;
 58.3477 +               }
 58.3478 +           }
 58.3479 +           /^[a-zA-Z_][a-zA-Z0-9_]*/ {
 58.3480 +               if ($1 == class) {
 58.3481 +                   fln = ln;
 58.3482 +                   store = $0;
 58.3483 +                   mode = "F";
 58.3484 +                   next;
 58.3485 +               }
 58.3486 +           }
 58.3487 +           /^\{ *$/ {
 58.3488 +               if (mode == "F") {
 58.3489 +                   printf("F:#line %d \"%s\"\n", fln, src);
 58.3490 +                   printf("F:%s;\n", store);
 58.3491 +                   printf("I:%s;\n", store);
 58.3492 +                   store = "";
 58.3493 +                   mode = "";
 58.3494 +                   next;
 58.3495 +               }
 58.3496 +           }
 58.3497 +           {
 58.3498 +               if (mode == "D")
 58.3499 +                   printf("D:%s\n", $0);
 58.3500 +               else if (mode == "F")
 58.3501 +                   store = store " " $0;
 58.3502 +           }
 58.3503 +        ' "src=$src" "define=$opt_D" "class=$opt_C" >>$tmpfile
 58.3504 +    done
 58.3505 +    if [ ".$opt_v" = .yes ]; then
 58.3506 +        echo "" 1>&2
 58.3507 +    fi
 58.3508 +
 58.3509 +    #   start generating output header
 58.3510 +    echo "/* $opt_o -- autogenerated from $opt_t, DO NOT EDIT! */" >$output
 58.3511 +    echo "#line 1 \"$opt_t\"" >>$output
 58.3512 +    sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd' |\
 58.3513 +    sed -e "/^${opt_M} *\$/d" >>$output
 58.3514 +
 58.3515 +    #   merge in the define blocks
 58.3516 +    grep '^D:' $tmpfile | sed -e 's/^D://' >>$output
 58.3517 +
 58.3518 +    #   generate standard prolog
 58.3519 +    echo "#line 1 \"_ON_THE_FLY_\"" >>$output
 58.3520 +    echo "" >>$output
 58.3521 +    echo "/* make sure the scpp source extensions are skipped */" >>$output
 58.3522 +    echo "#define $opt_D 0" >>$output
 58.3523 +    echo "#define $opt_C /**/" >>$output
 58.3524 +
 58.3525 +    #   generate namespace hiding for variables
 58.3526 +    echo "" >>$output
 58.3527 +    echo "/* move intern variables to hidden namespace */" >>$output
 58.3528 +    grep '^J:' $tmpfile | sed >>$output \
 58.3529 +        -e 's/^J://' \
 58.3530 +        -e 's/  */ /g' \
 58.3531 +        -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\];.*$/#define \1 __\1/' \
 58.3532 +        -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] =.*$/#define \1 __\1/' \
 58.3533 +        -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\);.*$/#define \1 __\1/' \
 58.3534 +        -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) =.*$/#define \1 __\1/'
 58.3535 +
 58.3536 +    #   generate namespace hiding for functions
 58.3537 +    echo "" >>$output
 58.3538 +    echo "/* move intern functions to hidden namespace */" >>$output
 58.3539 +    grep '^I:' $tmpfile | sed >>$output \
 58.3540 +        -e 's/^I://' \
 58.3541 +        -e 's/\([ (]\) */\1/g' \
 58.3542 +        -e 's/ *\([),]\)/\1/g' \
 58.3543 +        -e 's/^[^(]*[ *]\([a-zA-Z0-9_]*\)(.*$/#define \1 __\1/'
 58.3544 +
 58.3545 +    #   generate prototypes for variables
 58.3546 +    echo "" >>$output
 58.3547 +    echo "/* prototypes for intern variables */" >>$output
 58.3548 +    grep '^V:' $tmpfile | sed >>$output \
 58.3549 +        -e 's/^V://' \
 58.3550 +        -e 's/  */ /g' \
 58.3551 +        -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\);.*$/\1;/' \
 58.3552 +        -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\) =.*$/\1;/' \
 58.3553 +        -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\);.*$/\1;/' \
 58.3554 +        -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\) =.*$/\1;/' \
 58.3555 +        -e 's/ ;/;/g' \
 58.3556 +        -e "s/^$opt_C /extern /"
 58.3557 +
 58.3558 +    #   generate prototypes for functions
 58.3559 +    echo "" >>$output
 58.3560 +    echo "/* prototypes for intern functions */" >>$output
 58.3561 +    grep '^F:' $tmpfile | sed >>$output \
 58.3562 +        -e 's/^F://' \
 58.3563 +        -e 's/\([ (]\) */\1/g' \
 58.3564 +        -e 's/ *\([),]\)/\1/g' \
 58.3565 +        -e 's/\([* ]\)[a-zA-Z0-9_]*,/\1,/g' \
 58.3566 +        -e 's/\([* ]\)[a-zA-Z0-9_]*);/\1);/g' \
 58.3567 +        -e 's/(\*[a-zA-Z0-9_]*)(/(*)(/g' \
 58.3568 +        -e 's/\([ (]\) */\1/g' \
 58.3569 +        -e 's/ *\([),]\)/\1/g' \
 58.3570 +        -e "s/^$opt_C /extern /"
 58.3571 +
 58.3572 +    #   finish generating output header
 58.3573 +    n=`(echo ''; sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd') |\
 58.3574 +       wc -l | sed -e 's;^ *\([0-9]*\) *$;\1;'`
 58.3575 +    echo "#line $n \"$opt_t\"" >>$output
 58.3576 +    sed <$opt_t -e "/^${opt_M} *\$/,\$p" -e 'd' |\
 58.3577 +    sed -e "/^${opt_M} *\$/d" >>$output
 58.3578 +
 58.3579 +    #   create final output file
 58.3580 +    if [ -f $opt_o ]; then
 58.3581 +        if [ ".$opt_p" = .yes ]; then
 58.3582 +            grep -v '^#line' $opt_o  >$tmpfile.o
 58.3583 +            grep -v '^#line' $output >$tmpfile.n
 58.3584 +            out_old="$tmpfile.o"
 58.3585 +            out_new="$tmpfile.n"
 58.3586 +        else
 58.3587 +            out_old="$opt_o"
 58.3588 +            out_new="$output"
 58.3589 +        fi
 58.3590 +        if cmp -s $out_old $out_new; then
 58.3591 +            :
 58.3592 +        else
 58.3593 +            cp $output $opt_o
 58.3594 +        fi
 58.3595 +    else
 58.3596 +        cp $output $opt_o
 58.3597 +    fi
 58.3598 +    rm -f $output
 58.3599 +    rm -f $tmpfile $tmpfile.* >/dev/null 2>&1
 58.3600 +
 58.3601 +    shtool_exit 0
 58.3602 +    ;;
 58.3603 +
 58.3604 +version )
 58.3605 +    ##
 58.3606 +    ##  version -- Maintain a version information file
 58.3607 +    ##  Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.3608 +    ##
 58.3609 +
 58.3610 +    file="$1"
 58.3611 +
 58.3612 +    #   determine prefix and name
 58.3613 +    name="$opt_n"
 58.3614 +    prefix="$opt_p"
 58.3615 +
 58.3616 +    #   determine current version
 58.3617 +    triple="$opt_s"
 58.3618 +    if [ ".$triple" != . ]; then
 58.3619 +        #   use given triple
 58.3620 +        if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then
 58.3621 +            echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2
 58.3622 +            shtool_exit 1
 58.3623 +        fi
 58.3624 +        eval `echo $triple |\
 58.3625 +              sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\
 58.3626 +              ver="\1";rev="\2";typ="\3";lev="\4"%'`
 58.3627 +        tim=calc
 58.3628 +    elif [ -r $file ]; then
 58.3629 +        #   determine triple from given file
 58.3630 +        eval `grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\
 58.3631 +              sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\
 58.3632 +              ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%' -e 'q'`
 58.3633 +    else
 58.3634 +        #   intialise to first version
 58.3635 +        ver=0
 58.3636 +        rev=1
 58.3637 +        typ=.
 58.3638 +        lev=0
 58.3639 +        tim=calc
 58.3640 +    fi
 58.3641 +
 58.3642 +    #   determine new version in batch
 58.3643 +    if [ ".$opt_i" != . ]; then
 58.3644 +        case $opt_i in
 58.3645 +            v ) ver=`expr $ver + 1`
 58.3646 +                rev=0
 58.3647 +                lev=0
 58.3648 +                ;;
 58.3649 +            r ) rev=`expr $rev + 1`
 58.3650 +                lev=0
 58.3651 +                ;;
 58.3652 +            l ) lev=`expr $lev + 1`
 58.3653 +                ;;
 58.3654 +            * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2
 58.3655 +                shtool_exit 1
 58.3656 +                ;;
 58.3657 +        esac
 58.3658 +        tim=calc
 58.3659 +    fi
 58.3660 +
 58.3661 +    #   determine new version interactively
 58.3662 +    if [ ".$opt_e" = .yes ]; then
 58.3663 +        echo "old version: ${ver}.${rev}${typ}${lev}"
 58.3664 +        while [ 1 ]; do
 58.3665 +            echo dummy | awk '{ printf("new version: "); }'
 58.3666 +            read triple
 58.3667 +            case $triple in
 58.3668 +                [0-9]*.[0-9]*[sabp.][0-9]* )
 58.3669 +                    ;;
 58.3670 +                * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2
 58.3671 +                    continue
 58.3672 +                    ;;
 58.3673 +            esac
 58.3674 +            break
 58.3675 +        done
 58.3676 +        eval `echo $triple |\
 58.3677 +              sed -e 's%^\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\)$%\
 58.3678 +              ver="\1";rev="\2";typ="\3";lev="\4"%'`
 58.3679 +        tim=calc
 58.3680 +    fi
 58.3681 +
 58.3682 +    #   determine hexadecimal and libtool value of version
 58.3683 +    case $typ in
 58.3684 +        a     ) typnum=0;  levnum=$lev ;;
 58.3685 +        b     ) typnum=1;  levnum=$lev ;;
 58.3686 +        p | . ) typnum=2;  levnum=$lev ;;
 58.3687 +        s     ) typnum=15; levnum=255  ;; # snapshots are special
 58.3688 +    esac
 58.3689 +    hex=`echo "$ver:$rev:$typnum:$levnum" |\
 58.3690 +         awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\
 58.3691 +         tr 'abcdef' 'ABCDEF'`
 58.3692 +    ltv=`echo "$ver:$rev:$typnum:$levnum" |\
 58.3693 +         awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'`
 58.3694 +
 58.3695 +    #   determine date
 58.3696 +    if [ ".$tim" = .calc ]; then
 58.3697 +        day=`date '+%d'`
 58.3698 +        month=`date '+%m'`
 58.3699 +        year=`date '+%Y' 2>/dev/null`
 58.3700 +        if [ ".$time_year" = . ]; then
 58.3701 +            year=`date '+%y'`
 58.3702 +            case $year in
 58.3703 +                [5-9][0-9]) year="19$year" ;;
 58.3704 +                [0-4][0-9]) year="20$year" ;;
 58.3705 +            esac
 58.3706 +        fi
 58.3707 +        case $month in
 58.3708 +            1|01) month='Jan' ;;
 58.3709 +            2|02) month='Feb' ;;
 58.3710 +            3|03) month='Mar' ;;
 58.3711 +            4|04) month='Apr' ;;
 58.3712 +            5|05) month='May' ;;
 58.3713 +            6|06) month='Jun' ;;
 58.3714 +            7|07) month='Jul' ;;
 58.3715 +            8|08) month='Aug' ;;
 58.3716 +            9|09) month='Sep' ;;
 58.3717 +              10) month='Oct' ;;
 58.3718 +              11) month='Nov' ;;
 58.3719 +              12) month='Dec' ;;
 58.3720 +        esac
 58.3721 +        tim="${day}-${month}-${year}"
 58.3722 +    fi
 58.3723 +
 58.3724 +    #   perform result actions
 58.3725 +    mode=show
 58.3726 +    if [ ".$opt_i" != . ]; then
 58.3727 +        mode=edit
 58.3728 +    elif [ ".$opt_e" = .yes ]; then
 58.3729 +        mode=edit
 58.3730 +    elif [ ".$opt_s" != . ]; then
 58.3731 +        mode=edit
 58.3732 +    fi
 58.3733 +    if [ ".$mode" = .show ]; then
 58.3734 +        #   just display the current version
 58.3735 +        case $opt_d in
 58.3736 +            short )
 58.3737 +                echo "${ver}.${rev}${typ}${lev}"
 58.3738 +                ;;
 58.3739 +            long )
 58.3740 +                echo "${ver}.${rev}${typ}${lev} ($tim)"
 58.3741 +                ;;
 58.3742 +            libtool )
 58.3743 +                echo "${ltv}"
 58.3744 +                ;;
 58.3745 +            hex )
 58.3746 +                echo "${hex}"
 58.3747 +                ;;
 58.3748 +            * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2
 58.3749 +                shtool_exit 1
 58.3750 +                ;;
 58.3751 +        esac
 58.3752 +    else
 58.3753 +        #   update the version file
 58.3754 +
 58.3755 +        #   pre-generate various strings
 58.3756 +        triple="${ver}.${rev}${typ}${lev}"
 58.3757 +        vHex="$hex"
 58.3758 +        vShort="${triple}"
 58.3759 +        vLong="${triple} (${tim})"
 58.3760 +        vTeX="This is ${name}, Version ${triple} (${tim})"
 58.3761 +        vGNU="${name} ${triple} (${tim})"
 58.3762 +        vWeb="${name}/${triple}"
 58.3763 +        vSCCS="@(#)${name} ${triple} (${tim})"
 58.3764 +        vRCS="\$Id: ${name} ${triple} (${tim}) \$"
 58.3765 +
 58.3766 +        #   determine string out of filename
 58.3767 +        #   (do NOT try to optimize this in any way because of portability)
 58.3768 +        filestr=`util_upper "$file" | tr './%+' '____' | sed -e 's/-/_/g'`
 58.3769 +
 58.3770 +        #   generate uppercase prefix
 58.3771 +        prefixupper=`util_upper "$prefix"`
 58.3772 +
 58.3773 +        #   create the version file according the the selected language
 58.3774 +        echo "new version: ${vLong}"
 58.3775 +
 58.3776 +        cp /dev/null $file
 58.3777 +        case $opt_l in
 58.3778 +            txt )
 58.3779 +                echo >>$file ""
 58.3780 +                echo >>$file "  ${file} -- Version Information for ${name} (syntax: Text)"
 58.3781 +                echo >>$file "  [automatically generated and maintained by GNU shtool]"
 58.3782 +                echo >>$file ""
 58.3783 +                echo >>$file "  $vTeX"
 58.3784 +                echo >>$file ""
 58.3785 +                ;;
 58.3786 +            c )
 58.3787 +                echo >>$file "/*"
 58.3788 +                echo >>$file "**  ${file} -- Version Information for ${name} (syntax: C/C++)"
 58.3789 +                echo >>$file "**  [automatically generated and maintained by GNU shtool]"
 58.3790 +                echo >>$file "*/"
 58.3791 +                echo >>$file ""
 58.3792 +                echo >>$file "#ifdef _${filestr}_AS_HEADER_"
 58.3793 +                echo >>$file ""
 58.3794 +                echo >>$file "#ifndef _${filestr}_"
 58.3795 +                echo >>$file "#define _${filestr}_"
 58.3796 +                echo >>$file ""
 58.3797 +                echo >>$file "#define ${prefixupper}VERSION ${vHex}"
 58.3798 +                echo >>$file ""
 58.3799 +                echo >>$file "typedef struct {"
 58.3800 +                echo >>$file "    const int   v_hex;"
 58.3801 +                echo >>$file "    const char *v_short;"
 58.3802 +                echo >>$file "    const char *v_long;"
 58.3803 +                echo >>$file "    const char *v_tex;"
 58.3804 +                echo >>$file "    const char *v_gnu;"
 58.3805 +                echo >>$file "    const char *v_web;"
 58.3806 +                echo >>$file "    const char *v_sccs;"
 58.3807 +                echo >>$file "    const char *v_rcs;"
 58.3808 +                echo >>$file "} ${prefix}version_t;"
 58.3809 +                echo >>$file ""
 58.3810 +                echo >>$file "extern ${prefix}version_t ${prefix}version;"
 58.3811 +                echo >>$file ""
 58.3812 +                echo >>$file "#endif /* _${filestr}_ */"
 58.3813 +                echo >>$file ""
 58.3814 +                echo >>$file "#else /* _${filestr}_AS_HEADER_ */"
 58.3815 +                echo >>$file ""
 58.3816 +                echo >>$file "#define _${filestr}_AS_HEADER_"
 58.3817 +                echo >>$file "#include \"${file}\""
 58.3818 +                echo >>$file "#undef  _${filestr}_AS_HEADER_"
 58.3819 +                echo >>$file ""
 58.3820 +                echo >>$file "${prefix}version_t ${prefix}version = {"
 58.3821 +                echo >>$file "    ${vHex},"
 58.3822 +                echo >>$file "    \"${vShort}\","
 58.3823 +                echo >>$file "    \"${vLong}\","
 58.3824 +                echo >>$file "    \"${vTeX}\","
 58.3825 +                echo >>$file "    \"${vGNU}\","
 58.3826 +                echo >>$file "    \"${vWeb}\","
 58.3827 +                echo >>$file "    \"${vSCCS}\","
 58.3828 +                echo >>$file "    \"${vRCS}\""
 58.3829 +                echo >>$file "};"
 58.3830 +                echo >>$file ""
 58.3831 +                echo >>$file "#endif /* _${filestr}_AS_HEADER_ */"
 58.3832 +                echo >>$file ""
 58.3833 +                ;;
 58.3834 +            m4 )
 58.3835 +                echo >>$file "##"
 58.3836 +                echo >>$file "##  ${file} -- Version Information for ${name} (syntax: M4)"
 58.3837 +                echo >>$file "##  [automatically generated and maintained by GNU shtool]"
 58.3838 +                echo >>$file "##"
 58.3839 +                echo >>$file ""
 58.3840 +                echo >>$file "m4_define([v_hex],   [${vHex}])"
 58.3841 +                echo >>$file "m4_define([v_short], [${vShort}])"
 58.3842 +                echo >>$file "m4_define([v_long],  [${vLong}])"
 58.3843 +                echo >>$file "m4_define([v_tex],   [${vTeX}])"
 58.3844 +                echo >>$file "m4_define([v_gnu],   [${vGNU}])"
 58.3845 +                echo >>$file "m4_define([v_web],   [${vWeb}])"
 58.3846 +                echo >>$file "m4_define([v_sccs],  [${vSCCS}])"
 58.3847 +                echo >>$file "m4_define([v_rcs],   [${vRCS}])"
 58.3848 +                echo >>$file ""
 58.3849 +                ;;
 58.3850 +            perl )
 58.3851 +                echo >>$file "##"
 58.3852 +                echo >>$file "##  ${file} -- Version Information for ${name} (syntax: Perl)"
 58.3853 +                echo >>$file "##  [automatically generated and maintained by GNU shtool]"
 58.3854 +                echo >>$file "##"
 58.3855 +                echo >>$file ""
 58.3856 +                echo >>$file "our \$${prefix}version = {"
 58.3857 +                echo >>$file "    'v_hex'   => ${vHex},"
 58.3858 +                echo >>$file "    'v_short' => \"${vShort}\","
 58.3859 +                echo >>$file "    'v_long'  => \"${vLong}\","
 58.3860 +                echo >>$file "    'v_tex'   => \"${vTeX}\","
 58.3861 +                echo >>$file "    'v_gnu'   => \"${vGNU}\","
 58.3862 +                echo >>$file "    'v_web'   => \"${vWeb}\","
 58.3863 +                echo >>$file "    'v_sccs'  => \"${vSCCS}\","
 58.3864 +                echo >>$file "    'v_rcs'   => \"\\${vRCS}/\""
 58.3865 +                echo >>$file "};"
 58.3866 +                echo >>$file ""
 58.3867 +                echo >>$file "1;"
 58.3868 +                echo >>$file ""
 58.3869 +                ;;
 58.3870 +            python )
 58.3871 +                echo >>$file "##"
 58.3872 +                echo >>$file "##  ${file} -- Version Information for ${name} (syntax: Python)"
 58.3873 +                echo >>$file "##  [automatically generated and maintained by GNU shtool]"
 58.3874 +                echo >>$file "##"
 58.3875 +                echo >>$file ""
 58.3876 +                echo >>$file "class ${prefix}version:"
 58.3877 +                echo >>$file "    v_hex       = ${vHex}"
 58.3878 +                echo >>$file "    v_short     = \"${vShort}\""
 58.3879 +                echo >>$file "    v_long      = \"${vLong}\""
 58.3880 +                echo >>$file "    v_tex       = \"${vTeX}\""
 58.3881 +                echo >>$file "    v_gnu       = \"${vGNU}\""
 58.3882 +                echo >>$file "    v_web       = \"${vWeb}\""
 58.3883 +                echo >>$file "    v_sccs      = \"${vSCCS}\""
 58.3884 +                echo >>$file "    v_rcs       = \"${vRCS}\""
 58.3885 +                echo >>$file ""
 58.3886 +                ;;
 58.3887 +            * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2
 58.3888 +                shtool_exit 1
 58.3889 +                ;;
 58.3890 +        esac
 58.3891 +    fi
 58.3892 +
 58.3893 +    shtool_exit 0
 58.3894 +    ;;
 58.3895 +
 58.3896 +path )
 58.3897 +    ##
 58.3898 +    ##  path -- Deal with program paths
 58.3899 +    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
 58.3900 +    ##
 58.3901 +
 58.3902 +    namelist="$*"
 58.3903 +
 58.3904 +    #   check whether the test command supports the -x option
 58.3905 +    if [ -x /bin/sh ] 2>/dev/null; then
 58.3906 +        minusx="-x"
 58.3907 +    else
 58.3908 +        minusx="-r"
 58.3909 +    fi
 58.3910 +
 58.3911 +    #   split path string
 58.3912 +    paths="`echo $opt_p |\
 58.3913 +            sed -e 's/^:/.:/' \
 58.3914 +                -e 's/::/:.:/g' \
 58.3915 +                -e 's/:$/:./' \
 58.3916 +                -e 's/:/ /g'`"
 58.3917 +
 58.3918 +    #   SPECIAL REQUEST
 58.3919 +    #   translate forward to reverse path
 58.3920 +    if [ ".$opt_r" = .yes ]; then
 58.3921 +        if [ "x$namelist" = "x." ]; then
 58.3922 +            rp='.'
 58.3923 +        else
 58.3924 +            rp=''
 58.3925 +            for pe in `IFS="$IFS/"; echo $namelist`; do
 58.3926 +                rp="../$rp"
 58.3927 +            done
 58.3928 +        fi
 58.3929 +        echo $rp | sed -e 's:/$::'
 58.3930 +        shtool_exit 0
 58.3931 +    fi
 58.3932 +
 58.3933 +    #   SPECIAL REQUEST
 58.3934 +    #   strip out directory or base name
 58.3935 +    if [ ".$opt_d" = .yes ]; then
 58.3936 +        echo "$namelist" |\
 58.3937 +        sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'
 58.3938 +        shtool_exit 0
 58.3939 +    fi
 58.3940 +    if [ ".$opt_b" = .yes ]; then
 58.3941 +        echo "$namelist" |\
 58.3942 +        sed -e 's;.*/\([^/]*\)$;\1;'
 58.3943 +        shtool_exit 0
 58.3944 +    fi
 58.3945 +
 58.3946 +    #   MAGIC SITUATION
 58.3947 +    #   Perl Interpreter (perl)
 58.3948 +    if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then
 58.3949 +        rm -f $tmpfile >/dev/null 2>&1
 58.3950 +        touch $tmpfile
 58.3951 +        found=0
 58.3952 +        pc=99
 58.3953 +        for dir in $paths; do
 58.3954 +            dir=`echo $dir | sed -e 's;/*$;;'`
 58.3955 +            nc=99
 58.3956 +            for name in perl perl5 miniperl; do
 58.3957 +                 if [ $minusx "$dir/$name" ] && [ ! -d "$dir/$name" ]; then
 58.3958 +                     perl="$dir/$name"
 58.3959 +                     pv=`$perl -e 'printf("%.3f", $]);'`
 58.3960 +                     echo "$pv:$pc:$nc:$perl" >>$tmpfile
 58.3961 +                     found=1
 58.3962 +                 fi
 58.3963 +                 nc=`expr $nc - 1`
 58.3964 +            done
 58.3965 +            pc=`expr $pc - 1`
 58.3966 +        done
 58.3967 +        if [ $found = 1 ]; then
 58.3968 +            perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`"
 58.3969 +            rm -f $tmpfile >/dev/null 2>&1
 58.3970 +            echo "$perl"
 58.3971 +            shtool_exit 0
 58.3972 +        fi
 58.3973 +        rm -f $tmpfile >/dev/null 2>&1
 58.3974 +        shtool_exit 1
 58.3975 +    fi
 58.3976 +
 58.3977 +    #   MAGIC SITUATION
 58.3978 +    #   C pre-processor (cpp)
 58.3979 +    if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then
 58.3980 +        echo >$tmpfile.c "#include <assert.h>"
 58.3981 +        echo >>$tmpfile.c "Syntax Error"
 58.3982 +        #   1. try the standard cc -E approach
 58.3983 +        cpp="${CC-cc} -E"
 58.3984 +        (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out
 58.3985 +        my_error=`grep -v '^ *+' $tmpfile.out`
 58.3986 +        if [ ".$my_error" != . ]; then
 58.3987 +            #   2. try the cc -E approach and GCC's -traditional-ccp option
 58.3988 +            cpp="${CC-cc} -E -traditional-cpp"
 58.3989 +            (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out
 58.3990 +            my_error=`grep -v '^ *+' $tmpfile.out`
 58.3991 +            if [ ".$my_error" != . ]; then
 58.3992 +                #   3. try a standalone cpp command in path and lib dirs
 58.3993 +                for path in $paths /lib /usr/lib /usr/local/lib; do
 58.3994 +                    path=`echo $path | sed -e 's;/*$;;'`
 58.3995 +                    if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then
 58.3996 +                        cpp="$path/cpp"
 58.3997 +                        break
 58.3998 +                    fi
 58.3999 +                done
 58.4000 +                if [ ".$cpp" != . ]; then
 58.4001 +                    (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out
 58.4002 +                    my_error=`grep -v '^ *+' $tmpfile.out`
 58.4003 +                    if [ ".$my_error" != . ]; then
 58.4004 +                        #   ok, we gave up...
 58.4005 +                        cpp=''
 58.4006 +                    fi
 58.4007 +                fi
 58.4008 +            fi
 58.4009 +        fi
 58.4010 +        rm -f $tmpfile >/dev/null 2>&1
 58.4011 +        rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1
 58.4012 +        if [ ".$cpp" != . ]; then
 58.4013 +            echo "$cpp"
 58.4014 +            shtool_exit 0
 58.4015 +        fi
 58.4016 +        shtool_exit 1
 58.4017 +    fi
 58.4018 +
 58.4019 +    #   STANDARD SITUATION
 58.4020 +    #   iterate over names
 58.4021 +    for name in $namelist; do
 58.4022 +        #   iterate over paths
 58.4023 +        for path in $paths; do
 58.4024 +            path=`echo $path | sed -e 's;/*$;;'`
 58.4025 +            if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then
 58.4026 +                if [ ".$opt_s" != .yes ]; then
 58.4027 +                    echo "$path/$name"
 58.4028 +                fi
 58.4029 +                shtool_exit 0
 58.4030 +            fi
 58.4031 +        done
 58.4032 +    done
 58.4033 +
 58.4034 +    shtool_exit 1
 58.4035 +    ;;
 58.4036 +
 58.4037 +esac
 58.4038 +
 58.4039 +shtool_exit 0
 58.4040 +
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/openpkg/tar.patch	Tue Jan 06 23:40:39 2009 +0100
    59.3 @@ -0,0 +1,109 @@
    59.4 +Index: Makefile.in
    59.5 +--- Makefile.in.orig	2007-10-10 13:00:22 +0200
    59.6 ++++ Makefile.in	2007-10-17 08:40:12 +0200
    59.7 +@@ -485,7 +485,7 @@
    59.8 + target_alias = @target_alias@
    59.9 + ACLOCAL_AMFLAGS = -I m4
   59.10 + EXTRA_DIST = ChangeLog.1 PORTS
   59.11 +-SUBDIRS = doc lib rmt src scripts po tests
   59.12 ++SUBDIRS = doc lib src
   59.13 + all: config.h
   59.14 + 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
   59.15 + 
   59.16 +Index: lib/argp-help.c
   59.17 +--- lib/argp-help.c.orig	2007-09-28 15:11:36 +0200
   59.18 ++++ lib/argp-help.c	2007-10-17 08:40:12 +0200
   59.19 +@@ -570,8 +570,7 @@
   59.20 +   return val;
   59.21 + }
   59.22 + 
   59.23 +-static inline int
   59.24 +-__attribute__ ((always_inline))
   59.25 ++static int
   59.26 + hol_entry_long_iterate (const struct hol_entry *entry,
   59.27 + 			int (*func)(const struct argp_option *opt,
   59.28 + 				    const struct argp_option *real,
   59.29 +Index: src/compare.c
   59.30 +--- src/compare.c.orig	2007-08-26 10:56:55 +0200
   59.31 ++++ src/compare.c	2007-10-17 08:40:12 +0200
   59.32 +@@ -278,7 +278,7 @@
   59.33 +   size_t len = strlen (current_stat_info.link_name);
   59.34 +   char *linkbuf = alloca (len + 1);
   59.35 + 
   59.36 +-  int status = readlink (current_stat_info.file_name, linkbuf, len + 1);
   59.37 ++  int status = readlink (current_stat_info.file_name, linkbuf, len);
   59.38 + 
   59.39 +   if (status < 0)
   59.40 +     {
   59.41 +Index: src/create.c
   59.42 +--- src/create.c.orig	2007-10-05 19:46:49 +0200
   59.43 ++++ src/create.c	2007-10-17 08:40:12 +0200
   59.44 +@@ -1696,7 +1696,7 @@
   59.45 +       if (linklen != st->stat.st_size || linklen + 1 == 0)
   59.46 + 	xalloc_die ();
   59.47 +       buffer = (char *) alloca (linklen + 1);
   59.48 +-      size = readlink (p, buffer, linklen + 1);
   59.49 ++      size = readlink (p, buffer, linklen);
   59.50 +       if (size < 0)
   59.51 + 	{
   59.52 + 	  readlink_diag (p);
   59.53 +Index: src/incremen.c
   59.54 +--- src/incremen.c.orig	2007-10-01 23:19:55 +0200
   59.55 ++++ src/incremen.c	2007-10-17 08:40:12 +0200
   59.56 +@@ -526,6 +526,7 @@
   59.57 +            children = CHANGED_CHILDREN;
   59.58 + 	 but changed to: */
   59.59 +       free (name_buffer);
   59.60 ++      if (dirp)
   59.61 +       free (dirp);
   59.62 +       return NULL;
   59.63 +     }
   59.64 +Index: src/tar.c
   59.65 +--- src/tar.c.orig	2007-09-26 23:36:58 +0200
   59.66 ++++ src/tar.c	2007-10-17 08:40:12 +0200
   59.67 +@@ -20,6 +20,7 @@
   59.68 +    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
   59.69 + 
   59.70 + #include <system.h>
   59.71 ++#include <locale.h>
   59.72 + 
   59.73 + #include <fnmatch.h>
   59.74 + #include <argp.h>
   59.75 +Index: src/utf8.c
   59.76 +--- src/utf8.c.orig	2007-06-27 15:30:32 +0200
   59.77 ++++ src/utf8.c	2007-10-17 08:40:12 +0200
   59.78 +@@ -22,6 +22,9 @@
   59.79 + #include "common.h"
   59.80 + #ifdef HAVE_ICONV_H
   59.81 + # include <iconv.h>
   59.82 ++#else
   59.83 ++# define iconv_t void *
   59.84 ++# define ICONV_CONST const
   59.85 + #endif
   59.86 + 
   59.87 + #ifndef ICONV_CONST
   59.88 +Index: src/xheader.c
   59.89 +--- src/xheader.c.orig	2007-06-27 15:30:32 +0200
   59.90 ++++ src/xheader.c	2007-10-17 08:40:12 +0200
   59.91 +@@ -27,6 +27,10 @@
   59.92 + 
   59.93 + #include <fnmatch.h>
   59.94 + 
   59.95 ++#ifndef SIZE_MAX
   59.96 ++# define SIZE_MAX ((size_t) -1)
   59.97 ++#endif
   59.98 ++
   59.99 + static bool xheader_protected_pattern_p (char const *pattern);
  59.100 + static bool xheader_protected_keyword_p (char const *keyword);
  59.101 + static void xheader_set_single_keyword (char *) __attribute__ ((noreturn));
  59.102 +Index: lib/strerror.c
  59.103 +--- lib/strerror.c.orig	2007-09-28 15:11:37 +0200
  59.104 ++++ lib/strerror.c	2007-10-18 00:55:28 +0200
  59.105 +@@ -23,6 +23,7 @@
  59.106 + 
  59.107 + # include <string.h>
  59.108 + # include <stdio.h>
  59.109 ++# include <limits.h>
  59.110 + 
  59.111 + # undef strerror
  59.112 + 
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/openpkg/uuid.8	Tue Jan 06 23:40:39 2009 +0100
    60.3 @@ -0,0 +1,252 @@
    60.4 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
    60.5 +.\"
    60.6 +.\" Standard preamble:
    60.7 +.\" ========================================================================
    60.8 +.de Sh \" Subsection heading
    60.9 +.br
   60.10 +.if t .Sp
   60.11 +.ne 5
   60.12 +.PP
   60.13 +\fB\\$1\fR
   60.14 +.PP
   60.15 +..
   60.16 +.de Sp \" Vertical space (when we can't use .PP)
   60.17 +.if t .sp .5v
   60.18 +.if n .sp
   60.19 +..
   60.20 +.de Vb \" Begin verbatim text
   60.21 +.ft CW
   60.22 +.nf
   60.23 +.ne \\$1
   60.24 +..
   60.25 +.de Ve \" End verbatim text
   60.26 +.ft R
   60.27 +.fi
   60.28 +..
   60.29 +.\" Set up some character translations and predefined strings.  \*(-- will
   60.30 +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
   60.31 +.\" double quote, and \*(R" will give a right double quote.  | will give a
   60.32 +.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
   60.33 +.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
   60.34 +.\" expand to `' in nroff, nothing in troff, for use with C<>.
   60.35 +.tr \(*W-|\(bv\*(Tr
   60.36 +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
   60.37 +.ie n \{\
   60.38 +.    ds -- \(*W-
   60.39 +.    ds PI pi
   60.40 +.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
   60.41 +.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
   60.42 +.    ds L" ""
   60.43 +.    ds R" ""
   60.44 +.    ds C` 
   60.45 +.    ds C' 
   60.46 +'br\}
   60.47 +.el\{\
   60.48 +.    ds -- \|\(em\|
   60.49 +.    ds PI \(*p
   60.50 +.    ds L" ``
   60.51 +.    ds R" ''
   60.52 +'br\}
   60.53 +.\"
   60.54 +.\" If the F register is turned on, we'll generate index entries on stderr for
   60.55 +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
   60.56 +.\" entries marked with X<> in POD.  Of course, you'll have to process the
   60.57 +.\" output yourself in some meaningful fashion.
   60.58 +.if \nF \{\
   60.59 +.    de IX
   60.60 +.    tm Index:\\$1\t\\n%\t"\\$2"
   60.61 +..
   60.62 +.    nr % 0
   60.63 +.    rr F
   60.64 +.\}
   60.65 +.\"
   60.66 +.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
   60.67 +.\" way too many mistakes in technical documents.
   60.68 +.hy 0
   60.69 +.if n .na
   60.70 +.\"
   60.71 +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
   60.72 +.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
   60.73 +.    \" fudge factors for nroff and troff
   60.74 +.if n \{\
   60.75 +.    ds #H 0
   60.76 +.    ds #V .8m
   60.77 +.    ds #F .3m
   60.78 +.    ds #[ \f1
   60.79 +.    ds #] \fP
   60.80 +.\}
   60.81 +.if t \{\
   60.82 +.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
   60.83 +.    ds #V .6m
   60.84 +.    ds #F 0
   60.85 +.    ds #[ \&
   60.86 +.    ds #] \&
   60.87 +.\}
   60.88 +.    \" simple accents for nroff and troff
   60.89 +.if n \{\
   60.90 +.    ds ' \&
   60.91 +.    ds ` \&
   60.92 +.    ds ^ \&
   60.93 +.    ds , \&
   60.94 +.    ds ~ ~
   60.95 +.    ds /
   60.96 +.\}
   60.97 +.if t \{\
   60.98 +.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
   60.99 +.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  60.100 +.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  60.101 +.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  60.102 +.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  60.103 +.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  60.104 +.\}
  60.105 +.    \" troff and (daisy-wheel) nroff accents
  60.106 +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  60.107 +.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  60.108 +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  60.109 +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  60.110 +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  60.111 +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  60.112 +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  60.113 +.ds ae a\h'-(\w'a'u*4/10)'e
  60.114 +.ds Ae A\h'-(\w'A'u*4/10)'E
  60.115 +.    \" corrections for vroff
  60.116 +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  60.117 +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  60.118 +.    \" for low resolution devices (crt and lpr)
  60.119 +.if \n(.H>23 .if \n(.V>19 \
  60.120 +\{\
  60.121 +.    ds : e
  60.122 +.    ds 8 ss
  60.123 +.    ds o a
  60.124 +.    ds d- d\h'-1'\(ga
  60.125 +.    ds D- D\h'-1'\(hy
  60.126 +.    ds th \o'bp'
  60.127 +.    ds Th \o'LP'
  60.128 +.    ds ae ae
  60.129 +.    ds Ae AE
  60.130 +.\}
  60.131 +.rm #[ #] #H #V #F C
  60.132 +.\" ========================================================================
  60.133 +.\"
  60.134 +.IX Title "UUID 8"
  60.135 +.TH UUID 8 "OpenPKG" "UUID(8)" "OpenPKG"
  60.136 +.SH "NAME"
  60.137 +\&\fBopenpkg uuid\fR \- OpenPKG UUID Update Utility
  60.138 +.SH "SYNOPSIS"
  60.139 +.IX Header "SYNOPSIS"
  60.140 +\&\fBopenpkg uuid\fR [\fB\-\-verbose\fR] [\fB\-\-multicast\fR] \fBreset\fR|\fBupdate\fR|\fBinfo\fR
  60.141 +.SH "DESCRIPTION"
  60.142 +.IX Header "DESCRIPTION"
  60.143 +The \fBopenpkg uuid\fR command is the maintenance utility for the \s-1DCE\s0 1.1
  60.144 +and \s-1ISO/IEC\s0 11578:1996 compliant \fIUniversally Unique Identifiers\fR
  60.145 +(\s-1UUID\s0) of an \fBOpenPKG\fR instance. It is internally based on \fB\s-1OSSP\s0
  60.146 +uuid\fR.
  60.147 +.PP
  60.148 +UUIDs are 128 bit numbers which are intended to have a high likelihood
  60.149 +of uniqueness over space and time and are computationally difficult
  60.150 +to guess. They are globally unique identifiers which can be locally
  60.151 +generated without contacting a global registration authority. UUIDs are
  60.152 +intended as unique identifiers for both mass tagging objects with an
  60.153 +extremely short lifetime and to reliably identifying very persistent
  60.154 +objects across a network. The three classical \s-1UUID\s0 variants are \s-1DCE\s0 1.1
  60.155 +UUIDs of version 1 (time and node based), version 3 (name based) and
  60.156 +version 4 (random number based).
  60.157 +.PP
  60.158 +For an \fBOpenPKG\fR instance, three different UUIDs are used:
  60.159 +.ie n .IP "1. \fBOpenPKG Registry\fR (\*(C`UUID_REGISTRY\*(C')" 3
  60.160 +.el .IP "1. \fBOpenPKG Registry\fR (\f(CW\*(C`UUID_REGISTRY\*(C'\fR)" 3
  60.161 +.IX Item "1. OpenPKG Registry (UUID_REGISTRY)"
  60.162 +This is a version 1 \s-1UUID\s0 which uniquely identifiers the \fBOpenPKG\fR
  60.163 +instance for global registration purposes. It is generated just once in
  60.164 +the lifetime of the \fBOpenPKG\fR instance. The value of this \s-1UUID\s0 cannot
  60.165 +be recalculated deterministically.
  60.166 +.ie n .IP "2. \fBOpenPKG Instance\fR (\*(C`UUID_INSTANCE\*(C')" 3
  60.167 +.el .IP "2. \fBOpenPKG Instance\fR (\f(CW\*(C`UUID_INSTANCE\*(C'\fR)" 3
  60.168 +.IX Item "2. OpenPKG Instance (UUID_INSTANCE)"
  60.169 +This is a version 3 \s-1UUID\s0 which summarizes the \fBOpenPKG\fR
  60.170 +instance parameters. Currently the values of the following
  60.171 +particular OpenPKG \s-1RPM\s0 macros are uses as input:
  60.172 +.Sp
  60.173 +.Vb 5
  60.174 +\& %{l_openpkg_release} %{l_prefix}
  60.175 +\& %{l_susr} %{l_suid} %{l_sgrp} %{l_sgid}
  60.176 +\& %{l_musr} %{l_muid} %{l_mgrp} %{l_mgid}
  60.177 +\& %{l_rusr} %{l_ruid} %{l_rgrp} %{l_rgid}
  60.178 +\& %{l_nusr} %{l_nuid} %{l_ngrp} %{l_ngid}
  60.179 +.Ve
  60.180 +.Sp
  60.181 +The value of this \s-1UUID\s0 can be recalculated deterministically and will
  60.182 +not chance as long as none of the values of the above macro do not
  60.183 +change. This \s-1UUID\s0 can be used for detecting OpenPKG release upgrades,
  60.184 +accidentally changed UIDs or GIDs, etc. Notice that version 3 UUIDs are
  60.185 +message digests (actually \s-1MD5\s0 based) and so are one-way functions which do
  60.186 +not allow one to recalculate the input values from the \s-1UUID\s0.
  60.187 +.ie n .IP "3. \fBOpenPKG Platform\fR (\*(C`UUID_PLATFORM\*(C')" 3
  60.188 +.el .IP "3. \fBOpenPKG Platform\fR (\f(CW\*(C`UUID_PLATFORM\*(C'\fR)" 3
  60.189 +.IX Item "3. OpenPKG Platform (UUID_PLATFORM)"
  60.190 +This is a version 3 \s-1UUID\s0 which summarizes the \fBOpenPKG\fR platform
  60.191 +parameters. Currently the OpenPKG \s-1RPM\s0 platform id plus the \s-1FQDN\s0 and \s-1IP\s0
  60.192 +address of the underlying host are used as input. This \s-1UUID\s0 can be used
  60.193 +for detecting operating system and host changes. Notice that version
  60.194 +3 UUIDs are message digests (actually \s-1MD5\s0 based) and so are one-way
  60.195 +functions which do not allow one to recalculate the input values from
  60.196 +the \s-1UUID\s0.
  60.197 +.SH "OPTIONS"
  60.198 +.IX Header "OPTIONS"
  60.199 +.IP "\fB\-\-verbose\fR" 4
  60.200 +.IX Item "--verbose"
  60.201 +Print verbose messages during operation.
  60.202 +.IP "\fB\-\-multicast\fR" 4
  60.203 +.IX Item "--multicast"
  60.204 +Generate a random multicast \s-1MAC\s0 address instead of using the real \s-1IEEE\s0
  60.205 +802 \s-1MAC\s0 address of the underlying host when generating the version 1
  60.206 +\&\s-1UUID\s0 \f(CW\*(C`UUID_REGISTRY\*(C'\fR.
  60.207 +.SH "COMMANDS"
  60.208 +.IX Header "COMMANDS"
  60.209 +.IP "\fBreset\fR" 4
  60.210 +.IX Item "reset"
  60.211 +This resets the three UUIDs \f(CW\*(C`UUID_REGISTRY\*(C'\fR, \f(CW\*(C`UUID_INSTANCE\*(C'\fR and
  60.212 +\&\f(CW\*(C`UUID_PLATFORM\*(C'\fR to the \*(L"Nil \s-1UUID\s0\*(R". They are then automatically
  60.213 +regenerated within one day if already done explicitly afterward with
  60.214 +"\f(CW\*(C`openpkg uuid update\*(C'\fR".
  60.215 +.IP "\fBupdate\fR" 4
  60.216 +.IX Item "update"
  60.217 +This updates the three UUIDs \f(CW\*(C`UUID_REGISTRY\*(C'\fR, \f(CW\*(C`UUID_INSTANCE\*(C'\fR and
  60.218 +\&\f(CW\*(C`UUID_PLATFORM\*(C'\fR to the \*(L"Nil \s-1UUID\s0\*(R". \f(CW\*(C`UUID_REGISTRY\*(C'\fR is kept unless it
  60.219 +is the \*(L"Nil \s-1UUID\s0\*(R" (see "\f(CW\*(C`openpkg uuid reset\*(C'\fR" command above). The UUIDs
  60.220 +\&\f(CW\*(C`UUID_INSTANCE\*(C'\fR and \f(CW\*(C`UUID_PLATFORM\*(C'\fR are updated only if their input
  60.221 +values (and this way the resulting UUIDs) have changed. This operation
  60.222 +is performed daily automatically.
  60.223 +.IP "\fBinfo\fR" 4
  60.224 +.IX Item "info"
  60.225 +This print summary page of identification information, including all
  60.226 +UUIDs and all of their calculation inputs.
  60.227 +.SH "FILES"
  60.228 +.IX Header "FILES"
  60.229 +The three UUIDs of the \fBOpenPKG\fR instance are stored in the file
  60.230 +\&\f(CW\*(C`@l_prefix@/etc/openpkg/uuid\*(C'\fR in Bourne-Shell syntax. An example
  60.231 +content is:
  60.232 +.PP
  60.233 +.Vb 3
  60.234 +\& UUID_REGISTRY="81eca44e-4d18-11d8-a837-0090272ff725"
  60.235 +\& UUID_INSTANCE="c55a8d2d-31bb-3ae0-9edb-68337af61acc"
  60.236 +\& UUID_PLATFORM="05ec2532-9e3f-37dc-a7ed-b291c2c463ed"
  60.237 +.Ve
  60.238 +.SH "CAVEATS"
  60.239 +.IX Header "CAVEATS"
  60.240 +By default and in full compliance with \s-1DCE\s0 1.1 and \s-1ISO/IEC\s0 11578:1996,
  60.241 +the OpenPKG Registry \s-1UUID\s0 (\f(CW\*(C`UUID_REGISTRY\*(C'\fR) contains the \s-1IEEE\s0 802 \s-1MAC\s0
  60.242 +address of the underlying host. If this is not acceptable by local
  60.243 +security policies you can easily at any time generate a new OpenPKG
  60.244 +Registry \s-1UUID\s0 with a random multicast \s-1MAC\s0 address instead by running:
  60.245 +.PP
  60.246 +.Vb 2
  60.247 +\& $ openpkg uuid reset
  60.248 +\& $ openpkg uuid --multicast update
  60.249 +.Ve
  60.250 +.SH "SEE ALSO"
  60.251 +.IX Header "SEE ALSO"
  60.252 +\&\fB\s-1OSSP\s0 uuid\fR <http://www.ossp.org/pkg/lib/uuid/>.
  60.253 +.SH "HISTORY"
  60.254 +.IX Header "HISTORY"
  60.255 +The \fBopenpkg uuid\fR command first appeared in \fBOpenPKG 2.0\fR.
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/openpkg/uuid.pod	Tue Jan 06 23:40:39 2009 +0100
    61.3 @@ -0,0 +1,167 @@
    61.4 +##
    61.5 +##  uuid -- OpenPKG UUID Update Utility
    61.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    61.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    61.8 +##
    61.9 +##  Permission to use, copy, modify, and distribute this software for
   61.10 +##  any purpose with or without fee is hereby granted, provided that
   61.11 +##  the above copyright notice and this permission notice appear in all
   61.12 +##  copies.
   61.13 +##
   61.14 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   61.15 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   61.16 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   61.17 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   61.18 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   61.19 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   61.20 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   61.21 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   61.22 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   61.23 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   61.24 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   61.25 +##  SUCH DAMAGE.
   61.26 +##
   61.27 +
   61.28 +=pod
   61.29 +
   61.30 +=head1 NAME
   61.31 +
   61.32 +B<openpkg uuid> - OpenPKG UUID Update Utility
   61.33 +
   61.34 +=head1 SYNOPSIS
   61.35 +
   61.36 +B<openpkg uuid> [B<--verbose>] [B<--multicast>] B<reset>|B<update>|B<info>
   61.37 +
   61.38 +=head1 DESCRIPTION
   61.39 +
   61.40 +The B<openpkg uuid> command is the maintenance utility for the DCE 1.1
   61.41 +and ISO/IEC 11578:1996 compliant I<Universally Unique Identifiers>
   61.42 +(UUID) of an B<OpenPKG> instance. It is internally based on B<OSSP
   61.43 +uuid>.
   61.44 +
   61.45 +UUIDs are 128 bit numbers which are intended to have a high likelihood
   61.46 +of uniqueness over space and time and are computationally difficult
   61.47 +to guess. They are globally unique identifiers which can be locally
   61.48 +generated without contacting a global registration authority. UUIDs are
   61.49 +intended as unique identifiers for both mass tagging objects with an
   61.50 +extremely short lifetime and to reliably identifying very persistent
   61.51 +objects across a network. The three classical UUID variants are DCE 1.1
   61.52 +UUIDs of version 1 (time and node based), version 3 (name based) and
   61.53 +version 4 (random number based).
   61.54 +
   61.55 +For an B<OpenPKG> instance, three different UUIDs are used:
   61.56 +
   61.57 +=over 3
   61.58 +
   61.59 +=item 1. B<OpenPKG Registry> (C<UUID_REGISTRY>)
   61.60 +
   61.61 +This is a version 1 UUID which uniquely identifiers the B<OpenPKG>
   61.62 +instance for global registration purposes. It is generated just once in
   61.63 +the lifetime of the B<OpenPKG> instance. The value of this UUID cannot
   61.64 +be recalculated deterministically.
   61.65 +
   61.66 +=item 2. B<OpenPKG Instance> (C<UUID_INSTANCE>)
   61.67 +
   61.68 +This is a version 3 UUID which summarizes the B<OpenPKG>
   61.69 +instance parameters. Currently the values of the following
   61.70 +particular OpenPKG RPM macros are uses as input:
   61.71 +
   61.72 + %{l_openpkg_release} %{l_prefix}
   61.73 + %{l_susr} %{l_suid} %{l_sgrp} %{l_sgid}
   61.74 + %{l_musr} %{l_muid} %{l_mgrp} %{l_mgid}
   61.75 + %{l_rusr} %{l_ruid} %{l_rgrp} %{l_rgid}
   61.76 + %{l_nusr} %{l_nuid} %{l_ngrp} %{l_ngid}
   61.77 +
   61.78 +The value of this UUID can be recalculated deterministically and will
   61.79 +not chance as long as none of the values of the above macro do not
   61.80 +change. This UUID can be used for detecting OpenPKG release upgrades,
   61.81 +accidentally changed UIDs or GIDs, etc. Notice that version 3 UUIDs are
   61.82 +message digests (actually MD5 based) and so are one-way functions which do
   61.83 +not allow one to recalculate the input values from the UUID.
   61.84 +
   61.85 +=item 3. B<OpenPKG Platform> (C<UUID_PLATFORM>)
   61.86 +
   61.87 +This is a version 3 UUID which summarizes the B<OpenPKG> platform
   61.88 +parameters. Currently the OpenPKG RPM platform id plus the FQDN and IP
   61.89 +address of the underlying host are used as input. This UUID can be used
   61.90 +for detecting operating system and host changes. Notice that version
   61.91 +3 UUIDs are message digests (actually MD5 based) and so are one-way
   61.92 +functions which do not allow one to recalculate the input values from
   61.93 +the UUID.
   61.94 +
   61.95 +=back
   61.96 +
   61.97 +=head1 OPTIONS
   61.98 +
   61.99 +=over 4
  61.100 +
  61.101 +=item B<--verbose>
  61.102 +
  61.103 +Print verbose messages during operation.
  61.104 +
  61.105 +=item B<--multicast>
  61.106 +
  61.107 +Generate a random multicast MAC address instead of using the real IEEE
  61.108 +802 MAC address of the underlying host when generating the version 1
  61.109 +UUID C<UUID_REGISTRY>.
  61.110 +
  61.111 +=back
  61.112 +
  61.113 +=head1 COMMANDS
  61.114 +
  61.115 +=over 4
  61.116 +
  61.117 +=item B<reset>
  61.118 +
  61.119 +This resets the three UUIDs C<UUID_REGISTRY>, C<UUID_INSTANCE> and
  61.120 +C<UUID_PLATFORM> to the "Nil UUID". They are then automatically
  61.121 +regenerated within one day if already done explicitly afterward with
  61.122 +"C<openpkg uuid update>".
  61.123 +
  61.124 +=item B<update>
  61.125 +
  61.126 +This updates the three UUIDs C<UUID_REGISTRY>, C<UUID_INSTANCE> and
  61.127 +C<UUID_PLATFORM> to the "Nil UUID". C<UUID_REGISTRY> is kept unless it
  61.128 +is the "Nil UUID" (see "C<openpkg uuid reset>" command above). The UUIDs
  61.129 +C<UUID_INSTANCE> and C<UUID_PLATFORM> are updated only if their input
  61.130 +values (and this way the resulting UUIDs) have changed. This operation
  61.131 +is performed daily automatically.
  61.132 +
  61.133 +=item B<info>
  61.134 +
  61.135 +This print summary page of identification information, including all
  61.136 +UUIDs and all of their calculation inputs.
  61.137 +
  61.138 +=back
  61.139 +
  61.140 +=head1 FILES
  61.141 +
  61.142 +The three UUIDs of the B<OpenPKG> instance are stored in the file
  61.143 +C<@l_prefix@/etc/openpkg/uuid> in Bourne-Shell syntax. An example
  61.144 +content is:
  61.145 +
  61.146 + UUID_REGISTRY="81eca44e-4d18-11d8-a837-0090272ff725"
  61.147 + UUID_INSTANCE="c55a8d2d-31bb-3ae0-9edb-68337af61acc"
  61.148 + UUID_PLATFORM="05ec2532-9e3f-37dc-a7ed-b291c2c463ed"
  61.149 +
  61.150 +=head1 CAVEATS
  61.151 +
  61.152 +By default and in full compliance with DCE 1.1 and ISO/IEC 11578:1996,
  61.153 +the OpenPKG Registry UUID (C<UUID_REGISTRY>) contains the IEEE 802 MAC
  61.154 +address of the underlying host. If this is not acceptable by local
  61.155 +security policies you can easily at any time generate a new OpenPKG
  61.156 +Registry UUID with a random multicast MAC address instead by running:
  61.157 +
  61.158 + $ openpkg uuid reset
  61.159 + $ openpkg uuid --multicast update
  61.160 +
  61.161 +=head1 SEE ALSO
  61.162 +
  61.163 +B<OSSP uuid> E<lt>http://www.ossp.org/pkg/lib/uuid/E<gt>.
  61.164 +
  61.165 +=head1 HISTORY
  61.166 +
  61.167 +The B<openpkg uuid> command first appeared in B<OpenPKG 2.0>.
  61.168 +
  61.169 +=cut
  61.170 +
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/openpkg/uuid.sh	Tue Jan 06 23:40:39 2009 +0100
    62.3 @@ -0,0 +1,292 @@
    62.4 +#!@l_prefix@/lib/openpkg/bash
    62.5 +##
    62.6 +##  uuid -- OpenPKG UUID Update Utility
    62.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
    62.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
    62.9 +##
   62.10 +##  Permission to use, copy, modify, and distribute this software for
   62.11 +##  any purpose with or without fee is hereby granted, provided that
   62.12 +##  the above copyright notice and this permission notice appear in all
   62.13 +##  copies.
   62.14 +##
   62.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   62.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   62.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   62.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   62.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   62.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   62.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   62.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   62.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   62.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   62.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   62.26 +##  SUCH DAMAGE.
   62.27 +##
   62.28 +
   62.29 +#   configuration
   62.30 +prefix="@l_prefix@"
   62.31 +musr="@l_musr@"
   62.32 +mgrp="@l_mgrp@"
   62.33 +prog_rpm="$prefix/libexec/openpkg/rpm"
   62.34 +prog_shtool="$prefix/lib/openpkg/shtool"
   62.35 +prog_miniperl="$prefix/lib/openpkg/miniperl"
   62.36 +prog_uuid="$prefix/lib/openpkg/uuid"
   62.37 +file_uuid="$prefix/etc/openpkg/uuid"
   62.38 +
   62.39 +#   minimum command line parsing
   62.40 +opt_v=no
   62.41 +opt_m=no
   62.42 +while [ 1 ]; do
   62.43 +    case "$1" in
   62.44 +        -v | --verbose   ) opt_v=yes; shift ;;
   62.45 +        -m | --multicast ) opt_m=yes; shift ;;
   62.46 +        * ) break ;;
   62.47 +    esac
   62.48 +done
   62.49 +
   62.50 +#   special "Nil UUID"
   62.51 +UUID_NIL="00000000-0000-0000-0000-000000000000"
   62.52 +
   62.53 +#   Query Dynamic Information
   62.54 +do_query () {
   62.55 +    #   query RPM information
   62.56 +    query=":"
   62.57 +    for var in \
   62.58 +        l_openpkg_release \
   62.59 +        l_prefix \
   62.60 +        l_susr l_suid l_sgrp l_sgid \
   62.61 +        l_musr l_muid l_mgrp l_mgid \
   62.62 +        l_rusr l_ruid l_rgrp l_rgid \
   62.63 +        l_nusr l_nuid l_ngrp l_ngid; do
   62.64 +        query="$query; `echo $var | sed -e 's;^l_;Q_;'`=\"%{$var}\""
   62.65 +    done
   62.66 +    eval `$prog_rpm --eval "$query" 2>/dev/null`
   62.67 +
   62.68 +    #   query OS information
   62.69 +    Q_platform=`$prog_shtool platform --type=binary 2>/dev/null |\
   62.70 +        sed -e 's;^\([^-][^-]*-[^.-][^.-]*\)\..*$;\1;'`
   62.71 +    if [ ".$Q_platform" = . ]; then
   62.72 +        Q_platform="unknown"
   62.73 +    fi
   62.74 +    Q_discriminator=`$prog_uuid -v1 | $prog_uuid -d -- - | awk '/node:.*global unicast/ { printf("mac:%s", $2); }'`
   62.75 +    if [ ".$Q_discriminator" = . ]; then
   62.76 +        Q_discriminator=`$prog_miniperl -e 'if (-f "/etc/openpkg") { printf("inode:%s", (stat("/etc/openpkg"))[1]); }' 2>/dev/null`
   62.77 +        if [ ".$Q_discriminator" = . ]; then
   62.78 +            Q_discriminator=`$prog_shtool echo -e 'fqdn:%h%d' 2>/dev/null`
   62.79 +        fi
   62.80 +    fi
   62.81 +}
   62.82 +
   62.83 +#  Load Configuration
   62.84 +do_load () {
   62.85 +    #   start with reasonable defaults
   62.86 +    UUID_REGISTRY="$UUID_NIL"
   62.87 +    UUID_INSTANCE="$UUID_NIL"
   62.88 +    UUID_PLATFORM="$UUID_NIL"
   62.89 +
   62.90 +    #   load configuration (and override defaults)
   62.91 +    if [ -r $file_uuid ]; then
   62.92 +        if [ ".$opt_v" = .yes ]; then
   62.93 +            echo "uuid: loading UUID configuration file ($file_uuid)"
   62.94 +        fi
   62.95 +        . $file_uuid
   62.96 +    fi
   62.97 +
   62.98 +    #   remember whether something was changed
   62.99 +    changed=no
  62.100 +}
  62.101 +
  62.102 +#  Save Configuration
  62.103 +do_save () {
  62.104 +    if [ ".$changed" = .yes ]; then
  62.105 +        #   save configuration
  62.106 +        if [ ".$opt_v" = .yes ]; then
  62.107 +            echo "uuid: saving UUID configuration file ($file_uuid)"
  62.108 +        fi
  62.109 +        if [ -f $file_uuid ] && [ ! -w $file_uuid ]; then
  62.110 +            echo "uuid:ERROR: cannot write to $file_uuid" 1>&2
  62.111 +            exit 1
  62.112 +        fi
  62.113 +        ( echo "UUID_REGISTRY=\"$UUID_REGISTRY\""
  62.114 +          echo "UUID_INSTANCE=\"$UUID_INSTANCE\""
  62.115 +          echo "UUID_PLATFORM=\"$UUID_PLATFORM\""
  62.116 +        ) >$file_uuid.new || exit $?
  62.117 +        n=`egrep 'UUID_(REGISTRY|INSTANCE|PLATFORM)="[0-9a-f-]*"' \
  62.118 +           $file_uuid.new | wc -l | awk '{ print $1; }'`
  62.119 +        if [ ".$n" != .3 ]; then
  62.120 +            echo "uuid:ERROR: failed to update $file_uuid" 1>&2
  62.121 +            rm -f $file_uuid.new
  62.122 +            exit 1
  62.123 +        fi
  62.124 +        cp $file_uuid.new $file_uuid || exit $?
  62.125 +        rm -f $file_uuid.new || true
  62.126 +        chown $musr:$mgrp $file_uuid >/dev/null 2>&1 || true
  62.127 +        chmod 644 $file_uuid >/dev/null 2>&1 || true
  62.128 +
  62.129 +        #   remember that no more changes exist
  62.130 +        changed=no
  62.131 +    fi
  62.132 +}
  62.133 +
  62.134 +#  Reset UUIDs
  62.135 +do_reset () {
  62.136 +    #   reset all UUIDs to the "Nil UUID"
  62.137 +    if [ ".$UUID_REGISTRY" != ".$UUID_NIL" ]; then
  62.138 +        UUID_REGISTRY="$UUID_NIL"
  62.139 +        changed=yes
  62.140 +    fi
  62.141 +    if [ ".$UUID_INSTANCE" != ".$UUID_NIL" ]; then
  62.142 +        UUID_INSTANCE="$UUID_NIL"
  62.143 +        changed=yes
  62.144 +    fi
  62.145 +    if [ ".$UUID_PLATFORM" != ".$UUID_NIL" ]; then
  62.146 +        UUID_PLATFORM="$UUID_NIL"
  62.147 +        changed=yes
  62.148 +    fi
  62.149 +}
  62.150 +
  62.151 +#   Update UUIDs
  62.152 +do_update () {
  62.153 +    #   update registry UUID
  62.154 +    if [ ".$UUID_REGISTRY" = ".$UUID_NIL" -o ".$UUID_REGISTRY" = . ]; then
  62.155 +        opt=""
  62.156 +        if [ ".$opt_m" = .yes ]; then
  62.157 +            opt="-m"
  62.158 +        fi
  62.159 +        if [ ".$opt_v" = .yes ]; then
  62.160 +            echo "uuid: calculating OpenPKG Registry UUID (UUID_REGISTRY):"
  62.161 +            echo "uuid: << $prog_uuid -v1 $opt"
  62.162 +        fi
  62.163 +        uuid=`$prog_uuid -v1 $opt`
  62.164 +        if [ ".$UUID_REGISTRY" != ".$uuid" -a ".$uuid" != . ]; then
  62.165 +            UUID_REGISTRY="$uuid"
  62.166 +            if [ ".$opt_v" = .yes ]; then
  62.167 +                echo "uuid: >> $UUID_REGISTRY (NOT REPEATABLE)"
  62.168 +            fi
  62.169 +            changed=yes
  62.170 +        fi
  62.171 +    fi
  62.172 +
  62.173 +    #   update instance UUID
  62.174 +    name="${Q_openpkg_release}"
  62.175 +    name="$name:${Q_prefix}"
  62.176 +    name="$name:${Q_susr}:${Q_suid}:${Q_sgrp}:${Q_sgid}"
  62.177 +    name="$name:${Q_musr}:${Q_muid}:${Q_mgrp}:${Q_mgid}"
  62.178 +    name="$name:${Q_rusr}:${Q_ruid}:${Q_rgrp}:${Q_rgid}"
  62.179 +    name="$name:${Q_nusr}:${Q_nuid}:${Q_ngrp}:${Q_ngid}"
  62.180 +    if [ ".$opt_v" = .yes ]; then
  62.181 +        echo "uuid: querying OpenPKG Instance OID"
  62.182 +        echo "uuid: << $prog_rpm --eval '%{l_openpkg_oid_instance}'"
  62.183 +    fi
  62.184 +    OID_NS_INSTANCE="`$prog_rpm --eval '%{l_openpkg_oid_instance}'`"
  62.185 +    if [ ".$opt_v" = .yes ]; then
  62.186 +        echo "uuid: >> $OID_NS_INSTANCE"
  62.187 +    fi
  62.188 +    if [ ".$opt_v" = .yes ]; then
  62.189 +        echo "uuid: calculating OpenPKG Instance Namespace UUID"
  62.190 +        echo "uuid: << $prog_uuid -v3 ns:OID \"$OID_NS_INSTANCE\""
  62.191 +    fi
  62.192 +    UUID_NS_INSTANCE=`$prog_uuid -v3 ns:OID "$OID_NS_INSTANCE"`
  62.193 +    if [ ".$opt_v" = .yes ]; then
  62.194 +        echo "uuid: >> $UUID_NS_INSTANCE"
  62.195 +    fi
  62.196 +    if [ ".$opt_v" = .yes ]; then
  62.197 +        echo "uuid: calculating OpenPKG Instance UUID (UUID_INSTANCE):"
  62.198 +        echo "uuid: << $prog_uuid -v3 \"$UUID_NS_INSTANCE\" \"$name\""
  62.199 +    fi
  62.200 +    uuid=`$prog_uuid -v3 "$UUID_NS_INSTANCE" "$name"`
  62.201 +    if [ ".$opt_v" = .yes ]; then
  62.202 +        echo "uuid: >> $uuid"
  62.203 +    fi
  62.204 +    if [ ".$UUID_INSTANCE" != ".$uuid" -a ".$uuid" != . ]; then
  62.205 +        UUID_INSTANCE="$uuid"
  62.206 +        changed=yes
  62.207 +    fi
  62.208 +
  62.209 +    #   update platform UUID
  62.210 +    name="${Q_platform}"
  62.211 +    name="$name:${Q_discriminator}"
  62.212 +    if [ ".$opt_v" = .yes ]; then
  62.213 +        echo "uuid: querying OpenPKG Platform OID"
  62.214 +        echo "uuid: << $prog_rpm --eval '%{l_openpkg_oid_platform}'"
  62.215 +    fi
  62.216 +    OID_NS_PLATFORM="`$prog_rpm --eval '%{l_openpkg_oid_platform}'`"
  62.217 +    if [ ".$opt_v" = .yes ]; then
  62.218 +        echo "uuid: >> $OID_NS_PLATFORM"
  62.219 +    fi
  62.220 +    if [ ".$opt_v" = .yes ]; then
  62.221 +        echo "uuid: calculating OpenPKG Platform Namespace UUID"
  62.222 +        echo "uuid: << $prog_uuid -v3 ns:OID \"$OID_NS_PLATFORM\""
  62.223 +    fi
  62.224 +    UUID_NS_PLATFORM=`$prog_uuid -v3 ns:OID "$OID_NS_PLATFORM"`
  62.225 +    if [ ".$opt_v" = .yes ]; then
  62.226 +        echo "uuid: >> $UUID_NS_PLATFORM"
  62.227 +    fi
  62.228 +    if [ ".$opt_v" = .yes ]; then
  62.229 +        echo "uuid: calculating OpenPKG Platform UUID (UUID_PLATFORM):"
  62.230 +        echo "uuid: << $prog_uuid -v3 \"$UUID_NS_PLATFORM\" \"$name\""
  62.231 +    fi
  62.232 +    uuid=`$prog_uuid -v3 "$UUID_NS_PLATFORM" "$name"`
  62.233 +    if [ ".$opt_v" = .yes ]; then
  62.234 +        echo "uuid: >> $uuid"
  62.235 +    fi
  62.236 +    if [ ".$UUID_PLATFORM" != ".$uuid" -a ".$uuid" != . ]; then
  62.237 +        UUID_PLATFORM="$uuid"
  62.238 +        changed=yes
  62.239 +    fi
  62.240 +}
  62.241 +
  62.242 +#   Info about input and resulting UUIDs
  62.243 +do_info () {
  62.244 +    echo "OpenPKG Summary of Identification Information"
  62.245 +    echo "============================================="
  62.246 +    echo ""
  62.247 +    echo "OpenPKG Registry"
  62.248 +    time=""; clock=""; node=""
  62.249 +    eval `$prog_uuid -d "$UUID_REGISTRY" 2>/dev/null |\
  62.250 +          sed -e 's/^/X/' \
  62.251 +              -e 's/X.*time:  *\(.*\)$/time="\1";/' \
  62.252 +              -e 's/X.*clock:  *\(.*\)$/clock="\1";/' \
  62.253 +              -e 's/X.*node:  *\(.*\)$/node="\1";/' \
  62.254 +              -e 's/^X.*//'`
  62.255 +    echo "    System Time:           ${time:-unknown}"
  62.256 +    echo "    System Clock Sequence: ${clock:-unknown}"
  62.257 +    echo "    System Node Address:   ${node:-unknown}"
  62.258 +    echo "    UUID_REGISTRY:         $UUID_REGISTRY"
  62.259 +    echo ""
  62.260 +    echo "OpenPKG Instance"
  62.261 +    echo "    Release:               ${Q_openpkg_release}"
  62.262 +    echo "    Prefix:                ${Q_prefix}"
  62.263 +    echo "    Super Account:         ${Q_susr}(${Q_suid}):${Q_sgrp}(${Q_sgid})"
  62.264 +    echo "    Management Account:    ${Q_musr}(${Q_muid}):${Q_mgrp}(${Q_mgid})"
  62.265 +    echo "    Restricted Account:    ${Q_rusr}(${Q_ruid}):${Q_rgrp}(${Q_rgid})"
  62.266 +    echo "    Nonprivileged Account: ${Q_nusr}(${Q_nuid}):${Q_ngrp}(${Q_ngid})"
  62.267 +    echo "    UUID_INSTANCE:         $UUID_INSTANCE"
  62.268 +    echo ""
  62.269 +    echo "OpenPKG Platform"
  62.270 +    echo "    Platform Id:           $Q_platform"
  62.271 +    echo "    Discriminator:         $Q_discriminator"
  62.272 +    echo "    UUID_PLATFORM:         $UUID_PLATFORM"
  62.273 +    echo ""
  62.274 +    echo "(run \"$0 --verbose update\" to reproduce the UUID generation)"
  62.275 +}
  62.276 +
  62.277 +#   Command Line Dispatching
  62.278 +cmd="$1"
  62.279 +shift
  62.280 +case "$cmd" in
  62.281 +    reset )
  62.282 +        do_load; do_reset; do_save
  62.283 +        ;;
  62.284 +    update )
  62.285 +        do_query; do_load; do_update; do_save
  62.286 +        ;;
  62.287 +    info )
  62.288 +        do_query; do_load; do_info
  62.289 +        ;;
  62.290 +    * )
  62.291 +        echo "uuid:ERROR: invalid command \"$cmd\"" 1>&2
  62.292 +        exit 1
  62.293 +        ;;
  62.294 +esac
  62.295 +
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/radiusclient/radiusclient.patch	Tue Jan 06 23:40:39 2009 +0100
    63.3 @@ -0,0 +1,75 @@
    63.4 +Index: configure
    63.5 +--- configure.orig	2007-02-05 13:53:08 +0100
    63.6 ++++ configure	2007-02-05 17:15:19 +0100
    63.7 +@@ -2580,7 +2580,7 @@
    63.8 + LIBVERSION=2:0:0
    63.9 + 
   63.10 + 
   63.11 +-pkgsysconfdir=${sysconfdir}/$PACKAGE
   63.12 ++pkgsysconfdir=${sysconfdir}
   63.13 + 
   63.14 + 
   63.15 + # Check whether --enable-shared was given.
   63.16 +Index: lib/Makefile.in
   63.17 +--- lib/Makefile.in.orig	2007-02-05 14:02:08 +0100
   63.18 ++++ lib/Makefile.in	2007-02-05 17:17:41 +0100
   63.19 +@@ -204,7 +204,7 @@
   63.20 + AUTOMAKE_OPTIONS = foreign
   63.21 + INCLUDES = -I$(srcdir) -I$(top_srcdir)/include -I$(top_builddir)
   63.22 + CLEANFILES = *~
   63.23 +-lib_LTLIBRARIES = libradiusclient-ng.la
   63.24 ++lib_LTLIBRARIES = libradiusclient.la
   63.25 + libradiusclient_ng_la_SOURCES = buildreq.c clientid.c env.c sendserver.c \
   63.26 + 	avpair.c config.c dict.c ip_util.c log.c md5.c util.c lock.c \
   63.27 + 	options.h md5.h
   63.28 +@@ -270,7 +270,7 @@
   63.29 + 	  echo "rm -f \"$${dir}/so_locations\""; \
   63.30 + 	  rm -f "$${dir}/so_locations"; \
   63.31 + 	done
   63.32 +-libradiusclient-ng.la: $(libradiusclient_ng_la_OBJECTS) $(libradiusclient_ng_la_DEPENDENCIES) 
   63.33 ++libradiusclient.la: $(libradiusclient_ng_la_OBJECTS) $(libradiusclient_ng_la_DEPENDENCIES) 
   63.34 + 	$(libradiusclient_ng_la_LINK) -rpath $(libdir) $(libradiusclient_ng_la_OBJECTS) $(libradiusclient_ng_la_LIBADD) $(LIBS)
   63.35 + 
   63.36 + mostlyclean-compile:
   63.37 +Index: src/Makefile.in
   63.38 +--- src/Makefile.in.orig	2007-02-05 14:02:08 +0100
   63.39 ++++ src/Makefile.in	2007-02-05 17:18:08 +0100
   63.40 +@@ -62,24 +62,24 @@
   63.41 + am_radacct_OBJECTS = radacct.$(OBJEXT)
   63.42 + radacct_OBJECTS = $(am_radacct_OBJECTS)
   63.43 + radacct_LDADD = $(LDADD)
   63.44 +-radacct_DEPENDENCIES = ../lib/libradiusclient-ng.la
   63.45 ++radacct_DEPENDENCIES = ../lib/libradiusclient.la
   63.46 + am_radexample_OBJECTS = radexample.$(OBJEXT)
   63.47 + radexample_OBJECTS = $(am_radexample_OBJECTS)
   63.48 + radexample_LDADD = $(LDADD)
   63.49 +-radexample_DEPENDENCIES = ../lib/libradiusclient-ng.la
   63.50 ++radexample_DEPENDENCIES = ../lib/libradiusclient.la
   63.51 + am_radiusclient_OBJECTS = radiusclient.$(OBJEXT)
   63.52 + radiusclient_OBJECTS = $(am_radiusclient_OBJECTS)
   63.53 + radiusclient_LDADD = $(LDADD)
   63.54 +-radiusclient_DEPENDENCIES = ../lib/libradiusclient-ng.la
   63.55 ++radiusclient_DEPENDENCIES = ../lib/libradiusclient.la
   63.56 + am_radlogin_OBJECTS = radlogin.$(OBJEXT) radius.$(OBJEXT) \
   63.57 + 	local.$(OBJEXT)
   63.58 + radlogin_OBJECTS = $(am_radlogin_OBJECTS)
   63.59 + radlogin_LDADD = $(LDADD)
   63.60 +-radlogin_DEPENDENCIES = ../lib/libradiusclient-ng.la
   63.61 ++radlogin_DEPENDENCIES = ../lib/libradiusclient.la
   63.62 + am_radstatus_OBJECTS = radstatus.$(OBJEXT)
   63.63 + radstatus_OBJECTS = $(am_radstatus_OBJECTS)
   63.64 + radstatus_LDADD = $(LDADD)
   63.65 +-radstatus_DEPENDENCIES = ../lib/libradiusclient-ng.la
   63.66 ++radstatus_DEPENDENCIES = ../lib/libradiusclient.la
   63.67 + DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
   63.68 + depcomp = $(SHELL) $(top_srcdir)/depcomp
   63.69 + am__depfiles_maybe = depfiles
   63.70 +@@ -221,7 +221,7 @@
   63.71 + top_srcdir = @top_srcdir@
   63.72 + AUTOMAKE_OPTIONS = foreign
   63.73 + INCLUDES = -I$(srcdir) -I$(top_srcdir)/include -I$(top_builddir)
   63.74 +-LDADD = ../lib/libradiusclient-ng.la
   63.75 ++LDADD = ../lib/libradiusclient.la
   63.76 + CLEANFILES = *~
   63.77 + noinst_HEADERS = radlogin.h
   63.78 + radlogin_SOURCES = radlogin.c radius.c local.c
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/radiusclient/radiusclient.spec	Tue Jan 06 23:40:39 2009 +0100
    64.3 @@ -0,0 +1,89 @@
    64.4 +##
    64.5 +##  radiusclient.spec -- OpenPKG RPM Package Specification
    64.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
    64.7 +##
    64.8 +##  Permission to use, copy, modify, and distribute this software for
    64.9 +##  any purpose with or without fee is hereby granted, provided that
   64.10 +##  the above copyright notice and this permission notice appear in all
   64.11 +##  copies.
   64.12 +##
   64.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   64.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   64.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   64.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   64.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   64.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   64.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   64.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   64.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   64.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   64.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   64.24 +##  SUCH DAMAGE.
   64.25 +##
   64.26 +
   64.27 +#   package information
   64.28 +Name:         radiusclient
   64.29 +Summary:      RADIUS Client Library and Tools
   64.30 +URL:          http://radiusclient-ng.berlios.de/
   64.31 +Vendor:       Lars Fenneberg et al.
   64.32 +Packager:     OpenPKG Foundation e.V.
   64.33 +Distribution: OpenPKG Community
   64.34 +Class:        EVAL
   64.35 +Group:        RADIUS
   64.36 +License:      BSD-style
   64.37 +Version:      0.5.6
   64.38 +Release:      20080317
   64.39 +
   64.40 +#   list of sources
   64.41 +Source0:      http://download.berlios.de/radiusclient-ng/radiusclient-ng-%{version}.tar.gz
   64.42 +Patch0:       radiusclient.patch
   64.43 +
   64.44 +#   build information
   64.45 +Prefix:       %{l_prefix}
   64.46 +BuildRoot:    %{l_buildroot}
   64.47 +BuildPreReq:  OpenPKG, openpkg >= 20060823
   64.48 +PreReq:       OpenPKG, openpkg >= 20060823
   64.49 +AutoReq:      no
   64.50 +AutoReqProv:  no
   64.51 +
   64.52 +%description
   64.53 +    This is a RADIUS client library and corresponding tools.
   64.54 +
   64.55 +%track
   64.56 +    prog radiusclient = {
   64.57 +        version   = %{version}
   64.58 +        url       = http://prdownload.berlios.de/radiusclient-ng/
   64.59 +        regex     = radiusclient-ng-(__VER__)\.tar\.gz
   64.60 +    }
   64.61 +
   64.62 +%prep
   64.63 +    %setup -q -n radiusclient-ng-%{version}
   64.64 +    %patch -p0
   64.65 +
   64.66 +%build
   64.67 +    CC="%{l_cc}" \
   64.68 +    CFLAGS="%{l_cflags -O}" \
   64.69 +    CPPFLAGS="%{l_cppflags}" \
   64.70 +    LDFLAGS="%{l_ldflags}" \
   64.71 +    ./configure \
   64.72 +        --prefix=%{l_prefix} \
   64.73 +        --sysconfdir=%{l_prefix}/etc/radiusclient \
   64.74 +        --disable-shared
   64.75 +    %{l_make} %{l_mflags -O}
   64.76 +
   64.77 +%install
   64.78 +    rm -rf $RPM_BUILD_ROOT
   64.79 +    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   64.80 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/login.radius
   64.81 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   64.82 +    mv  $RPM_BUILD_ROOT%{l_prefix}/include/radiusclient-ng.h \
   64.83 +        $RPM_BUILD_ROOT%{l_prefix}/include/radiusclient.h
   64.84 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   64.85 +        %{l_files_std} \
   64.86 +        '%config %{l_prefix}/etc/radiusclient/*'
   64.87 +
   64.88 +%files -f files
   64.89 +
   64.90 +%clean
   64.91 +    rm -rf $RPM_BUILD_ROOT
   64.92 +
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/shtool/shtool.spec	Tue Jan 06 23:40:39 2009 +0100
    65.3 @@ -0,0 +1,94 @@
    65.4 +##
    65.5 +##  shtool.spec -- OpenPKG RPM Package Specification
    65.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
    65.7 +##
    65.8 +##  Permission to use, copy, modify, and distribute this software for
    65.9 +##  any purpose with or without fee is hereby granted, provided that
   65.10 +##  the above copyright notice and this permission notice appear in all
   65.11 +##  copies.
   65.12 +##
   65.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   65.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   65.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   65.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   65.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   65.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   65.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   65.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   65.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   65.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   65.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   65.24 +##  SUCH DAMAGE.
   65.25 +##
   65.26 +
   65.27 +#   package information
   65.28 +Name:         shtool
   65.29 +Summary:      GNU Portable Shell Tool
   65.30 +URL:          http://www.gnu.org/software/shtool/
   65.31 +Vendor:       Ralf S. Engelschall
   65.32 +Packager:     OpenPKG Foundation e.V.
   65.33 +Distribution: OpenPKG Community
   65.34 +Class:        CORE
   65.35 +Group:        Building
   65.36 +License:      GPL
   65.37 +Version:      2.0.8
   65.38 +Release:      20080718
   65.39 +
   65.40 +#   package options
   65.41 +%option       with_shtoolize  yes
   65.42 +
   65.43 +#   list of sources
   65.44 +Source0:      ftp://ftp.gnu.org/gnu/shtool/shtool-%{version}.tar.gz
   65.45 +
   65.46 +#   build information
   65.47 +Prefix:       %{l_prefix}
   65.48 +BuildRoot:    %{l_buildroot}
   65.49 +BuildPreReq:  OpenPKG, openpkg >= 20040130, perl
   65.50 +PreReq:       OpenPKG, openpkg >= 20040130
   65.51 +%if "%{with_shtoolize}" == "yes"
   65.52 +PreReq:       perl
   65.53 +%endif
   65.54 +AutoReq:      no
   65.55 +AutoReqProv:  no
   65.56 +
   65.57 +%description
   65.58 +    GNU shtool is a compilation of small but very stable and portable
   65.59 +    shell scripts into a single shell tool. All ingredients were in
   65.60 +    successful use over many years in various free software projects.
   65.61 +    The compiled shtool script is intended to be used inside the source
   65.62 +    tree of those free software packages. There it can take over
   65.63 +    various (usually non-portable) tasks related to the building and
   65.64 +    installation of such packages.
   65.65 +
   65.66 +%track
   65.67 +    prog shtool = {
   65.68 +        version   = %{version}
   65.69 +        url       = ftp://ftp.gnu.org/gnu/shtool/
   65.70 +        regex     = shtool-(__VER__)\.tar\.gz
   65.71 +    }
   65.72 +
   65.73 +%prep
   65.74 +    %setup -q
   65.75 +
   65.76 +%build
   65.77 +    ./configure \
   65.78 +        --prefix=%{l_prefix} \
   65.79 +        --mandir=%{l_prefix}/man
   65.80 +    %{l_make} %{l_mflags}
   65.81 +
   65.82 +%install
   65.83 +    rm -rf $RPM_BUILD_ROOT
   65.84 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   65.85 +%if "%{with_shtoolize}" != "yes"
   65.86 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/shtoolize
   65.87 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/shtoolize.1
   65.88 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/shtool
   65.89 +%endif
   65.90 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   65.91 +        %{l_files_std}
   65.92 +
   65.93 +%files -f files
   65.94 +
   65.95 +%clean
   65.96 +    rm -rf $RPM_BUILD_ROOT
   65.97 +
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/sox/sox.spec	Tue Jan 06 23:40:39 2009 +0100
    66.3 @@ -0,0 +1,91 @@
    66.4 +##
    66.5 +##  sox.spec -- OpenPKG RPM Package Specification
    66.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
    66.7 +##
    66.8 +##  Permission to use, copy, modify, and distribute this software for
    66.9 +##  any purpose with or without fee is hereby granted, provided that
   66.10 +##  the above copyright notice and this permission notice appear in all
   66.11 +##  copies.
   66.12 +##
   66.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   66.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   66.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   66.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   66.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   66.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   66.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   66.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   66.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   66.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   66.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   66.24 +##  SUCH DAMAGE.
   66.25 +##
   66.26 +
   66.27 +#   package information
   66.28 +Name:         sox
   66.29 +Summary:      Audio Format Conversion Tool
   66.30 +URL:          http://sox.sourceforge.net/
   66.31 +Vendor:       Lance Norskog
   66.32 +Packager:     OpenPKG Foundation e.V.
   66.33 +Distribution: OpenPKG Community
   66.34 +Class:        PLUS
   66.35 +Group:        Audio
   66.36 +License:      LGPL
   66.37 +Version:      14.1.0
   66.38 +Release:      20080730
   66.39 +
   66.40 +#   list of sources
   66.41 +Source0:      http://switch.dl.sourceforge.net/sourceforge/sox/sox-%{version}.tar.gz
   66.42 +
   66.43 +#   build information
   66.44 +Prefix:       %{l_prefix}
   66.45 +BuildRoot:    %{l_buildroot}
   66.46 +BuildPreReq:  OpenPKG, openpkg >= 20040130, gcc, make
   66.47 +PreReq:       OpenPKG, openpkg >= 20040130
   66.48 +AutoReq:      no
   66.49 +AutoReqProv:  no
   66.50 +
   66.51 +%description
   66.52 +    SoX is the swiss army knife of sound processing programs. It is a
   66.53 +    command line utility that can convert various formats of computer
   66.54 +    audio files in to other formats. It can also apply various effects
   66.55 +    to these sound files during the conversion. As an added bonus, SoX
   66.56 +    can play and record audio files on several Unix style platforms.
   66.57 +
   66.58 +%track
   66.59 +    prog sox = {
   66.60 +        version   = %{version}
   66.61 +        url       = http://prdownloads.sourceforge.net/sox/
   66.62 +        regex     = sox-(__VER__)\.tar\.gz
   66.63 +    }
   66.64 +
   66.65 +%prep
   66.66 +    %setup -q
   66.67 +
   66.68 +%build
   66.69 +    export CC="%{l_cc}"
   66.70 +    export CFLAGS="%{l_cflags -O} %{l_cppflags}"
   66.71 +    export CPPFLAGS="%{l_cppflags}"
   66.72 +    export LDFLAGS="%{l_ldflags}"
   66.73 +    export LIBS=""
   66.74 +    case "%{l_platform -p}" in
   66.75 +        *-netbsd* ) LIBS="$LIBS -lossaudio" ;;
   66.76 +    esac
   66.77 +    ./configure \
   66.78 +        --prefix=%{l_prefix} \
   66.79 +        --mandir=%{l_prefix}/man
   66.80 +    %{l_make} %{l_mflags -O}
   66.81 +
   66.82 +%install
   66.83 +    rm -rf $RPM_BUILD_ROOT
   66.84 +    %{l_make} %{l_mflags} install \
   66.85 +        AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" \
   66.86 +        LN_S="ln"
   66.87 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   66.88 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   66.89 +
   66.90 +%files -f files
   66.91 +
   66.92 +%clean
   66.93 +    rm -rf $RPM_BUILD_ROOT
   66.94 +
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/tightvnc/tightvnc.spec	Tue Jan 06 23:40:39 2009 +0100
    67.3 @@ -0,0 +1,101 @@
    67.4 +##
    67.5 +##  tightvnc.spec -- OpenPKG RPM Package Specification
    67.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
    67.7 +##
    67.8 +##  Permission to use, copy, modify, and distribute this software for
    67.9 +##  any purpose with or without fee is hereby granted, provided that
   67.10 +##  the above copyright notice and this permission notice appear in all
   67.11 +##  copies.
   67.12 +##
   67.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   67.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   67.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   67.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
   67.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   67.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   67.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   67.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   67.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   67.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   67.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   67.24 +##  SUCH DAMAGE.
   67.25 +##
   67.26 +
   67.27 +#   package information
   67.28 +Name:         tightvnc
   67.29 +Summary:      Enhanced Virtual Network Computing (VNC)
   67.30 +URL:          http://www.tightvnc.org/
   67.31 +Vendor:       Constantin Kaplinsky
   67.32 +Packager:     OpenPKG Foundation e.V.
   67.33 +Distribution: OpenPKG Community
   67.34 +Class:        EVAL
   67.35 +Group:        XWindow
   67.36 +License:      GPL
   67.37 +Version:      1.3.9
   67.38 +Release:      20080101
   67.39 +
   67.40 +#   list of sources
   67.41 +Source0:      http://switch.dl.sourceforge.net/vnc-tight/tightvnc-%{version}_unixsrc.tar.bz2
   67.42 +
   67.43 +#   build information
   67.44 +Prefix:       %{l_prefix}
   67.45 +BuildRoot:    %{l_buildroot}
   67.46 +BuildPreReq:  OpenPKG, openpkg >= 20040130, X11, make, gcc
   67.47 +PreReq:       OpenPKG, openpkg >= 20040130, X11
   67.48 +BuildPreReq:  zlib, jpeg
   67.49 +PreReq:       zlib, jpeg
   67.50 +AutoReq:      no
   67.51 +AutoReqProv:  no
   67.52 +
   67.53 +%description
   67.54 +    TightVNC is a free remote control package derived from the popular
   67.55 +    Virtual Network Computing (VNC) software. With TightVNC, you can see
   67.56 +    the desktop of a remote machine and control it with your local mouse
   67.57 +    and keyboard, just like you would do it sitting in the front of that
   67.58 +    computer. This packages provides the VNC client only.
   67.59 +
   67.60 +%track
   67.61 +    prog tightvnc = {
   67.62 +        version   = %{version}
   67.63 +        url       = http://prdownloads.sourceforge.net/vnc-tight/
   67.64 +        regex     = tightvnc-(__VER__)_unixsrc\.tar\.bz2
   67.65 +    }
   67.66 +
   67.67 +%prep
   67.68 +    %setup -q -n vnc_unixsrc
   67.69 +
   67.70 +%build
   67.71 +    %{l_shtool} subst \
   67.72 +        -e 's;^\(ZLIB_INC =\).*;\1 %{l_cppflags};' \
   67.73 +        -e 's;^\(ZLIB_LIB =\).*;\1 %{l_ldflags} -lz;' \
   67.74 +        -e 's;^\(JPEG_INC =\).*;\1 %{l_cppflags};' \
   67.75 +        -e 's;^\(JPEG_LIB =\).*;\1 %{l_ldflags} -ljpeg;' \
   67.76 +        -e 's;-I/usr/include;;' \
   67.77 +        vncviewer/Imakefile
   67.78 +    rm -f Makefile */Makefile
   67.79 +    PATH="$PATH:`%{l_rc} --query x11_bindir`"
   67.80 +    x11config=`%{l_rc} --query x11_libdir`/X11/config
   67.81 +    imake -DHasGcc2 -UHasSunC -DUseInstalled -I$x11config
   67.82 +    %{l_make} Makefiles IMAKE_DEFINES="-DHasGcc2 -UHasSunC"
   67.83 +    %{l_make} includes
   67.84 +    %{l_make} all CC="%{l_cc}"
   67.85 +
   67.86 +%install
   67.87 +    rm -rf $RPM_BUILD_ROOT
   67.88 +    %{l_shtool} mkdir -f -p -m 755 \
   67.89 +        $RPM_BUILD_ROOT%{l_prefix}/bin \
   67.90 +        $RPM_BUILD_ROOT%{l_prefix}/man/man1
   67.91 +    for f in vncviewer vncpasswd; do
   67.92 +        %{l_shtool} install -c -m 755 \
   67.93 +            $f/$f $RPM_BUILD_ROOT%{l_prefix}/bin/$f
   67.94 +        %{l_shtool} install -c -m 644 \
   67.95 +            $f/$f.man $RPM_BUILD_ROOT%{l_prefix}/man/man1/$f.1
   67.96 +    done
   67.97 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   67.98 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   67.99 +
  67.100 +%files -f files
  67.101 +
  67.102 +%clean
  67.103 +    rm -rf $RPM_BUILD_ROOT
  67.104 +

mercurial