openpkg.spec 90 KB

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