openpkg.spec 90 KB

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