openpkg.spec 110 KB

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