1 #!/bin/sh |
1 #!/bin/sh |
2 ## |
2 ## |
3 ## openpkg.boot -- OpenPKG bootstrap procedure (look Ma, without hands ;) |
3 ## openpkg.boot -- OpenPKG bootstrap procedure (look Ma, without hands ;) |
4 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> |
4 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/> |
5 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> |
5 ## |
6 ## |
6 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. |
7 ## Permission to use, copy, modify, and distribute this software for |
7 ## All rights reserved. Licenses which grant limited permission to use, |
8 ## any purpose with or without fee is hereby granted, provided that |
8 ## copy, modify and distribute this software are available from the |
9 ## the above copyright notice and this permission notice appear in all |
9 ## OpenPKG GmbH. |
10 ## copies. |
10 ## |
11 ## |
11 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
12 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
13 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
14 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
15 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
16 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
17 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
104 help=1 |
107 help=1 |
105 fi |
108 fi |
106 if [ ".$help" = .1 ]; then |
109 if [ ".$help" = .1 ]; then |
107 echo "Usage: sh $me" 2>&1 |
110 echo "Usage: sh $me" 2>&1 |
108 echo " [--prefix=<prefix>] [--tag=<str>]" 2>&1 |
111 echo " [--prefix=<prefix>] [--tag=<str>]" 2>&1 |
|
112 echo " [--stack=<name-or-url>] [--unprivileged]" 2>&1 |
109 echo " [--user=<usr>] [--group=<grp>]" 2>&1 |
113 echo " [--user=<usr>] [--group=<grp>]" 2>&1 |
110 echo " [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1 |
114 echo " [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1 |
111 echo " [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1 |
115 echo " [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1 |
112 echo " [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1 |
116 echo " [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1 |
113 echo " [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1 |
117 echo " [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1 |
114 echo " [-t|--tar] [-h|--help] [-v|--version]" 2>&1 |
118 echo " [-t|--tar] [-h|--help] [-v|--version]" 2>&1 |
115 exit 1 |
119 exit 1 |
116 fi |
120 fi |
117 |
121 |
|
122 # special support for environments with only a single |
|
123 # fully unprivileged user account (the current user) |
|
124 if [ ".$unprivileged" = .yes ]; then |
|
125 # determine current user/group |
|
126 cusr=`(id -un) 2>/dev/null ||\ |
|
127 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
|
128 (whoami) 2>/dev/null ||\ |
|
129 (who am i | cut "-d " -f1) 2>/dev/null ||\ |
|
130 echo $LOGNAME` |
|
131 cgid=`(id -g $cusr) 2>/dev/null ||\ |
|
132 ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\ |
|
133 sed -n -e '1p' | awk -F: '{ print $4; }')` |
|
134 cgrp=`(id -gn $cusr) 2>/dev/null ||\ |
|
135 ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\ |
|
136 sed -n -e '1p' | awk -F: '{ print $1; }')` |
|
137 [ ".$cgrp" = . ] && cgrp="$cusr" |
|
138 |
|
139 # set all other user/group variants to current user/group |
|
140 for who in s m r n; do |
|
141 for what in usr grp; do |
|
142 eval "${who}${what}=\"\$c${what}\"" |
|
143 done |
|
144 done |
|
145 fi |
|
146 |
118 # determine missing parameters |
147 # determine missing parameters |
119 eval `sh aux.usrgrp.sh \ |
148 eval `sh etc.usrgrp.sh \ |
120 --usr="$usr" --grp="$grp" \ |
149 --usr="$usr" --grp="$grp" \ |
121 --susr="$susr" --sgrp="$sgrp" \ |
150 --susr="$susr" --sgrp="$sgrp" \ |
122 --musr="$musr" --mgrp="$mgrp" \ |
151 --musr="$musr" --mgrp="$mgrp" \ |
123 --rusr="$rusr" --rgrp="$rgrp" \ |
152 --rusr="$rusr" --rgrp="$rgrp" \ |
124 --nusr="$nusr" --ngrp="$ngrp" \ |
153 --nusr="$nusr" --ngrp="$ngrp" \ |
216 ## |
239 ## |
217 ## determine distribution directory |
240 ## determine distribution directory |
218 ## |
241 ## |
219 |
242 |
220 V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'` |
243 V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'` |
221 if [ -f "../../dst/openpkg/rpm-${V_rpm}.tar.gz" ]; then |
244 if [ -d ../dst ]; then |
222 distdir="`cd ../../dst/openpkg; pwd`" # developer only |
245 distdir="`cd ../dst; pwd`" |
|
246 elif [ -d ../../dst/openpkg ]; then |
|
247 distdir="`cd ../../dst/openpkg; pwd`" |
223 else |
248 else |
224 distdir="`pwd`" |
249 distdir="`pwd`" |
225 fi |
250 fi |
226 echo "++ distribution directory: $distdir" |
251 echo "++ distribution directory: $distdir" |
227 |
252 |
228 ## |
253 ## |
229 ## perform prerequisite checks |
254 ## perform prerequisite checks |
230 ## |
255 ## |
231 |
256 |
232 sh ./aux.prereq.sh source || exit $? |
257 sh ./etc.prereq.sh source || exit $? |
233 |
258 |
234 ## |
259 ## |
235 ## find reasonable run-time paths and tools |
260 ## find reasonable run-time paths and tools |
236 ## |
261 ## |
237 |
262 |
238 # find reasonable temporary directory |
263 # find reasonable temporary directory |
239 tmpdir="${TMPDIR-/tmp}" |
264 if [ -d ../tmp ]; then |
|
265 tmpdir="`cd ../tmp; pwd`" |
|
266 else |
|
267 tmpdir="${TMPDIR-/tmp}" |
|
268 fi |
240 |
269 |
241 # find reasonable safe program path |
270 # find reasonable safe program path |
242 test ".$PATH" = . && PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin" |
271 test ".$PATH" = . && PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin" |
243 for dir in /usr/ccs/bin /usr/xpg4/bin; do |
272 for dir in /usr/ccs/bin /usr/xpg4/bin; do |
244 test -d $dir && PATH="$PATH:$dir" |
273 test -d $dir && PATH="$PATH:$dir" |
365 echo "$0:ERROR: file $tmpdir/rpm exists, cannot override" |
397 echo "$0:ERROR: file $tmpdir/rpm exists, cannot override" |
366 exit 1 |
398 exit 1 |
367 fi |
399 fi |
368 ( echo "#!/bin/sh" |
400 ( echo "#!/bin/sh" |
369 echo "exec $RPM_BUILD_ROOT$prefix/lib/openpkg/rpm \\" |
401 echo "exec $RPM_BUILD_ROOT$prefix/lib/openpkg/rpm \\" |
370 echo " --rcfile \"$tmpdir/rpm.1\" \\" |
402 echo " --macros \"$tmpdir/rpm.1:$tmpdir/rpm.2:$tmpdir/rpm.3\" \\" |
371 echo " --define \"__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform\" \\" |
403 echo " --rpmpopt \"$tmpdir/rpm.4:$tmpdir/rpm.5\" \\" |
|
404 echo " --rpmlua \"$tmpdir/rpm.6\" \\" |
372 echo " \"\$@\"" |
405 echo " \"\$@\"" |
373 ) >$tmpdir/rpm |
406 ) >$tmpdir/rpm |
374 chmod a+x $tmpdir/rpm |
407 chmod a+x $tmpdir/rpm |
375 |
408 |
376 # direct our own "rpm" tool to adjusted macro sets |
|
377 sed <`SOURCE rpmrc` >$tmpdir/rpm.1 \ |
|
378 -e "s;^\\(macrofiles:\\) .*;\\1 $tmpdir/rpm.2:$tmpdir/rpm.3;" |
|
379 |
|
380 # use an adjusted vendor macro set |
409 # use an adjusted vendor macro set |
381 sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/macros >$tmpdir/rpm.2 \ |
410 rm -f $tmpdir/rpm.1 >/dev/null 2>&1 |
|
411 sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmmacros >$tmpdir/rpm.1 \ |
382 -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g" |
412 -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g" |
383 |
413 |
384 # override the vendor macro set |
414 # override the vendor macro set |
385 sed <`SOURCE rpmmacros` >$tmpdir/rpm.3 \ |
415 rm -f $tmpdir/rpm.2 >/dev/null 2>&1 |
|
416 sed <`SOURCE rpmmacros` >$tmpdir/rpm.2 \ |
386 -e "s;@SUSR@;$susr;" \ |
417 -e "s;@SUSR@;$susr;" \ |
387 -e "s;@SGRP@;$sgrp;" \ |
418 -e "s;@SGRP@;$sgrp;" \ |
388 -e "s;@MUSR@;$musr;" \ |
419 -e "s;@MUSR@;$musr;" \ |
389 -e "s;@MGRP@;$mgrp;" \ |
420 -e "s;@MGRP@;$mgrp;" \ |
390 -e "s;@RUSR@;$rusr;" \ |
421 -e "s;@RUSR@;$rusr;" \ |
391 -e "s;@RGRP@;$rgrp;" \ |
422 -e "s;@RGRP@;$rgrp;" \ |
392 -e "s;@NUSR@;$nusr;" \ |
423 -e "s;@NUSR@;$nusr;" \ |
393 -e "s;@NGRP@;$ngrp;" \ |
424 -e "s;@NGRP@;$ngrp;" \ |
394 -e "s;@TAG@;$tag;" \ |
425 -e "s;@TAG@;$tag;" \ |
|
426 -e "s;@l_unprivileged@;$unprivileged;" \ |
395 -e "s;\\(%{l_prefix}/lib/openpkg/rpmtool\\);%{l_bash} \\1;g" \ |
427 -e "s;\\(%{l_prefix}/lib/openpkg/rpmtool\\);%{l_bash} \\1;g" \ |
396 -e "s;@l_prefix_static@;$prefix;g" \ |
428 -e "s;@l_prefix_static@;$prefix;g" \ |
397 -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" \ |
429 -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" \ |
398 -e "s;%l_prefix\\([^_]\\);%l_prefix_INTERNAL\\1;g" \ |
430 -e "s;^%l_prefix\\([^_]\\);%l_prefix_INTERNAL\\1;g" \ |
399 -e "s;%{l_prefix};%{l_prefix_INTERNAL};g" \ |
431 -e "s;%{l_prefix};%{l_prefix_INTERNAL};g" \ |
400 -e "s;^\\(%_specdir *\\).*;\\1 `pwd`;" \ |
432 -e "s;^\\(%_specdir *\\).*;\\1 `pwd`;" \ |
401 -e "s;^\\(%_sourcedir *\\).*;\\1 $distdir;" \ |
433 -e "s;^\\(%_sourcedir *\\).*;\\1 $distdir;" \ |
402 -e "s;^\\(%_builddir *\\).*;\\1 $tmpdir;" \ |
434 -e "s;^\\(%_builddir *\\).*;\\1 $tmpdir;" \ |
403 -e "s;^\\(%_tmppath *\\).*;\\1 $tmpdir;" \ |
435 -e "s;^\\(%_tmppath *\\).*;\\1 $tmpdir;" \ |
404 -e "s;^\\(%_buildshell *\\).*;\\1 env -i OPENPKG_BOOT=1 %{l_build_shell_cmd} %{l_build_shell_opt};" \ |
436 -e "s;^\\(%_buildshell *\\).*;\\1 env -i OPENPKG_BOOT=1 %{l_build_shell_cmd} %{l_build_shell_opt};" \ |
405 -e "s;@l_build_path@;/bin:/sbin:/usr/bin:/usr/sbin;g" \ |
437 -e "s;@l_build_path@;/bin:/sbin:/usr/bin:/usr/sbin;g" \ |
406 -e "s;@l_build_ldlp@;/usr/lib;g" \ |
438 -e "s;@l_build_ldlp@;/usr/lib;g" \ |
407 -e "s;@l_build_ulim@;:;g" |
439 -e "s;@l_build_ulim@;:;g" |
408 echo "%l_prefix $prefix" >>$tmpdir/rpm.3 |
440 |
409 |
441 # provide some special overrides |
410 # use an own $HOME/.popt in order to make sure the "rpm" |
442 rm -f $tmpdir/rpm.3 >/dev/null 2>&1 |
411 # tool is able to execute its sub-tools "rpm<x>". |
443 ( echo "%l_prefix $prefix" |
412 V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'` |
444 echo "%l_rpm $tmpdir/rpm" |
413 sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/.popt \ |
445 echo "%__spec_install_pre %{nil}" |
414 -e "s;^\\(rpm.*exec.*\\)\\(rpm[bdieukvq]*\\);\\1$RPM_BUILD_ROOT$prefix/lib/openpkg/\\2;" |
446 echo "%__spec_clean_body %{nil}" |
415 |
447 echo "%__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform" |
416 # activate the .popt file |
448 echo "%_integrity_spec_cfg $RPM_BUILD_ROOT$prefix/etc/openpkg/license.d/BOOT" |
417 HOME=$tmpdir |
449 echo "%_integrity_proc_lua $RPM_BUILD_ROOT$prefix/lib/openpkg/license.lua" |
418 export HOME |
450 echo "%_integrity_pkey_pgp $RPM_BUILD_ROOT$prefix/etc/openpkg/openpkg.com.pgp" |
|
451 ) >$tmpdir/rpm.3 |
|
452 |
|
453 # use an adjusted vendor POPT config |
|
454 rm -f $tmpdir/rpm.4 >/dev/null 2>&1 |
|
455 sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/rpm.4 \ |
|
456 -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g" |
|
457 |
|
458 # override the vendor POPT config |
|
459 rm -f $tmpdir/rpm.5 >/dev/null 2>&1 |
|
460 sed <$RPM_BUILD_ROOT$prefix/etc/openpkg/rpmpopt >$tmpdir/rpm.5 \ |
|
461 -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" |
|
462 |
|
463 # use an adjusted vendor RPM Lua script |
|
464 rm -f $tmpdir/rpm.6 >/dev/null 2>&1 |
|
465 sed <$RPM_BUILD_ROOT$prefix/etc/openpkg/rpmlua >$tmpdir/rpm.6 \ |
|
466 -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" |
419 |
467 |
420 ## |
468 ## |
421 ## now initialize the RPM database under the temporary install location |
469 ## now initialize the RPM database under the temporary install location |
422 ## |
470 ## |
423 |
471 |
460 |
508 |
461 v="$version-$release" |
509 v="$version-$release" |
462 t="`$tmpdir/rpm --eval '%{l_platform -p}-%{l_tag}'`" |
510 t="`$tmpdir/rpm --eval '%{l_platform -p}-%{l_tag}'`" |
463 |
511 |
464 # find a reasonable destination directory for packages |
512 # find a reasonable destination directory for packages |
465 if [ -d ../PKG/BIN ]; then |
513 if [ -d ../pkg ]; then |
466 dstdir=../PKG/BIN |
514 pkgdir=../pkg |
467 elif [ -d ../PKG ]; then |
515 elif [ -d ../../pkg/openpkg ]; then |
468 dstdir=../PKG |
516 pkgdir=../../pkg/openpkg |
469 elif [ -d ../../PKG/BIN ]; then |
|
470 dstdir=../../PKG/BIN |
|
471 elif [ -d ../../PKG ]; then |
|
472 dstdir=../../PKG |
|
473 else |
517 else |
474 dstdir=.. |
518 pkgdir=.. |
475 fi |
519 fi |
476 |
520 |
477 # create Source-RPM file |
521 # create Source-RPM file |
478 echo "++ creating bootstrap source RPM file" |
522 echo "++ creating bootstrap source RPM file" |
479 $tmpdir/rpm -bs --nodeps $spec |
523 $tmpdir/rpm -bs --nodeps --define "_srcrpmdir $pkgdir" $spec |
480 cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm $dstdir/ |
|
481 rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.src.rpm |
|
482 |
524 |
483 # create Binary-RPM file |
525 # create Binary-RPM file |
|
526 # (notice that there might be a discrepancy in the platform |
|
527 # identification, so we have to copy the source via wildcard) |
484 echo "++ creating bootstrap binary RPM file" |
528 echo "++ creating bootstrap binary RPM file" |
485 cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm $dstdir/ |
529 cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm $pkgdir/openpkg-$v.$t.rpm |
486 rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-$v.$t.rpm |
530 rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm |
487 |
531 |
488 # create Binary-Bootstrap file |
532 # create Binary-Bootstrap file |
489 echo "++ creating bootstrap binary shell script" |
533 echo "++ creating bootstrap binary shell script" |
490 files=`cat $spec |\ |
534 files=`cat $spec |\ |
491 sed -e '1,/%files/d' -e '/%clean/,$d' |\ |
535 sed -e '1,/%files/d' -e '/%clean/,$d' |\ |
492 grep -v '^ *$' | grep -v '%defattr' |\ |
536 grep -v '^ *$' | grep -v '%defattr' |\ |
493 sed -e 's;%config(noreplace) *;;' -e 's;%config *;;' -e 's;%ghost *;;' -e 's;%attr([^)]*) *;;' \ |
537 sed -e 's;%config(noreplace) *;;' -e 's;%config *;;' -e 's;%ghost *;;' -e 's;%attr([^)]*) *;;' \ |
494 -e 's;%dir *;;' -e 's;%{l_prefix}/;;' -e 's;^ *;;' -e "s;%{V_rpm};${V_rpm};"` |
538 -e 's;%dir *;;' -e 's;%{l_prefix}/;;' -e 's;^ *;;' -e "s;%{V_rpm};${V_rpm};"` |
|
539 rm -f $RPM_BUILD_ROOT$prefix/RPM/DB/__db.[0-9]* |
495 db_files="" |
540 db_files="" |
496 for db_file in \ |
541 for db_file in \ |
497 `$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \ |
542 `$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \ |
498 $RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \ |
543 $RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \ |
499 --prefix=$RPM_BUILD_ROOT$prefix \ |
544 --prefix=$RPM_BUILD_ROOT$prefix \ |
500 --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \ |
545 --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \ |
501 --list --quiet`; do |
546 --rpm=$tmpdir/rpm \ |
|
547 --list --quiet` VERSION; do |
502 db_files="$db_files RPM/DB/$db_file" |
548 db_files="$db_files RPM/DB/$db_file" |
503 done |
549 done |
504 chmod 644 $RPM_BUILD_ROOT$prefix/RPM/DB/* |
550 chmod 644 $RPM_BUILD_ROOT$prefix/RPM/DB/* |
505 files="$files $db_files" |
551 files="$files $db_files" |
506 ( cd $RPM_BUILD_ROOT$prefix |
552 ( cd $RPM_BUILD_ROOT$prefix |
544 -e "s;@NUID@;$nuid;" -e "s;@NGID@;$ngid;" \ |
590 -e "s;@NUID@;$nuid;" -e "s;@NGID@;$ngid;" \ |
545 -e "s;@l_prefix@;$prefix;" \ |
591 -e "s;@l_prefix@;$prefix;" \ |
546 -e "s;@l_platform@;$l_platform;" \ |
592 -e "s;@l_platform@;$l_platform;" \ |
547 -e "s;@l_release@;$l_release;" \ |
593 -e "s;@l_release@;$l_release;" \ |
548 -e "s;@l_version@;$l_version;" \ |
594 -e "s;@l_version@;$l_version;" \ |
|
595 -e "s;@l_unprivileged@;$unprivileged;" \ |
549 -e "/^@PRE@/r $tmpdir/rpm.pre" \ |
596 -e "/^@PRE@/r $tmpdir/rpm.pre" \ |
550 -e "/^@POST@/r $tmpdir/rpm.post" |\ |
597 -e "/^@POST@/r $tmpdir/rpm.post" |\ |
551 sed -e '/^@PRE@/d' -e '/^@POST@/d' >$tmpdir/openpkg.boot.tmp |
598 sed -e '/^@PRE@/d' -e '/^@POST@/d' >$tmpdir/openpkg.boot.tmp |
552 echo . | awk '{ |
599 echo . | awk '{ |
553 for (i = 0; i < 8192; i++) { |
600 for (i = 0; i < 8192; i++) { |
554 printf(" "); |
601 printf(" "); |
555 } |
602 } |
556 }' >>$tmpdir/openpkg.boot.tmp |
603 }' >>$tmpdir/openpkg.boot.tmp |
557 rm -f $dstdir/openpkg-$v.$t.sh |
604 rm -f $pkgdir/openpkg-$v.$t.sh |
558 dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \ |
605 dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=8 \ |
559 of=$dstdir/openpkg-$v.$t.sh 2>/dev/null |
606 of=$pkgdir/openpkg-$v.$t.sh 2>/dev/null |
560 rm -f $tmpdir/openpkg.boot.tmp |
607 rm -f $tmpdir/openpkg.boot.tmp |
561 ( cd $RPM_BUILD_ROOT$prefix |
608 ( cd $RPM_BUILD_ROOT$prefix |
562 $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - \ |
609 $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - \ |
563 openpkg.tar openpkg.bzip2 openpkg.tar.bz2 |
610 openpkg.tar openpkg.bzip2 openpkg.tar.bz2 |
564 ) >>$dstdir/openpkg-$v.$t.sh |
611 ) >>$pkgdir/openpkg-$v.$t.sh |
565 |
612 |
566 # cleanup |
613 # cleanup |
567 echo "++ cleaning up" |
614 echo "++ cleaning up" |
568 cp `SOURCE rpmtool` $tmpdir/rpmtool |
615 cp `SOURCE rpmtool` $tmpdir/rpmtool |
569 rm -rf $RPM_BUILD_ROOT |
616 rm -rf $RPM_BUILD_ROOT |
570 rm -rf $tmpdir/$name-$version |
617 rm -rf $tmpdir/$name-$version |
571 rm -f $tmpdir/rpm $tmpdir/rpm.[123] $tmpdir/.popt $tmpdir/rpm.pre $tmpdir/rpm.post |
618 rm -f $tmpdir/rpm $tmpdir/rpm.[123456] $tmpdir/rpm.pre $tmpdir/rpm.post |
572 rm -f $prolog |
619 rm -f $prolog |
573 |
620 |
574 # final hint about results |
621 # final hint about results |
575 echo "++ resulting OpenPKG bootstrap package files:" |
622 echo "++ resulting OpenPKG Framework bootstrap package files:" |
576 (cd $dstdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm) |
623 (cd $pkgdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm) |
577 set +x |
624 set +x |
578 ( echo "You have successfully built the OpenPKG Package from scratch" |
625 ( echo "You have successfully built the OpenPKG Framework from scratch" |
579 echo "for prefix $prefix on target platform $l_platform. The input" |
626 echo "for prefix $prefix on target platform $l_platform. The input" |
580 echo "was the OpenPKG Source Bootstrap Package in file:" |
627 echo "was the OpenPKG Framework Source Bootstrap Package in file:" |
581 echo "" |
628 echo "" |
582 echo " openpkg-$v.src.sh" |
629 echo " openpkg-$v.src.sh" |
583 echo "" |
630 echo "" |
584 echo "The results are the following three files:" |
631 echo "The results are the following three files:" |
585 echo "" |
632 echo "" |
586 echo " openpkg-$v.src.rpm" |
633 echo " openpkg-$v.src.rpm" |
587 echo " openpkg-$v.$t.rpm" |
634 echo " openpkg-$v.$t.rpm" |
588 echo " openpkg-$v.$t.sh" |
635 echo " openpkg-$v.$t.sh" |
589 echo "" |
636 echo "" |
590 echo "The first result file is the OpenPKG Source RPM Package," |
637 echo "The first result file is the OpenPKG Framework Source RPM Package," |
591 echo "containing just the same contents than the OpenPKG Source" |
638 echo "containing just the same contents than the OpenPKG Framework Source" |
592 echo "Bootstrap Package, but now in RPM format. Optionally use this" |
639 echo "Bootstrap Package, but now in RPM format. Optionally use this after" |
593 echo "after the installation of the OpenPKG Binary Bootstrap Package" |
640 echo "the installation of the OpenPKG Framework Binary Bootstrap Package" |
594 echo "if you want to rebuild from source again (but then with RPM" |
641 echo "if you want to rebuild from source again (but then with RPM" |
595 echo "available)." |
642 echo "available)." |
596 echo "" |
643 echo "" |
597 echo "The second result file is the OpenPKG Binary RPM Package," |
644 echo "The second result file is the OpenPKG Framework Binary RPM Package," |
598 echo "containing the installation files in RPM format for the OpenPKG" |
645 echo "containing the installation files in RPM format for the OpenPKG" |
599 echo "instance $prefix. Optionally use this after the installation of" |
646 echo "instance $prefix. Optionally use this after the installation of" |
600 echo "the OpenPKG Binary Bootstrap Package if you want (usually for" |
647 echo "the OpenPKG Framework Binary Bootstrap Package if you want (usually" |
601 echo "fixing something) to reinstall (but then with RPM available)." |
648 echo "for fixing something) to reinstall (but then with RPM available)." |
602 echo "" |
649 echo "" |
603 echo "The third result file is the OpenPKG Binary Bootstrap Package," |
650 echo "The third result file is the OpenPKG Framework Binary Bootstrap" |
604 echo "containing the installation files as a self-extracting shell" |
651 echo "Package, containing the installation files as a self-extracting" |
605 echo "script for the OpenPKG instance $prefix. Use this in YOUR NEXT" |
652 echo "shell script for the OpenPKG instance $prefix. Use this in YOUR" |
606 echo "STEP to initially create the OpenPKG instance from scratch." |
653 echo "NEXT STEP to initially create the OpenPKG instance from scratch." |
607 echo "Hence, proceed now by running the following command:" |
654 echo "Hence, proceed now by running the following command:" |
608 echo "" |
655 echo "" |
609 cusr=`(id -un) 2>/dev/null ||\ |
656 cusr=`(id -un) 2>/dev/null ||\ |
610 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
657 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
611 (whoami) 2>/dev/null ||\ |
658 (whoami) 2>/dev/null ||\ |