| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597 |
- ##
- ## openpkg.spec -- OpenPKG RPM Specification
- ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
- ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
- ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # NOTICE: This RPM specification is _very_ special, because it is
- # used both for bootstrapping OpenPKG with its RPM and for regular
- # builds of RPM in order to upgrade an existing installation. For this
- # it has to interact correctly with the "openpkg.boot" script. See
- # this companion script for details, but do not touch anything here
- # until you are 100% sure about what you are doing. In short: This
- # script is allowed to use only a very restricted subset of the RPM
- # functionality!
- # BUILD REQUIREMENTS:
- # o any sh(1)
- # o any tar(1)
- # o any make(1)
- # o any cc(1)
- # the package version/release
- %define V_openpkg 20030422
- # the used software versions
- %define V_rpm 4.0.2
- %define V_zlib 1.1.4
- %define V_bzip2 1.0.2
- %define V_db 3.2.9
- %define V_curl 7.10.4
- %define V_make 3.80
- %define V_gzip 1.3.5
- %define V_patch 2.5.4
- %define V_tar 1.13.25
- %define V_bash 2.05b
- # package information
- Name: openpkg
- Summary: OpenPKG Bootstrap
- URL: http://www.openpkg.org/
- Vendor: OpenPKG
- Packager: The OpenPKG Project
- Distribution: OpenPKG [CORE]
- Group: Bootstrapping
- License: GPL
- Version: %{V_openpkg}
- Release: %{V_openpkg}
- # list of sources
- Source0: README
- Source1: openpkg.boot
- Source2: ftp://ftp.rpm.org/pub/rpm/dist/rpm-%{V_rpm}.x/rpm-%{V_rpm}.tar.gz
- Source3: rpm.patch.bugfix
- Source4: rpm.patch.feature
- Source5: rpm.patch.porting
- Source6: rpm.patch.regen
- Source7: http://www.sleepycat.com/update/%{V_db}/db-%{V_db}.tar.gz
- Source8: ftp://sources.redhat.com/pub/bzip2/v102/bzip2-%{V_bzip2}.tar.gz
- Source9: ftp://ftp.info-zip.org/pub/infozip/zlib/zlib-%{V_zlib}.tar.gz
- Source10: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
- Source11: rpmpopt
- Source12: rpmrc
- Source13: rpmmacros
- Source14: root.README
- Source15: local.README
- Source16: rc
- Source17: rc.func
- Source18: rpmtool
- Source19: rpmtool.8
- Source20: rpmtool.pod
- Source21: lsync
- Source22: lsync.8
- Source23: lsync.pod
- Source24: aux.wrapsrc.sh
- Source25: aux.wrapbin.sh
- Source26: openpkg.pgp
- Source27: shtool
- Source28: rpmx.sh
- Source29: rpmx.pl
- Source30: ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
- Source31: ftp://alpha.gnu.org/gnu/gzip/gzip-%{V_gzip}.tar
- Source32: ftp://ftp.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
- Source33: rc.openpkg
- Source34: ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
- Source35: ftp://ftp.gnu.org/gnu/bash/bash-%{V_bash}.tar.gz
- Source36: dot.bashrc
- Source37: dot.bash_login
- Source38: dot.lsyncrc
- Source39: db.patch
- Source40: rc.conf
- Source41: aux.prereq.sh
- Source42: aux.usrgrp.sh
- Source43: mkproxyrpm.pl
- Source44: ftp://ftp.gnu.org/gnu/config/config.guess
- Source45: ftp://ftp.gnu.org/gnu/config/config.sub
- Source46: make.patch
- # build information
- Prefix: %{l_prefix}
- BuildRoot: %{l_buildroot}
- AutoReq: no
- AutoReqProv: no
- Provides: OpenPKG
- %description
- This is the bootstrap package for the RPM-based Unix Software
- Package Hierarchy OpenPKG. The RedHat Package Manager (RPM) is a
- sophisticated and portable package manager for Unix platforms,
- which supports the automated building, installation, management and
- deinstallation of Unix software. Originally RPM is designed and
- implemented for us with the RedHat Linux operating system where
- it manages every file on the whole system. In OpenPKG RPM is used
- only for managing all files in a particular filesystem hierarchy
- dedicated to the installation of third-party software packages
- provided by the OpenPKG project.
- Internally the OpenPKG bootstrap package is based on the
- following particular vendor products:
- RedHat RPM %{V_rpm}, Berkeley-DB %{V_db}, ZLib %{V_zlib},
- GNU Bzip2 %{V_bzip2}, GNU Gzip %{V_gzip}, GNU Tar %{V_tar},
- GNU Patch %{V_patch}, GNU Make %{V_make}, GNU Bash %{V_bash},
- cURL %{V_curl}
- %prep
- # skip in bootstrap phase 2 (see openpkg.boot)
- [ ".$OPENPKG_BOOT" = .1 ] && exit 0
- # switch into a temporary build area
- rm -rf %{name}-%{version}
- mkdir %{name}-%{version}
- cd %{name}-%{version}
- rm -f .buildenv
- touch .buildenv
- # provide a bootstrap alternative to %{SOURCE xxx} because else
- # it is not possible to upgrade a newer OpenPKG RPM with an older
- # OpenPKG RPM.
- echo >>.buildenv 'SOURCE () {'
- echo >>.buildenv ' if [ -f "%{_specdir}/$1" ]; then'
- echo >>.buildenv ' echo "%{_specdir}/$1"'
- echo >>.buildenv ' else'
- echo >>.buildenv ' echo "%{_sourcedir}/$1"'
- echo >>.buildenv ' fi'
- echo >>.buildenv '}'
- . ./.buildenv
- # determine path to shtool
- shtool=`SOURCE shtool`
- echo "shtool=$shtool" >>./.buildenv
- # manually make sure tar(1) is available
- l_tar=`sh $shtool path gtar tar`; export l_tar
- if [ ".$l_tar" = . ]; then
- echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
- exit 1
- fi
- echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
- # manually make sure make(1) is available
- l_make=`sh $shtool path gmake make`; export l_make
- if [ ".$l_make" = . ]; then
- echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
- exit 1
- fi
- echo "l_make=\"$l_make\"; export l_make" >>.buildenv
- # manually make sure cc(1) is available
- l_cc=`sh $shtool path gcc cc`; export l_cc
- if [ ".$l_cc" = . ]; then
- echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
- exit 1
- fi
- echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
- # manually make sure ar(1) is available
- l_ar=`sh $shtool path ar`; export l_ar
- if [ ".$l_ar" = . ]; then
- echo "openpkg: prerequisite tool \`ar' not found"
- exit 1
- fi
- # manually make sure ld(1) is available
- l_ld=`sh $shtool path ld`; export l_ld
- if [ ".$l_ld" = . ]; then
- echo "openpkg: prerequisite tool \`ld' not found"
- exit 1
- fi
- # determine path to aux.usrgrp.sh script
- usrgrp=`SOURCE aux.usrgrp.sh`
- echo "usrgrp=$usrgrp" >>./.buildenv
- # determine user/group name/id pairs
- # - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
- # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
- # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
- susr=""; [ ".%{?l_susr:set}" = .set ] && susr="%{l_susr}"
- sgrp=""; [ ".%{?l_sgrp:set}" = .set ] && sgrp="%{l_sgrp}"
- musr=""; [ ".%{?l_musr:set}" = .set ] && musr="%{l_musr}"
- mgrp=""; [ ".%{?l_mgrp:set}" = .set ] && mgrp="%{l_mgrp}"
- rusr=""; [ ".%{?l_rusr:set}" = .set ] && rusr="%{l_rusr}"
- rgrp=""; [ ".%{?l_rgrp:set}" = .set ] && rgrp="%{l_rgrp}"
- nusr=""; [ ".%{?l_nusr:set}" = .set ] && nusr="%{l_nusr}"
- ngrp=""; [ ".%{?l_ngrp:set}" = .set ] && ngrp="%{l_ngrp}"
- # corresponding ids
- suid=""; [ ".%{?l_suid:set}" = .set ] && suid="%{l_suid}"
- sgid=""; [ ".%{?l_sgid:set}" = .set ] && sgid="%{l_sgid}"
- muid=""; [ ".%{?l_muid:set}" = .set ] && muid="%{l_muid}"
- mgid=""; [ ".%{?l_mgid:set}" = .set ] && mgid="%{l_mgid}"
- ruid=""; [ ".%{?l_ruid:set}" = .set ] && ruid="%{l_ruid}"
- rgid=""; [ ".%{?l_rgid:set}" = .set ] && rgid="%{l_rgid}"
- nuid=""; [ ".%{?l_nuid:set}" = .set ] && nuid="%{l_nuid}"
- ngid=""; [ ".%{?l_ngid:set}" = .set ] && ngid="%{l_ngid}"
- # compat:
- usr=""; [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
- grp=""; [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
- eval `sh $usrgrp \
- --usr="$usr" --grp="$grp" \
- --susr="$susr" --sgrp="$sgrp" \
- --musr="$musr" --mgrp="$mgrp" \
- --rusr="$rusr" --rgrp="$rgrp" \
- --nusr="$nusr" --ngrp="$ngrp" \
- --suid="$suid" --sgid="$sgid" \
- --muid="$muid" --mgid="$mgid" \
- --ruid="$ruid" --rgid="$rgid" \
- --nuid="$nuid" --ngid="$ngid"`
- echo "susr=\"$susr\"; export susr" >>.buildenv
- echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
- echo "musr=\"$musr\"; export musr" >>.buildenv
- echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
- echo "rusr=\"$rusr\"; export rusr" >>.buildenv
- echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
- echo "nusr=\"$nusr\"; export nusr" >>.buildenv
- echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
- echo "suid=\"$suid\"; export suid" >>.buildenv
- echo "sgid=\"$sgid\"; export sgid" >>.buildenv
- echo "muid=\"$muid\"; export muid" >>.buildenv
- echo "mgid=\"$mgid\"; export mgid" >>.buildenv
- echo "ruid=\"$ruid\"; export ruid" >>.buildenv
- echo "rgid=\"$rgid\"; export rgid" >>.buildenv
- echo "nuid=\"$nuid\"; export nuid" >>.buildenv
- echo "ngid=\"$ngid\"; export ngid" >>.buildenv
- # determine installation location id
- if [ ".%{?l_location:set}" = .set ]; then
- loc="%{l_location}"
- else
- if [ ".`expr %{l_prefix} : '/[^/][^/]*$'`" != .0 ]; then
- loc=`echo %{l_prefix} | cut -c2-4`
- else
- loc=`echo %{l_prefix} | sed -e 's;/\(.\)[^/]*;\1;g' | cut -c1-3`
- fi
- fi
- echo "loc=\"$loc\"; export loc" >>.buildenv
- # determine platform id
- s=`(uname -s) 2>/dev/null` || s='Unknown'
- r=`(uname -r) 2>/dev/null` || r='0.0'
- plid="${s}/${r}"
- # determine platform-specific build environment
- case $plid in
- FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
- Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
- SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
- Darwin/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
- * ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
- esac
- case $plid in
- FreeBSD/* ) l_build_ldlp="/usr/lib" ;;
- Linux/* ) l_build_ldlp="/lib:/usr/lib" ;;
- SunOS/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
- Darwin/* ) l_build_ldlp="/usr/lib" ;;
- * ) l_build_ldlp="/usr/lib" ;;
- esac
- case $plid in
- FreeBSD/4* ) l_build_ulim="ulimit -H -S -f 262144 -d 262144 -m 262144 -s 65536 -u 128" ;;
- Linux/2* ) l_build_ulim="ulimit -H -S -f 262144 -d 262144 -m 262144 -v 262144 -s 65536 -u 128" ;;
- SunOS/5.8* ) l_build_ulim="ulimit -H -S -f 262144 -d 262144 -s 65536" ;;
- Darwin/* ) l_build_ulim=":" ;;
- * ) l_build_ulim=":" ;;
- esac
- echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
- echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
- echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
- # bootstrap GNU zip tool
- ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
- ( cd gzip-%{V_gzip}
- CC="${l_cc}" ./configure
- ${l_make}
- )
- l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
- echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
- # unpack distribution tarballs
- ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE db-%{V_db}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
- # update config.guess/config.sub
- for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt db-%{V_db}/dist \
- curl-%{V_curl} make-%{V_make} patch-%{V_patch} tar-%{V_tar} bash-%{V_bash}/support; do
- chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
- cp `SOURCE config.guess` $dir/
- cp `SOURCE config.sub` $dir/
- done
- # bootstrap GNU patch tool
- ( cd patch-%{V_patch}
- echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}' >config.cache
- false=`sh $shtool path false`
- echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}" >>config.cache
- CC="${l_cc}" ./configure --disable-largefile
- ${l_make}
- (mv patch ..; ${l_make} clean || true; mv ../patch .)
- ) || exit $?
- l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
- echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
- # apply OpenPKG patches to distribution trees
- ( cd rpm-%{V_rpm}
- ${l_patch} -p0 <`SOURCE rpm.patch.bugfix`
- ${l_patch} -p0 <`SOURCE rpm.patch.feature`
- ${l_patch} -p0 <`SOURCE rpm.patch.porting`
- ${l_patch} -p0 <`SOURCE rpm.patch.regen`
- touch aclocal.m4 configure
- ) || exit $?
- ( cd db-%{V_db}
- ${l_patch} -p0 <`SOURCE db.patch`
- ) || exit $?
- ( cd make-%{V_make}
- ${l_patch} -p0 <`SOURCE make.patch`
- ) || exit $?
- # bootstrap GNU make tool
- ( cd make-%{V_make}
- CC="${l_cc}" ./configure --disable-nls --disable-largefile
- ${l_make}
- (mv make ..; ${l_make} clean || true; mv ../make .)
- ) || exit $?
- l_make="`pwd`/make-%{V_make}/make"; export l_make
- echo "l_make=\"$l_make\"; export l_make" >>.buildenv
- %build
- # skip in bootstrap phase 2 (see openpkg.boot)
- [ ".$OPENPKG_BOOT" = .1 ] && exit 0
- # switch into a temporary build area
- cd %{name}-%{version}
- . ./.buildenv
- # build GNU bash tool
- ( cd bash-%{V_bash}
- ( # force disabled wide-character support
- echo "ac_cv_header_wchar_h=no"
- echo "ac_cv_header_wctype_h=no"
- echo "ac_cv_func_mbsrtowcs=no"
- # force disabled internationalization support
- echo "ac_cv_header_libintl_h=no"
- echo "ac_cv_func_gettext=no"
- echo "ac_cv_func_textdomain=no"
- echo "ac_cv_func_bindtextdomain=no"
- echo "ac_cv_lib_intl_bindtextdomain=no"
- ) >config.cache || exit $?
- CC="${l_cc}"
- ./configure \
- --cache-file=./config.cache \
- --prefix=%{l_prefix} \
- --without-curses \
- --without-gnu-malloc \
- --disable-nls
- ${l_make} || exit $?
- (mv bash ..; ${l_make} clean || true; mv ../bash .)
- ) || exit $?
- # build GNU tar tool
- ( cd tar-%{V_tar}
- echo 'am_cv_func_iconv=${am_cv_func_iconv=no}' >config.cache
- echo 'am_cv_lib_iconv=${am_cv_lib_iconv=no}' >config.cache
- echo 'am_cv_func_iconv=${am_cv_func_iconv=no}' >config.cache
- CC="${l_cc}"
- ../bash-%{V_bash}/bash \
- ./configure \
- --config-cache \
- --prefix=%{l_prefix} \
- --disable-nls
- ${l_make} || exit $?
- (mv src/tar ..; ${l_make} clean || true; mv ../tar src/)
- ) || exit $?
- # build BZIP2 library
- ( cd bzip2-%{V_bzip2}
- ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
- ) || exit $?
- # build ZLIB library
- ( cd zlib-%{V_zlib}
- CC="${l_cc}" CFLAGS="-O" ./configure
- ${l_make} CC="${l_cc}" CFLAGS="-O" libz.a || exit $?
- ) || exit $?
- # build cURL tool
- ( cd curl-%{V_curl}
- echo 'ac_cv_header_openssl_engine_h=no' >config.cache
- CC="${l_cc}" \
- CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
- CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
- LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
- ./configure \
- --cache-file=./config.cache \
- --without-ssl \
- --disable-shared \
- --disable-thread \
- --disable-ipv6 \
- --with-zlib=`pwd`/../zlib-%{V_zlib}
- ${l_make} || exit $?
- (mv src/curl ..; ${l_make} clean || true; mv ../curl ./src)
- ) || exit $?
- # build Berkeley-DB library
- ( cd db-%{V_db}/build_unix
- case `sh ../dist/config.guess` in
- *-*-osf* ) echo 'db_cv_mutex=${db_cv_mutex=UNIX/msem_init}' >config.cache ;; # avoid dependency to pthread
- esac
- CC="${l_cc}" ../dist/configure
- ${l_make} libdb.a || exit $?
- ln libdb.a libdbXXX.a # workaround for Tru64
- ) || exit $?
- # build RPM
- # - we make sure RPM builds without NLS/gettext problems :-(
- # - we make sure RPM finds and uses our own BZIP2/ZLIB/DB libraries
- # - we speed up building by skipping the NLS/gettext data
- ( br=`pwd`
- cd rpm-%{V_rpm}
- sed -e 's;(aclocal --version);false;' \
- -e 's;(automake --version);false;' \
- -e 's;(autoconf --version);false;' \
- -e 's;(autoheader --version);false;' \
- -e 's;(makeinfo --version);false;' \
- -e 's;/lib/rpm;/lib/openpkg;' \
- -e "s;MKDIR_P=.*;MKDIR_P='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755';" \
- -e 's;LDFLAGS_STATIC="[^"]*";LDFLAGS_STATIC="";g' \
- <configure >configure.n && \
- mv configure.n configure
- sed -e 's;@INTLLIBS@;@INTLLIBS@ @LIBMISC@;' \
- <tools/Makefile.in >tools/Makefile.in.n && \
- mv tools/Makefile.in.n tools/Makefile.in
- sed -e 's;^\(SUBDIRS[ ]*=.*\) po \(.*\)$;\1 \2;' \
- -e 's;^\(SUBDIRS[ ]*=.*\) tools \(.*\)$;\1 \2;' \
- -e 's;^\(LIBS[ ]*=\).*;\1 @LIBS@ $(EXTRA_LIBS);' \
- <Makefile.in >Makefile.in.n && mv Makefile.in.n Makefile.in
- sed -e 's;^\(SUBDIRS[ ]*=.*\) po$;\1;' \
- <popt/Makefile.in >popt/Makefile.in.n && \
- mv popt/Makefile.in.n popt/Makefile.in
- sed -e 's;BUFSIZ;8192;g' \
- <rpmio/macro.c >rpmio/macro.c.n && \
- mv rpmio/macro.c.n rpmio/macro.c
- ( echo 'ac_cv_path_MSGFMT=${ac_cv_path_MSGFMT=no}'
- echo 'ac_cv_path_GMSGFMT=${ac_cv_path_GMSGFMT=no}'
- echo "ac_cv_path_MKDIR=%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755}"
- echo "ac_cv_path___MKDIR=%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755}"
- ) >config.cache
- case `sh ./config.guess` in
- *-*-linux* ) nlsopt="--disable-nls" ;;
- * ) nlsopt="--enable-nls --with-included-gettext" ;;
- esac
- nlsopt="--disable-nls"
- CC="${l_cc} -DOPENPKG -I$br/db-%{V_db}/build_unix -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2}" \
- CFLAGS="-DOPENPKG -I$br/db-%{V_db}/build_unix -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2}" \
- CPPFLAGS="-DOPENPKG -I$br/db-%{V_db}/build_unix -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2}" \
- LDFLAGS="-L$br/db-%{V_db}/build_unix -L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2}" \
- LIBS="-L$br/db-%{V_db}/build_unix -ldbXXX -L$br/zlib-%{V_zlib} -lz -L$br/bzip2-%{V_bzip2} -lbz2" \
- sh ./configure \
- --prefix=%{l_prefix} \
- --disable-shared \
- --disable-db1 \
- --with-glob \
- $nlsopt
- ${l_make} \
- EXTRA_LIBS="-L$br/db-%{V_db}/build_unix -ldbXXX -L$br/zlib-%{V_zlib} -lz -L$br/bzip2-%{V_bzip2} -lbz2"
- ) || exit $?
- %install
- # skip in bootstrap phase 2 (see openpkg.boot)
- [ ".$OPENPKG_BOOT" = .1 ] && exit 0
- # switch into a temporary build area
- cd %{name}-%{version}
- . ./.buildenv
- # create installation hierarchy
- rm -rf $RPM_BUILD_ROOT
- sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
- for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
- test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
- done
- for i in 1 2 3 4 5 6 7 8 9; do
- test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
- test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
- done
- for dir in PKG bin etc include info lib man sbin; do
- test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
- done
- for i in 1 2 3 4 5 6 7 8 9; do
- test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
- test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
- done
- test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
- for dir in SRC PKG DB TMP; do
- test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
- done
- # install RPM into installation hierarchy
- ( cd rpm-%{V_rpm}
- ${l_make} DESTDIR="$RPM_BUILD_ROOT" install
- ) || exit $?
- # strip RPM installation
- strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \
- $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
- for dir in man/ja man/pl man/ru man/sk src; do
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
- done
- for file in rpmbuild rpmdb rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
- rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
- done
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
- rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
- rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
- rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
- rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
- rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
- for file in \
- u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
- perl.prov perl.req mkinstalldirs magic.prov magic.req http.req \
- getpo.sh get_magic.pl find-requires.perl find-req.pl find-provides.perl \
- find-prov.pl find-lang.sh cpanflute convertrpmrc.sh check-prereqs \
- rpmputtext rpmgettext brp-compress brp-redhat brp-sparc64-linux \
- brp-strip brp-strip-shared brp-strip-comment-note rpmrc \
- config.guess config.sub; do
- rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
- done
- # add additional development files
- cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
- cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
- cp db-%{V_db}/build_unix/db.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
- cp db-%{V_db}/build_unix/libdb.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmdb.a
- # post-adjust RPM installation (namespace-clean POPT inclusion)
- mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
- $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
- mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
- $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
- # replace symlinks with hardlinks
- for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
- eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
- rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
- ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
- $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
- done
- # install lsync tool
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE lsync` \
- >$RPM_BUILD_ROOT%{l_prefix}/sbin/lsync
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/sbin/lsync
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE dot.lsyncrc` \
- >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE lsync.8` \
- >$RPM_BUILD_ROOT%{l_prefix}/man/man8/lsync.8
- # install RPM extension
- ( cd curl-%{V_curl}
- cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
- strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
- )
- ( cd bzip2-%{V_bzip2}
- cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
- strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
- )
- ( cd gzip-%{V_gzip}
- cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
- strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
- )
- ( cd patch-%{V_patch}
- cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
- strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
- )
- ( cd tar-%{V_tar}
- cp src/tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
- strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
- )
- ( cd bash-%{V_bash}
- cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
- strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
- )
- sed -e "s;@l_prefix@;%{l_prefix};g" \
- <`SOURCE rpmx.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmx.sh
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmx.sh
- sed -e "s;@l_prefix@;%{l_prefix};g" \
- <`SOURCE rpmx.pl` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmx.pl
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmx.pl
- sed -e "s;@l_prefix@;%{l_prefix};g" \
- <`SOURCE mkproxyrpm.pl` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/mkproxyrpm.pl
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/mkproxyrpm.pl
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
- # install an own copy of shtool
- cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
- # install GNU config scripts
- cp `SOURCE config.guess` $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/config.guess
- cp `SOURCE config.sub` $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
- chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/config.sub
- # install a few README files
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE root.README` \
- >$RPM_BUILD_ROOT%{l_prefix}/README
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE local.README` \
- >$RPM_BUILD_ROOT%{l_prefix}/local/README
- # install Bash environment
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE dot.bashrc` \
- >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE dot.bash_login` \
- >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
- # install Run-Command files
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE rc` \
- >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
- chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE rc.conf` \
- >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
- chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE rc.func` \
- >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
- chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
- mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE rc.openpkg` \
- >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
- chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
- # hard-code RPM tool for installation hierarchy
- # and adjust RPM configuration files
- mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
- $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm
- ( echo "#!%{l_prefix}/lib/openpkg/bash";
- echo "exec %{l_prefix}/lib/openpkg/rpm --rcfile %{l_prefix}/etc/openpkg/rpmrc \${1+\"\$@\"}"
- ) >$RPM_BUILD_ROOT%{l_prefix}/bin/rpm
- chmod 755 $RPM_BUILD_ROOT%{l_prefix}/bin/rpm
- cat `SOURCE rpmpopt` \
- >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt-%{V_rpm}
- test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
- mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- <`SOURCE rpmrc` \
- >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
- sed -e "s:@l_prefix@:%{l_prefix}:g" \
- -e "s;@l_build_path@;$l_build_path;g" \
- -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
- -e "s;@l_build_ulim@;$l_build_ulim;g" \
- -e "s:@LOC@:$loc:g" \
- -e "s:@SUSR@:$susr:g" \
- -e "s:@SGRP@:$sgrp:g" \
- -e "s:@MUSR@:$musr:g" \
- -e "s:@MGRP@:$mgrp:g" \
- -e "s:@RUSR@:$rusr:g" \
- -e "s:@RGRP@:$rgrp:g" \
- -e "s:@NUSR@:$nusr:g" \
- -e "s:@NGRP@:$ngrp:g" \
- <`SOURCE rpmmacros` \
- >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
- cp `SOURCE openpkg.pgp` \
- $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.pgp
- %files
- %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
- %{l_prefix}/README
- %config(noreplace) %{l_prefix}/.bashrc
- %config(noreplace) %{l_prefix}/.bash_login
- %dir %{l_prefix}/RPM
- %dir %{l_prefix}/RPM/SRC
- %dir %{l_prefix}/RPM/PKG
- %dir %{l_prefix}/RPM/DB
- %dir %{l_prefix}/RPM/TMP
- %dir %{l_prefix}/cgi
- %dir %{l_prefix}/bin
- %{l_prefix}/bin/rpm2cpio
- %{l_prefix}/bin/rpm
- %dir %{l_prefix}/etc
- %{l_prefix}/etc/rc
- %config(noreplace) %{l_prefix}/etc/rc.conf
- %{l_prefix}/etc/rc.func
- %dir %{l_prefix}/etc/rc.d
- %{l_prefix}/etc/rc.d/rc.openpkg
- %dir %{l_prefix}/etc/openpkg
- %config %{l_prefix}/etc/openpkg/rpmmacros
- %config %{l_prefix}/etc/openpkg/rpmrc
- %{l_prefix}/etc/openpkg/openpkg.pgp
- %dir %{l_prefix}/include
- %dir %{l_prefix}/include/rpm
- %{l_prefix}/include/rpm/popt.h
- %{l_prefix}/include/rpm/header.h
- %{l_prefix}/include/rpm/misc.h
- %{l_prefix}/include/rpm/rpmbuild.h
- %{l_prefix}/include/rpm/rpmerr.h
- %{l_prefix}/include/rpm/rpmio.h
- %{l_prefix}/include/rpm/rpmlib.h
- %{l_prefix}/include/rpm/rpmlog.h
- %{l_prefix}/include/rpm/rpmmacro.h
- %{l_prefix}/include/rpm/rpmmessages.h
- %{l_prefix}/include/rpm/rpmspec.h
- %{l_prefix}/include/rpm/rpmurl.h
- %{l_prefix}/include/rpm/stringbuf.h
- %{l_prefix}/include/rpm/ugid.h
- %{l_prefix}/include/rpm/db.h
- %{l_prefix}/include/rpm/zlib.h
- %dir %{l_prefix}/info
- %dir %{l_prefix}/lib
- %dir %{l_prefix}/lib/openpkg
- %{l_prefix}/lib/openpkg/bash
- %{l_prefix}/lib/openpkg/bzip2
- %{l_prefix}/lib/openpkg/curl
- %{l_prefix}/lib/openpkg/find-provides
- %{l_prefix}/lib/openpkg/find-requires
- %{l_prefix}/lib/openpkg/gzip
- %{l_prefix}/lib/openpkg/macros
- %{l_prefix}/lib/openpkg/mkproxyrpm.pl
- %{l_prefix}/lib/openpkg/patch
- %{l_prefix}/lib/openpkg/rpm
- %{l_prefix}/lib/openpkg/rpmb
- %{l_prefix}/lib/openpkg/rpmdb
- %{l_prefix}/lib/openpkg/rpme
- %{l_prefix}/lib/openpkg/rpmi
- %{l_prefix}/lib/openpkg/rpmk
- %{l_prefix}/lib/openpkg/rpmpopt-%{V_rpm}
- %{l_prefix}/lib/openpkg/rpmq
- %{l_prefix}/lib/openpkg/rpmt
- %{l_prefix}/lib/openpkg/rpmtool
- %{l_prefix}/lib/openpkg/rpmu
- %{l_prefix}/lib/openpkg/rpmv
- %{l_prefix}/lib/openpkg/rpmx.pl
- %{l_prefix}/lib/openpkg/rpmx.sh
- %{l_prefix}/lib/openpkg/shtool
- %{l_prefix}/lib/openpkg/tar
- %{l_prefix}/lib/openpkg/config.guess
- %{l_prefix}/lib/openpkg/config.sub
- %{l_prefix}/lib/librpmpopt.a
- %{l_prefix}/lib/librpm.a
- %{l_prefix}/lib/librpmbuild.a
- %{l_prefix}/lib/librpmio.a
- %{l_prefix}/lib/librpmz.a
- %{l_prefix}/lib/librpmdb.a
- %dir %{l_prefix}/libexec
- %dir %{l_prefix}/man
- %dir %{l_prefix}/man/man1
- %dir %{l_prefix}/man/man2
- %dir %{l_prefix}/man/man3
- %dir %{l_prefix}/man/man4
- %dir %{l_prefix}/man/man5
- %dir %{l_prefix}/man/man6
- %dir %{l_prefix}/man/man7
- %dir %{l_prefix}/man/man8
- %dir %{l_prefix}/man/man9
- %dir %{l_prefix}/man/cat1
- %dir %{l_prefix}/man/cat2
- %dir %{l_prefix}/man/cat3
- %dir %{l_prefix}/man/cat4
- %dir %{l_prefix}/man/cat5
- %dir %{l_prefix}/man/cat6
- %dir %{l_prefix}/man/cat7
- %dir %{l_prefix}/man/cat8
- %dir %{l_prefix}/man/cat9
- %{l_prefix}/man/man8/rpm.8
- %{l_prefix}/man/man8/rpm2cpio.8
- %{l_prefix}/man/man8/lsync.8
- %dir %{l_prefix}/sbin
- %dir %{l_prefix}/pub
- %dir %{l_prefix}/share
- %dir %{l_prefix}/var
- %{l_prefix}/sbin/lsync
- %dir %{l_prefix}/local
- %{l_prefix}/local/README
- %{l_prefix}/local/.lsyncrc
- %dir %{l_prefix}/local/PKG
- %dir %{l_prefix}/local/bin
- %dir %{l_prefix}/local/etc
- %dir %{l_prefix}/local/include
- %dir %{l_prefix}/local/info
- %dir %{l_prefix}/local/lib
- %dir %{l_prefix}/local/man
- %dir %{l_prefix}/local/man/man1
- %dir %{l_prefix}/local/man/man2
- %dir %{l_prefix}/local/man/man3
- %dir %{l_prefix}/local/man/man4
- %dir %{l_prefix}/local/man/man5
- %dir %{l_prefix}/local/man/man6
- %dir %{l_prefix}/local/man/man7
- %dir %{l_prefix}/local/man/man8
- %dir %{l_prefix}/local/man/man9
- %dir %{l_prefix}/local/man/cat1
- %dir %{l_prefix}/local/man/cat2
- %dir %{l_prefix}/local/man/cat3
- %dir %{l_prefix}/local/man/cat4
- %dir %{l_prefix}/local/man/cat5
- %dir %{l_prefix}/local/man/cat6
- %dir %{l_prefix}/local/man/cat7
- %dir %{l_prefix}/local/man/cat8
- %dir %{l_prefix}/local/man/cat9
- %dir %{l_prefix}/local/sbin
- %clean
- # skip in bootstrap phase 2 (see openpkg.boot)
- [ ".$OPENPKG_BOOT" = .1 ] && exit 0
- # cleanup after building
- rm -rf $RPM_BUILD_ROOT
- rm -rf %{name}-%{version}
- %pre
- # always performed for upgrades and because it doesn't harm!
- # [ ".$1" != .1 ] && exit 0
- # this procedure is only usable with root privileges
- # (for non-root installations it is not required at all)
- cusr=`(id -un) 2>/dev/null ||\
- (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
- (whoami) 2>/dev/null ||\
- (who am i | cut "-d " -f1) 2>/dev/null ||\
- echo $LOGNAME`
- # determine runtime details (for both inside and outside RPM!!)
- # - bootstrapping: $xxx is set from aux.wrapbin.sh
- # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
- # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
- [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
- [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
- [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
- [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
- [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
- [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
- [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
- [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
- # if any of these optional params are not used we won't have a
- # corresponding macro either, so make use of one conditionally
- [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
- [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
- [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
- [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
- [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
- [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
- [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
- [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
- # determine prefix
- [ ".$prefix" = . ] && prefix="%{l_prefix}"
- prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
- # determine user/group ids
- for class in s m r n; do
- eval "xusr=\"\$${class}usr\""
- eval "xgrp=\"\$${class}grp\""
- eval "xuid=\"\$${class}uid\""
- eval "xgid=\"\$${class}gid\""
- if [ ".$xuid" = . ]; then
- xuid=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null |\
- grep "^${xusr}:" | awk -F: '{ print $3; }'`
- if [ ".$xuid" = . ]; then
- # seek for a reasonably uid/gid pair
- xuid=1000
- ok=0
- while [ ".$ok" = .0 ]; do
- eval "u_exists=\$u_exists_$xuid"
- if [ ".$u_exists" = . ]; then
- u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null | grep "^[^:]*:[^:]*:$xuid:"`
- fi
- eval "g_exists=\$g_exists_$xuid"
- if [ ".$g_exists" = . ]; then
- g_exists=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:$xuid:"`
- fi
- if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
- ok=1
- break
- fi
- xuid=`expr $xuid + 1`
- done
- eval "u_exists_$xuid=yes"
- eval "g_exists_$xuid=yes"
- fi
- fi
- if [ ".$xgid" = . ]; then
- xgid=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null |\
- grep "^${xgrp}:" | awk -F: '{ print $3; }'`
- if [ ".$xgid" = . ]; then
- xgid="$xuid"
- fi
- fi
- eval "${class}uid=\"$xuid\""
- eval "${class}gid=\"$xgid\""
- done
- # determine platform id
- s=`(uname -s) 2>/dev/null` || s='Unknown'
- r=`(uname -r) 2>/dev/null` || r='0.0'
- plid="${s}/${r}"
- # add entry to /etc/shells
- shell="${prefix}/lib/openpkg/bash"
- exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
- if [ ".$exists" = . ]; then
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- echo "${shell}" >>/etc/shells
- fi
- fi
- # create the hierarchy user/group
- for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
- "management:${musr}:${muid}:${mgrp}:${mgid}" \
- "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
- "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
- # split request into class/usr/uid/grp/gid
- OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
- class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
- # check whether user already exists
- exists=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null | grep "^$usr:"`
- if [ ".$exists" = . ]; then
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- # add entry to passwd database
- realname="${prefix} OpenPKG ($class)"
- case "$plid" in
- FreeBSD/* | NetBSD/* )
- file=/etc/master.passwd
- entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
- update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
- ;;
- Linux/* )
- file=/etc/passwd
- entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
- update="(PATH=\$PATH:/usr/sbin; pwconv)"
- ;;
- SunOS/5.* )
- file=/etc/passwd
- entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
- update="(PATH=\$PATH:/usr/sbin; pwconv)"
- ;;
- OSF1/V5.* )
- file=/etc/passwd
- entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
- update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
- ;;
- HP-UX/* )
- file=/etc/passwd
- entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
- update=":"
- ;;
- Darwin/* )
- # intentionally do nothing here
- ;;
- esac
- case "$plid" in
- Darwin/* )
- niutil -create . "/users/${usr}"
- niutil -createprop . "/users/${usr}" passwd "*"
- niutil -createprop . "/users/${usr}" uid "${uid}"
- niutil -createprop . "/users/${usr}" gid "${gid}"
- niutil -createprop . "/users/${usr}" realname "${realname}"
- niutil -createprop . "/users/${usr}" home "${prefix}"
- niutil -createprop . "/users/${usr}" shell "${shell}"
- ;;
- * )
- cp $file $file.bak && \
- (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
- rm -f $file.bak >/dev/null 2>&1
- eval $update
- ;;
- esac
- fi
- fi
- # check whether group already exists
- exists=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null | grep "^$grp:"`
- if [ ".$exists" = . ]; then
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- case "$plid" in
- Darwin/* )
- niutil -create . "/groups/${grp}"
- niutil -createprop . "/groups/${grp}" gid "${gid}"
- niutil -createprop . "/groups/${grp}" users "${usr}"
- ;;
- * )
- # add entry to group database
- file=/etc/group
- entry="${grp}:*:${gid}:${usr}"
- cp $file $file.bak && \
- (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
- rm -f $file.bak >/dev/null 2>&1
- ;;
- esac
- fi
- fi
- done
- # create the startup/shutdown transfer script
- name=`echo "$prefix" | sed -e 's;/;;g'`
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- case "$plid" in
- FreeBSD/* )
- if [ ! -f /etc/rc.d/${name}.sh ]; then
- # make sure /etc/rc.d exists
- if [ ! -d /etc/rc.d ]; then
- mkdir /etc/rc.d
- fi
- # make sure /etc/rc.d is activated
- ( . /etc/defaults/rc.conf
- . /etc/rc.conf
- found=0
- for p in ${local_startup-x}; do
- if [ ".$p" = "./etc/rc.d" ]; then
- found=1
- break
- fi
- done
- if [ ".$found" = .0 ]; then
- cp -p /etc/rc.conf /etc/rc.conf.bak
- (
- grep -v local_startup /etc/rc.conf.bak
- echo "local_startup=\"/etc/rc.d $local_startup\""
- ) >/etc/rc.conf
- fi
- )
- # install transfer script
- rm -f /etc/rc.d/${name}.sh >/dev/null 2>&1
- ( echo "#!/bin/sh"
- echo "#"
- echo "# ${name}.sh -- startup/shutdown transfer script for ${prefix} OpenPKG hierarchy"
- echo "#"
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo "case \$1 in"
- echo " start ) exec ${prefix}/etc/rc all start ;;"
- echo " stop ) exec ${prefix}/etc/rc all stop ;;"
- echo "esac"
- ) >/etc/rc.d/${name}.sh
- chmod 755 /etc/rc.d/${name}.sh
- fi
- ;;
- NetBSD/* )
- if [ ! -f /etc/rc.d/${name} ]; then
- ( echo "#!/bin/sh"
- echo "#"
- echo "# ${name} -- startup/shutdown transfer script for ${prefix} OpenPKG hierarchy"
- echo "#"
- echo "# PROVIDE: ${name}"
- echo "# REQUIRE: DAEMON LOGIN NETWORK SERVERS"
- echo "#"
- echo ""
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo "case \$1 in"
- echo " start ) exec ${prefix}/etc/rc all start ;;"
- echo " stop ) exec ${prefix}/etc/rc all stop ;;"
- echo " restart ) exec ${prefix}/etc/rc all stop start ;;"
- echo " status ) ;;"
- echo "esac"
- ) >/etc/rc.d/${name}
- chmod 755 /etc/rc.d/${name}
- fi
- ;;
- Linux/* )
- # sroot: script root directory
- # lroot: link root directory
- if [ -f /etc/debian_version ]; then
- sroot=/etc/init.d
- lroot=/etc/rc%d.d
- elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
- sroot=/etc/rc.d/init.d
- lroot=/etc/rc.d/rc%d.d
- else
- echo "WARNING: you are not running one of the supported standard" 1>&2
- echo "WARNING: Linux platforms (Debian, RedHat). We are trying" 1>&2
- echo "WARNING: to guess the location of the system init scripts!" 1>&2
- sroot=""
- lroot=""
- for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
- if [ -d $sr ]; then
- sroot="$sr"
- break
- fi
- done
- for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
- if [ -d $lr ]; then
- lroot="`echo $lr | sed -e 's;2;%d;'`"
- break
- fi
- done
- if [ ".$sroot" = . -o ".$lroot" = . ]; then
- echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
- exit 1
- fi
- fi
- if [ ! -f $sroot/${name} ]; then
- # install transfer script
- ( echo "#!/bin/sh"
- echo "#"
- echo "# ${name} -- startup/shutdown transfer script for ${prefix} OpenPKG hierarchy"
- echo "#"
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo "case \$1 in"
- echo " start ) exec ${prefix}/etc/rc all start ;;"
- echo " stop ) exec ${prefix}/etc/rc all stop ;;"
- echo "esac"
- ) >$sroot/${name}
- chmod 755 $sroot/${name}
- # create corresponding symbolic links
- for i in 2 3 4 5; do
- ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
- done
- for i in 0 1 6; do
- ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
- done
- fi
- ;;
- SunOS/5.* )
- if [ ! -f /etc/init.d/${name} ]; then
- # install transfer script
- ( echo "#!/bin/sh"
- echo "#"
- echo "# ${name} -- startup/shutdown transfer script for ${prefix} OpenPKG hierarchy"
- echo "#"
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo "case \$1 in"
- echo " start ) exec ${prefix}/etc/rc all start ;;"
- echo " stop ) exec ${prefix}/etc/rc all stop ;;"
- echo "esac"
- ) >/etc/init.d/${name}
- chmod 755 /etc/init.d/${name}
- # create corresponding symbolic links
- ( cd /etc
- ln init.d/${name} rc3.d/S99${name}
- ln init.d/${name} rc0.d/K00${name}
- ln init.d/${name} rc1.d/K00${name}
- )
- fi
- ;;
- OSF1/V5.* )
- if [ ! -f /sbin/init.d/${name} ]; then
- # install transfer script
- ( echo "#!/bin/sh"
- echo "#"
- echo "# ${name} -- startup/shutdown transfer script for ${prefix} OpenPKG hierarchy"
- echo "#"
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo "case \$1 in"
- echo " start ) exec ${prefix}/etc/rc all start ;;"
- echo " stop ) exec ${prefix}/etc/rc all stop ;;"
- echo "esac"
- ) >/sbin/init.d/${name}
- chmod 755 /sbin/init.d/${name}
- # create corresponding symbolic links
- ( cd /sbin
- ln -s ../init.d/${name} rc3.d/S99${name}
- ln -s ../init.d/${name} rc0.d/K00${name}
- )
- fi
- ;;
- HP-UX/* )
- if [ ! -f /sbin/init.d/${name} ]; then
- # install transfer script
- ( echo "#!/bin/sh"
- echo "#"
- echo "# ${name} -- startup/shutdown transfer script for ${prefix} OpenPKG hierarchy"
- echo "#"
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo "case \$1 in"
- echo " start ) exec ${prefix}/etc/rc all start ;;"
- echo " stop ) exec ${prefix}/etc/rc all stop ;;"
- echo "esac"
- ) >/sbin/init.d/${name}
- chmod 755 /sbin/init.d/${name}
- # create corresponding symbolic links
- ( cd /sbin
- ln -s ../init.d/${name} rc2.d/S900${name}
- ln -s ../init.d/${name} rc1.d/K100${name}
- )
- fi
- ;;
- Darwin/* )
- darwin_rc_dir="/System/Library/StartupItems/${name}"
- if [ ! -d ${darwin_rc_dir} ]; then
- mkdir ${darwin_rc_dir}
- fi
- # make sure hierarchy is activated in /etc/hostconfig
- # FIXME: cs: simple and bad code here without any detection of existing entries
- echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
- # install transfer script
- if [ ! -f ${darwin_rc_dir}/${name} ]; then
- rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
- ( echo "#!/bin/sh"
- echo "#"
- echo "# /System/Library/StartupItems/${name}/${name}"
- echo "# -- startup transfer script for OpenPKG ${prefix} hierarchy"
- echo "#"
- echo ""
- echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
- echo ""
- echo ". /etc/rc.common"
- echo ""
- echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
- echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
- echo " ${prefix}/etc/rc all start"
- echo "fi"
- ) >${darwin_rc_dir}/${name}
- chmod 755 ${darwin_rc_dir}/${name}
- fi
- # install startup parameter list
- if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
- rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
- (
- echo "{"
- echo " Description = \"OpenPKG ${prefix} hierarchy\";"
- echo " Provides = (\"OpenPKG ${prefix}\");"
- echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
- echo " Uses = (\"Cron\");"
- echo " OrderPreference = \"Last\";"
- echo " Messages ="
- echo " {"
- echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
- echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
- echo " };"
- echo "}"
- ) >${darwin_rc_dir}/StartupParameters.plist
- chmod 644 ${darwin_rc_dir}/StartupParameters.plist
- fi
- ;;
- esac
- fi
- # create the cron transfer entries
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- case "$plid" in
- FreeBSD/* | Linux/* | Darwin/* )
- exists=`grep "$prefix/etc/rc" /etc/crontab`
- if [ ".$exists" = . ]; then
- ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
- echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
- echo "0 0 1 * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
- echo "0 0 * * 0 root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
- echo "0 0 * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
- echo "0 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
- echo "*/15 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
- echo "# </OpenPKG>"
- ) >>/etc/crontab
- fi
- ;;
- SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* )
- exists=`crontab -l | grep "$prefix/etc/rc"`
- if [ ".$exists" = . ]; then
- EDITOR=/tmp/vipw.$$
- VISUAL="$EDITOR"
- export EDITOR
- export VISUAL
- ( echo "#!/bin/sh"
- echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
- echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
- echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
- echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
- echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
- echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
- echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
- echo " echo \"# </OpenPKG>\""
- echo ") >>\$1"
- ) >$EDITOR
- chmod a+x $EDITOR
- (PATH="$PATH:/usr/bin"; crontab -e)
- rm -f $EDITOR
- fi
- ;;
- esac
- fi
- %post
- # Finally, rebuild the RPM database with the newly installed RPM
- # program on upgrades. Because of RPM internal database locking we
- # have to play a little trick here and delay the operation until RPM
- # thinks this "post" script has already terminated.
- if [ ".$1" = .2 ]; then
- ( sleep 2
- %{l_prefix}/bin/rpm --rebuilddb
- chown %{l_musr}:%{l_mgrp} %{l_prefix}/RPM/DB/* || true
- ) </dev/null >/dev/null 2>/dev/null &
- fi
- %preun
- [ ".$1" != .0 ] && exit 0
- # remove files which are not RPM controlled
- rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
- rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
- rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
- rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
- # The following code usually would be done in a %postun section.
- # But because we already had to remove the database in this %preun
- # section (see the 'rm' commands above) in order to make RPM happy
- # inside its own removal procedure, RPM would no longer find the
- # %postun script (because it's recorded in the database files). So
- # we have to perform the procedure already in this %preun script.
- # except for the removal of the top-level directory it does not
- # matter. But the top-level directory can only be removed after
- # the RPM removal procedure took place, so we play a little delay
- # trick below.
- # determine current user
- cusr=`(id -un) 2>/dev/null ||\
- (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
- (whoami) 2>/dev/null ||\
- (who am i | cut "-d " -f1) 2>/dev/null ||\
- echo $LOGNAME`
- # determine runtime details (for both inside and outside RPM!!)
- user="%{l_musr}"
- group="%{l_mgrp}"
- prefix="%{l_prefix}"
- prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
- # determine platform id
- s=`(uname -s) 2>/dev/null` || s='Unknown'
- r=`(uname -r) 2>/dev/null` || r='0.0'
- plid="${s}/${r}"
- # remove entry in /etc/shells
- shell="${prefix}/lib/openpkg/bash"
- exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
- if [ ".$exists" != . ]; then
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- cp /etc/shells /etc/shells.bak && \
- grep -v "^${shell}" /etc/shells.bak >/etc/shells
- fi
- fi
- # remove the hierarchy user/group
- for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
- "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
- "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
- "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
- # split request into class/usr/uid/grp/gid
- OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
- class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
- # check whether user already exists
- exists=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null | grep "^$usr:"`
- if [ ".$exists" != . ]; then
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- elif [ ".$usr" = ".root" ]; then
- echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
- echo "openpkg:WARNING: (would remove system standard user)" 1>&2
- else
- case "$plid" in
- FreeBSD/* | NetBSD/* )
- cp /etc/master.passwd /etc/master.passwd.bak && \
- grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
- (PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd)
- ;;
- Linux/* | SunOS/5.* )
- cp /etc/passwd /etc/passwd.bak && \
- grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
- (PATH="$PATH:/usr/sbin"; pwconv)
- ;;
- OSF1/V5.* )
- cp /etc/passwd /etc/passwd.bak && \
- grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
- (PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd)
- ;;
- HP-UX/* )
- cp /etc/passwd /etc/passwd.bak && \
- grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
- ;;
- Darwin/* )
- niutil -destroy . "/users/${usr}"
- ;;
- esac
- fi
- fi
- # check whether group already exists
- exists=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null | grep "^$grp:"`
- if [ ".$exists" != . ]; then
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
- echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
- echo "openpkg:WARNING: (would remove system standard group)" 1>&2
- else
- case "$plid" in
- Darwin/* )
- niutil -destroy . "/groups/${grp}"
- ;;
- * )
- cp /etc/group /etc/group.bak && \
- grep -v "^${grp}:" /etc/group.bak >/etc/group
- ;;
- esac
- fi
- fi
- done
- # remove the startup/shutdown transfer ripts
- name=`echo "$prefix" | sed -e 's;/;;g'`
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- case "$plid" in
- FreeBSD/* )
- rm -f /etc/rc.d/${name}.sh >/dev/null 2>&1
- ;;
- NetBSD/* )
- rm -f /etc/rc.d/${name} >/dev/null 2>&1
- ;;
- Linux/* )
- # sroot: script root directory
- # lroot: link root directory
- if [ -f /etc/debian_version ]; then
- sroot=/etc/init.d
- lroot=/etc/rc%d.d
- elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
- sroot=/etc/rc.d/init.d
- lroot=/etc/rc.d/rc%d.d
- else
- echo "WARNING: you are not running one of the supported standard" 1>&2
- echo "WARNING: Linux platforms (Debian, RedHat). We are trying" 1>&2
- echo "WARNING: to guess the location of the system init scripts!" 1>&2
- sroot=""
- lroot=""
- for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
- if [ -d $sr ]; then
- sroot="$sr"
- break
- fi
- done
- for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
- if [ -d $lr ]; then
- lroot="`echo $lr | sed -e 's;2;%d;'`"
- break
- fi
- done
- if [ ".$sroot" = . -o ".$lroot" = . ]; then
- echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
- exit 1
- fi
- fi
- rm -f ${sroot}/${name} >/dev/null 2>&1
- for i in 2 3 4 5; do
- rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
- done
- for i in 0 1 6; do
- rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
- done
- ;;
- SunOS/5.* )
- rm -f /etc/init.d/${name} >/dev/null 2>&1
- rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
- rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
- rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
- ;;
- OSF1/V5.* )
- rm -f /sbin/init.d/${name} >/dev/null 2>&1
- rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
- rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
- ;;
- HP-UX/* )
- rm -f /sbin/init.d/${name} >/dev/null 2>&1
- rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
- rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
- ;;
- Darwin/* )
- cp /etc/hostconfig /etc/hostconfig.bak && \
- grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
- rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
- ;;
- esac
- fi
- # remove the cron transfer entries
- if [ ".$cusr" != ".root" ]; then
- echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
- echo "openpkg:WARNING: (would require root-privileges)" 1>&2
- else
- case "$plid" in
- FreeBSD/* | Linux/* | Darwin/* )
- exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
- if [ ".$exists" != . ]; then
- p=`echo $prefix | sed -e 's;/;\\\\/;g'`
- cp /etc/crontab /etc/crontab.bak
- cat /etc/crontab.bak |\
- sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
- >/etc/crontab
- fi
- ;;
- SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* )
- EDITOR=/tmp/vipw.$$
- VISUAL="$EDITOR"
- export EDITOR
- export VISUAL
- p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
- ( echo "cp \$1 \$1.bak"
- echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
- echo "rm -f \$1.bak"
- ) >$EDITOR
- chmod a+x $EDITOR
- (PATH="$PATH:/usr/bin"; crontab -e)
- rm -f $EDITOR
- ;;
- esac
- fi
- # delayed removal of top-level directory.
- ( sleep 10
- rmdir %{l_prefix} >/dev/null 2>&1 || true
- ) </dev/null >/dev/null 2>/dev/null &
|