michael@13: ##
michael@13: ## openpkg.spec -- OpenPKG RPM Package Specification
michael@13: ## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
michael@13: ## Copyright (c) 2000-2007 Ralf S. Engelschall
michael@13: ##
michael@13: ## Permission to use, copy, modify, and distribute this software for
michael@13: ## any purpose with or without fee is hereby granted, provided that
michael@13: ## the above copyright notice and this permission notice appear in all
michael@13: ## copies.
michael@13: ##
michael@13: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@13: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@13: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@13: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@13: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@13: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@13: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@13: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@13: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@13: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@13: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@13: ## SUCH DAMAGE.
michael@13: ##
michael@13:
michael@13: # NOTICE: This OpenPKG RPM specification is _very_ special, because
michael@13: # it is used both for bootstrapping OpenPKG with its OpenPKG RPM and
michael@13: # for regular builds of OpenPKG RPM in order to upgrade an existing
michael@13: # installation. For this it has to interact correctly with the
michael@13: # "openpkg.boot" script. See the documentation in the file "README"
michael@13: # and the source of the companion script "openpkg.boot" for details,
michael@13: # but do not touch anything here until you are 100% sure about what
michael@13: # you are doing. In short: This script is allowed to use only a very
michael@13: # restricted subset of the OpenPKG RPM functionality!
michael@13:
michael@13: # BUILD REQUIREMENTS:
michael@13: # o any sh(1)
michael@13: # o any tar(1)
michael@13: # o any make(1)
michael@13: # o any cc(1)
michael@13:
michael@13: # the package version/release
michael@333: %define V_openpkg 20110322
michael@13:
michael@13: # the used software versions
michael@13: %define V_rpm 4.2.1
michael@250: %define V_zlib 1.2.5
michael@250: %define V_bzip2 1.0.5
michael@13: %define V_beecrypt 4.1.2
michael@250: %define V_curl 7.21.1
michael@250: %define V_make 3.82
michael@250: %define V_gzip 1.4
michael@13: %define V_gzip_r 1.13
michael@250: %define V_patch 2.6.1
michael@250: %define V_tar 1.23
michael@13: %define V_bash 3.2
michael@250: %define V_uuid 1.6.2
michael@13: %define V_config 20060923
michael@13: %define V_registry 1.1.3
michael@13: %define V_perl 5.10.0
michael@13: %define V_openssl 0.9.8g
michael@13: %define V_tools 1.4.5
michael@13: %define V_exec 2.0.1-C
michael@13:
michael@13: # package information
michael@13: Name: openpkg
michael@13: Summary: OpenPKG Bootstrap
michael@13: URL: http://www.openpkg.org/
michael@13: Vendor: OpenPKG
michael@13: Packager: OpenPKG Foundation e.V.
michael@13: Distribution: OpenPKG Community
michael@13: Class: CORE
michael@13: Group: Bootstrapping
michael@13: License: MIT/BSD/LGPL/GPL
michael@13: Version: %{V_openpkg}
michael@13: Release: %{V_openpkg}
michael@13:
michael@13: # list of sources
michael@250: Source0: ftp://ftp.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
michael@13: Source1: ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz
michael@13: Source2: ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
michael@13: Source3: ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
michael@13: Source4: ftp://ftp.openpkg.org/sources/CPY/config/config-%{V_config}.tar.gz
michael@13: Source5: ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/openpkg-registry-%{V_registry}.tar.gz
michael@13: Source6: ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/openpkg-tools-%{V_tools}.tar.gz
michael@13: Source7: ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar
michael@250: Source8: ftp://ftp.gnu.org/gnu/gzip/gzip-%{V_gzip}.tar
michael@13: Source9: ftp://ftp.openpkg.org/sources/CPY/openpkg/openpkg-executable-%{V_exec}.tar.gz
michael@13: Source10: ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
michael@13: Source11: ftp://ftp.openpkg.org/sources/CPY/perl/perl-%{V_perl}-mini.tar.gz
michael@13: Source12: ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
michael@13: Source13: ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
michael@13: Source14: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
michael@13: Source15: http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
michael@13: Source16: http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz
michael@13: Source17: http://www.zlib.net/zlib-%{V_zlib}.tar.gz
michael@13: Source100: bash.patch
michael@13: Source101: beecrypt.patch
michael@13: Source102: make.patch
michael@13: Source103: openssl.patch
michael@13: Source104: perl.patch
michael@13: Source105: tar.patch
michael@13: Source106: rpm.patch.bugfix
michael@13: Source107: rpm.patch.feature
michael@13: Source108: rpm.patch.porting
michael@13: Source109: rpm.patch.regen
michael@13: Source200: HISTORY
michael@13: Source201: README
michael@13: Source202: aux.prereq.sh
michael@13: Source203: aux.usrgrp.sh
michael@13: Source204: aux.wrapbin.sh
michael@13: Source205: aux.wrapsrc.sh
michael@13: Source206: dot.bash_login
michael@13: Source207: dot.bashrc
michael@13: Source208: dot.lsyncrc
michael@13: Source209: install.sh
michael@13: Source210: local.README
michael@13: Source211: lsync
michael@13: Source212: lsync.8
michael@13: Source213: lsync.pod
michael@13: Source214: man.sh
michael@13: Source215: openpkg.1
michael@13: Source216: openpkg.boot
michael@13: Source217: openpkg.com.pgp
michael@13: Source218: openpkg.net.pgp
michael@13: Source219: openpkg.org.pgp
michael@13: Source220: openpkg.pod
michael@13: Source221: openpkg.sh
michael@13: Source222: pod2man.sh
michael@13: Source223: rc
michael@13: Source224: rc.8
michael@13: Source225: rc.conf
michael@13: Source226: rc.func
michael@13: Source227: rc.openpkg
michael@13: Source228: rc.pod
michael@13: Source229: release.8
michael@13: Source230: release.pod
michael@13: Source231: release.sh
michael@13: Source232: root.README
michael@13: Source233: rpm-config.8
michael@13: Source234: rpm-config.pod
michael@13: Source235: rpm-config.sh
michael@13: Source236: rpmdb
michael@13: Source237: rpmtool
michael@13: Source238: rpmtool.8
michael@13: Source239: rpmtool.pod
michael@13: Source240: shtool
michael@13: Source241: uuid.8
michael@13: Source242: uuid.pod
michael@13: Source243: uuid.sh
michael@13: Source244: rpmmacros
michael@13: Source245: rpmpopt
michael@13: Source246: rpmrc
michael@13:
michael@13: # build information
michael@13: Prefix: %{l_prefix}
michael@13: BuildRoot: %{l_buildroot}
michael@13: AutoReq: no
michael@13: AutoReqProv: no
michael@13: Provides: OpenPKG
michael@13:
michael@13: %description
michael@13: This is the bootstrap package for the RPM-based Unix Software
michael@13: Package Hierarchy OpenPKG. The RPM Package Manager (RPM) is a
michael@13: sophisticated and portable package manager for Unix platforms,
michael@13: which supports automated building, installation, management and
michael@13: deinstallation of Unix software. RPM was originally designed and
michael@13: implemented for the RedHat Linux operating system where it manages
michael@13: every file on the whole system. OpenPKG uses RPM only for managing
michael@13: the files in a particular filesystem hierarchy dedicated to the
michael@13: installation of third-party software packages provided by the
michael@13: OpenPKG project.
michael@13:
michael@13: The OpenPKG bootstrap package includes the following software:
michael@13: RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
michael@13: GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
michael@13: GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
michael@13: OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt},
michael@13: OpenSSL %{V_openssl}, Perl %{V_perl}
michael@13:
michael@13: %track
michael@13: prog openpkg:bash = {
michael@13: version = %{V_bash}
michael@13: url = ftp://ftp.cwru.edu/pub/bash/
michael@13: regex = bash-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:bzip2 = {
michael@13: version = %{V_bzip2}
michael@13: url = http://www.bzip.org/downloads.html
michael@13: regex = bzip2-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:curl = {
michael@13: version = %{V_curl}
michael@13: url = http://curl.haxx.se/download/
michael@13: regex = curl-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:gzip = {
michael@13: comment = "rse: intentionally tracked at gnu.org, although fetched from openpkg.org because of uncompression"
michael@13: version = %{V_gzip}
michael@13: url = ftp://ftp.gnu.org/gnu/gzip/
michael@13: regex = gzip-(__VER__)\.tar(\.gz)?
michael@13: }
michael@13: prog openpkg:gzip_r = {
michael@13: version = %{V_gzip_r}
michael@13: url = ftp://ftp.openpkg.org/sources/CPY/openpkg/
michael@13: regex = gzip-%{V_gzip}-openpkg-r(__VER__)\.tar
michael@13: }
michael@13: prog openpkg:make = {
michael@13: version = %{V_make}
michael@13: url = ftp://ftp.gnu.org/gnu/make/
michael@13: regex = make-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:patch = {
michael@13: disabled
michael@13: comment = "rse: directory missing after GNU.org security issues"
michael@13: version = %{V_patch}
michael@13: url = ftp://alpha.gnu.org/gnu/patch/
michael@13: regex = patch-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:rpm = {
michael@13: disabled
michael@13: comment = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1"
michael@13: version = %{V_rpm}
michael@13: url = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/
michael@13: regex = rpm-(4\.2\.\d+)\.tar\.gz
michael@13: }
michael@13: prog openpkg:tar = {
michael@13: version = %{V_tar}
michael@13: url = ftp://ftp.gnu.org/gnu/tar/
michael@13: regex = tar-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:zlib = {
michael@13: version = %{V_zlib}
michael@13: url = http://www.zlib.net/
michael@13: regex = zlib-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:uuid = {
michael@13: version = %{V_uuid}
michael@13: url = ftp://ftp.ossp.org/pkg/lib/uuid/
michael@13: regex = uuid-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:config = {
michael@13: version = %{V_config}
michael@13: url = ftp://ftp.openpkg.org/sources/CPY/config/
michael@13: regex = config-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:beecrypt = {
michael@13: version = %{V_beecrypt}
michael@13: url = http://prdownloads.sourceforge.net/beecrypt/
michael@13: regex = beecrypt-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:registry = {
michael@13: version = %{V_registry}
michael@13: url = ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/
michael@13: regex = openpkg-registry-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:perl = {
michael@13: version = %{V_perl}
michael@13: url = ftp://ftp.openpkg.org/sources/CPY/perl/
michael@13: regex = perl-(__VER__)-mini\.tar\.gz
michael@13: }
michael@13: prog openpkg:openssl = {
michael@13: version = %{V_openssl}
michael@13: url = ftp://ftp.openssl.org/source/
michael@13: regex = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
michael@13: }
michael@13: prog openpkg:openpkg-tools = {
michael@13: version = %{V_tools}
michael@13: url = ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/
michael@13: regex = openpkg-tools-(__VER__)\.tar\.gz
michael@13: }
michael@13: prog openpkg:openpkg-executable = {
michael@13: version = %{V_exec}
michael@13: url = ftp://ftp.openpkg.org/sources/CPY/openpkg/
michael@13: regex = openpkg-executable-(__VER__-C)\.tar\.gz
michael@13: }
michael@13:
michael@13: %prep
michael@13: # skip in bootstrap phase 2 (see openpkg.boot)
michael@13: [ ".$OPENPKG_BOOT" = .1 ] && exit 0
michael@13:
michael@13: # switch into a temporary build area
michael@13: rm -rf openpkg-%{version}
michael@13: mkdir openpkg-%{version}
michael@13: cd openpkg-%{version}
michael@13: rm -f .buildenv
michael@13: touch .buildenv
michael@13:
michael@13: # provide a bootstrap alternative to %{SOURCE xxx} because else
michael@13: # it is not possible to upgrade a newer OpenPKG RPM with an older
michael@13: # OpenPKG RPM.
michael@13: echo >>.buildenv 'SOURCE () {'
michael@13: echo >>.buildenv ' if [ -f "%{_specdir}/$1" ]; then'
michael@13: echo >>.buildenv ' echo "%{_specdir}/$1"'
michael@13: echo >>.buildenv ' else'
michael@13: echo >>.buildenv ' echo "%{_sourcedir}/$1"'
michael@13: echo >>.buildenv ' fi'
michael@13: echo >>.buildenv '}'
michael@13: echo >>.buildenv 'VERBOSE () {'
michael@13: echo >>.buildenv ' if [ -f "%{_specdir}/rpmtool" ]; then'
michael@13: echo >>.buildenv ' echo "$*" | sh %{_specdir}/rpmtool msg'
michael@13: echo >>.buildenv ' else'
michael@13: echo >>.buildenv ' echo "$*" | sh %{_sourcedir}/rpmtool msg'
michael@13: echo >>.buildenv ' fi'
michael@13: echo >>.buildenv '}'
michael@13: . ./.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"; set -x
michael@13:
michael@13: # determine path to shtool
michael@13: shtool=`SOURCE shtool`
michael@13: echo "shtool=$shtool" >>./.buildenv
michael@13:
michael@13: # determine development tools
michael@13: # - bootstrapping: %{l_xxx} is set via sed(1)
michael@13: # - upgrading new: %{l_xxx} is set via rpmmacros
michael@13: # - upgrading old: %{l_xxx} is not set at all
michael@13:
michael@13: # manually make sure tar(1) is available
michael@13: l_tar=""; export l_tar
michael@13: [ ".%{?l_tar:set}" = .set ] && l_tar="%{l_tar}"
michael@13: [ ".%{?use_tar:set}" = .set ] && l_tar="%{use_tar}"
michael@13: if [ ".$l_tar" = . ]; then
michael@13: l_tar=`sh $shtool path gtar tar`
michael@13: if [ ".$l_tar" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
michael@13:
michael@13: # manually make sure make(1) is available
michael@13: l_make=""; export l_make
michael@13: [ ".%{?l_make:set}" = .set ] && l_make="%{l_make}"
michael@13: [ ".%{?use_make:set}" = .set ] && l_make="%{use_make}"
michael@13: if [ ".$l_make" = . ]; then
michael@13: l_make=`sh $shtool path gmake make`
michael@13: if [ ".$l_make" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_make=\"$l_make\"; export l_make" >>.buildenv
michael@13:
michael@13: # manually make sure cc(1) is available
michael@13: l_cc=""; export l_cc
michael@13: [ ".%{?l_cc:set}" = .set ] && l_cc="%{l_cc}"
michael@13: [ ".%{?use_cc:set}" = .set ] && l_cc="%{use_cc}"
michael@13: if [ ".$l_cc" = . ]; then
michael@13: l_cc=`sh $shtool path gcc cc`
michael@13: if [ ".$l_cc" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
michael@13:
michael@13: # manually make sure ar(1) is available
michael@13: l_ar=""; export l_ar
michael@13: [ ".%{?l_ar:set}" = .set ] && l_ar="%{l_ar}"
michael@13: [ ".%{?use_ar:set}" = .set ] && l_ar="%{use_ar}"
michael@13: if [ ".$l_ar" = . ]; then
michael@13: l_ar=`sh $shtool path ar`
michael@13: if [ ".$l_ar" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`ar' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_ar=\"$l_ar\"; export l_ar" >>.buildenv
michael@13:
michael@13: # manually make sure ld(1) is available
michael@13: l_ld=""; export l_ld
michael@13: [ ".%{?l_ld:set}" = .set ] && l_ld="%{l_ld}"
michael@13: [ ".%{?use_ld:set}" = .set ] && l_ld="%{use_ld}"
michael@13: if [ ".$l_ld" = . ]; then
michael@13: l_ld=`sh $shtool path ld`
michael@13: if [ ".$l_ld" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`ld' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_ld=\"$l_ld\"; export l_ld" >>.buildenv
michael@13:
michael@13: # manually make sure as(1) is available
michael@13: l_as=""; export l_as
michael@13: [ ".%{?l_as:set}" = .set ] && l_as="%{l_as}"
michael@13: [ ".%{?use_as:set}" = .set ] && l_as="%{use_as}"
michael@13: if [ ".$l_as" = . ]; then
michael@13: l_as=`sh $shtool path as`
michael@13: if [ ".$l_as" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`as' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_as=\"$l_as\"; export l_as" >>.buildenv
michael@13:
michael@13: # manually make sure strip(1) is available or use a null replacement
michael@13: l_strip=""; export l_strip
michael@13: [ ".%{?l_strip:set}" = .set ] && l_strip="%{l_strip}"
michael@13: [ ".%{?use_strip:set}" = .set ] && l_strip="%{use_strip}"
michael@13: if [ ".$l_strip" = . ]; then
michael@13: l_strip=`sh $shtool path strip ls`
michael@13: if [ ".$l_strip" = . ]; then
michael@13: echo "openpkg: prerequisite tool \`strip' not found"
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv
michael@13:
michael@13: # determine path to aux.usrgrp.sh script
michael@13: usrgrp=`SOURCE aux.usrgrp.sh`
michael@13: echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"; set -x
michael@13:
michael@13: # determine user/group name/id pairs
michael@13: # - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
michael@13: # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
michael@13: # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
michael@13: susr=""; [ ".%{?l_susr:set}" = .set ] && susr="%{l_susr}"
michael@13: sgrp=""; [ ".%{?l_sgrp:set}" = .set ] && sgrp="%{l_sgrp}"
michael@13: musr=""; [ ".%{?l_musr:set}" = .set ] && musr="%{l_musr}"
michael@13: mgrp=""; [ ".%{?l_mgrp:set}" = .set ] && mgrp="%{l_mgrp}"
michael@13: rusr=""; [ ".%{?l_rusr:set}" = .set ] && rusr="%{l_rusr}"
michael@13: rgrp=""; [ ".%{?l_rgrp:set}" = .set ] && rgrp="%{l_rgrp}"
michael@13: nusr=""; [ ".%{?l_nusr:set}" = .set ] && nusr="%{l_nusr}"
michael@13: ngrp=""; [ ".%{?l_ngrp:set}" = .set ] && ngrp="%{l_ngrp}"
michael@13: # corresponding ids
michael@13: suid=""; [ ".%{?l_suid:set}" = .set ] && suid="%{l_suid}"
michael@13: sgid=""; [ ".%{?l_sgid:set}" = .set ] && sgid="%{l_sgid}"
michael@13: muid=""; [ ".%{?l_muid:set}" = .set ] && muid="%{l_muid}"
michael@13: mgid=""; [ ".%{?l_mgid:set}" = .set ] && mgid="%{l_mgid}"
michael@13: ruid=""; [ ".%{?l_ruid:set}" = .set ] && ruid="%{l_ruid}"
michael@13: rgid=""; [ ".%{?l_rgid:set}" = .set ] && rgid="%{l_rgid}"
michael@13: nuid=""; [ ".%{?l_nuid:set}" = .set ] && nuid="%{l_nuid}"
michael@13: ngid=""; [ ".%{?l_ngid:set}" = .set ] && ngid="%{l_ngid}"
michael@13: # compat:
michael@13: usr=""; [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
michael@13: grp=""; [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
michael@13: eval `sh $usrgrp \
michael@13: --usr="$usr" --grp="$grp" \
michael@13: --susr="$susr" --sgrp="$sgrp" \
michael@13: --musr="$musr" --mgrp="$mgrp" \
michael@13: --rusr="$rusr" --rgrp="$rgrp" \
michael@13: --nusr="$nusr" --ngrp="$ngrp" \
michael@13: --suid="$suid" --sgid="$sgid" \
michael@13: --muid="$muid" --mgid="$mgid" \
michael@13: --ruid="$ruid" --rgid="$rgid" \
michael@13: --nuid="$nuid" --ngid="$ngid"`
michael@13: echo "susr=\"$susr\"; export susr" >>.buildenv
michael@13: echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
michael@13: echo "musr=\"$musr\"; export musr" >>.buildenv
michael@13: echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
michael@13: echo "rusr=\"$rusr\"; export rusr" >>.buildenv
michael@13: echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
michael@13: echo "nusr=\"$nusr\"; export nusr" >>.buildenv
michael@13: echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
michael@13: echo "suid=\"$suid\"; export suid" >>.buildenv
michael@13: echo "sgid=\"$sgid\"; export sgid" >>.buildenv
michael@13: echo "muid=\"$muid\"; export muid" >>.buildenv
michael@13: echo "mgid=\"$mgid\"; export mgid" >>.buildenv
michael@13: echo "ruid=\"$ruid\"; export ruid" >>.buildenv
michael@13: echo "rgid=\"$rgid\"; export rgid" >>.buildenv
michael@13: echo "nuid=\"$nuid\"; export nuid" >>.buildenv
michael@13: echo "ngid=\"$ngid\"; export ngid" >>.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"; set -x
michael@13:
michael@13: # determine installation location id
michael@13: if [ ".%{?l_tag_fmt:set}" = .set ]; then
michael@13: tag="%{l_tag_fmt}"
michael@13: else
michael@13: tag=""
michael@13: fi
michael@13: echo "tag=\"$tag\"; export tag" >>.buildenv
michael@13:
michael@13: # determine platform id
michael@13: s=`(uname -s) 2>/dev/null` || s='Unknown'
michael@13: r=`(uname -r) 2>/dev/null` || r='0.0'
michael@13: plid="${s}/${r}"
michael@13: echo "plid=\"$plid\"; export plid" >>.buildenv
michael@13:
michael@13: # determine platform-specific build environment
michael@13: case $plid in
michael@13: FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: NetBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
michael@13: UnixWare/*) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
michael@13: AIX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
michael@13: Darwin/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: HP-UX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: * ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
michael@13: esac
michael@13: case $plid in
michael@13: FreeBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
michael@13: NetBSD/* ) l_build_ldlp="/lib:/usr/lib" ;;
michael@13: Linux/* ) l_build_ldlp="/lib:/usr/lib" ;;
michael@13: SunOS/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
michael@13: UnixWare/*) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
michael@13: AIX/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
michael@13: Darwin/* ) l_build_ldlp="/usr/lib" ;;
michael@13: OSF1/V5.* ) l_build_ldlp="/usr/lib" ;;
michael@13: HP-UX/* ) l_build_ldlp="/usr/lib" ;;
michael@13: IRIX*/6.* ) l_build_ldlp="/usr/lib" ;;
michael@13: * ) l_build_ldlp="/usr/lib" ;;
michael@13: esac
michael@13: case $plid in
michael@13: * ) l_build_ulim=":" ;;
michael@13: esac
michael@13: echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
michael@13: echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
michael@13: echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x
michael@13:
michael@13: # bootstrap GNU zip tool
michael@13: ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
michael@13: ${l_tar} xf `SOURCE gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar` 2>/dev/null || true
michael@13: ( cd gzip-%{V_gzip}
michael@13: echo "ac_cv_prog_cc_g=no" >config.cache
michael@13: case $plid in
michael@13: Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;;
michael@13: esac
michael@13: CC="${l_cc}" \
michael@13: GREP="grep" \
michael@333: MAKE="${l_make}" \
michael@13: ./configure \
michael@13: --cache-file=./config.cache
michael@13: ${l_make} || exit $?
michael@13: ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $?
michael@13: ) || exit $?
michael@13: l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
michael@13: echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Unpack GNU configuration guessing utilities"; set -x
michael@13:
michael@13: # unpack GNU config.guess
michael@13: ${l_gzip} -dc `SOURCE config-%{V_config}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"; set -x
michael@13:
michael@13: # bootstrap GNU patch tool
michael@13: ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ( cd patch-%{V_patch}
michael@13: chmod u+w config.guess config.sub >/dev/null 2>&1 || true
michael@13: cp ../config/config.guess .
michael@13: cp ../config/config.sub .
michael@13: ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
michael@13: echo 'ac_cv_prog_cc_g=no'
michael@13: false=`sh $shtool path false`
michael@13: echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
michael@13: ) >config.cache
michael@13: CC="${l_cc}" \
michael@329: GREP="grep" \
michael@13: ./configure \
michael@13: --cache-file=./config.cache \
michael@13: --disable-largefile
michael@13: ${l_make} || exit $?
michael@250: ( mv src/patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
michael@13: ) || exit $?
michael@13: l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
michael@13: echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"; set -x
michael@13:
michael@13: # build GNU tar tool
michael@13: ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ( cd tar-%{V_tar}
michael@13: ${l_patch} -p0 <`SOURCE tar.patch`
michael@13: ( echo 'am_cv_func_iconv=no'
michael@13: echo 'am_cv_lib_iconv=no'
michael@13: echo 'ac_cv_lib_iconv_iconv=no'
michael@13: echo 'ac_cv_header_iconv_h=no'
michael@13: echo 'ac_cv_type_iconv_t=no'
michael@13: ) >config.cache
michael@13: CC="${l_cc}" \
michael@333: MAKE="${l_make}" \
michael@13: MAKEINFO="true" \
michael@13: GREP="grep" \
michael@13: ./configure \
michael@13: --cache-file=./config.cache \
michael@13: --prefix=%{l_prefix} \
michael@13: --disable-nls
michael@13: ${l_make} || exit $?
michael@13: ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $?
michael@13: ) || exit $?
michael@13: l_tar="`pwd`/tar-%{V_tar}/tar"; export l_tar
michael@13: echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x
michael@13:
michael@13: # unpack distribution tarballs
michael@13: ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE openpkg-registry-%{V_registry}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE openpkg-tools-%{V_tools}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13: ${l_gzip} -dc `SOURCE openpkg-executable-%{V_exec}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
michael@13:
michael@13: # update config.guess/config.sub
michael@13: for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
michael@13: curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do
michael@13: chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
michael@13: cp config/config.guess $dir/
michael@13: cp config/config.sub $dir/
michael@13: done
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x
michael@13:
michael@13: # apply OpenPKG patches to distribution trees
michael@13: ( cd rpm-%{V_rpm}
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix` | ${l_patch} -p0
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen` | ${l_patch} -p0
michael@13: rm -rf db/docs # just reduce disk size of source tree
michael@13: ) || exit $?
michael@13: ( cd make-%{V_make}
michael@13: ${l_patch} -p0 <`SOURCE make.patch`
michael@13: ) || exit $?
michael@13: ( cd bash-%{V_bash}
michael@13: ${l_patch} -p0 <`SOURCE bash.patch`
michael@13: sleep 1
michael@13: touch y.tab.[ch]
michael@13: touch configure config.h.in
michael@13: ) || exit $?
michael@13: ( cd beecrypt-%{V_beecrypt}
michael@13: ${l_patch} -p0 <`SOURCE beecrypt.patch`
michael@13: ) || exit $?
michael@13: ( cd perl-%{V_perl}
michael@13: ${l_patch} -p0 <`SOURCE perl.patch`
michael@13: ) || exit $?
michael@13: ( cd openssl-%{V_openssl}
michael@13: ${l_patch} -p0 <`SOURCE openssl.patch`
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x
michael@13:
michael@13: # bootstrap GNU make tool
michael@13: ( cd make-%{V_make}
michael@13: CC="${l_cc}" \
michael@329: GREP="grep" \
michael@13: ./configure \
michael@13: --without-libiconv-prefix \
michael@13: --without-libintl-prefix \
michael@13: --disable-nls \
michael@13: --disable-largefile
michael@13: ${l_make}
michael@13: ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
michael@13: ) || exit $?
michael@13: l_make="`pwd`/make-%{V_make}/make"; export l_make
michael@13: echo "l_make=\"$l_make\"; export l_make" >>.buildenv
michael@13:
michael@13: %build
michael@13: # skip in bootstrap phase 2 (see openpkg.boot)
michael@13: [ ".$OPENPKG_BOOT" = .1 ] && exit 0
michael@13:
michael@13: # switch into a temporary build area
michael@13: cd openpkg-%{version}
michael@13: . ./.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"; set -x
michael@13:
michael@13: # build GNU bash tool
michael@13: ( cd bash-%{V_bash}
michael@13: sh $shtool subst \
michael@13: -e 's;@l_openpkg_release@;OpenPKG;' \
michael@13: version.c
michael@13: ( # force disabled wide-character support
michael@13: echo "ac_cv_header_wchar_h=no"
michael@13: echo "ac_cv_header_wctype_h=no"
michael@13: echo "ac_cv_func_mbsrtowcs=no"
michael@13: # force disabled internationalization support
michael@13: echo "ac_cv_header_libintl_h=no"
michael@13: echo "ac_cv_func_gettext=no"
michael@13: echo "ac_cv_func_textdomain=no"
michael@13: echo "ac_cv_func_bindtextdomain=no"
michael@13: echo "ac_cv_lib_intl_bindtextdomain=no"
michael@13: # disable building with debug symbols
michael@13: echo "ac_cv_prog_cc_g=no"
michael@13: ) >config.cache
michael@13: AUTOCONF="true" \
michael@333: CC="${l_cc}" \
michael@333: MAKE="${l_make}" \
michael@13: ./configure \
michael@13: --cache-file=./config.cache \
michael@13: --prefix=%{l_prefix} \
michael@13: --without-curses \
michael@13: --without-gnu-malloc \
michael@13: --disable-nls
michael@13: ${l_make} || exit $?
michael@13: ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"; set -x
michael@13:
michael@13: # build BZIP2 library
michael@13: ( cd bzip2-%{V_bzip2}
michael@13: ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
michael@13: ( echo "# libbz2.la - a libtool library file"
michael@13: echo "# Generated by ltmain.sh - GNU libtool x.x.x"
michael@13: echo "dlname=''"
michael@13: echo "library_names=''"
michael@13: echo "old_library='libbz2.a'"
michael@13: echo "dependency_libs=''"
michael@13: echo "current=0"
michael@13: echo "age=0"
michael@13: echo "revision=0"
michael@13: echo "installed=no"
michael@13: echo "dlopen=''"
michael@13: echo "dlpreopen=''"
michael@13: echo "libdir='%{l_prefix}'"
michael@13: ) >libbz2.la
michael@13: ln -s . .libs
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"; set -x
michael@13:
michael@13: # build ZLIB library
michael@13: ( cd zlib-%{V_zlib}
michael@13: CC="${l_cc}" CFLAGS="-O" ./configure
michael@13: ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x
michael@13:
michael@13: # build OSSP uuid tool
michael@13: ( cd uuid-%{V_uuid}
michael@13: CC="${l_cc}" \
michael@13: CFLAGS="-O" \
michael@13: GREP="grep" \
michael@13: ./configure \
michael@13: --prefix=%{l_prefix} \
michael@13: --disable-shared
michael@13: ${l_make} || exit $?
michael@13: ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $?
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build Perl (Programming Language)"; set -x
michael@13:
michael@13: # build Perl tool
michael@13: ( cd perl-%{V_perl}
michael@13: chmod -R u+w .
michael@13: sh $shtool subst \
michael@13: -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;' \
michael@13: -e 's;package=perl5;package=perl;' \
michael@13: Configure
michael@13: sh $shtool subst \
michael@13: -e 's; */usr/local/lib;;' \
michael@13: hints/freebsd.sh hints/netbsd.sh
michael@13: libdirs=""
michael@13: for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
michael@13: [ -d $dir ] && libdirs="$libdirs $dir"
michael@13: done
michael@333: PATH=$PATH:`echo "${l_make}" | sed -e 's;\(.*\)/[^/][^/]*$;\1;'` \
michael@13: ./Configure \
michael@13: -d -e -s \
michael@13: -Dprefix=%{l_prefix} \
michael@13: -Dvendorprefix=%{l_prefix} \
michael@13: -Dinstallprefix=%{l_prefix} \
michael@13: -Dinstallstyle="lib/perl5" \
michael@13: -Dman1dir=%{l_prefix}/man/man1 \
michael@13: -Dman3dir=%{l_prefix}/man/man3 \
michael@13: -Dcc="${l_cc}" -Uoptimize \
michael@13: -Dlocincpth="%{l_prefix}/include" \
michael@13: -Dloclibpth="%{l_prefix}/lib" \
michael@13: -Dldflags="-L""%{l_prefix}/lib" \
michael@13: -Dlibpth="$libdirs" \
michael@13: -Dglibpth="$libdirs" \
michael@13: -Dscriptdir="%{l_prefix}/bin" \
michael@13: -Uinstallusrbinperl \
michael@13: -Adefine:useshrplib='false' \
michael@13: -Ui_malloc -Ui_iconv -Ui_db
michael@13: ${l_make} miniperl || exit $?
michael@13: rm -f *.o >/dev/null 2>&1 || true
michael@13: ) || exit $?
michael@13: l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl
michael@13: echo "l_perl=\"$l_perl\"; export l_perl" >>.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build OpenSSL (Crypography and SSL/TLS Toolkit)"; set -x
michael@13:
michael@13: # build OpenSSL toolkit
michael@13: ( cd openssl-%{V_openssl}
michael@13: sh $shtool subst \
michael@13: -e 's;-m486;-march=i486;g' \
michael@13: -e 's;BN_LLONG *;;' \
michael@13: Configure
michael@13: sh $shtool subst \
michael@13: -e 's;test "$OSTYPE" = msdosdjgpp;true;' \
michael@13: util/point.sh
michael@13: sh $shtool subst \
michael@13: -e "1s;^.*\$;#!$l_perl;" \
michael@13: Configure `find . -name "*.pl" -print`
michael@13: opts=""
michael@13: case `sh $shtool platform -n -L -S "" -C "+" -F "%-%"` in
michael@13: *-solaris* ) opts="-lnsl -lsocket" ;;
michael@13: esac
michael@13: case `sh $shtool platform -n -L -S "" -C "+" -F "%-%"` in
michael@13: amd64-* ) opts="$opts -fPIC" ;;
michael@13: ia64-* ) opts="$opts -fPIC" ;;
michael@13: sparc64-freebsd* ) opts="$opts -fPIC" ;;
michael@13: esac
michael@13: CC="${l_cc}" \
michael@13: PERL="${l_perl}" \
michael@13: ./config \
michael@13: --prefix=%{l_prefix} \
michael@13: no-asm no-shared no-dso \
michael@13: no-zlib no-idea no-threads no-krb5 no-hw \
michael@13: $opts
michael@13: ${l_make} CC="${l_cc}" build_libs build_apps || exit $?
michael@13: ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $?
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x
michael@13:
michael@13: # build cURL tool
michael@13: ( cd curl-%{V_curl}
michael@13: sh $shtool subst \
michael@13: -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
michael@13: configure
michael@13: ( echo 'ac_cv_header_openssl_engine_h=no'
michael@13: echo 'lt_cv_prog_compiler_c_o_F77=no'
michael@13: echo 'lt_cv_sys_max_cmd_len=100'
michael@13: ) >config.cache
michael@13: CC="${l_cc}" \
michael@333: MAKE="${l_make}" \
michael@13: CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
michael@13: CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
michael@13: LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
michael@13: GREP="grep" \
michael@13: ./configure \
michael@13: --cache-file=./config.cache \
michael@13: --without-libidn \
michael@13: --disable-shared \
michael@13: --disable-thread \
michael@13: --disable-ipv6 \
michael@13: --disable-ldap \
michael@13: --with-zlib=`pwd`/../zlib-%{V_zlib} \
michael@13: --with-ssl=`pwd`/../openssl-%{V_openssl} \
michael@13: --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509
michael@13: ${l_make} || exit $?
michael@13: ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"; set -x
michael@13:
michael@13: # build BeeCrypt library
michael@13: ( cd beecrypt-%{V_beecrypt}
michael@13: sh $shtool subst \
michael@13: -e 's;^[ ][ ]*#;#;' \
michael@13: aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \
michael@13: md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c
michael@13: sh $shtool subst \
michael@13: -e 's;cppglue\.lo;;g' \
michael@13: -e 's;cppglue\.cxx;;g' \
michael@13: -e '/^CXX = /s;@CXX@;@CC@;g' \
michael@13: Makefile.in
michael@13: sh $shtool subst \
michael@13: -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
michael@13: configure
michael@13: ( echo 'ac_cv_have_dev_dsp=no'
michael@13: echo 'ac_cv_have_dev_audio=no'
michael@13: echo 'ac_cv_func_gettimeofday=yes'
michael@13: echo 'bc_cv_as_noexecstack=no'
michael@13: ) >config.cache
michael@13: CC="${l_cc}" \
michael@333: MAKE="${l_make}" \
michael@13: CFLAGS="-O" \
michael@13: ./configure \
michael@13: --cache-file=./config.cache \
michael@13: --prefix=%{l_prefix} \
michael@13: --without-cplusplus \
michael@13: --without-java \
michael@13: --without-python \
michael@13: --with-cpu=none \
michael@13: --with-arch=none \
michael@13: --disable-threads \
michael@13: --disable-shared
michael@13: ${l_make} || exit $?
michael@13: cp .libs/libbeecrypt.a .
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x
michael@13:
michael@13: # build RPM
michael@13: ( br=`pwd`
michael@13: cd rpm-%{V_rpm}
michael@13:
michael@13: # remove object files accidentally distributed with the RPM tarball
michael@13: rm -f db/build_unix/*.o
michael@13: rm -f db/build_unix/*.lo
michael@13:
michael@13: # remove embedded zlib (we are linking with an external one)
michael@13: rm -rf zlib
michael@13:
michael@13: # kill Linux-based preconfigured DB header, to allow the Makefiles to
michael@13: # symlink to it the header that is configured for the current system.
michael@13: rm -f rpmdb/db.h
michael@13:
michael@13: # make sure we do not trigger Autoconf/Automake tools
michael@13: touch configure
michael@13: touch config.h.in
michael@13:
michael@13: # disable running of any Autoconf/Automake tools
michael@13: ACLOCAL=true
michael@13: AUTOCONF=true
michael@13: AUTOMAKE=true
michael@13: AUTOHEADER=true
michael@13: MAKEINFO=true
michael@13: AMTAR=true
michael@13: export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR
michael@13:
michael@13: # cheat GNU Autoconf
michael@13: ( echo 'ac_cv_path_MSGFMT=:'
michael@13: echo 'ac_cv_path_GMSGFMT=:'
michael@13: echo 'ac_cv_path_XGETTEXT=:'
michael@13: echo 'ac_cv_path_MSGMERGE=:'
michael@13: echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
michael@13: echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
michael@13: echo "ac_cv_path___PYTHON=true"
michael@13: echo "ac_cv_path___DOXYGEN=true"
michael@13: echo "acl_cv_rpath=no"
michael@13: echo "ac_cv_header_getopt_h=no"
michael@13: ) >config.cache
michael@13:
michael@13: # provide platform identification
michael@13: os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'
michael@13: os_name=`echo "${os_name}" |\
michael@13: sed -e 's;[^a-zA-Z0-9];;g' |\
michael@13: tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
michael@13:
michael@13: # set build tool flags
michael@13: CC="${l_cc}"
michael@13: CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
michael@13: CFLAGS="$CPPFLAGS"
michael@13: LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
michael@13: LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
michael@13: case $os_name in
michael@13: SUNOS* ) LIBS="$LIBS -lresolv" ;;
michael@13: IRIX* ) LIBS="$LIBS -lgen" ;;
michael@13: esac
michael@13: export CC CPPFLAGS CFLAGS LDFLAGS LIBS
michael@13:
michael@13: # adjust for BeeCrypt 4.0
michael@13: sh $shtool subst \
michael@13: -e 's;beecrypt\.api\.h;beecrypt.h;g' \
michael@13: rpmio/rpmio_internal.h
michael@13: sh $shtool subst \
michael@13: -e 's;\(rsavrfy(\)\(&dig->rsa_pk\);\1\2.n, \2.e;g' \
michael@13: lib/signature.c
michael@333: sh $shtool subst \
michael@333: -e 's;\(^LIBS =\)[ \t]*;\1 -ldb;' \
michael@333: -e 's;\(^rpmdb_[^_][^_]*_LDFLAGS =\)[ \t]*;\1 -L$(top_srcdir)/db3;g' \
michael@333: rpmdb/Makefile.in
michael@333: sh $shtool subst \
michael@333: -e 's;\(^myLDFLAGS =\);\1 -L$(top_srcdir)/db3;' \
michael@333: Makefile.in
michael@13:
michael@13: # configure the package
michael@333: MAKE="${l_make}" \
michael@13: sh ./configure \
michael@13: --cache-file=./config.cache \
michael@13: --prefix=%{l_prefix} \
michael@13: --with-db \
michael@13: --with-glob \
michael@13: --without-python \
michael@13: --without-apidocs \
michael@13: --disable-shared \
michael@13: --disable-rpath \
michael@13: --disable-nls
michael@13:
michael@303: # deny automatic dependency calculations
michael@303: rm -f find-provides find-requires
michael@303: ln -s autodeps/none find-provides
michael@303: ln -s autodeps/none find-requires
michael@303:
michael@13: # build the package
michael@13: ${l_make}
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x
michael@13:
michael@13: # build "openpkg" executable
michael@13: ( cd openpkg-executable-%{V_exec}
michael@13: ${l_make} \
michael@13: CC="${l_cc}" \
michael@13: OPENPKG_PREFIX="%{l_prefix}" \
michael@13: OPENPKG_SUSR="%{l_susr}" \
michael@13: OPENPKG_MUSR="%{l_musr}"
michael@13: ) || exit $?
michael@13:
michael@13: %install
michael@13: # skip in bootstrap phase 2 (see openpkg.boot)
michael@13: [ ".$OPENPKG_BOOT" = .1 ] && exit 0
michael@13:
michael@13: # switch into a temporary build area
michael@13: cd openpkg-%{version}
michael@13: . ./.buildenv
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x
michael@13:
michael@13: # create installation hierarchy
michael@13: rm -rf $RPM_BUILD_ROOT
michael@13: sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
michael@13: for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
michael@13: done
michael@13: for i in 1 2 3 4 5 6 7 8 9; do
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
michael@13: done
michael@13: for dir in PKG bin etc include info lib man sbin; do
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
michael@13: done
michael@13: for i in 1 2 3 4 5 6 7 8 9; do
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
michael@13: done
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
michael@13: for dir in SRC PKG DB TMP; do
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
michael@13: done
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Installation of RPM"; set -x
michael@13:
michael@13: # install RPM into installation hierarchy
michael@13: ( cd rpm-%{V_rpm}
michael@13: DESTDIR="$RPM_BUILD_ROOT"
michael@13: export DESTDIR
michael@13: ${l_make} install
michael@13: ) || exit $?
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Install Additional Files"; set -x
michael@13:
michael@13: # add additional development files
michael@13: cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
michael@13: cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
michael@13: cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
michael@13: cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
michael@13: cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
michael@13: cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
michael@13: cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
michael@13: cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x
michael@13:
michael@13: # post-adjust RPM installation (namespace-clean POPT inclusion)
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
michael@13:
michael@13: # move C API into custom locations
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
michael@13:
michael@13: # move rpm tool to custom location
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
michael@13:
michael@13: # move rpm2cpio tool to custom location
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
michael@13:
michael@13: # replace symlinks with hardlinks
michael@13: for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
michael@13: eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
michael@13: ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
michael@13: done
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
michael@13: ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x
michael@13:
michael@13: # strip RPM installation
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
michael@13: for dir in man/ja man/pl man/ru man/sk src; do
michael@13: rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
michael@13: done
michael@13: rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true
michael@13: for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
michael@13: done
michael@13: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
michael@13: rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
michael@13: for file in \
michael@13: u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
michael@303: mkinstalldirs magic.prov magic.req http.req getpo.sh \
michael@303: get_magic.pl find-provides find-requires find-requires.perl \
michael@303: find-req.pl find-provides.perl find-prov.pl find-lang.sh \
michael@303: cpanflute convertrpmrc.sh check-prereqs rpmputtext rpmgettext \
michael@303: brp-compress brp-redhat brp-sparc64-linux brp-strip \
michael@303: brp-strip-shared brp-strip-comment-note rpmrc \
michael@13: config.guess config.sub check-files; do
michael@13: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
michael@13: done
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x
michael@13:
michael@13: # install lsync tool
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE lsync` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE dot.lsyncrc` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE lsync.8` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
michael@13:
michael@13: # install rpm-config tool
michael@13: ( l_prefix="%{l_prefix}"
michael@13: l_cc="%{l_cc}"
michael@13: l_cflags=""
michael@13: l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
michael@13: l_ldflags="-L${l_prefix}/lib/openpkg"
michael@13: l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: -e "s:@l_cc@:$l_cc:g" \
michael@13: -e "s:@l_cflags@:$l_cflags:g" \
michael@13: -e "s:@l_cppflags@:$l_cppflags:g" \
michael@13: -e "s:@l_ldflags@:$l_ldflags:g" \
michael@13: -e "s:@l_libs@:$l_libs:g" \
michael@13: -e "s:@l_version@:%{V_rpm}:g" \
michael@13: <`SOURCE rpm-config.sh` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
michael@13: ) || exit $?
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
michael@13: sed -e "s:RPM_VERSION:%{V_rpm}:g" \
michael@13: <`SOURCE rpm-config.8` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
michael@13:
michael@13: # install OpenPKG registry commands
michael@13: ( cd openpkg-registry-%{V_registry}
michael@13: mv $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
michael@13: chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
michael@13: chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register
michael@13: cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8
michael@13: ) || exit $?
michael@13:
michael@13: # install OpenPKG Tool Chain command subset
michael@13: ( cd openpkg-tools-%{V_tools}
michael@13: cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh
michael@13: cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
michael@13: chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl
michael@13: cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8
michael@13: ) || exit $?
michael@13:
michael@13: # install RPM extension
michael@13: ( cd rpm-%{V_rpm}
michael@13: cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
michael@13: ) || exit $?
michael@13: ( cd perl-%{V_perl}
michael@13: cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl
michael@13: ) || exit $?
michael@13: ( cd openssl-%{V_openssl}
michael@13: cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl
michael@13: ) || exit $?
michael@13: ( cd curl-%{V_curl}
michael@13: cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
michael@13: ) || exit $?
michael@13: ( cd bzip2-%{V_bzip2}
michael@13: cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
michael@13: ) || exit $?
michael@13: ( cd gzip-%{V_gzip}
michael@13: cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
michael@13: ) || exit $?
michael@13: ( cd patch-%{V_patch}
michael@13: cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
michael@13: ) || exit $?
michael@13: ( cd tar-%{V_tar}
michael@13: cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
michael@13: ) || exit $?
michael@13: ( cd bash-%{V_bash}
michael@13: cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
michael@13: ) || exit $?
michael@13: ( cd uuid-%{V_uuid}
michael@13: cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
michael@13: ) || exit $?
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: -e "s;@l_musr@;%{l_musr};g" \
michael@13: -e "s;@l_mgrp@;%{l_mgrp};g" \
michael@13: <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: -e "s;@l_musr@;%{l_musr};g" \
michael@13: -e "s;@l_mgrp@;%{l_mgrp};g" \
michael@13: <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
michael@13:
michael@13: # install OpenPKG tool chain execution frontend and execution wrapper
michael@13: cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
michael@13: ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
michael@13: chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
michael@13: chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE openpkg.1` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
michael@13:
michael@13: # install more OpenPKG tool chain commands
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
michael@13: sed -e "s;@l_prefix@;%{l_prefix};g" \
michael@13: <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
michael@13:
michael@13: # install an own copy of shtool
michael@13: cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
michael@13: chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x
michael@13:
michael@13: # install a few README files
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE root.README` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/README
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE local.README` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/local/README
michael@13:
michael@13: # install Bash environment
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE dot.bashrc` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE dot.bash_login` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
michael@13:
michael@13: # install Run-Command files
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: -e "s:@l_susr@:%{l_susr}:g" \
michael@13: -e "s:@l_musr@:%{l_musr}:g" \
michael@13: <`SOURCE rc` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
michael@13: chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE rc.conf` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
michael@13: chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE rc.func` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
michael@13: chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: -e "s:@l_musr@:%{l_musr}:g" \
michael@13: <`SOURCE rc.openpkg` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
michael@13: chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
michael@13: ( echo "#!/bin/sh"
michael@13: echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
michael@13: ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
michael@13: chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
michael@13: ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE rc.8` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
michael@13:
michael@13: # create configuration directory
michael@13: test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
michael@13: mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
michael@13:
michael@13: # install platform identification file
michael@13: sh $shtool platform -n -L -S "" -C "+" -F "%-any-%" \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
michael@13: chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
michael@13:
michael@13: # install UUID configuration file (ghost)
michael@13: touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
michael@13: chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
michael@13:
michael@13: # install registry configuration files (ghost)
michael@13: touch \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
michael@13: chmod 644 \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util
michael@13:
michael@13: # install default managers configuration file
michael@13: ( echo "##"
michael@13: echo "## managers -- OpenPKG Instance Managers"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "%{l_susr}"
michael@13: echo "%{l_musr}"
michael@13: echo ""
michael@13: ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers
michael@13:
michael@13: # install overriding RPM configuration files
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE rpmpopt` \
michael@13: >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: <`SOURCE rpmrc` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
michael@13: sed -e "s:@l_prefix@:%{l_prefix}:g" \
michael@13: -e "s:@l_prefix_static@:%{l_prefix}:g" \
michael@13: -e "s;@l_build_path@;$l_build_path;g" \
michael@13: -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
michael@13: -e "s;@l_build_ulim@;$l_build_ulim;g" \
michael@13: -e "s:@TAG@:$tag:g" \
michael@13: -e "s:@SUSR@:$susr:g" \
michael@13: -e "s:@SGRP@:$sgrp:g" \
michael@13: -e "s:@MUSR@:$musr:g" \
michael@13: -e "s:@MGRP@:$mgrp:g" \
michael@13: -e "s:@RUSR@:$rusr:g" \
michael@13: -e "s:@RGRP@:$rgrp:g" \
michael@13: -e "s:@NUSR@:$nusr:g" \
michael@13: -e "s:@NGRP@:$ngrp:g" \
michael@13: <`SOURCE rpmmacros` \
michael@13: >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
michael@13: cp `SOURCE openpkg.org.pgp` \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp
michael@13: cp `SOURCE openpkg.com.pgp` \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp
michael@13: cp `SOURCE openpkg.net.pgp` \
michael@13: $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp
michael@13:
michael@13: # display verbosity header
michael@13: set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x
michael@13:
michael@13: %files
michael@13: %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
michael@13: %{l_prefix}/README
michael@13: %config(noreplace) %{l_prefix}/.bashrc
michael@13: %config(noreplace) %{l_prefix}/.bash_login
michael@13: %dir %{l_prefix}/RPM
michael@13: %dir %{l_prefix}/RPM/SRC
michael@13: %dir %{l_prefix}/RPM/PKG
michael@13: %dir %{l_prefix}/RPM/DB
michael@13: %dir %{l_prefix}/RPM/TMP
michael@13: %dir %{l_prefix}/cgi
michael@13: %dir %{l_prefix}/bin
michael@13: %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg
michael@13: %dir %{l_prefix}/etc
michael@13: %{l_prefix}/etc/rc
michael@13: %config(noreplace) %{l_prefix}/etc/rc.conf
michael@13: %{l_prefix}/etc/rc.func
michael@13: %dir %{l_prefix}/etc/rc.d
michael@13: %{l_prefix}/etc/rc.d/rc.openpkg
michael@13: %dir %{l_prefix}/etc/openpkg
michael@13: %ghost %{l_prefix}/etc/openpkg/uuid
michael@13: %config %{l_prefix}/etc/openpkg/platform
michael@13: %config %{l_prefix}/etc/openpkg/rpmmacros
michael@13: %config %{l_prefix}/etc/openpkg/rpmrc
michael@13: %ghost %{l_prefix}/etc/openpkg/register.conf
michael@13: %ghost %{l_prefix}/etc/openpkg/register.prep
michael@13: %ghost %{l_prefix}/etc/openpkg/register.tran
michael@13: %ghost %{l_prefix}/etc/openpkg/register.util
michael@13: %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers
michael@13: %{l_prefix}/etc/openpkg/openpkg.org.pgp
michael@13: %{l_prefix}/etc/openpkg/openpkg.com.pgp
michael@13: %{l_prefix}/etc/openpkg/openpkg.net.pgp
michael@13: %dir %{l_prefix}/include
michael@13: %dir %{l_prefix}/include/openpkg
michael@13: %dir %{l_prefix}/include/openpkg/rpm
michael@13: %{l_prefix}/include/openpkg/rpm/argv.h
michael@13: %{l_prefix}/include/openpkg/rpm/beecrypt.h
michael@13: %{l_prefix}/include/openpkg/rpm/bzlib.h
michael@13: %{l_prefix}/include/openpkg/rpm/db.h
michael@13: %{l_prefix}/include/openpkg/rpm/fts.h
michael@13: %{l_prefix}/include/openpkg/rpm/glob.h
michael@13: %{l_prefix}/include/openpkg/rpm/hdrinline.h
michael@13: %{l_prefix}/include/openpkg/rpm/header.h
michael@13: %{l_prefix}/include/openpkg/rpm/misc.h
michael@13: %{l_prefix}/include/openpkg/rpm/popt.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmal.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmbuild.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmcli.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmdb.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmds.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmerr.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmfc.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmfi.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmfile.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmhash.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmio.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmlib.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmlog.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmmacro.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmmessages.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmpgp.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmps.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmspec.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmsw.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmte.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmts.h
michael@13: %{l_prefix}/include/openpkg/rpm/rpmurl.h
michael@13: %{l_prefix}/include/openpkg/rpm/stringbuf.h
michael@13: %{l_prefix}/include/openpkg/rpm/ugid.h
michael@13: %{l_prefix}/include/openpkg/rpm/zconf.h
michael@13: %{l_prefix}/include/openpkg/rpm/zlib.h
michael@13: %dir %{l_prefix}/info
michael@13: %dir %{l_prefix}/lib
michael@13: %dir %{l_prefix}/lib/openpkg
michael@13: %{l_prefix}/lib/openpkg/bash
michael@13: %{l_prefix}/lib/openpkg/bzip2
michael@13: %{l_prefix}/lib/openpkg/curl
michael@13: %{l_prefix}/lib/openpkg/file
michael@13: %{l_prefix}/lib/openpkg/gzip
michael@13: %{l_prefix}/lib/openpkg/librpm.a
michael@13: %{l_prefix}/lib/openpkg/librpmbeecrypt.a
michael@13: %{l_prefix}/lib/openpkg/librpmbuild.a
michael@13: %{l_prefix}/lib/openpkg/librpmbz2.a
michael@13: %{l_prefix}/lib/openpkg/librpmdb.a
michael@13: %{l_prefix}/lib/openpkg/librpmio.a
michael@13: %{l_prefix}/lib/openpkg/librpmpopt.a
michael@13: %{l_prefix}/lib/openpkg/librpmz.a
michael@13: %{l_prefix}/lib/openpkg/macros
michael@13: %{l_prefix}/lib/openpkg/magic
michael@13: %{l_prefix}/lib/openpkg/magic.mgc
michael@13: %{l_prefix}/lib/openpkg/magic.mime
michael@13: %{l_prefix}/lib/openpkg/magic.mime.mgc
michael@13: %{l_prefix}/lib/openpkg/miniperl
michael@13: %{l_prefix}/lib/openpkg/openpkg
michael@13: %{l_prefix}/lib/openpkg/openssl
michael@13: %{l_prefix}/lib/openpkg/patch
michael@13: %{l_prefix}/lib/openpkg/rc
michael@13: %{l_prefix}/lib/openpkg/rpm
michael@13: %{l_prefix}/lib/openpkg/rpmb
michael@13: %{l_prefix}/lib/openpkg/rpmd
michael@13: %{l_prefix}/lib/openpkg/rpmdb
michael@13: %{l_prefix}/lib/openpkg/rpmdb_dump
michael@13: %{l_prefix}/lib/openpkg/rpmdb_load
michael@13: %{l_prefix}/lib/openpkg/rpmdb_verify
michael@13: %{l_prefix}/lib/openpkg/rpme
michael@13: %{l_prefix}/lib/openpkg/rpmi
michael@13: %{l_prefix}/lib/openpkg/rpmk
michael@13: %{l_prefix}/lib/openpkg/rpmpopt
michael@13: %{l_prefix}/lib/openpkg/rpmq
michael@13: %{l_prefix}/lib/openpkg/rpmt
michael@13: %{l_prefix}/lib/openpkg/rpmtool
michael@13: %{l_prefix}/lib/openpkg/rpmu
michael@13: %{l_prefix}/lib/openpkg/rpmv
michael@13: %{l_prefix}/lib/openpkg/shtool
michael@13: %{l_prefix}/lib/openpkg/tar
michael@13: %{l_prefix}/lib/openpkg/uuid
michael@13: %dir %{l_prefix}/libexec
michael@13: %dir %{l_prefix}/libexec/openpkg
michael@13: %{l_prefix}/libexec/openpkg/build.8
michael@13: %{l_prefix}/libexec/openpkg/build.pl
michael@13: %{l_prefix}/libexec/openpkg/curl.sh
michael@13: %{l_prefix}/libexec/openpkg/install
michael@13: %{l_prefix}/libexec/openpkg/lsync
michael@13: %{l_prefix}/libexec/openpkg/lsync.8
michael@13: %{l_prefix}/libexec/openpkg/man
michael@13: %{l_prefix}/libexec/openpkg/rc
michael@13: %{l_prefix}/libexec/openpkg/rc.8
michael@13: %{l_prefix}/libexec/openpkg/register
michael@13: %{l_prefix}/libexec/openpkg/register.8
michael@13: %{l_prefix}/libexec/openpkg/release
michael@13: %{l_prefix}/libexec/openpkg/release.8
michael@13: %{l_prefix}/libexec/openpkg/rpm
michael@13: %{l_prefix}/libexec/openpkg/rpm-config
michael@13: %{l_prefix}/libexec/openpkg/rpm-config.8
michael@13: %{l_prefix}/libexec/openpkg/rpm.8
michael@13: %{l_prefix}/libexec/openpkg/rpm2cpio
michael@13: %{l_prefix}/libexec/openpkg/rpm2cpio.8
michael@13: %{l_prefix}/libexec/openpkg/rpmbuild
michael@13: %{l_prefix}/libexec/openpkg/rpmbuild.8
michael@13: %{l_prefix}/libexec/openpkg/uuid
michael@13: %{l_prefix}/libexec/openpkg/uuid.8
michael@13: %dir %{l_prefix}/man
michael@13: %dir %{l_prefix}/man/man1
michael@13: %dir %{l_prefix}/man/man2
michael@13: %dir %{l_prefix}/man/man3
michael@13: %dir %{l_prefix}/man/man4
michael@13: %dir %{l_prefix}/man/man5
michael@13: %dir %{l_prefix}/man/man6
michael@13: %dir %{l_prefix}/man/man7
michael@13: %dir %{l_prefix}/man/man8
michael@13: %dir %{l_prefix}/man/man9
michael@13: %dir %{l_prefix}/man/cat1
michael@13: %dir %{l_prefix}/man/cat2
michael@13: %dir %{l_prefix}/man/cat3
michael@13: %dir %{l_prefix}/man/cat4
michael@13: %dir %{l_prefix}/man/cat5
michael@13: %dir %{l_prefix}/man/cat6
michael@13: %dir %{l_prefix}/man/cat7
michael@13: %dir %{l_prefix}/man/cat8
michael@13: %dir %{l_prefix}/man/cat9
michael@13: %{l_prefix}/man/man1/openpkg.1
michael@13: %dir %{l_prefix}/sbin
michael@13: %dir %{l_prefix}/pub
michael@13: %dir %{l_prefix}/share
michael@13: %dir %{l_prefix}/var
michael@13: %dir %{l_prefix}/local
michael@13: %{l_prefix}/local/README
michael@13: %{l_prefix}/local/.lsyncrc
michael@13: %dir %{l_prefix}/local/PKG
michael@13: %dir %{l_prefix}/local/bin
michael@13: %dir %{l_prefix}/local/etc
michael@13: %dir %{l_prefix}/local/include
michael@13: %dir %{l_prefix}/local/info
michael@13: %dir %{l_prefix}/local/lib
michael@13: %dir %{l_prefix}/local/man
michael@13: %dir %{l_prefix}/local/man/man1
michael@13: %dir %{l_prefix}/local/man/man2
michael@13: %dir %{l_prefix}/local/man/man3
michael@13: %dir %{l_prefix}/local/man/man4
michael@13: %dir %{l_prefix}/local/man/man5
michael@13: %dir %{l_prefix}/local/man/man6
michael@13: %dir %{l_prefix}/local/man/man7
michael@13: %dir %{l_prefix}/local/man/man8
michael@13: %dir %{l_prefix}/local/man/man9
michael@13: %dir %{l_prefix}/local/man/cat1
michael@13: %dir %{l_prefix}/local/man/cat2
michael@13: %dir %{l_prefix}/local/man/cat3
michael@13: %dir %{l_prefix}/local/man/cat4
michael@13: %dir %{l_prefix}/local/man/cat5
michael@13: %dir %{l_prefix}/local/man/cat6
michael@13: %dir %{l_prefix}/local/man/cat7
michael@13: %dir %{l_prefix}/local/man/cat8
michael@13: %dir %{l_prefix}/local/man/cat9
michael@13: %dir %{l_prefix}/local/sbin
michael@13:
michael@13: %clean
michael@13: # skip in bootstrap phase 2 (see openpkg.boot)
michael@13: [ ".$OPENPKG_BOOT" = .1 ] && exit 0
michael@13:
michael@13: # cleanup build area
michael@13: rm -rf openpkg-%{version} >/dev/null 2>&1 || true
michael@13:
michael@13: # cleanup installation area
michael@13: rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true
michael@13:
michael@13: %pre
michael@13: # always performed for upgrades and because it doesn't harm!
michael@13: # [ ".$1" != .1 ] && exit 0
michael@13:
michael@13: # this procedure is only usable with root privileges
michael@13: # (for non-root installations it is not required at all)
michael@13: cusr=`(id -un) 2>/dev/null ||\
michael@13: (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
michael@13: (whoami) 2>/dev/null ||\
michael@13: (who am i | cut "-d " -f1) 2>/dev/null ||\
michael@13: echo $LOGNAME`
michael@13:
michael@13: # determine runtime details (for both inside and outside RPM!!)
michael@13: # - bootstrapping: $xxx is set from aux.wrapbin.sh
michael@13: # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
michael@13: # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
michael@13: [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
michael@13: [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
michael@13: [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
michael@13: [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
michael@13: [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
michael@13: [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
michael@13: [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
michael@13: [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
michael@13: [ ".$suid" = . ] && suid="%{?l_suid}"
michael@13: [ ".$sgid" = . ] && sgid="%{?l_sgid}"
michael@13: [ ".$muid" = . ] && muid="%{?l_muid}"
michael@13: [ ".$mgid" = . ] && mgid="%{?l_mgid}"
michael@13: [ ".$ruid" = . ] && ruid="%{?l_ruid}"
michael@13: [ ".$rgid" = . ] && rgid="%{?l_rgid}"
michael@13: [ ".$nuid" = . ] && nuid="%{?l_nuid}"
michael@13: [ ".$ngid" = . ] && ngid="%{?l_ngid}"
michael@13:
michael@13: # if any of these optional params are not used we won't have a
michael@13: # corresponding macro either, so make use of one conditionally
michael@13: [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
michael@13: [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
michael@13: [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
michael@13: [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
michael@13: [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
michael@13: [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
michael@13: [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
michael@13: [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
michael@13:
michael@13: # determine prefix
michael@13: [ ".$prefix" = . ] && prefix="%{l_prefix}"
michael@13: prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
michael@13:
michael@13: # register instance in presence file
michael@13: presence="/etc/openpkg"
michael@13: exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
michael@13: if [ ".$exists" = . ]; then
michael@13: ( umask 022
michael@13: echo "${prefix}" >>$presence
michael@13: ) 2>/dev/null || true
michael@13: fi
michael@13:
michael@13: # determine user/group ids
michael@13: for class in s m r n; do
michael@13: eval "xusr=\"\$${class}usr\""
michael@13: eval "xgrp=\"\$${class}grp\""
michael@13: eval "xuid=\"\$${class}uid\""
michael@13: eval "xgid=\"\$${class}gid\""
michael@13: if [ ".$xuid" = . ]; then
michael@13: xuid=`(getent passwd "${xusr}"; \
michael@13: grep "^${xusr}:" /etc/passwd; \
michael@13: ypmatch "${xusr}" passwd; \
michael@13: nismatch "${xusr}" passwd; \
michael@13: nidump passwd . | grep "^${xusr}:") 2>/dev/null | \
michael@13: sed -e 'q' | awk -F: '{ print $3; }'`
michael@13: if [ ".$xuid" = . ]; then
michael@13: # seek for a reasonably uid/gid pair
michael@13: xuid=1000
michael@13: ok=0
michael@13: while [ ".$ok" = .0 ]; do
michael@13: eval "u_exists=\$u_exists_$xuid"
michael@13: if [ ".$u_exists" = . ]; then
michael@13: u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\
michael@13: grep "^[^:]*:[^:]*:$xuid:"`
michael@13: fi
michael@13: eval "g_exists=\$g_exists_$xuid"
michael@13: if [ ".$g_exists" = . ]; then
michael@13: g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\
michael@13: grep "^[^:]*:[^:]*:$xuid:"`
michael@13: fi
michael@13: if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
michael@13: ok=1
michael@13: break
michael@13: fi
michael@13: xuid=`expr $xuid + 1`
michael@13: done
michael@13: eval "u_exists_$xuid=yes"
michael@13: eval "g_exists_$xuid=yes"
michael@13: fi
michael@13: fi
michael@13: if [ ".$xgid" = . ]; then
michael@13: xgid=`(getent group "${xgrp}"; \
michael@13: grep "^${xgrp}:" /etc/group; \
michael@13: ypmatch "${xgrp}" group; \
michael@13: nismatch "${xgrp}" group; \
michael@13: nidump group . | grep "^${xgrp}:") 2>/dev/null | \
michael@13: sed -e 'q' | awk -F: '{ print $3; }'`
michael@13: if [ ".$xgid" = . ]; then
michael@13: xgid="$xuid"
michael@13: fi
michael@13: fi
michael@13: eval "${class}uid=\"$xuid\""
michael@13: eval "${class}gid=\"$xgid\""
michael@13: done
michael@13:
michael@13: # determine platform id
michael@13: s=`(uname -s) 2>/dev/null` || s='Unknown'
michael@13: r=`(uname -r) 2>/dev/null` || r='0.0'
michael@13: plid="${s}/${r}"
michael@13:
michael@13: # add entry to /etc/shells
michael@13: shell="${prefix}/lib/openpkg/bash"
michael@13: if [ -f /etc/shells ]; then
michael@13: exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
michael@13: if [ ".$exists" = . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: echo "${shell}" >>/etc/shells
michael@13: fi
michael@13: fi
michael@13: fi
michael@13:
michael@13: # clear pending deferred actions
michael@13: rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1
michael@13:
michael@13: # create the hierarchy user/group
michael@13: for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
michael@13: "management:${musr}:${muid}:${mgrp}:${mgid}" \
michael@13: "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
michael@13: "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
michael@13: # split request into class/usr/uid/grp/gid
michael@13: OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
michael@13: class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
michael@13:
michael@13: # check whether user already exists
michael@13: exists=`(getent passwd "$usr"; \
michael@13: grep "^$usr:" /etc/passwd; \
michael@13: ypmatch "$usr" passwd; \
michael@13: nismatch "$usr" passwd; \
michael@13: nidump passwd . | grep "^$usr:") 2>/dev/null | \
michael@13: sed -e 'q'`
michael@13: if [ ".$exists" = . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: # add entry to passwd database
michael@13: realname="${prefix} OpenPKG ($class)"
michael@13: case "$plid" in
michael@13: FreeBSD/* | NetBSD/* )
michael@13: file=/etc/master.passwd
michael@13: entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
michael@13: update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
michael@13: ;;
michael@13: Linux/* )
michael@13: file=/etc/passwd
michael@13: entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
michael@13: update="(PATH=\$PATH:/usr/sbin; pwconv)"
michael@13: ;;
michael@13: SunOS/5.* | UnixWare/* )
michael@13: file=/etc/passwd
michael@13: entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
michael@13: update="(PATH=\$PATH:/usr/sbin; pwconv)"
michael@13: ;;
michael@13: AIX/* )
michael@13: # intentionally do nothing here
michael@13: :
michael@13: ;;
michael@13: OSF1/V5.* )
michael@13: file=/etc/passwd
michael@13: entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
michael@13: update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
michael@13: ;;
michael@13: HP-UX/* )
michael@13: file=/etc/passwd
michael@13: entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
michael@13: update=":"
michael@13: ;;
michael@13: Darwin/* )
michael@13: # intentionally do nothing here
michael@13: :
michael@13: ;;
michael@13: IRIX*/6.* )
michael@13: file=/etc/passwd
michael@13: entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
michael@13: if [ -f /etc/shadow ]
michael@13: then update="(PATH=\$PATH:/sbin; pwconv)"
michael@13: else update=":"
michael@13: fi
michael@13: ;;
michael@13: esac
michael@13: case "$plid" in
michael@13: Darwin/* )
michael@13: niutil -create . "/users/${usr}"
michael@13: niutil -createprop . "/users/${usr}" passwd "*"
michael@13: niutil -createprop . "/users/${usr}" uid "${uid}"
michael@13: niutil -createprop . "/users/${usr}" gid "${gid}"
michael@13: niutil -createprop . "/users/${usr}" realname "${realname}"
michael@13: niutil -createprop . "/users/${usr}" home "${prefix}"
michael@13: niutil -createprop . "/users/${usr}" shell "${shell}"
michael@13: ;;
michael@13: AIX/* )
michael@13: mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}"
michael@13: cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
michael@13: sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \
michael@13: /etc/security/login.cfg && \
michael@13: rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
michael@13: # defer both the setting of the primary group and the shell,
michael@13: # as they do not exist at this stage of processing.
michael@13: echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh
michael@13: echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh
michael@13: ;;
michael@13: * )
michael@13: cp $file $file.bak && \
michael@13: (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
michael@13: rm -f $file.bak >/dev/null 2>&1
michael@13: eval $update
michael@13: [ $? -ne 0 ] && exit $?
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13: fi
michael@13:
michael@13: # check whether group already exists
michael@13: exists=`(getent group "$grp"; \
michael@13: grep "^$grp:" /etc/group; \
michael@13: ypmatch "$grp" group; \
michael@13: nismatch "$grp" group; \
michael@13: nidump group . | grep "^$grp:") 2>/dev/null | \
michael@13: sed -e 'q'`
michael@13: if [ ".$exists" = . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: Darwin/* )
michael@13: niutil -create . "/groups/${grp}"
michael@13: niutil -createprop . "/groups/${grp}" gid "${gid}"
michael@13: niutil -createprop . "/groups/${grp}" users "${usr}"
michael@13: ;;
michael@13: AIX/* )
michael@13: mkgroup id="${gid}" users="${usr}" "${grp}"
michael@13: ;;
michael@13: * )
michael@13: # add entry to group database
michael@13: file=/etc/group
michael@13: entry="${grp}:*:${gid}:${usr}"
michael@13: cp $file $file.bak && \
michael@13: (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
michael@13: rm -f $file.bak >/dev/null 2>&1
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13: fi
michael@13: done
michael@13:
michael@13: # optional group processing (deferred adjustment of primary group)
michael@13: if [ -f %{l_prefix}.pre-group-process.sh ]; then
michael@13: sh %{l_prefix}.pre-group-process.sh
michael@13: rm -f %{l_prefix}.pre-group-process.sh
michael@13: fi
michael@13:
michael@13: # invalidate passwd and group tables from Name Service Cache Daemon to
michael@13: # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
michael@13: if [ -x /usr/sbin/nscd ]; then
michael@13: /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
michael@13: /usr/sbin/nscd -i group >/dev/null 2>&1 || true
michael@13: fi
michael@13:
michael@13: # create the startup/shutdown transfer script
michael@13: name=`echo "$prefix" | sed -e 's;/;;g'`
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: FreeBSD/* )
michael@13: if [ ! -f /etc/rc.d/openpkg-${name} ]; then
michael@13: # install transfer script
michael@13: rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "# PROVIDE: openpkg-${name}"
michael@13: echo "# REQUIRE: LOGIN"
michael@13: echo "# KEYWORD: shutdown"
michael@13: echo ""
michael@13: echo ". /etc/rc.subr"
michael@13: echo ""
michael@13: echo "name=\"openpkg_${name}\""
michael@13: echo "start_cmd=\"openpkg_rc_all start\""
michael@13: echo "stop_cmd=\"openpkg_rc_all stop\""
michael@13: echo "restart_cmd=\"openpkg_rc_all stop start\""
michael@13: echo ""
michael@13: echo "openpkg_rc_all () {"
michael@13: echo " if [ -f ${prefix}/etc/rc ]; then"
michael@13: echo " ${prefix}/etc/rc all \"\$@\""
michael@13: echo " fi"
michael@13: echo "}"
michael@13: echo ""
michael@13: echo "load_rc_config \$name"
michael@13: echo "run_rc_command \"\$1\""
michael@13: echo ""
michael@13: ) >/etc/rc.d/openpkg-${name}
michael@13: chmod 755 /etc/rc.d/openpkg-${name}
michael@13: fi
michael@13: ;;
michael@13: NetBSD/* )
michael@13: if [ ! -f /etc/rc.d/${name} ]; then
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo "## PROVIDE: ${name}"
michael@13: echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo " restart ) exec ${prefix}/etc/rc all stop start ;;"
michael@13: echo " status ) ;;"
michael@13: echo "esac"
michael@13: ) >/etc/rc.d/${name}
michael@13: chmod 755 /etc/rc.d/${name}
michael@13: fi
michael@13: ;;
michael@13: Linux/* )
michael@13: if [ -f /etc/gentoo-release ]; then
michael@13: if [ ! -f /etc/init.d/openpkg-${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/sbin/runscript"
michael@13: echo "##"
michael@13: echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "depend() {"
michael@13: echo " after *"
michael@13: echo "}"
michael@13: echo ""
michael@13: echo "checkconfig() {"
michael@13: echo " [ -f ${prefix}/etc/rc ] || return 1"
michael@13: echo " case $1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo " esac"
michael@13: echo "}"
michael@13: echo ""
michael@13: echo "start() {"
michael@13: echo " checkconfig || return 1"
michael@13: echo " ebegin "Starting OpenPKG ${prefix} hierarchy""
michael@13: echo " exec ${prefix}/etc/rc all start"
michael@13: echo " eend 0"
michael@13: echo "}"
michael@13: echo ""
michael@13: echo "stop() {"
michael@13: echo " checkconfig || return 1"
michael@13: echo " ebegin "Stopping OpenPKG ${prefix} hierarchy""
michael@13: echo " exec ${prefix}/etc/rc all stop"
michael@13: echo " eend 0"
michael@13: echo "}"
michael@13: ) >/etc/init.d/openpkg-${name}
michael@13: chmod 755 /etc/init.d/openpkg-${name}
michael@13: /sbin/rc-update add openpkg-${name} default
michael@13: fi
michael@13: else
michael@13: # sroot: script root directory
michael@13: # lroot: link root directory
michael@13: if [ -f /etc/debian_version ]; then
michael@13: sroot=/etc/init.d
michael@13: lroot=/etc/rc%d.d
michael@13: elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
michael@13: sroot=/etc/rc.d/init.d
michael@13: lroot=/etc/rc.d/rc%d.d
michael@13: elif [ -f /etc/SuSE-release ]; then
michael@13: sroot=/etc/init.d
michael@13: lroot=/etc/init.d/rc%d.d
michael@13: elif [ -f /etc/slackware-version ]; then
michael@13: sroot=/etc/rc.d
michael@13: lroot=/etc/rc.d/rc%d.d
michael@13: name="rc.${name}"
michael@13: for i in 0 1 2 3 4 5 6; do
michael@13: l=`echo $lroot | sed -e "s;%d;$i;"`
michael@13: if [ ! -d $l ]; then
michael@13: mkdir $l 2>&1 || true
michael@13: fi
michael@13: done
michael@13: else
michael@13: echo "WARNING: you are not running one of the supported standard" 1>&2
michael@13: echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
michael@13: echo "WARNING: Guessing the location of the system init scripts!" 1>&2
michael@13: sroot=""
michael@13: lroot=""
michael@13: for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
michael@13: if [ -d $sr ]; then
michael@13: sroot="$sr"
michael@13: break
michael@13: fi
michael@13: done
michael@13: for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
michael@13: if [ -d $lr ]; then
michael@13: lroot="`echo $lr | sed -e 's;2;%d;'`"
michael@13: break
michael@13: fi
michael@13: done
michael@13: if [ ".$sroot" = . -o ".$lroot" = . ]; then
michael@13: echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: if [ ! -f $sroot/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >$sroot/${name}
michael@13: chmod 755 $sroot/${name}
michael@13: # create corresponding symbolic links
michael@13: for i in 2 3 4 5; do
michael@13: ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
michael@13: done
michael@13: for i in 0 1 6; do
michael@13: ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
michael@13: done
michael@13: fi
michael@13: fi
michael@13: ;;
michael@329: SunOS/5.1* )
michael@329: if [ ! -d /var/svc/manifest/openpkg ]; then
michael@329: mkdir /var/svc/manifest/openpkg
michael@329: fi
michael@329: if [ ! -f /var/svc/manifest/openpkg/${name}.xml ]; then
michael@329: # install SMF manifest
michael@329: ( echo ""
michael@329: echo ""
michael@329: echo ""
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo " OpenPKG Instance ${prefix}"
michael@329: echo " "
michael@329: echo " "
michael@329: echo " "
michael@329: echo ""
michael@329: ) >/var/svc/manifest/openpkg/${name}.xml
michael@329: chmod 644 /var/svc/manifest/openpkg/${name}.xml
michael@329: /usr/sbin/svccfg import /var/svc/manifest/openpkg/${name}.xml
michael@329: ( echo "/usr/sbin/svcadm enable \"svc:/openpkg/${name}:default\""
michael@329: ) >%{l_prefix}.pre-post-process.sh
michael@329: fi
michael@329: ;;
michael@13: SunOS/5.* )
michael@13: if [ ! -f /etc/init.d/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >/etc/init.d/${name}
michael@13: chmod 755 /etc/init.d/${name}
michael@13: # create corresponding symbolic links
michael@13: ( cd /etc
michael@13: ln init.d/${name} rc3.d/S99${name}
michael@13: ln init.d/${name} rc0.d/K00${name}
michael@13: ln init.d/${name} rc1.d/K00${name}
michael@13: ) || exit $?
michael@13: fi
michael@13: ;;
michael@13: UnixWare/* )
michael@13: if [ ! -f /etc/init.d/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >/etc/init.d/${name}
michael@13: chmod 755 /etc/init.d/${name}
michael@13: # create corresponding symbolic links
michael@13: ( cd /etc
michael@13: ln init.d/${name} rc2.d/S99${name}
michael@13: ln init.d/${name} rc0.d/K00${name}
michael@13: ln init.d/${name} rc1.d/K00${name}
michael@13: ) || exit $?
michael@13: fi
michael@13: ;;
michael@13: AIX/* )
michael@13: if [ ! -f /etc/rc.d/init.d/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >/etc/rc.d/init.d/${name}
michael@13: chmod 755 /etc/rc.d/init.d/${name}
michael@13: # create corresponding symbolic links
michael@13: ( cd /etc/rc.d
michael@13: ln -s ../init.d/${name} rc2.d/S99${name}
michael@13: ) || exit $?
michael@13: fi
michael@13: ;;
michael@13: OSF1/V5.* )
michael@13: if [ ! -f /sbin/init.d/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >/sbin/init.d/${name}
michael@13: chmod 755 /sbin/init.d/${name}
michael@13: # create corresponding symbolic links
michael@13: ( cd /sbin
michael@13: ln -s ../init.d/${name} rc3.d/S99${name}
michael@13: ln -s ../init.d/${name} rc0.d/K00${name}
michael@13: ) || exit $?
michael@13: fi
michael@13: ;;
michael@13: HP-UX/* )
michael@13: if [ ! -f /sbin/init.d/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >/sbin/init.d/${name}
michael@13: chmod 755 /sbin/init.d/${name}
michael@13: # create corresponding symbolic links
michael@13: ( cd /sbin
michael@13: ln -s ../init.d/${name} rc2.d/S900${name}
michael@13: ln -s ../init.d/${name} rc1.d/K100${name}
michael@13: ) || exit $?
michael@13: fi
michael@13: ;;
michael@13: Darwin/* )
michael@13: darwin_rc_dir="/System/Library/StartupItems/${name}"
michael@13: if [ ! -d ${darwin_rc_dir} ]; then
michael@13: mkdir ${darwin_rc_dir}
michael@13: fi
michael@13:
michael@13: # make sure hierarchy is activated in /etc/hostconfig
michael@13: # FIXME: cs: simple and bad code here without any detection of existing entries
michael@13: echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
michael@13:
michael@13: # install transfer script
michael@13: if [ ! -f ${darwin_rc_dir}/${name} ]; then
michael@13: rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${darwin_rc_dir}/${name}"
michael@13: echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo ""
michael@13: echo ". /etc/rc.common"
michael@13: echo ""
michael@13: echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
michael@13: echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
michael@13: echo " ${prefix}/etc/rc all start"
michael@13: echo "fi"
michael@13: ) >${darwin_rc_dir}/${name}
michael@13: chmod 755 ${darwin_rc_dir}/${name}
michael@13: fi
michael@13: # install startup parameter list
michael@13: if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
michael@13: rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
michael@13: ( echo "{"
michael@13: echo " Description = \"OpenPKG ${prefix} hierarchy\";"
michael@13: echo " Provides = (\"OpenPKG ${prefix}\");"
michael@13: echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
michael@13: echo " Uses = (\"Cron\");"
michael@13: echo " OrderPreference = \"Last\";"
michael@13: echo " Messages ="
michael@13: echo " {"
michael@13: echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
michael@13: echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
michael@13: echo " };"
michael@13: echo "}"
michael@13: ) >${darwin_rc_dir}/StartupParameters.plist
michael@13: chmod 644 ${darwin_rc_dir}/StartupParameters.plist
michael@13: fi
michael@13: ;;
michael@13: IRIX*/6.* )
michael@13: if [ ! -f /etc/init.d/${name} ]; then
michael@13: # install transfer script
michael@13: ( echo "#!/bin/sh"
michael@13: echo "##"
michael@13: echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
michael@13: echo "##"
michael@13: echo ""
michael@13: echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
michael@13: echo "case \$1 in"
michael@13: echo " start ) exec ${prefix}/etc/rc all start ;;"
michael@13: echo " stop ) exec ${prefix}/etc/rc all stop ;;"
michael@13: echo "esac"
michael@13: ) >/etc/init.d/${name}
michael@13: chmod 755 /etc/init.d/${name}
michael@13: # create corresponding links
michael@13: ( cd /etc
michael@13: ln -f init.d/${name} rc2.d/S99${name}
michael@13: ln -f init.d/${name} rc0.d/K00${name}
michael@13: ) || exit $?
michael@13: fi
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13:
michael@13: # create the cron transfer entries
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: FreeBSD/* | Linux/* | Darwin/* )
michael@13: if [ -f /etc/slackware-version ]; then
michael@13: exists=`crontab -l | grep "$prefix/etc/rc"`
michael@13: if [ ".$exists" = . ]; then
michael@13: EDITOR=/tmp/vipw.$$
michael@13: VISUAL="$EDITOR"
michael@13: export EDITOR
michael@13: export VISUAL
michael@13: ( echo "#!/bin/sh"
michael@13: echo "( echo \"# \""
michael@13: echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
michael@13: echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
michael@13: echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
michael@13: echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
michael@13: echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
michael@13: echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
michael@13: echo " echo \"# \""
michael@13: echo ") >>\$1"
michael@13: ) >$EDITOR
michael@13: chmod a+x $EDITOR
michael@13: ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
michael@13: rm -f $EDITOR
michael@13: fi
michael@13: else
michael@13: exists=`grep "$prefix/etc/rc" /etc/crontab`
michael@13: if [ ".$exists" = . ]; then
michael@13: ( echo "# "
michael@13: echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
michael@13: echo "0 0 1 * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
michael@13: echo "0 0 * * 0 root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
michael@13: echo "0 0 * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
michael@13: echo "0 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
michael@13: echo "*/15 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
michael@13: echo "# "
michael@13: ) >>/etc/crontab
michael@13: fi
michael@13: fi
michael@13: ;;
michael@13: SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
michael@13: exists=`crontab -l | grep "$prefix/etc/rc"`
michael@13: if [ ".$exists" = . ]; then
michael@13: EDITOR=/tmp/vipw.$$
michael@13: VISUAL="$EDITOR"
michael@13: export EDITOR
michael@13: export VISUAL
michael@13: ( echo "#!/bin/sh"
michael@13: echo "( echo \"# \""
michael@13: echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
michael@13: echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
michael@13: echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
michael@13: echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
michael@13: echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
michael@13: echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
michael@13: echo " echo \"# \""
michael@13: echo ") >>\$1"
michael@13: ) >$EDITOR
michael@13: chmod a+x $EDITOR
michael@13: ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
michael@13: rm -f $EDITOR
michael@13: fi
michael@13: ;;
michael@13: IRIX*/6.* )
michael@13: exists=`crontab -l | grep "$prefix/etc/rc"`
michael@13: if [ ".$exists" = . ]; then
michael@13: ( crontab -l
michael@13: echo "# "
michael@13: echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
michael@13: echo "0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
michael@13: echo "0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
michael@13: echo "0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
michael@13: echo "0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
michael@13: echo "0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
michael@13: echo "# "
michael@13: ) | /usr/bin/crontab || exit $?
michael@13: fi
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13:
michael@13: # remember what OpenPKG RPM version was installed, so we can
michael@13: # correctly upgrade the RPM database in the %post section (see below).
michael@13: if [ -d ${prefix}/RPM/DB ]; then
michael@13: if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
michael@13: # OpenPKG 2.0
michael@13: rpm="${prefix}/bin/openpkg rpm"
michael@13: else
michael@13: # OpenPKG 1.x
michael@13: rpm="${prefix}/bin/rpm"
michael@13: fi
michael@13: rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
michael@13: $rpm --version |\
michael@13: sed -e 's;^;X;' \
michael@13: -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
michael@13: -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
michael@13: -e 's;^X.*$;4.0;' \
michael@13: >${prefix}/RPM/DB/.version
michael@13: fi
michael@13:
michael@13: %post
michael@13: # optional post-processing from "pre" section
michael@13: if [ -f %{l_prefix}.pre-post-process.sh ]; then
michael@13: sh %{l_prefix}.pre-post-process.sh
michael@13: rm -f %{l_prefix}.pre-post-process.sh
michael@13: fi
michael@13:
michael@13: # update or initially create OpenPKG UUID configuration
michael@13: %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
michael@13:
michael@13: # determine new and old OpenPKG RPM version
michael@13: V_rpm_new="%{V_rpm}"
michael@13: if [ -f %{l_prefix}/RPM/DB/.version ]; then
michael@13: V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
michael@13: rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
michael@13: else
michael@13: V_rpm_old="4.0"
michael@13: fi
michael@13:
michael@13: # make sure all RPM database files are present and that their
michael@13: # attributes are correct, etc. This is not a database rebuild
michael@13: # operation, so this is fully harmless and can be done always.
michael@13: %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
michael@13:
michael@13: # check RPM database for upgrade requirements
michael@13: if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
michael@13: # RPM 4.0/4.1 does not allow concurrent database access, so we
michael@13: # cannot upgrade the database immediately from here (because
michael@13: # we are still running within the execution context of the
michael@13: # old RPM which in turn has the database locked) and instead
michael@13: # have to just drop a note to the administrator about database
michael@13: # upgrading. RPM 4.2 in general allows concurrent database
michael@13: # access, but the whole stuff is too risky here, too.
michael@13: ( echo "You are upgrading the OpenPKG bootstrap from a previous"
michael@13: echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
michael@13: echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
michael@13: echo "be used, but it is strongly recommended to upgrade it as"
michael@13: echo "soon as possible to the latest Berkeley-DB format files by"
michael@13: echo "executing the command:"
michael@13: echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
michael@13: echo "In case of problems with the RPM database you can always"
michael@13: echo "execute the command:"
michael@13: echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
michael@13: ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
michael@13: fi
michael@13:
michael@13: # system command overriding support
michael@13: # ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC
michael@13: # BUILD COMMAND OVERRIDE SOLUTION!
michael@13: if [ ! -d %{l_prefix}/lib/openpkg/override ]; then
michael@13: mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
michael@13: fi
michael@13: chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
michael@13: case "`cat %{l_prefix}/etc/openpkg/platform`" in
michael@13: *-*-debian* | *-*-ubuntu* )
michael@13: # FIXME: Evil hack to workaround build problems under Debian
michael@13: # (at least 3.1) (and similar platforms) where a Debian
michael@13: # install-info(8) exists which is both API and functionally
michael@13: # incompatible to the de-facto standardized install-info(8)
michael@13: # command from GNU Texinfo.
michael@13: if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then
michael@13: ( echo "#!/bin/sh"
michael@13: echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'"
michael@13: echo "exit 0"
michael@13: ) >%{l_prefix}/lib/openpkg/override/install-info
michael@13: chmod 775 %{l_prefix}/lib/openpkg/override/install-info
michael@13: fi
michael@13: ;;
michael@13: *-*-macosx* | *-*-darwin* )
michael@13: # FIXME: Evil hack to workaround the fact that Mac OS X'
michael@13: # linker by default prefers the /usr/lib libraries and does
michael@13: # not honor the -L options the way one would expect it.
michael@13: gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
michael@13: cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
michael@13: ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
michael@13: if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then
michael@13: ( echo "#!/bin/sh"
michael@13: echo "case \" \$* \" in"
michael@13: echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
michael@13: echo " * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;"
michael@13: echo "esac"
michael@13: ) >%{l_prefix}/lib/openpkg/override/gcc
michael@13: chmod 775 %{l_prefix}/lib/openpkg/override/gcc
michael@13: fi
michael@13: if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then
michael@13: ( echo "#!/bin/sh"
michael@13: echo "case \" \$* \" in"
michael@13: echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;"
michael@13: echo " * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;"
michael@13: echo "esac"
michael@13: ) >%{l_prefix}/lib/openpkg/override/cc
michael@13: chmod 775 %{l_prefix}/lib/openpkg/override/cc
michael@13: fi
michael@13: if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then
michael@13: ( echo "#!/bin/sh"
michael@13: echo "exec $ld -search_paths_first \"\$@\""
michael@13: ) >%{l_prefix}/lib/openpkg/override/ld
michael@13: chmod 775 %{l_prefix}/lib/openpkg/override/ld
michael@13: fi
michael@13: ;;
michael@13: esac
michael@13:
michael@13: # FIXME: hack to workaround problems in environments with too few
michael@13: # development tools. ATTENTION: see one paragraph above.
michael@13: if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then
michael@13: mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
michael@13: fi
michael@13: chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
michael@13:
michael@13: # check for "openpkg" executable from the OpenPKG Community series
michael@13: # print license if not OSS, otherwise register with openpkg.org
michael@13: community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \
michael@13: sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'`
michael@13: if [ ".$community_version" = . ]; then
michael@13: ( echo ""
michael@13: echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\""
michael@13: echo "executable which is covered by the following terms of use:"
michael@13: echo "______________________________________________________________________________"
michael@13: echo ""
michael@13: %{l_prefix}/bin/openpkg --license | sed -e '1d'
michael@13: ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice
michael@13: else
michael@13: %{l_prefix}/bin/openpkg register /dev/null 2>&1 || true
michael@13: fi
michael@13:
michael@13: %preun
michael@13: [ ".$1" != .0 ] && exit 0
michael@13:
michael@13: # remove override files
michael@13: if [ -d %{l_prefix}/lib/openpkg/override ]; then
michael@13: rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true
michael@13: fi
michael@13:
michael@13: # remove fallback files
michael@13: if [ -d %{l_prefix}/lib/openpkg/fallback ]; then
michael@13: rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true
michael@13: fi
michael@13:
michael@13: # remove files which are not RPM controlled
michael@13: rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
michael@13: rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
michael@13: rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
michael@13: rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
michael@13:
michael@13: # The following code usually would be done in a %postun section.
michael@13: # But because we already had to remove the database in this %preun
michael@13: # section (see the 'rm' commands above) in order to make RPM happy
michael@13: # inside its own removal procedure, RPM would no longer find the
michael@13: # %postun script (because it's recorded in the database files). So
michael@13: # we have to perform the procedure already in this %preun script.
michael@13: # except for the removal of the top-level directory it does not
michael@13: # matter. But the top-level directory can only be removed after
michael@13: # the RPM removal procedure took place, so we play a little delay
michael@13: # trick below.
michael@13:
michael@13: # determine current user
michael@13: cusr=`(id -un) 2>/dev/null ||\
michael@13: (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
michael@13: (whoami) 2>/dev/null ||\
michael@13: (who am i | cut "-d " -f1) 2>/dev/null ||\
michael@13: echo $LOGNAME`
michael@13:
michael@13: # determine runtime details (for both inside and outside RPM!!)
michael@13: user="%{l_musr}"
michael@13: group="%{l_mgrp}"
michael@13: prefix="%{l_prefix}"
michael@13: prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
michael@13:
michael@13: # determine platform id
michael@13: s=`(uname -s) 2>/dev/null` || s='Unknown'
michael@13: r=`(uname -r) 2>/dev/null` || r='0.0'
michael@13: plid="${s}/${r}"
michael@13:
michael@13: # unregister instance in presence file
michael@13: presence="/etc/openpkg"
michael@13: exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"`
michael@13: if [ ".$exists" != . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: cp $presence $presence.bak && \
michael@13: egrep -v "^ *${prefix} *\$" $presence.bak >$presence
michael@13: rm -f $presence.bak >/dev/null 2>&1
michael@13: if [ ".`cat $presence`" = . ]; then
michael@13: rm -f $presence >/dev/null 2>&1
michael@13: fi
michael@13: fi
michael@13: fi
michael@13:
michael@13: # remove entry in /etc/shells
michael@13: shell="${prefix}/lib/openpkg/bash"
michael@13: exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
michael@13: if [ ".$exists" != . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: cp /etc/shells /etc/shells.bak && \
michael@13: grep -v "^${shell}" /etc/shells.bak >/etc/shells
michael@13: rm -f /etc/shells.bak >/dev/null 2>&1
michael@13: fi
michael@13: fi
michael@13:
michael@13: # remove the hierarchy user/group
michael@13: for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
michael@13: "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
michael@13: "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
michael@13: "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
michael@13: # split request into class/usr/uid/grp/gid
michael@13: OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
michael@13: class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
michael@13:
michael@13: # check whether user already exists
michael@13: exists=`(getent passwd "$usr"; \
michael@13: grep "^$usr:" /etc/passwd; \
michael@13: ypmatch "$usr" passwd; \
michael@13: nismatch "$usr" passwd; \
michael@13: nidump passwd . | grep "^$usr:") 2>/dev/null | \
michael@13: sed -e 'q'`
michael@13: if [ ".$exists" != . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: elif [ ".$usr" = ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
michael@13: echo "openpkg:WARNING: (would remove system standard user)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: FreeBSD/* | NetBSD/* )
michael@13: cp /etc/master.passwd /etc/master.passwd.bak && \
michael@13: grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
michael@13: ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
michael@13: rm -f /etc/master.passwd.bak >/dev/null 2>&1
michael@13: ;;
michael@13: Linux/* | SunOS/5.* | UnixWare/* )
michael@13: cp /etc/passwd /etc/passwd.bak && \
michael@13: grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
michael@13: ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
michael@13: rm -f /etc/passwd.bak >/dev/null 2>&1
michael@13: ;;
michael@13: AIX/* )
michael@13: rmuser -p "${usr}"
michael@13: cp /etc/security/login.cfg /etc/security/login.cfg.bak && \
michael@13: sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \
michael@13: /etc/security/login.cfg && \
michael@13: rm -f /etc/security/login.cfg.bak >/dev/null 2>&1
michael@13: ;;
michael@13: OSF1/V5.* )
michael@13: cp /etc/passwd /etc/passwd.bak && \
michael@13: grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
michael@13: ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
michael@13: rm -f /etc/passwd.bak >/dev/null 2>&1
michael@13: ;;
michael@13: HP-UX/* )
michael@13: cp /etc/passwd /etc/passwd.bak && \
michael@13: grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
michael@13: rm -f /etc/passwd.bak >/dev/null 2>&1
michael@13: ;;
michael@13: Darwin/* )
michael@13: niutil -destroy . "/users/${usr}"
michael@13: ;;
michael@13: IRIX*/6.* )
michael@13: cp /etc/passwd /etc/passwd.bak && \
michael@13: grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
michael@13: if [ -f /etc/shadow ]
michael@13: then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
michael@13: fi
michael@13: rm -f /etc/passwd.bak >/dev/null 2>&1
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13: fi
michael@13:
michael@13: # check whether group already exists
michael@13: exists=`(getent group "$grp"; \
michael@13: grep "^$grp:" /etc/group; \
michael@13: ypmatch "$grp" group; \
michael@13: nismatch "$grp" group; \
michael@13: nidump group . | grep "^$grp:") 2>/dev/null | \
michael@13: sed -e 'q'`
michael@13: if [ ".$exists" != . ]; then
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
michael@13: echo "openpkg:WARNING: (would remove system standard group)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: Darwin/* )
michael@13: niutil -destroy . "/groups/${grp}"
michael@13: ;;
michael@13: AIX/* )
michael@13: rmgroup "${grp}"
michael@13: ;;
michael@13: * )
michael@13: cp /etc/group /etc/group.bak && \
michael@13: grep -v "^${grp}:" /etc/group.bak >/etc/group
michael@13: rm -f /etc/group.bak >/dev/null 2>&1
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13: fi
michael@13: done
michael@13:
michael@13: # invalidate passwd and group tables from Name Service Cache Daemon to
michael@13: # ensure chown/chgrp works immediately after pwconv on Linux and Solaris
michael@13: if [ -x /usr/sbin/nscd ]; then
michael@13: /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true
michael@13: /usr/sbin/nscd -i group >/dev/null 2>&1 || true
michael@13: fi
michael@13:
michael@13: # remove the startup/shutdown transfer scripts
michael@13: name=`echo "$prefix" | sed -e 's;/;;g'`
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: FreeBSD/* )
michael@13: rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1
michael@13: ;;
michael@13: NetBSD/* )
michael@13: rm -f /etc/rc.d/${name} >/dev/null 2>&1
michael@13: ;;
michael@13: Linux/* )
michael@13: if [ -f /etc/gentoo-release ]; then
michael@13: /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
michael@13: rm -f /etc/init.d/openpkg-${name} >/dev/null 2>&1
michael@13: else
michael@13: # sroot: script root directory
michael@13: # lroot: link root directory
michael@13: if [ -f /etc/debian_version ]; then
michael@13: sroot=/etc/init.d
michael@13: lroot=/etc/rc%d.d
michael@13: elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
michael@13: sroot=/etc/rc.d/init.d
michael@13: lroot=/etc/rc.d/rc%d.d
michael@13: elif [ -f /etc/SuSE-release ]; then
michael@13: sroot=/etc/init.d
michael@13: lroot=/etc/init.d/rc%d.d
michael@13: elif [ -f /etc/slackware-version ]; then
michael@13: sroot=/etc/rc.d
michael@13: lroot=/etc/rc.d/rc%d.d
michael@13: name="rc.${name}"
michael@13: else
michael@13: echo "WARNING: you are not running one of the supported standard" 1>&2
michael@13: echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
michael@13: echo "WARNING: Guessing the location of the system init scripts!" 1>&2
michael@13: sroot=""
michael@13: lroot=""
michael@13: for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
michael@13: if [ -d $sr ]; then
michael@13: sroot="$sr"
michael@13: break
michael@13: fi
michael@13: done
michael@13: for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
michael@13: if [ -d $lr ]; then
michael@13: lroot="`echo $lr | sed -e 's;2;%d;'`"
michael@13: break
michael@13: fi
michael@13: done
michael@13: if [ ".$sroot" = . -o ".$lroot" = . ]; then
michael@13: echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
michael@13: exit 1
michael@13: fi
michael@13: fi
michael@13: rm -f ${sroot}/${name} >/dev/null 2>&1
michael@13: for i in 2 3 4 5; do
michael@13: rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
michael@13: done
michael@13: for i in 0 1 6; do
michael@13: rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
michael@13: done
michael@13: if [ -f /etc/slackware-version ]; then
michael@13: for i in 0 1 2 3 4 5 6; do
michael@13: l=`echo $lroot | sed -e "s;%d;$i;"`
michael@13: if [ -d $l ]; then
michael@13: rmdir $l >/dev/null 2>&1 || true
michael@13: fi
michael@13: done
michael@13: fi
michael@13: fi
michael@13: ;;
michael@329: SunOS/5.1* )
michael@329: /usr/sbin/svcadm disable "svc:/openpkg/${name}:default"; sleep 2
michael@329: /usr/sbin/svccfg delete -f "svc:/openpkg/${name}:default" >/dev/null 2>&1 || true
michael@329: rm -f /var/svc/manifest/openpkg/${name}.xml >/dev/null 2>&1
michael@329: rmdir /var/svc/manifest/openpkg >/dev/null 2>&1 || true
michael@329: ;;
michael@13: SunOS/5.* )
michael@13: rm -f /etc/init.d/${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
michael@13: ;;
michael@13: UnixWare/* )
michael@13: rm -f /etc/init.d/${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
michael@13: ;;
michael@13: AIX/* )
michael@13: rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1
michael@13: ;;
michael@13: OSF1/V5.* )
michael@13: rm -f /sbin/init.d/${name} >/dev/null 2>&1
michael@13: rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
michael@13: rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
michael@13: ;;
michael@13: HP-UX/* )
michael@13: rm -f /sbin/init.d/${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
michael@13: ;;
michael@13: Darwin/* )
michael@13: cp /etc/hostconfig /etc/hostconfig.bak && \
michael@13: grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
michael@13: rm -f /etc/hostconfig.bak >/dev/null 2>&1
michael@13: rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
michael@13: ;;
michael@13: IRIX*/6.* )
michael@13: rm -f /etc/init.d/${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
michael@13: rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13:
michael@13: # remove the cron transfer entries
michael@13: if [ ".$cusr" != ".root" ]; then
michael@13: echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
michael@13: echo "openpkg:WARNING: (would require root-privileges)" 1>&2
michael@13: else
michael@13: case "$plid" in
michael@13: FreeBSD/* | Linux/* | Darwin/* )
michael@13: if [ -f /etc/slackware-version ]; then
michael@13: EDITOR=/tmp/vipw.$$
michael@13: VISUAL="$EDITOR"
michael@13: export EDITOR
michael@13: export VISUAL
michael@13: p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
michael@13: ( echo "cp \$1 \$1.bak"
michael@13: echo "cat \$1.bak | sed -e \"//,/<\\\\/OpenPKG>/d\" >\$1"
michael@13: echo "rm -f \$1.bak"
michael@13: ) >$EDITOR
michael@13: chmod a+x $EDITOR
michael@13: ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
michael@13: rm -f $EDITOR
michael@13: else
michael@13: exists=`grep "" /etc/crontab`
michael@13: if [ ".$exists" != . ]; then
michael@13: p=`echo $prefix | sed -e 's;/;\\\\/;g'`
michael@13: cp /etc/crontab /etc/crontab.bak
michael@13: cat /etc/crontab.bak |\
michael@13: sed -e "//,/<\\/OpenPKG>/d" \
michael@13: >/etc/crontab
michael@13: rm -f /etc/crontab.bak >/dev/null 2>&1
michael@13: fi
michael@13: fi
michael@13: ;;
michael@13: SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* )
michael@13: EDITOR=/tmp/vipw.$$
michael@13: VISUAL="$EDITOR"
michael@13: export EDITOR
michael@13: export VISUAL
michael@13: p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
michael@13: ( echo "cp \$1 \$1.bak"
michael@13: echo "cat \$1.bak | sed -e \"//,/<\\\\/OpenPKG>/d\" >\$1"
michael@13: echo "rm -f \$1.bak"
michael@13: ) >$EDITOR
michael@13: chmod a+x $EDITOR
michael@13: ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
michael@13: rm -f $EDITOR
michael@13: ;;
michael@13: IRIX*/6.* )
michael@13: p=`echo $prefix | sed -e 's;/;\\\\\\/;g'`
michael@13: ( crontab -l |
michael@13: sed -e "//,/<\/OpenPKG>/d"
michael@13: ) | /usr/bin/crontab || exit $?
michael@13: ;;
michael@13: esac
michael@13: fi
michael@13:
michael@13: # delayed removal of top-level directory.
michael@13: ( sleep 2
michael@13: rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
michael@13: rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
michael@13: rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
michael@13: rmdir %{l_prefix} >/dev/null 2>&1 || true
michael@13: ) /dev/null 2>/dev/null &
michael@13: