openpkg.spec 88 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140
  1. ##
  2. ## openpkg.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # NOTICE: This RPM specification is _very_ special, because it is
  26. # used both for bootstrapping OpenPKG with its RPM and for regular
  27. # builds of RPM in order to upgrade an existing installation. For this
  28. # it has to interact correctly with the "openpkg.boot" script. See
  29. # this companion script for details, but do not touch anything here
  30. # until you are 100% sure about what you are doing. In short: This
  31. # script is allowed to use only a very restricted subset of the RPM
  32. # functionality!
  33. # BUILD REQUIREMENTS:
  34. # o any sh(1)
  35. # o any tar(1)
  36. # o any make(1)
  37. # o any cc(1)
  38. # the package version/release
  39. %define V_openpkg 20040515
  40. # the used software versions
  41. %define V_rpm 4.2.1
  42. %define V_zlib 1.2.1
  43. %define V_bzip2 1.0.2
  44. %define V_beecrypt 3.1.0
  45. %define V_curl 7.11.2
  46. %define V_make 3.80
  47. %define V_gzip 1.3.5
  48. %define V_patch 2.5.9
  49. %define V_tar 1.13.94
  50. %define V_bash 2.05b
  51. %define V_uuid 1.0.0
  52. # package information
  53. Name: openpkg
  54. Summary: OpenPKG Bootstrap
  55. URL: http://www.openpkg.org/
  56. Vendor: OpenPKG
  57. Packager: The OpenPKG Project
  58. Distribution: OpenPKG
  59. Class: CORE
  60. Group: Bootstrapping
  61. License: GPL
  62. Version: %{V_openpkg}
  63. Release: %{V_openpkg}
  64. # list of sources
  65. Source0: ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz
  66. Source1: ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz
  67. Source2: ftp://alpha.gnu.org/gnu/gzip/gzip-%{V_gzip}.tar
  68. Source3: ftp://alpha.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz
  69. Source4: ftp://alpha.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz
  70. Source5: ftp://ftp.gnu.org/gnu/bash/bash-%{V_bash}.tar.gz
  71. Source6: ftp://ftp.gnu.org/gnu/config/config.guess
  72. Source7: ftp://ftp.gnu.org/gnu/config/config.sub
  73. Source8: ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz
  74. Source9: ftp://sources.redhat.com/pub/bzip2/v102/bzip2-%{V_bzip2}.tar.gz
  75. Source10: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz
  76. Source11: http://osdn.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz
  77. Source12: http://www.gzip.org/zlib/zlib-%{V_zlib}.tar.gz
  78. Source13: HISTORY
  79. Source14: README
  80. Source15: aux.prereq.sh
  81. Source16: aux.usrgrp.sh
  82. Source17: aux.wrapbin.sh
  83. Source18: aux.wrapsrc.sh
  84. Source19: bash.patch
  85. Source20: beecrypt.patch
  86. Source21: dot.bash_login
  87. Source22: dot.bashrc
  88. Source23: dot.lsyncrc
  89. Source24: local.README
  90. Source25: lsync
  91. Source26: lsync.8
  92. Source27: lsync.pod
  93. Source28: make.patch
  94. Source29: install.sh
  95. Source30: man.sh
  96. Source31: openpkg.1
  97. Source32: openpkg.boot
  98. Source33: openpkg.pgp
  99. Source34: openpkg.pod
  100. Source35: openpkg.sh
  101. Source36: pod2man.sh
  102. Source37: rc
  103. Source38: rc.8
  104. Source39: rc.conf
  105. Source40: rc.func
  106. Source41: rc.openpkg
  107. Source42: rc.pod
  108. Source43: root.README
  109. Source44: rpm-config.8
  110. Source45: rpm-config.pod
  111. Source46: rpm-config.sh
  112. Source47: rpm.patch.bugfix
  113. Source48: rpm.patch.feature
  114. Source49: rpm.patch.porting
  115. Source50: rpm.patch.regen
  116. Source51: rpmdb
  117. Source52: rpmmacros
  118. Source53: rpmpopt
  119. Source54: rpmrc
  120. Source55: rpmtool
  121. Source56: rpmtool.8
  122. Source57: rpmtool.pod
  123. Source58: shtool
  124. Source59: tar.patch
  125. Source60: uuid.8
  126. Source61: uuid.pod
  127. Source62: uuid.sh
  128. # build information
  129. Prefix: %{l_prefix}
  130. BuildRoot: %{l_buildroot}
  131. AutoReq: no
  132. AutoReqProv: no
  133. Provides: OpenPKG
  134. Provides: openpkg = 2.0.3-2.0.3
  135. %description
  136. This is the bootstrap package for the RPM-based Unix Software
  137. Package Hierarchy OpenPKG. The RedHat Package Manager (RPM) is a
  138. sophisticated and portable package manager for Unix platforms,
  139. which supports the automated building, installation, management and
  140. deinstallation of Unix software. Originally RPM is designed and
  141. implemented for us with the RedHat Linux operating system where
  142. it manages every file on the whole system. In OpenPKG RPM is used
  143. only for managing all files in a particular filesystem hierarchy
  144. dedicated to the installation of third-party software packages
  145. provided by the OpenPKG project.
  146. Internally the OpenPKG bootstrap package is based on the
  147. following particular vendor products:
  148. RedHat RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2},
  149. GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch},
  150. GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl},
  151. OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt}
  152. %track
  153. prog openpkg:bash = {
  154. version = %{V_bash}
  155. url = ftp://ftp.gnu.org/gnu/bash/
  156. regex = bash-(__VER__)\.tar\.gz
  157. }
  158. prog openpkg:bzip2 = {
  159. version = %{V_bzip2}
  160. url = ftp://sources.redhat.com/pub/bzip2/
  161. regex = v(\d+)
  162. url = ftp://sources.redhat.com/pub/bzip2/v__NEWVER__/
  163. regex = bzip2-(__VER__)\.tar\.gz
  164. }
  165. prog openpkg:curl = {
  166. version = %{V_curl}
  167. url = http://curl.haxx.se/download/
  168. regex = curl-(__VER__)\.tar\.gz
  169. }
  170. prog openpkg:gzip = {
  171. version = %{V_gzip}
  172. url = ftp://alpha.gnu.org/gnu/gzip/
  173. regex = gzip-(__VER__)\.tar(\.gz)?
  174. }
  175. prog openpkg:make = {
  176. version = %{V_make}
  177. url = ftp://ftp.gnu.org/gnu/make/
  178. regex = make-(__VER__)\.tar\.gz
  179. }
  180. prog openpkg:patch = {
  181. disabled
  182. comment = "rse: directory missing after GNU.org security issues"
  183. version = %{V_patch}
  184. url = ftp://alpha.gnu.org/gnu/patch/
  185. regex = patch-(__VER__)\.tar\.gz
  186. }
  187. prog openpkg:rpm = {
  188. disabled
  189. comment = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1"
  190. version = %{V_rpm}
  191. url = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/
  192. regex = rpm-(4\.2\.\d+)\.tar\.gz
  193. }
  194. prog openpkg:tar = {
  195. version = %{V_tar}
  196. url = ftp://alpha.gnu.org/gnu/tar/
  197. regex = tar-(__VER__)\.tar\.gz
  198. }
  199. prog openpkg:zlib = {
  200. version = %{V_zlib}
  201. url = http://www.gzip.org/zlib/
  202. regex = zlib-(__VER__)\.tar\.gz
  203. }
  204. prog openpkg:uuid = {
  205. version = %{V_uuid}
  206. url = ftp://ftp.ossp.org/pkg/lib/uuid/
  207. regex = uuid-(__VER__)\.tar\.gz
  208. }
  209. %prep
  210. # skip in bootstrap phase 2 (see openpkg.boot)
  211. [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  212. # switch into a temporary build area
  213. rm -rf openpkg-%{version}
  214. mkdir openpkg-%{version}
  215. cd openpkg-%{version}
  216. rm -f .buildenv
  217. touch .buildenv
  218. # provide a bootstrap alternative to %{SOURCE xxx} because else
  219. # it is not possible to upgrade a newer OpenPKG RPM with an older
  220. # OpenPKG RPM.
  221. echo >>.buildenv 'SOURCE () {'
  222. echo >>.buildenv ' if [ -f "%{_specdir}/$1" ]; then'
  223. echo >>.buildenv ' echo "%{_specdir}/$1"'
  224. echo >>.buildenv ' else'
  225. echo >>.buildenv ' echo "%{_sourcedir}/$1"'
  226. echo >>.buildenv ' fi'
  227. echo >>.buildenv '}'
  228. echo >>.buildenv 'VERBOSE () {'
  229. echo >>.buildenv ' if [ -f "%{_specdir}/rpmtool" ]; then'
  230. echo >>.buildenv ' echo "$*" | sh %{_specdir}/rpmtool msg'
  231. echo >>.buildenv ' else'
  232. echo >>.buildenv ' echo "$*" | sh %{_sourcedir}/rpmtool msg'
  233. echo >>.buildenv ' fi'
  234. echo >>.buildenv ' set -x'
  235. echo >>.buildenv '}'
  236. . ./.buildenv
  237. # display verbosity header
  238. set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"
  239. # determine path to shtool
  240. shtool=`SOURCE shtool`
  241. echo "shtool=$shtool" >>./.buildenv
  242. # manually make sure tar(1) is available
  243. l_tar=""; [ ".%{?l_tar:set}" = .set ] && l_tar="%{l_tar}"; export l_tar
  244. if [ ".$l_tar" = . ]; then
  245. l_tar=`sh $shtool path gtar tar`
  246. if [ ".$l_tar" = . ]; then
  247. echo "openpkg: prerequisite tool \`gtar' or \`tar' not found"
  248. exit 1
  249. fi
  250. fi
  251. echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv
  252. # manually make sure make(1) is available
  253. l_make=""; [ ".%{?l_make:set}" = .set ] && l_make="%{l_make}"; export l_make
  254. if [ ".$l_make" = . ]; then
  255. l_make=`sh $shtool path gmake make`
  256. if [ ".$l_make" = . ]; then
  257. echo "openpkg: prerequisite tool \`gmake' or \`make' not found"
  258. exit 1
  259. fi
  260. fi
  261. echo "l_make=\"$l_make\"; export l_make" >>.buildenv
  262. # manually make sure cc(1) is available
  263. l_cc=""; [ ".%{?l_cc:set}" = .set ] && l_cc="%{l_cc}"; export l_cc
  264. if [ ".$l_cc" = . ]; then
  265. l_cc=`sh $shtool path gcc cc`
  266. if [ ".$l_cc" = . ]; then
  267. echo "openpkg: prerequisite tool \`gcc' or \`cc' not found"
  268. exit 1
  269. fi
  270. fi
  271. echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv
  272. # manually make sure ar(1) is available
  273. l_ar=""; [ ".%{?l_ar:set}" = .set ] && l_ar="%{l_ar}"; export l_ar
  274. if [ ".$l_ar" = . ]; then
  275. l_ar=`sh $shtool path ar`
  276. if [ ".$l_ar" = . ]; then
  277. echo "openpkg: prerequisite tool \`ar' not found"
  278. exit 1
  279. fi
  280. fi
  281. # manually make sure ld(1) is available
  282. l_ld=""; [ ".%{?l_ld:set}" = .set ] && l_ld="%{l_ld}"; export l_ld
  283. if [ ".$l_ld" = . ]; then
  284. l_ld=`sh $shtool path ld`
  285. if [ ".$l_ld" = . ]; then
  286. echo "openpkg: prerequisite tool \`ld' not found"
  287. exit 1
  288. fi
  289. fi
  290. # determine path to aux.usrgrp.sh script
  291. usrgrp=`SOURCE aux.usrgrp.sh`
  292. echo "usrgrp=$usrgrp" >>./.buildenv
  293. # display verbosity header
  294. set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"
  295. # determine user/group name/id pairs
  296. # - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1)
  297. # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
  298. # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
  299. susr=""; [ ".%{?l_susr:set}" = .set ] && susr="%{l_susr}"
  300. sgrp=""; [ ".%{?l_sgrp:set}" = .set ] && sgrp="%{l_sgrp}"
  301. musr=""; [ ".%{?l_musr:set}" = .set ] && musr="%{l_musr}"
  302. mgrp=""; [ ".%{?l_mgrp:set}" = .set ] && mgrp="%{l_mgrp}"
  303. rusr=""; [ ".%{?l_rusr:set}" = .set ] && rusr="%{l_rusr}"
  304. rgrp=""; [ ".%{?l_rgrp:set}" = .set ] && rgrp="%{l_rgrp}"
  305. nusr=""; [ ".%{?l_nusr:set}" = .set ] && nusr="%{l_nusr}"
  306. ngrp=""; [ ".%{?l_ngrp:set}" = .set ] && ngrp="%{l_ngrp}"
  307. # corresponding ids
  308. suid=""; [ ".%{?l_suid:set}" = .set ] && suid="%{l_suid}"
  309. sgid=""; [ ".%{?l_sgid:set}" = .set ] && sgid="%{l_sgid}"
  310. muid=""; [ ".%{?l_muid:set}" = .set ] && muid="%{l_muid}"
  311. mgid=""; [ ".%{?l_mgid:set}" = .set ] && mgid="%{l_mgid}"
  312. ruid=""; [ ".%{?l_ruid:set}" = .set ] && ruid="%{l_ruid}"
  313. rgid=""; [ ".%{?l_rgid:set}" = .set ] && rgid="%{l_rgid}"
  314. nuid=""; [ ".%{?l_nuid:set}" = .set ] && nuid="%{l_nuid}"
  315. ngid=""; [ ".%{?l_ngid:set}" = .set ] && ngid="%{l_ngid}"
  316. # compat:
  317. usr=""; [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}"
  318. grp=""; [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}"
  319. eval `sh $usrgrp \
  320. --usr="$usr" --grp="$grp" \
  321. --susr="$susr" --sgrp="$sgrp" \
  322. --musr="$musr" --mgrp="$mgrp" \
  323. --rusr="$rusr" --rgrp="$rgrp" \
  324. --nusr="$nusr" --ngrp="$ngrp" \
  325. --suid="$suid" --sgid="$sgid" \
  326. --muid="$muid" --mgid="$mgid" \
  327. --ruid="$ruid" --rgid="$rgid" \
  328. --nuid="$nuid" --ngid="$ngid"`
  329. echo "susr=\"$susr\"; export susr" >>.buildenv
  330. echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv
  331. echo "musr=\"$musr\"; export musr" >>.buildenv
  332. echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv
  333. echo "rusr=\"$rusr\"; export rusr" >>.buildenv
  334. echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv
  335. echo "nusr=\"$nusr\"; export nusr" >>.buildenv
  336. echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv
  337. echo "suid=\"$suid\"; export suid" >>.buildenv
  338. echo "sgid=\"$sgid\"; export sgid" >>.buildenv
  339. echo "muid=\"$muid\"; export muid" >>.buildenv
  340. echo "mgid=\"$mgid\"; export mgid" >>.buildenv
  341. echo "ruid=\"$ruid\"; export ruid" >>.buildenv
  342. echo "rgid=\"$rgid\"; export rgid" >>.buildenv
  343. echo "nuid=\"$nuid\"; export nuid" >>.buildenv
  344. echo "ngid=\"$ngid\"; export ngid" >>.buildenv
  345. # display verbosity header
  346. set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"
  347. # determine installation location id
  348. if [ ".%{?l_tag_fmt:set}" = .set ]; then
  349. tag="%{l_tag_fmt}"
  350. else
  351. tag="<compat>"
  352. fi
  353. echo "tag=\"$tag\"; export tag" >>.buildenv
  354. # determine platform id
  355. s=`(uname -s) 2>/dev/null` || s='Unknown'
  356. r=`(uname -r) 2>/dev/null` || r='0.0'
  357. plid="${s}/${r}"
  358. # determine platform-specific build environment
  359. case $plid in
  360. FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  361. Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  362. SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;;
  363. Darwin/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  364. * ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;;
  365. esac
  366. case $plid in
  367. FreeBSD/* ) l_build_ldlp="/usr/lib" ;;
  368. Linux/* ) l_build_ldlp="/lib:/usr/lib" ;;
  369. SunOS/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;;
  370. Darwin/* ) l_build_ldlp="/usr/lib" ;;
  371. * ) l_build_ldlp="/usr/lib" ;;
  372. esac
  373. case $plid in
  374. FreeBSD/4* ) l_build_ulim="ulimit -H -S -f 262144 -d 262144 -m 262144 -s 65536 -u 128" ;;
  375. Linux/2* ) l_build_ulim="ulimit -H -S -f 262144 -d 262144 -m 262144 -v 262144 -s 65536 -u 128" ;;
  376. SunOS/5.8* ) l_build_ulim="ulimit -H -S -f 262144 -d 262144 -s 65536" ;;
  377. Darwin/* ) l_build_ulim=":" ;;
  378. * ) l_build_ulim=":" ;;
  379. esac
  380. echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv
  381. echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv
  382. echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv
  383. # display verbosity header
  384. set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"
  385. # bootstrap GNU zip tool
  386. ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true
  387. ( cd gzip-%{V_gzip}
  388. echo "ac_cv_prog_cc_g=no" >config.cache
  389. CC="${l_cc}" \
  390. ./configure \
  391. --cache-file=./config.cache
  392. ${l_make}
  393. ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $?
  394. ) || exit $?
  395. l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip
  396. echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv
  397. # display verbosity header
  398. set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"
  399. # unpack distribution tarballs
  400. ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  401. ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  402. ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  403. ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  404. ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  405. ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  406. ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  407. ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  408. ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  409. ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true
  410. # update config.guess/config.sub
  411. for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \
  412. curl-%{V_curl} make-%{V_make} patch-%{V_patch} tar-%{V_tar} \
  413. bash-%{V_bash}/support; do
  414. chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true
  415. cp `SOURCE config.guess` $dir/
  416. cp `SOURCE config.sub` $dir/
  417. done
  418. # display verbosity header
  419. set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"
  420. # bootstrap GNU patch tool
  421. ( cd patch-%{V_patch}
  422. ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}'
  423. echo 'ac_cv_prog_cc_g=no'
  424. false=`sh $shtool path false`
  425. echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}"
  426. ) >config.cache
  427. CC="${l_cc}" \
  428. ./configure \
  429. --cache-file=./config.cache \
  430. --disable-largefile
  431. ${l_make}
  432. ( mv patch ..; ${l_make} clean || true; mv ../patch . ) || exit $?
  433. ) || exit $?
  434. l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch
  435. echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv
  436. # display verbosity header
  437. set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distibutions"
  438. # apply OpenPKG patches to distribution trees
  439. ( cd rpm-%{V_rpm}
  440. sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix` | ${l_patch} -p0
  441. sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0
  442. sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0
  443. sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen` | ${l_patch} -p0
  444. rm -rf db/docs # just reduce disk size of source tree
  445. ) || exit $?
  446. ( cd make-%{V_make}
  447. ${l_patch} -p0 <`SOURCE make.patch`
  448. ) || exit $?
  449. ( cd bash-%{V_bash}
  450. ${l_patch} -p0 <`SOURCE bash.patch`
  451. ) || exit $?
  452. ( cd tar-%{V_tar}
  453. ${l_patch} -p0 <`SOURCE tar.patch`
  454. ) || exit $?
  455. ( cd beecrypt-%{V_beecrypt}
  456. ${l_patch} -p0 <`SOURCE beecrypt.patch`
  457. sh $shtool subst \
  458. -e 's;^[ ][ ]*#;#;' \
  459. aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \
  460. md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c
  461. ) || exit $?
  462. # display verbosity header
  463. set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"
  464. # bootstrap GNU make tool
  465. ( cd make-%{V_make}
  466. CC="${l_cc}" \
  467. ./configure \
  468. --disable-nls \
  469. --disable-largefile
  470. ${l_make}
  471. ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $?
  472. ) || exit $?
  473. l_make="`pwd`/make-%{V_make}/make"; export l_make
  474. echo "l_make=\"$l_make\"; export l_make" >>.buildenv
  475. %build
  476. # skip in bootstrap phase 2 (see openpkg.boot)
  477. [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  478. # switch into a temporary build area
  479. cd openpkg-%{version}
  480. . ./.buildenv
  481. # display verbosity header
  482. set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"
  483. # build GNU bash tool
  484. ( cd bash-%{V_bash}
  485. ( # force disabled wide-character support
  486. echo "ac_cv_header_wchar_h=no"
  487. echo "ac_cv_header_wctype_h=no"
  488. echo "ac_cv_func_mbsrtowcs=no"
  489. # force disabled internationalization support
  490. echo "ac_cv_header_libintl_h=no"
  491. echo "ac_cv_func_gettext=no"
  492. echo "ac_cv_func_textdomain=no"
  493. echo "ac_cv_func_bindtextdomain=no"
  494. echo "ac_cv_lib_intl_bindtextdomain=no"
  495. # disable building with debug symbols
  496. echo "ac_cv_prog_cc_g=no"
  497. ) >config.cache
  498. CC="${l_cc}"
  499. ./configure \
  500. --cache-file=./config.cache \
  501. --prefix=%{l_prefix} \
  502. --without-curses \
  503. --without-gnu-malloc \
  504. --disable-nls
  505. ${l_make} || exit $?
  506. ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $?
  507. ) || exit $?
  508. # display verbosity header
  509. set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"
  510. # build GNU tar tool
  511. ( cd tar-%{V_tar}
  512. ( echo 'am_cv_func_iconv=no'
  513. echo 'am_cv_lib_iconv=no'
  514. echo 'ac_cv_lib_iconv_iconv=no'
  515. echo 'ac_cv_header_iconv_h=no'
  516. echo 'ac_cv_type_iconv_t=no'
  517. ) >config.cache
  518. sh $shtool subst \
  519. -e 's;^rm conftest\.sed;rm -f conftest.sed;' \
  520. configure
  521. CC="${l_cc}" \
  522. ../bash-%{V_bash}/bash \
  523. ./configure \
  524. --cache-file=./config.cache \
  525. --prefix=%{l_prefix} \
  526. --disable-nls
  527. ${l_make} || exit $?
  528. ( mv src/tar ..; ${l_make} clean || true; mv ../tar src/ ) || exit $?
  529. ) || exit $?
  530. # display verbosity header
  531. set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"
  532. # build BZIP2 library
  533. ( cd bzip2-%{V_bzip2}
  534. ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $?
  535. ) || exit $?
  536. # display verbosity header
  537. set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"
  538. # build ZLIB library
  539. ( cd zlib-%{V_zlib}
  540. CC="${l_cc}" CFLAGS="-O" ./configure
  541. ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here
  542. ) || exit $?
  543. # display verbosity header
  544. set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"
  545. # build OSSP uuid tool
  546. ( cd uuid-%{V_uuid}
  547. CC="${l_cc}" \
  548. CFLAGS="-O" \
  549. ./configure \
  550. --prefix=%{l_prefix} \
  551. --disable-shared
  552. ${l_make} || exit $?
  553. ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $?
  554. ) || exit $?
  555. # display verbosity header
  556. set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"
  557. # build cURL tool
  558. ( cd curl-%{V_curl}
  559. ( echo 'ac_cv_header_openssl_engine_h=no'
  560. echo 'lt_cv_prog_compiler_c_o_F77=no'
  561. echo 'lt_cv_sys_max_cmd_len=100'
  562. ) >config.cache
  563. CC="${l_cc}" \
  564. CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
  565. CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \
  566. LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \
  567. ./configure \
  568. --cache-file=./config.cache \
  569. --without-ssl \
  570. --disable-shared \
  571. --disable-thread \
  572. --disable-ipv6 \
  573. --with-zlib=`pwd`/../zlib-%{V_zlib}
  574. ${l_make} || exit $?
  575. ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $?
  576. ) || exit $?
  577. # display verbosity header
  578. set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"
  579. # build BeeCrypt library
  580. ( cd beecrypt-%{V_beecrypt}
  581. ( echo 'ac_cv_have_dev_dsp=no'
  582. echo 'ac_cv_have_dev_audio=no'
  583. ) >config.cache
  584. CC="${l_cc}" \
  585. CFLAGS="-O" \
  586. ./configure \
  587. --cache-file=./config.cache \
  588. --prefix=%{l_prefix} \
  589. --disable-threads \
  590. --disable-shared \
  591. --with-cpu=none \
  592. --with-arch=none
  593. ${l_make} || exit $?
  594. cp .libs/libbeecrypt.a .
  595. ) || exit $?
  596. # display verbosity header
  597. set +x; VERBOSE "BUILD: Build RPM (RedHat Package Manager)"
  598. # build RPM
  599. ( br=`pwd`
  600. cd rpm-%{V_rpm}
  601. # remove object files accidentally distributed with the RPM tarball
  602. rm -f db/build_unix/*.o
  603. rm -f db/build_unix/*.lo
  604. # remove embedded zlib (we are linking with an external one)
  605. rm -rf zlib
  606. # kill Linux-based preconfigured DB header, to allow the Makefiles to
  607. # symlink to it the header that is configured for the current system.
  608. rm -f rpmdb/db.h
  609. # make sure we do not trigger Autoconf/Automake tools
  610. touch configure
  611. touch config.h.in
  612. # disable running of any Autoconf/Automake tools
  613. ACLOCAL=true
  614. AUTOCONF=true
  615. AUTOMAKE=true
  616. AUTOHEADER=true
  617. MAKEINFO=true
  618. AMTAR=true
  619. export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR
  620. # cheat GNU Autoconf
  621. ( echo 'ac_cv_path_MSGFMT=:'
  622. echo 'ac_cv_path_GMSGFMT=:'
  623. echo 'ac_cv_path_XGETTEXT=:'
  624. echo 'ac_cv_path_MSGMERGE=:'
  625. echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
  626. echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'"
  627. echo "ac_cv_path___PYTHON=true"
  628. echo "ac_cv_path___DOXYGEN=true"
  629. echo "acl_cv_rpath=no"
  630. echo "ac_cv_header_getopt_h=no"
  631. ) >config.cache
  632. # provide platform identification
  633. os_name=`(uname -s) 2>/dev/null` || os_name='Unknown'
  634. os_name=`echo "${os_name}" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  635. # set build tool flags
  636. CC="${l_cc}"
  637. CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}"
  638. CFLAGS="$CPPFLAGS"
  639. LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}"
  640. LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt"
  641. export CC CPPFLAGS CFLAGS LDFLAGS LIBS
  642. # configure the package
  643. sh ./configure \
  644. --cache-file=./config.cache \
  645. --prefix=%{l_prefix} \
  646. --with-db \
  647. --with-glob \
  648. --without-python \
  649. --without-apidocs \
  650. --disable-shared \
  651. --disable-rpath \
  652. --disable-nls
  653. # build the package
  654. ${l_make}
  655. ) || exit $?
  656. %install
  657. # skip in bootstrap phase 2 (see openpkg.boot)
  658. [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  659. # switch into a temporary build area
  660. cd openpkg-%{version}
  661. . ./.buildenv
  662. # display verbosity header
  663. set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"
  664. # create installation hierarchy
  665. rm -rf $RPM_BUILD_ROOT
  666. sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  667. for dir in bin etc include info lib libexec man sbin share var cgi pub local; do
  668. test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \
  669. mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir
  670. done
  671. for i in 1 2 3 4 5 6 7 8 9; do
  672. test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \
  673. mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i
  674. test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \
  675. mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i
  676. done
  677. for dir in PKG bin etc include info lib man sbin; do
  678. test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \
  679. mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir
  680. done
  681. for i in 1 2 3 4 5 6 7 8 9; do
  682. test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \
  683. mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i
  684. test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \
  685. mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i
  686. done
  687. test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \
  688. mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM
  689. for dir in SRC PKG DB TMP; do
  690. test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \
  691. mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir
  692. done
  693. mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg
  694. mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg
  695. # display verbosity header
  696. set +x; VERBOSE "INSTALL: Installation of RPM"
  697. # install RPM into installation hierarchy
  698. ( cd rpm-%{V_rpm}
  699. ${l_make} DESTDIR="$RPM_BUILD_ROOT" install
  700. ) || exit $?
  701. # display verbosity header
  702. set +x; VERBOSE "INSTALL: Stripping Down Installation"
  703. # strip RPM installation
  704. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \
  705. $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true
  706. for dir in man/ja man/pl man/ru man/sk src; do
  707. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true
  708. done
  709. for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do
  710. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true
  711. done
  712. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true
  713. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true
  714. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true
  715. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true
  716. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true
  717. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true
  718. rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true
  719. for file in \
  720. u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \
  721. perl.prov perl.req mkinstalldirs magic.prov magic.req http.req \
  722. getpo.sh get_magic.pl find-provides find-requires \
  723. find-requires.perl find-req.pl find-provides.perl \
  724. find-prov.pl find-lang.sh cpanflute convertrpmrc.sh check-prereqs \
  725. rpmputtext rpmgettext brp-compress brp-redhat brp-sparc64-linux \
  726. brp-strip brp-strip-shared brp-strip-comment-note rpmrc \
  727. config.guess config.sub check-files; do
  728. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true
  729. done
  730. # display verbosity header
  731. set +x; VERBOSE "INSTALL: Install Additional Files"
  732. # add additional development files
  733. cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  734. cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  735. cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a
  736. cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  737. cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a
  738. cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/
  739. cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a
  740. # display verbosity header
  741. set +x; VERBOSE "INSTALL: Post-Adjust Installation"
  742. # post-adjust RPM installation (namespace-clean POPT inclusion)
  743. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \
  744. $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a
  745. mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \
  746. $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h
  747. # move C API into custom locations
  748. mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \
  749. $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm
  750. mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \
  751. $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/
  752. # replace symlinks with hardlinks
  753. for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do
  754. eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'`
  755. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
  756. ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \
  757. $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst
  758. done
  759. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild
  760. ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \
  761. $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild
  762. mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \
  763. $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8
  764. # display verbosity header
  765. set +x; VERBOSE "INSTALL: Install Additional Tools"
  766. # install lsync tool
  767. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  768. <`SOURCE lsync` \
  769. >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
  770. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync
  771. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  772. <`SOURCE dot.lsyncrc` \
  773. >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc
  774. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  775. <`SOURCE lsync.8` \
  776. >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8
  777. # install rpm-config tool
  778. ( l_prefix="%{l_prefix}"
  779. l_cc="%{l_cc}"
  780. l_cflags=""
  781. l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg"
  782. l_ldflags="-L${l_prefix}/lib/openpkg"
  783. l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz"
  784. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  785. -e "s:@l_cc@:$l_cc:g" \
  786. -e "s:@l_cflags@:$l_cflags:g" \
  787. -e "s:@l_cppflags@:$l_cppflags:g" \
  788. -e "s:@l_ldflags@:$l_ldflags:g" \
  789. -e "s:@l_libs@:$l_libs:g" \
  790. -e "s:@l_version@:%{V_rpm}:g" \
  791. <`SOURCE rpm-config.sh` \
  792. >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
  793. ) || exit $?
  794. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config
  795. sed -e "s:RPM_VERSION:%{V_rpm}:g" \
  796. <`SOURCE rpm-config.8` \
  797. >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8
  798. # move rpm2cpio tool to custom location
  799. mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \
  800. $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio
  801. mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \
  802. $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8
  803. # move rpm tool to custom location
  804. mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \
  805. $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm
  806. mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \
  807. $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8
  808. # install RPM extension
  809. ( cd rpm-%{V_rpm}
  810. cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
  811. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file
  812. ) || exit $?
  813. ( cd curl-%{V_curl}
  814. cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
  815. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl
  816. ) || exit $?
  817. ( cd bzip2-%{V_bzip2}
  818. cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
  819. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2
  820. ) || exit $?
  821. ( cd gzip-%{V_gzip}
  822. cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
  823. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip
  824. ) || exit $?
  825. ( cd patch-%{V_patch}
  826. cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
  827. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch
  828. ) || exit $?
  829. ( cd tar-%{V_tar}
  830. cp src/tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
  831. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar
  832. ) || exit $?
  833. ( cd bash-%{V_bash}
  834. cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
  835. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash
  836. ) || exit $?
  837. ( cd uuid-%{V_uuid}
  838. cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
  839. strip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid
  840. ) || exit $?
  841. sed -e "s;@l_prefix@;%{l_prefix};g" \
  842. -e "s;@l_musr@;%{l_musr};g" \
  843. -e "s;@l_mgrp@;%{l_mgrp};g" \
  844. <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
  845. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid
  846. sed -e "s;@l_prefix@;%{l_prefix};g" \
  847. <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8
  848. sed -e "s;@l_prefix@;%{l_prefix};g" \
  849. -e "s;@l_musr@;%{l_musr};g" \
  850. -e "s;@l_mgrp@;%{l_mgrp};g" \
  851. <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
  852. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb
  853. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  854. <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
  855. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool
  856. # install OpenPKG tool chain execution frontend
  857. sed -e "s;@l_prefix@;%{l_prefix};g" \
  858. <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  859. chmod 755 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg
  860. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  861. <`SOURCE openpkg.1` \
  862. >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1
  863. # install more OpenPKG tool chain commands
  864. sed -e "s;@l_prefix@;%{l_prefix};g" \
  865. <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
  866. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install
  867. sed -e "s;@l_prefix@;%{l_prefix};g" \
  868. <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
  869. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man
  870. # install an own copy of shtool
  871. cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
  872. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool
  873. # display verbosity header
  874. set +x; VERBOSE "INSTALL: Install Configuration Files"
  875. # install a few README files
  876. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  877. <`SOURCE root.README` \
  878. >$RPM_BUILD_ROOT%{l_prefix}/README
  879. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  880. <`SOURCE local.README` \
  881. >$RPM_BUILD_ROOT%{l_prefix}/local/README
  882. # install Bash environment
  883. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  884. <`SOURCE dot.bashrc` \
  885. >$RPM_BUILD_ROOT%{l_prefix}/.bashrc
  886. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  887. <`SOURCE dot.bash_login` \
  888. >$RPM_BUILD_ROOT%{l_prefix}/.bash_login
  889. # install Run-Command files
  890. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  891. -e "s:@l_susr@:%{l_susr}:g" \
  892. -e "s:@l_musr@:%{l_musr}:g" \
  893. <`SOURCE rc` \
  894. >$RPM_BUILD_ROOT%{l_prefix}/etc/rc
  895. chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc
  896. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  897. <`SOURCE rc.conf` \
  898. >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
  899. chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf
  900. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  901. <`SOURCE rc.func` \
  902. >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
  903. chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func
  904. mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  905. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  906. <`SOURCE rc.openpkg` \
  907. >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
  908. chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg
  909. ( echo "#!/bin/sh"
  910. echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}"
  911. ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
  912. chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc
  913. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \
  914. $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc
  915. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  916. <`SOURCE rc.8` \
  917. >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8
  918. # create configuration directory
  919. test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \
  920. mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg
  921. # install platform identification file
  922. sh `SOURCE shtool` platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \
  923. >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
  924. chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform
  925. # install UUID configuration file (ghost)
  926. touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
  927. chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid
  928. # install overriding RPM configuration files
  929. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  930. <`SOURCE rpmpopt` \
  931. >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt
  932. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  933. <`SOURCE rpmrc` \
  934. >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc
  935. sed -e "s:@l_prefix@:%{l_prefix}:g" \
  936. -e "s:@l_prefix_static@:%{l_prefix}:g" \
  937. -e "s;@l_build_path@;$l_build_path;g" \
  938. -e "s;@l_build_ldlp@;$l_build_ldlp;g" \
  939. -e "s;@l_build_ulim@;$l_build_ulim;g" \
  940. -e "s:@TAG@:$tag:g" \
  941. -e "s:@SUSR@:$susr:g" \
  942. -e "s:@SGRP@:$sgrp:g" \
  943. -e "s:@MUSR@:$musr:g" \
  944. -e "s:@MGRP@:$mgrp:g" \
  945. -e "s:@RUSR@:$rusr:g" \
  946. -e "s:@RGRP@:$rgrp:g" \
  947. -e "s:@NUSR@:$nusr:g" \
  948. -e "s:@NGRP@:$ngrp:g" \
  949. <`SOURCE rpmmacros` \
  950. >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros
  951. cp `SOURCE openpkg.pgp` \
  952. $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.pgp
  953. # display verbosity header
  954. set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."
  955. %files
  956. %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}})
  957. %{l_prefix}/README
  958. %config(noreplace) %{l_prefix}/.bashrc
  959. %config(noreplace) %{l_prefix}/.bash_login
  960. %dir %{l_prefix}/RPM
  961. %dir %{l_prefix}/RPM/SRC
  962. %dir %{l_prefix}/RPM/PKG
  963. %dir %{l_prefix}/RPM/DB
  964. %dir %{l_prefix}/RPM/TMP
  965. %dir %{l_prefix}/cgi
  966. %dir %{l_prefix}/bin
  967. %{l_prefix}/bin/openpkg
  968. %dir %{l_prefix}/etc
  969. %{l_prefix}/etc/rc
  970. %config(noreplace) %{l_prefix}/etc/rc.conf
  971. %{l_prefix}/etc/rc.func
  972. %dir %{l_prefix}/etc/rc.d
  973. %{l_prefix}/etc/rc.d/rc.openpkg
  974. %dir %{l_prefix}/etc/openpkg
  975. %ghost %{l_prefix}/etc/openpkg/uuid
  976. %config %{l_prefix}/etc/openpkg/platform
  977. %config %{l_prefix}/etc/openpkg/rpmmacros
  978. %config %{l_prefix}/etc/openpkg/rpmrc
  979. %{l_prefix}/etc/openpkg/openpkg.pgp
  980. %dir %{l_prefix}/include
  981. %dir %{l_prefix}/include/openpkg
  982. %dir %{l_prefix}/include/openpkg/rpm
  983. %{l_prefix}/include/openpkg/rpm/argv.h
  984. %{l_prefix}/include/openpkg/rpm/beecrypt.h
  985. %{l_prefix}/include/openpkg/rpm/bzlib.h
  986. %{l_prefix}/include/openpkg/rpm/db.h
  987. %{l_prefix}/include/openpkg/rpm/fts.h
  988. %{l_prefix}/include/openpkg/rpm/glob.h
  989. %{l_prefix}/include/openpkg/rpm/hdrinline.h
  990. %{l_prefix}/include/openpkg/rpm/header.h
  991. %{l_prefix}/include/openpkg/rpm/misc.h
  992. %{l_prefix}/include/openpkg/rpm/popt.h
  993. %{l_prefix}/include/openpkg/rpm/rpmal.h
  994. %{l_prefix}/include/openpkg/rpm/rpmbuild.h
  995. %{l_prefix}/include/openpkg/rpm/rpmcli.h
  996. %{l_prefix}/include/openpkg/rpm/rpmdb.h
  997. %{l_prefix}/include/openpkg/rpm/rpmds.h
  998. %{l_prefix}/include/openpkg/rpm/rpmerr.h
  999. %{l_prefix}/include/openpkg/rpm/rpmfc.h
  1000. %{l_prefix}/include/openpkg/rpm/rpmfi.h
  1001. %{l_prefix}/include/openpkg/rpm/rpmfile.h
  1002. %{l_prefix}/include/openpkg/rpm/rpmhash.h
  1003. %{l_prefix}/include/openpkg/rpm/rpmio.h
  1004. %{l_prefix}/include/openpkg/rpm/rpmlib.h
  1005. %{l_prefix}/include/openpkg/rpm/rpmlog.h
  1006. %{l_prefix}/include/openpkg/rpm/rpmmacro.h
  1007. %{l_prefix}/include/openpkg/rpm/rpmmessages.h
  1008. %{l_prefix}/include/openpkg/rpm/rpmpgp.h
  1009. %{l_prefix}/include/openpkg/rpm/rpmps.h
  1010. %{l_prefix}/include/openpkg/rpm/rpmspec.h
  1011. %{l_prefix}/include/openpkg/rpm/rpmsw.h
  1012. %{l_prefix}/include/openpkg/rpm/rpmte.h
  1013. %{l_prefix}/include/openpkg/rpm/rpmts.h
  1014. %{l_prefix}/include/openpkg/rpm/rpmurl.h
  1015. %{l_prefix}/include/openpkg/rpm/stringbuf.h
  1016. %{l_prefix}/include/openpkg/rpm/ugid.h
  1017. %{l_prefix}/include/openpkg/rpm/zlib.h
  1018. %dir %{l_prefix}/info
  1019. %dir %{l_prefix}/lib
  1020. %dir %{l_prefix}/lib/openpkg
  1021. %{l_prefix}/lib/openpkg/bash
  1022. %{l_prefix}/lib/openpkg/bzip2
  1023. %{l_prefix}/lib/openpkg/uuid
  1024. %{l_prefix}/lib/openpkg/curl
  1025. %{l_prefix}/lib/openpkg/file
  1026. %{l_prefix}/lib/openpkg/gzip
  1027. %{l_prefix}/lib/openpkg/macros
  1028. %{l_prefix}/lib/openpkg/magic
  1029. %{l_prefix}/lib/openpkg/magic.mgc
  1030. %{l_prefix}/lib/openpkg/magic.mime
  1031. %{l_prefix}/lib/openpkg/magic.mime.mgc
  1032. %{l_prefix}/lib/openpkg/patch
  1033. %{l_prefix}/lib/openpkg/rc
  1034. %{l_prefix}/lib/openpkg/rpmb
  1035. %{l_prefix}/lib/openpkg/rpmd
  1036. %{l_prefix}/lib/openpkg/rpmdb
  1037. %{l_prefix}/lib/openpkg/rpmdb_dump
  1038. %{l_prefix}/lib/openpkg/rpmdb_load
  1039. %{l_prefix}/lib/openpkg/rpmdb_verify
  1040. %{l_prefix}/lib/openpkg/rpme
  1041. %{l_prefix}/lib/openpkg/rpmi
  1042. %{l_prefix}/lib/openpkg/rpmk
  1043. %{l_prefix}/lib/openpkg/rpmpopt
  1044. %{l_prefix}/lib/openpkg/rpmq
  1045. %{l_prefix}/lib/openpkg/rpmt
  1046. %{l_prefix}/lib/openpkg/rpmtool
  1047. %{l_prefix}/lib/openpkg/rpmu
  1048. %{l_prefix}/lib/openpkg/rpmv
  1049. %{l_prefix}/lib/openpkg/shtool
  1050. %{l_prefix}/lib/openpkg/tar
  1051. %{l_prefix}/lib/openpkg/librpm.a
  1052. %{l_prefix}/lib/openpkg/librpmbeecrypt.a
  1053. %{l_prefix}/lib/openpkg/librpmbuild.a
  1054. %{l_prefix}/lib/openpkg/librpmbz2.a
  1055. %{l_prefix}/lib/openpkg/librpmdb.a
  1056. %{l_prefix}/lib/openpkg/librpmio.a
  1057. %{l_prefix}/lib/openpkg/librpmpopt.a
  1058. %{l_prefix}/lib/openpkg/librpmz.a
  1059. %dir %{l_prefix}/libexec
  1060. %dir %{l_prefix}/libexec/openpkg
  1061. %{l_prefix}/libexec/openpkg/uuid
  1062. %{l_prefix}/libexec/openpkg/uuid.8
  1063. %{l_prefix}/libexec/openpkg/man
  1064. %{l_prefix}/libexec/openpkg/install
  1065. %{l_prefix}/libexec/openpkg/lsync
  1066. %{l_prefix}/libexec/openpkg/lsync.8
  1067. %{l_prefix}/libexec/openpkg/rc
  1068. %{l_prefix}/libexec/openpkg/rc.8
  1069. %{l_prefix}/libexec/openpkg/rpm-config
  1070. %{l_prefix}/libexec/openpkg/rpm-config.8
  1071. %{l_prefix}/libexec/openpkg/rpm2cpio
  1072. %{l_prefix}/libexec/openpkg/rpm2cpio.8
  1073. %{l_prefix}/libexec/openpkg/rpmbuild
  1074. %{l_prefix}/libexec/openpkg/rpmbuild.8
  1075. %{l_prefix}/libexec/openpkg/rpm
  1076. %{l_prefix}/libexec/openpkg/rpm.8
  1077. %dir %{l_prefix}/man
  1078. %dir %{l_prefix}/man/man1
  1079. %dir %{l_prefix}/man/man2
  1080. %dir %{l_prefix}/man/man3
  1081. %dir %{l_prefix}/man/man4
  1082. %dir %{l_prefix}/man/man5
  1083. %dir %{l_prefix}/man/man6
  1084. %dir %{l_prefix}/man/man7
  1085. %dir %{l_prefix}/man/man8
  1086. %dir %{l_prefix}/man/man9
  1087. %dir %{l_prefix}/man/cat1
  1088. %dir %{l_prefix}/man/cat2
  1089. %dir %{l_prefix}/man/cat3
  1090. %dir %{l_prefix}/man/cat4
  1091. %dir %{l_prefix}/man/cat5
  1092. %dir %{l_prefix}/man/cat6
  1093. %dir %{l_prefix}/man/cat7
  1094. %dir %{l_prefix}/man/cat8
  1095. %dir %{l_prefix}/man/cat9
  1096. %{l_prefix}/man/man1/openpkg.1
  1097. %dir %{l_prefix}/sbin
  1098. %dir %{l_prefix}/pub
  1099. %dir %{l_prefix}/share
  1100. %dir %{l_prefix}/var
  1101. %dir %{l_prefix}/local
  1102. %{l_prefix}/local/README
  1103. %{l_prefix}/local/.lsyncrc
  1104. %dir %{l_prefix}/local/PKG
  1105. %dir %{l_prefix}/local/bin
  1106. %dir %{l_prefix}/local/etc
  1107. %dir %{l_prefix}/local/include
  1108. %dir %{l_prefix}/local/info
  1109. %dir %{l_prefix}/local/lib
  1110. %dir %{l_prefix}/local/man
  1111. %dir %{l_prefix}/local/man/man1
  1112. %dir %{l_prefix}/local/man/man2
  1113. %dir %{l_prefix}/local/man/man3
  1114. %dir %{l_prefix}/local/man/man4
  1115. %dir %{l_prefix}/local/man/man5
  1116. %dir %{l_prefix}/local/man/man6
  1117. %dir %{l_prefix}/local/man/man7
  1118. %dir %{l_prefix}/local/man/man8
  1119. %dir %{l_prefix}/local/man/man9
  1120. %dir %{l_prefix}/local/man/cat1
  1121. %dir %{l_prefix}/local/man/cat2
  1122. %dir %{l_prefix}/local/man/cat3
  1123. %dir %{l_prefix}/local/man/cat4
  1124. %dir %{l_prefix}/local/man/cat5
  1125. %dir %{l_prefix}/local/man/cat6
  1126. %dir %{l_prefix}/local/man/cat7
  1127. %dir %{l_prefix}/local/man/cat8
  1128. %dir %{l_prefix}/local/man/cat9
  1129. %dir %{l_prefix}/local/sbin
  1130. %clean
  1131. # skip in bootstrap phase 2 (see openpkg.boot)
  1132. [ ".$OPENPKG_BOOT" = .1 ] && exit 0
  1133. # cleanup after building
  1134. rm -rf $RPM_BUILD_ROOT
  1135. %pre
  1136. # always performed for upgrades and because it doesn't harm!
  1137. # [ ".$1" != .1 ] && exit 0
  1138. # this procedure is only usable with root privileges
  1139. # (for non-root installations it is not required at all)
  1140. cusr=`(id -un) 2>/dev/null ||\
  1141. (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  1142. (whoami) 2>/dev/null ||\
  1143. (who am i | cut "-d " -f1) 2>/dev/null ||\
  1144. echo $LOGNAME`
  1145. # determine runtime details (for both inside and outside RPM!!)
  1146. # - bootstrapping: $xxx is set from aux.wrapbin.sh
  1147. # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros
  1148. # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all
  1149. [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}"
  1150. [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}"
  1151. [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}"
  1152. [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}"
  1153. [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}"
  1154. [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}"
  1155. [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}"
  1156. [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}"
  1157. [ ".$suid" = . ] && suid="%{?l_suid}"
  1158. [ ".$sgid" = . ] && sgid="%{?l_sgid}"
  1159. [ ".$muid" = . ] && muid="%{?l_muid}"
  1160. [ ".$mgid" = . ] && mgid="%{?l_mgid}"
  1161. [ ".$ruid" = . ] && ruid="%{?l_ruid}"
  1162. [ ".$rgid" = . ] && rgid="%{?l_rgid}"
  1163. [ ".$nuid" = . ] && nuid="%{?l_nuid}"
  1164. [ ".$ngid" = . ] && ngid="%{?l_ngid}"
  1165. # if any of these optional params are not used we won't have a
  1166. # corresponding macro either, so make use of one conditionally
  1167. [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}"
  1168. [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}"
  1169. [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}"
  1170. [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}"
  1171. [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}"
  1172. [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}"
  1173. [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}"
  1174. [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}"
  1175. # determine prefix
  1176. [ ".$prefix" = . ] && prefix="%{l_prefix}"
  1177. prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  1178. # register the OpenPKG instance in /etc/openpkg
  1179. registry="/etc/openpkg"
  1180. exists=`cat $registry 2>/dev/null | egrep "^ *${prefix} *\$"`
  1181. if [ ".$exists" = . ]; then
  1182. ( umask 022
  1183. echo "${prefix}" >>$registry
  1184. ) 2>/dev/null || true
  1185. fi
  1186. # determine user/group ids
  1187. for class in s m r n; do
  1188. eval "xusr=\"\$${class}usr\""
  1189. eval "xgrp=\"\$${class}grp\""
  1190. eval "xuid=\"\$${class}uid\""
  1191. eval "xgid=\"\$${class}gid\""
  1192. if [ ".$xuid" = . ]; then
  1193. xuid=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null |\
  1194. grep "^${xusr}:" | awk -F: '{ print $3; }'`
  1195. if [ ".$xuid" = . ]; then
  1196. # seek for a reasonably uid/gid pair
  1197. xuid=1000
  1198. ok=0
  1199. while [ ".$ok" = .0 ]; do
  1200. eval "u_exists=\$u_exists_$xuid"
  1201. if [ ".$u_exists" = . ]; then
  1202. u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null | grep "^[^:]*:[^:]*:$xuid:"`
  1203. fi
  1204. eval "g_exists=\$g_exists_$xuid"
  1205. if [ ".$g_exists" = . ]; then
  1206. g_exists=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:$xuid:"`
  1207. fi
  1208. if [ ".$u_exists" = . -a ".$g_exists" = . ]; then
  1209. ok=1
  1210. break
  1211. fi
  1212. xuid=`expr $xuid + 1`
  1213. done
  1214. eval "u_exists_$xuid=yes"
  1215. eval "g_exists_$xuid=yes"
  1216. fi
  1217. fi
  1218. if [ ".$xgid" = . ]; then
  1219. xgid=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null |\
  1220. grep "^${xgrp}:" | awk -F: '{ print $3; }'`
  1221. if [ ".$xgid" = . ]; then
  1222. xgid="$xuid"
  1223. fi
  1224. fi
  1225. eval "${class}uid=\"$xuid\""
  1226. eval "${class}gid=\"$xgid\""
  1227. done
  1228. # determine platform id
  1229. s=`(uname -s) 2>/dev/null` || s='Unknown'
  1230. r=`(uname -r) 2>/dev/null` || r='0.0'
  1231. plid="${s}/${r}"
  1232. # add entry to /etc/shells
  1233. shell="${prefix}/lib/openpkg/bash"
  1234. if [ -f /etc/shells ]; then
  1235. exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
  1236. if [ ".$exists" = . ]; then
  1237. if [ ".$cusr" != ".root" ]; then
  1238. echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2
  1239. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1240. else
  1241. echo "${shell}" >>/etc/shells
  1242. fi
  1243. fi
  1244. fi
  1245. # create the hierarchy user/group
  1246. for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \
  1247. "management:${musr}:${muid}:${mgrp}:${mgid}" \
  1248. "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \
  1249. "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do
  1250. # split request into class/usr/uid/grp/gid
  1251. OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
  1252. class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
  1253. # check whether user already exists
  1254. exists=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null | grep "^$usr:"`
  1255. if [ ".$exists" = . ]; then
  1256. if [ ".$cusr" != ".root" ]; then
  1257. echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2
  1258. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1259. else
  1260. # add entry to passwd database
  1261. realname="${prefix} OpenPKG ($class)"
  1262. case "$plid" in
  1263. FreeBSD/* | NetBSD/* )
  1264. file=/etc/master.passwd
  1265. entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}"
  1266. update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
  1267. ;;
  1268. Linux/* )
  1269. file=/etc/passwd
  1270. entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1271. update="(PATH=\$PATH:/usr/sbin; pwconv)"
  1272. ;;
  1273. SunOS/5.* | UnixWare/* )
  1274. file=/etc/passwd
  1275. entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1276. update="(PATH=\$PATH:/usr/sbin; pwconv)"
  1277. ;;
  1278. OSF1/V5.* )
  1279. file=/etc/passwd
  1280. entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1281. update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
  1282. ;;
  1283. HP-UX/* )
  1284. file=/etc/passwd
  1285. entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}"
  1286. update=":"
  1287. ;;
  1288. Darwin/* )
  1289. # intentionally do nothing here
  1290. ;;
  1291. esac
  1292. case "$plid" in
  1293. Darwin/* )
  1294. niutil -create . "/users/${usr}"
  1295. niutil -createprop . "/users/${usr}" passwd "*"
  1296. niutil -createprop . "/users/${usr}" uid "${uid}"
  1297. niutil -createprop . "/users/${usr}" gid "${gid}"
  1298. niutil -createprop . "/users/${usr}" realname "${realname}"
  1299. niutil -createprop . "/users/${usr}" home "${prefix}"
  1300. niutil -createprop . "/users/${usr}" shell "${shell}"
  1301. ;;
  1302. * )
  1303. cp $file $file.bak && \
  1304. (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
  1305. rm -f $file.bak >/dev/null 2>&1
  1306. eval $update
  1307. [ $? -ne 0 ] && exit $?
  1308. ;;
  1309. esac
  1310. fi
  1311. fi
  1312. # check whether group already exists
  1313. exists=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null | grep "^$grp:"`
  1314. if [ ".$exists" = . ]; then
  1315. if [ ".$cusr" != ".root" ]; then
  1316. echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2
  1317. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1318. else
  1319. case "$plid" in
  1320. Darwin/* )
  1321. niutil -create . "/groups/${grp}"
  1322. niutil -createprop . "/groups/${grp}" gid "${gid}"
  1323. niutil -createprop . "/groups/${grp}" users "${usr}"
  1324. ;;
  1325. * )
  1326. # add entry to group database
  1327. file=/etc/group
  1328. entry="${grp}:*:${gid}:${usr}"
  1329. cp $file $file.bak && \
  1330. (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
  1331. rm -f $file.bak >/dev/null 2>&1
  1332. ;;
  1333. esac
  1334. fi
  1335. fi
  1336. done
  1337. # create the startup/shutdown transfer script
  1338. name=`echo "$prefix" | sed -e 's;/;;g'`
  1339. if [ ".$cusr" != ".root" ]; then
  1340. echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2
  1341. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1342. else
  1343. case "$plid" in
  1344. FreeBSD/* )
  1345. if [ ! -f /etc/rc.d/${name}.sh ]; then
  1346. # make sure /etc/rc.d exists
  1347. if [ ! -d /etc/rc.d ]; then
  1348. mkdir /etc/rc.d
  1349. fi
  1350. # make sure /etc/rc.d is activated
  1351. ( . /etc/defaults/rc.conf
  1352. . /etc/rc.conf
  1353. found=0
  1354. for p in ${local_startup-x}; do
  1355. if [ ".$p" = "./etc/rc.d" ]; then
  1356. found=1
  1357. break
  1358. fi
  1359. done
  1360. if [ ".$found" = .0 ]; then
  1361. cp -p /etc/rc.conf /etc/rc.conf.bak
  1362. ( grep -v local_startup /etc/rc.conf.bak
  1363. echo "local_startup=\"/etc/rc.d $local_startup\""
  1364. ) >/etc/rc.conf
  1365. rm -f /etc/rc.conf.bak >/dev/null 2>&1
  1366. fi
  1367. ) || exit $?
  1368. # install transfer script
  1369. rm -f /etc/rc.d/${name}.sh >/dev/null 2>&1
  1370. ( echo "#!/bin/sh"
  1371. echo "##"
  1372. echo "## ${name}.sh -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1373. echo "##"
  1374. echo ""
  1375. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1376. echo "case \$1 in"
  1377. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1378. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1379. echo "esac"
  1380. ) >/etc/rc.d/${name}.sh
  1381. chmod 755 /etc/rc.d/${name}.sh
  1382. fi
  1383. ;;
  1384. NetBSD/* )
  1385. if [ ! -f /etc/rc.d/${name} ]; then
  1386. ( echo "#!/bin/sh"
  1387. echo "##"
  1388. echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1389. echo "##"
  1390. echo "## PROVIDE: ${name}"
  1391. echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS"
  1392. echo "##"
  1393. echo ""
  1394. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1395. echo "case \$1 in"
  1396. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1397. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1398. echo " restart ) exec ${prefix}/etc/rc all stop start ;;"
  1399. echo " status ) ;;"
  1400. echo "esac"
  1401. ) >/etc/rc.d/${name}
  1402. chmod 755 /etc/rc.d/${name}
  1403. fi
  1404. ;;
  1405. Linux/* )
  1406. if [ -f /etc/gentoo-release ]; then
  1407. if [ ! -f /etc/init.d/openpkg-${name} ]; then
  1408. # install transfer script
  1409. ( echo "#!/sbin/runscript"
  1410. echo "##"
  1411. echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1412. echo "##"
  1413. echo ""
  1414. echo "depend() {"
  1415. echo " need net"
  1416. echo "}"
  1417. echo ""
  1418. echo "checkconfig() {"
  1419. echo " [ -f ${prefix}/etc/rc ] || return 1"
  1420. echo " case $1 in"
  1421. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1422. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1423. echo " esac"
  1424. echo "}"
  1425. echo ""
  1426. echo "start() {"
  1427. echo " checkconfig || return 1"
  1428. echo " ebegin "Starting OpenPKG ${prefix} hierarchy""
  1429. echo " exec ${prefix}/etc/rc all start"
  1430. echo " eend 0"
  1431. echo "}"
  1432. echo ""
  1433. echo "stop() {"
  1434. echo " checkconfig || return 1"
  1435. echo " ebegin "Stopping OpenPKG ${prefix} hierarchy""
  1436. echo " exec ${prefix}/etc/rc all stop"
  1437. echo " eend 0"
  1438. echo "}"
  1439. ) >/etc/init.d/openpkg-${name}
  1440. chmod 755 /etc/init.d/openpkg-${name}
  1441. /sbin/rc-update add openpkg-${name} default
  1442. fi
  1443. else
  1444. # sroot: script root directory
  1445. # lroot: link root directory
  1446. if [ -f /etc/debian_version ]; then
  1447. sroot=/etc/init.d
  1448. lroot=/etc/rc%d.d
  1449. elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
  1450. sroot=/etc/rc.d/init.d
  1451. lroot=/etc/rc.d/rc%d.d
  1452. elif [ -f /etc/SuSE-release ]; then
  1453. sroot=/etc/init.d
  1454. lroot=/etc/init.d/rc%d.d
  1455. else
  1456. echo "WARNING: you are not running one of the supported standard" 1>&2
  1457. echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
  1458. echo "WARNING: Guessing the location of the system init scripts!" 1>&2
  1459. sroot=""
  1460. lroot=""
  1461. for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
  1462. if [ -d $sr ]; then
  1463. sroot="$sr"
  1464. break
  1465. fi
  1466. done
  1467. for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
  1468. if [ -d $lr ]; then
  1469. lroot="`echo $lr | sed -e 's;2;%d;'`"
  1470. break
  1471. fi
  1472. done
  1473. if [ ".$sroot" = . -o ".$lroot" = . ]; then
  1474. echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
  1475. exit 1
  1476. fi
  1477. fi
  1478. if [ ! -f $sroot/${name} ]; then
  1479. # install transfer script
  1480. ( echo "#!/bin/sh"
  1481. echo "##"
  1482. echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1483. echo "##"
  1484. echo ""
  1485. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1486. echo "case \$1 in"
  1487. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1488. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1489. echo "esac"
  1490. ) >$sroot/${name}
  1491. chmod 755 $sroot/${name}
  1492. # create corresponding symbolic links
  1493. for i in 2 3 4 5; do
  1494. ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
  1495. done
  1496. for i in 0 1 6; do
  1497. ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
  1498. done
  1499. fi
  1500. fi
  1501. ;;
  1502. SunOS/5.* )
  1503. if [ ! -f /etc/init.d/${name} ]; then
  1504. # install transfer script
  1505. ( echo "#!/bin/sh"
  1506. echo "##"
  1507. echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1508. echo "##"
  1509. echo ""
  1510. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1511. echo "case \$1 in"
  1512. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1513. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1514. echo "esac"
  1515. ) >/etc/init.d/${name}
  1516. chmod 755 /etc/init.d/${name}
  1517. # create corresponding symbolic links
  1518. ( cd /etc
  1519. ln init.d/${name} rc3.d/S99${name}
  1520. ln init.d/${name} rc0.d/K00${name}
  1521. ln init.d/${name} rc1.d/K00${name}
  1522. ) || exit $?
  1523. fi
  1524. ;;
  1525. UnixWare/* )
  1526. if [ ! -f /etc/init.d/${name} ]; then
  1527. # install transfer script
  1528. ( echo "#!/bin/sh"
  1529. echo "##"
  1530. echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1531. echo "##"
  1532. echo ""
  1533. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1534. echo "case \$1 in"
  1535. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1536. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1537. echo "esac"
  1538. ) >/etc/init.d/${name}
  1539. chmod 755 /etc/init.d/${name}
  1540. # create corresponding symbolic links
  1541. ( cd /etc
  1542. ln init.d/${name} rc2.d/S99${name}
  1543. ln init.d/${name} rc0.d/K00${name}
  1544. ln init.d/${name} rc1.d/K00${name}
  1545. ) || exit $?
  1546. fi
  1547. ;;
  1548. OSF1/V5.* )
  1549. if [ ! -f /sbin/init.d/${name} ]; then
  1550. # install transfer script
  1551. ( echo "#!/bin/sh"
  1552. echo "##"
  1553. echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1554. echo "##"
  1555. echo ""
  1556. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1557. echo "case \$1 in"
  1558. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1559. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1560. echo "esac"
  1561. ) >/sbin/init.d/${name}
  1562. chmod 755 /sbin/init.d/${name}
  1563. # create corresponding symbolic links
  1564. ( cd /sbin
  1565. ln -s ../init.d/${name} rc3.d/S99${name}
  1566. ln -s ../init.d/${name} rc0.d/K00${name}
  1567. ) || exit $?
  1568. fi
  1569. ;;
  1570. HP-UX/* )
  1571. if [ ! -f /sbin/init.d/${name} ]; then
  1572. # install transfer script
  1573. ( echo "#!/bin/sh"
  1574. echo "##"
  1575. echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
  1576. echo "##"
  1577. echo ""
  1578. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1579. echo "case \$1 in"
  1580. echo " start ) exec ${prefix}/etc/rc all start ;;"
  1581. echo " stop ) exec ${prefix}/etc/rc all stop ;;"
  1582. echo "esac"
  1583. ) >/sbin/init.d/${name}
  1584. chmod 755 /sbin/init.d/${name}
  1585. # create corresponding symbolic links
  1586. ( cd /sbin
  1587. ln -s ../init.d/${name} rc2.d/S900${name}
  1588. ln -s ../init.d/${name} rc1.d/K100${name}
  1589. ) || exit $?
  1590. fi
  1591. ;;
  1592. Darwin/* )
  1593. darwin_rc_dir="/System/Library/StartupItems/${name}"
  1594. if [ ! -d ${darwin_rc_dir} ]; then
  1595. mkdir ${darwin_rc_dir}
  1596. fi
  1597. # make sure hierarchy is activated in /etc/hostconfig
  1598. # FIXME: cs: simple and bad code here without any detection of existing entries
  1599. echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig
  1600. # install transfer script
  1601. if [ ! -f ${darwin_rc_dir}/${name} ]; then
  1602. rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1
  1603. ( echo "#!/bin/sh"
  1604. echo "##"
  1605. echo "## ${darwin_rc_dir}/${name}"
  1606. echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy"
  1607. echo "##"
  1608. echo ""
  1609. echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
  1610. echo ""
  1611. echo ". /etc/rc.common"
  1612. echo ""
  1613. echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then"
  1614. echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\""
  1615. echo " ${prefix}/etc/rc all start"
  1616. echo "fi"
  1617. ) >${darwin_rc_dir}/${name}
  1618. chmod 755 ${darwin_rc_dir}/${name}
  1619. fi
  1620. # install startup parameter list
  1621. if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then
  1622. rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1
  1623. ( echo "{"
  1624. echo " Description = \"OpenPKG ${prefix} hierarchy\";"
  1625. echo " Provides = (\"OpenPKG ${prefix}\");"
  1626. echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");"
  1627. echo " Uses = (\"Cron\");"
  1628. echo " OrderPreference = \"Last\";"
  1629. echo " Messages ="
  1630. echo " {"
  1631. echo " start = \"Starting OpenPKG ${prefix} hierarchy\";"
  1632. echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";"
  1633. echo " };"
  1634. echo "}"
  1635. ) >${darwin_rc_dir}/StartupParameters.plist
  1636. chmod 644 ${darwin_rc_dir}/StartupParameters.plist
  1637. fi
  1638. ;;
  1639. esac
  1640. fi
  1641. # create the cron transfer entries
  1642. if [ ".$cusr" != ".root" ]; then
  1643. echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2
  1644. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1645. else
  1646. case "$plid" in
  1647. FreeBSD/* | Linux/* | Darwin/* )
  1648. exists=`grep "$prefix/etc/rc" /etc/crontab`
  1649. if [ ".$exists" = . ]; then
  1650. ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>"
  1651. echo "# chronological tasks of ${prefix} OpenPKG hierarchy"
  1652. echo "0 0 1 * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly"
  1653. echo "0 0 * * 0 root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly"
  1654. echo "0 0 * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily"
  1655. echo "0 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly"
  1656. echo "*/15 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly"
  1657. echo "# </OpenPKG>"
  1658. ) >>/etc/crontab
  1659. fi
  1660. ;;
  1661. SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* )
  1662. exists=`crontab -l | grep "$prefix/etc/rc"`
  1663. if [ ".$exists" = . ]; then
  1664. EDITOR=/tmp/vipw.$$
  1665. VISUAL="$EDITOR"
  1666. export EDITOR
  1667. export VISUAL
  1668. ( echo "#!/bin/sh"
  1669. echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\""
  1670. echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\""
  1671. echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\""
  1672. echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\""
  1673. echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\""
  1674. echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\""
  1675. echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\""
  1676. echo " echo \"# </OpenPKG>\""
  1677. echo ") >>\$1"
  1678. ) >$EDITOR
  1679. chmod a+x $EDITOR
  1680. ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  1681. rm -f $EDITOR
  1682. fi
  1683. ;;
  1684. esac
  1685. fi
  1686. # remember what OpenPKG RPM version was installed, so we can
  1687. # correctly upgrade the RPM database in the %post section (see below).
  1688. if [ -d ${prefix}/RPM/DB ]; then
  1689. if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then
  1690. # OpenPKG 2.0
  1691. rpm="${prefix}/bin/openpkg rpm"
  1692. else
  1693. # OpenPKG 1.x
  1694. rpm="${prefix}/bin/rpm"
  1695. fi
  1696. rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true
  1697. $rpm --version |\
  1698. sed -e 's;^;X;' \
  1699. -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  1700. -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \
  1701. -e 's;^X.*$;4.0;' \
  1702. >${prefix}/RPM/DB/.version
  1703. fi
  1704. %post
  1705. # update or initially create OpenPKG UUID configuration
  1706. %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true
  1707. # determine new and old OpenPKG RPM version
  1708. V_rpm_new="%{V_rpm}"
  1709. if [ -f %{l_prefix}/RPM/DB/.version ]; then
  1710. V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`"
  1711. rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true
  1712. else
  1713. V_rpm_old="4.0"
  1714. fi
  1715. # make sure all RPM database files are present and that their
  1716. # attributes are correct, etc. This is not a database rebuild
  1717. # operation, so this is fully harmless and can be done always.
  1718. %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate
  1719. # check RPM database for upgrade requirements
  1720. if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then
  1721. # RPM 4.0/4.1 does not allow concurrent database access, so we
  1722. # cannot upgrade the database immediately from here (because
  1723. # we are still running within the execution context of the
  1724. # old RPM which in turn has the database locked) and instead
  1725. # have to just drop a note to the administrator about database
  1726. # upgrading. RPM 4.2 in general allows concurrent database
  1727. # access, but the whole stuff is too risky here, too.
  1728. ( echo "You are upgrading the OpenPKG bootstrap from a previous"
  1729. echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based"
  1730. echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still"
  1731. echo "be used, but it is strongly recommended to upgrade it as"
  1732. echo "soon as possible to the latest Berkeley-DB format files by"
  1733. echo "executing the command:"
  1734. echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild"
  1735. echo "In case of problems with the RPM database you can always"
  1736. echo "execute the command:"
  1737. echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup"
  1738. ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn
  1739. fi
  1740. %preun
  1741. [ ".$1" != .0 ] && exit 0
  1742. # remove files which are not RPM controlled
  1743. rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true
  1744. rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true
  1745. rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true
  1746. rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
  1747. # The following code usually would be done in a %postun section.
  1748. # But because we already had to remove the database in this %preun
  1749. # section (see the 'rm' commands above) in order to make RPM happy
  1750. # inside its own removal procedure, RPM would no longer find the
  1751. # %postun script (because it's recorded in the database files). So
  1752. # we have to perform the procedure already in this %preun script.
  1753. # except for the removal of the top-level directory it does not
  1754. # matter. But the top-level directory can only be removed after
  1755. # the RPM removal procedure took place, so we play a little delay
  1756. # trick below.
  1757. # determine current user
  1758. cusr=`(id -un) 2>/dev/null ||\
  1759. (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
  1760. (whoami) 2>/dev/null ||\
  1761. (who am i | cut "-d " -f1) 2>/dev/null ||\
  1762. echo $LOGNAME`
  1763. # determine runtime details (for both inside and outside RPM!!)
  1764. user="%{l_musr}"
  1765. group="%{l_mgrp}"
  1766. prefix="%{l_prefix}"
  1767. prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'`
  1768. # determine platform id
  1769. s=`(uname -s) 2>/dev/null` || s='Unknown'
  1770. r=`(uname -r) 2>/dev/null` || r='0.0'
  1771. plid="${s}/${r}"
  1772. # unregister the OpenPKG instance in /etc/openpkg
  1773. registry="/etc/openpkg"
  1774. exists=`cat $registry 2>/dev/null | egrep "^ *${prefix} *\$"`
  1775. if [ ".$exists" != . ]; then
  1776. if [ ".$cusr" != ".root" ]; then
  1777. echo "openpkg:WARNING: skipping unregistering of $prefix in $registry" 1>&2
  1778. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1779. else
  1780. cp $registry $registry.bak && \
  1781. egrep -v "^ *${prefix} *\$" $registry.bak >$registry
  1782. rm -f $registry.bak >/dev/null 2>&1
  1783. if [ ".`cat $registry`" = . ]; then
  1784. rm -f $registry >/dev/null 2>&1
  1785. fi
  1786. fi
  1787. fi
  1788. # remove entry in /etc/shells
  1789. shell="${prefix}/lib/openpkg/bash"
  1790. exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
  1791. if [ ".$exists" != . ]; then
  1792. if [ ".$cusr" != ".root" ]; then
  1793. echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2
  1794. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1795. else
  1796. cp /etc/shells /etc/shells.bak && \
  1797. grep -v "^${shell}" /etc/shells.bak >/etc/shells
  1798. rm -f /etc/shells.bak >/dev/null 2>&1
  1799. fi
  1800. fi
  1801. # remove the hierarchy user/group
  1802. for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \
  1803. "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \
  1804. "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \
  1805. "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do
  1806. # split request into class/usr/uid/grp/gid
  1807. OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS"
  1808. class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5"
  1809. # check whether user already exists
  1810. exists=`(getent passwd; cat /etc/passwd; ypcat passwd; nidump passwd .) 2>/dev/null | grep "^$usr:"`
  1811. if [ ".$exists" != . ]; then
  1812. if [ ".$cusr" != ".root" ]; then
  1813. echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
  1814. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1815. elif [ ".$usr" = ".root" ]; then
  1816. echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2
  1817. echo "openpkg:WARNING: (would remove system standard user)" 1>&2
  1818. else
  1819. case "$plid" in
  1820. FreeBSD/* | NetBSD/* )
  1821. cp /etc/master.passwd /etc/master.passwd.bak && \
  1822. grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd
  1823. ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $?
  1824. rm -f /etc/master.passwd.bak >/dev/null 2>&1
  1825. ;;
  1826. Linux/* | SunOS/5.* | UnixWare/* )
  1827. cp /etc/passwd /etc/passwd.bak && \
  1828. grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1829. ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $?
  1830. rm -f /etc/passwd.bak >/dev/null 2>&1
  1831. ;;
  1832. OSF1/V5.* )
  1833. cp /etc/passwd /etc/passwd.bak && \
  1834. grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1835. ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $?
  1836. rm -f /etc/passwd.bak >/dev/null 2>&1
  1837. ;;
  1838. HP-UX/* )
  1839. cp /etc/passwd /etc/passwd.bak && \
  1840. grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd
  1841. rm -f /etc/passwd.bak >/dev/null 2>&1
  1842. ;;
  1843. Darwin/* )
  1844. niutil -destroy . "/users/${usr}"
  1845. ;;
  1846. esac
  1847. fi
  1848. fi
  1849. # check whether group already exists
  1850. exists=`(getent group; cat /etc/group; ypcat group; nidump group .) 2>/dev/null | grep "^$grp:"`
  1851. if [ ".$exists" != . ]; then
  1852. if [ ".$cusr" != ".root" ]; then
  1853. echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
  1854. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1855. elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then
  1856. echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2
  1857. echo "openpkg:WARNING: (would remove system standard group)" 1>&2
  1858. else
  1859. case "$plid" in
  1860. Darwin/* )
  1861. niutil -destroy . "/groups/${grp}"
  1862. ;;
  1863. * )
  1864. cp /etc/group /etc/group.bak && \
  1865. grep -v "^${grp}:" /etc/group.bak >/etc/group
  1866. rm -f /etc/group.bak >/dev/null 2>&1
  1867. ;;
  1868. esac
  1869. fi
  1870. fi
  1871. done
  1872. # remove the startup/shutdown transfer scripts
  1873. name=`echo "$prefix" | sed -e 's;/;;g'`
  1874. if [ ".$cusr" != ".root" ]; then
  1875. echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2
  1876. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1877. else
  1878. case "$plid" in
  1879. FreeBSD/* )
  1880. rm -f /etc/rc.d/${name}.sh >/dev/null 2>&1
  1881. ;;
  1882. NetBSD/* )
  1883. rm -f /etc/rc.d/${name} >/dev/null 2>&1
  1884. ;;
  1885. Linux/* )
  1886. if [ -f /etc/gentoo-release ]; then
  1887. /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
  1888. rm -f /etc/init.d/openpkg-${name} >/dev/null 2>&1
  1889. else
  1890. # sroot: script root directory
  1891. # lroot: link root directory
  1892. if [ -f /etc/debian_version ]; then
  1893. sroot=/etc/init.d
  1894. lroot=/etc/rc%d.d
  1895. elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
  1896. sroot=/etc/rc.d/init.d
  1897. lroot=/etc/rc.d/rc%d.d
  1898. elif [ -f /etc/SuSE-release ]; then
  1899. sroot=/etc/init.d
  1900. lroot=/etc/init.d/rc%d.d
  1901. else
  1902. echo "WARNING: you are not running one of the supported standard" 1>&2
  1903. echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2
  1904. echo "WARNING: Guessing the location of the system init scripts!" 1>&2
  1905. sroot=""
  1906. lroot=""
  1907. for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
  1908. if [ -d $sr ]; then
  1909. sroot="$sr"
  1910. break
  1911. fi
  1912. done
  1913. for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
  1914. if [ -d $lr ]; then
  1915. lroot="`echo $lr | sed -e 's;2;%d;'`"
  1916. break
  1917. fi
  1918. done
  1919. if [ ".$sroot" = . -o ".$lroot" = . ]; then
  1920. echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
  1921. exit 1
  1922. fi
  1923. fi
  1924. rm -f ${sroot}/${name} >/dev/null 2>&1
  1925. for i in 2 3 4 5; do
  1926. rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
  1927. done
  1928. for i in 0 1 6; do
  1929. rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
  1930. done
  1931. fi
  1932. ;;
  1933. SunOS/5.* )
  1934. rm -f /etc/init.d/${name} >/dev/null 2>&1
  1935. rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1
  1936. rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  1937. rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
  1938. ;;
  1939. UnixWare/* )
  1940. rm -f /etc/init.d/${name} >/dev/null 2>&1
  1941. rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1
  1942. rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1
  1943. rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1
  1944. ;;
  1945. OSF1/V5.* )
  1946. rm -f /sbin/init.d/${name} >/dev/null 2>&1
  1947. rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1
  1948. rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1
  1949. ;;
  1950. HP-UX/* )
  1951. rm -f /sbin/init.d/${name} >/dev/null 2>&1
  1952. rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1
  1953. rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1
  1954. ;;
  1955. Darwin/* )
  1956. cp /etc/hostconfig /etc/hostconfig.bak && \
  1957. grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig
  1958. rm -f /etc/hostconfig.bak >/dev/null 2>&1
  1959. rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1
  1960. ;;
  1961. esac
  1962. fi
  1963. # remove the cron transfer entries
  1964. if [ ".$cusr" != ".root" ]; then
  1965. echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2
  1966. echo "openpkg:WARNING: (would require root-privileges)" 1>&2
  1967. else
  1968. case "$plid" in
  1969. FreeBSD/* | Linux/* | Darwin/* )
  1970. exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab`
  1971. if [ ".$exists" != . ]; then
  1972. p=`echo $prefix | sed -e 's;/;\\\\/;g'`
  1973. cp /etc/crontab /etc/crontab.bak
  1974. cat /etc/crontab.bak |\
  1975. sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \
  1976. >/etc/crontab
  1977. rm -f /etc/crontab.bak >/dev/null 2>&1
  1978. fi
  1979. ;;
  1980. SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* )
  1981. EDITOR=/tmp/vipw.$$
  1982. VISUAL="$EDITOR"
  1983. export EDITOR
  1984. export VISUAL
  1985. p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'`
  1986. ( echo "cp \$1 \$1.bak"
  1987. echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1"
  1988. echo "rm -f \$1.bak"
  1989. ) >$EDITOR
  1990. chmod a+x $EDITOR
  1991. ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $?
  1992. rm -f $EDITOR
  1993. ;;
  1994. esac
  1995. fi
  1996. # delayed removal of top-level directory.
  1997. ( sleep 2
  1998. rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true
  1999. rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true
  2000. rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true
  2001. rmdir %{l_prefix} >/dev/null 2>&1 || true
  2002. ) </dev/null >/dev/null 2>/dev/null &