michael@13: michael@13: OpenPKG Boostrap Package Source Tree michael@13: ==================================== michael@13: michael@13: This is the source code tree for the OpenPKG bootstrap package. What michael@13: you find here is rather complex and tricky stuff, so don't be confused michael@13: if you don't understand everything immediately. michael@13: michael@13: The Files michael@13: --------- michael@13: michael@13: README .................. this file ;-) michael@13: HISTORY ................. change history tracking of this package michael@13: michael@13: openpkg.spec ............ the regular build procedure michael@13: openpkg.boot ............ the bootstrapping procedure michael@13: michael@13: gzip-*.tar .............. untouched distribution tarball of the GNU gzip tool michael@13: make-*.tar.gz ........... untouched distribution tarball of the GNU make tool michael@13: patch-*.tar.gz .......... untouched distribution tarball of the GNU patch tool michael@13: bash-*.tar.gz ........... untouched distribution tarball of the GNU bash tool michael@13: tar-*.tar.gz ............ untouched distribution tarball of the GNU tar tool michael@13: uuid-*.tar.gz ........... untouched distribution tarball of the OSSP uuid tool michael@13: curl-*.tar.gz ........... untouched distribution tarball of the cURL tool michael@13: bzip2-*.tar.gz .......... untouched distribution tarball of the BZIP2 library michael@13: zlib-*.tar.gz ........... untouched distribution tarball of the ZLIB library michael@13: beecrypt-*.tar.gz ....... untouched distribution tarball of the BeeCrypt library michael@13: rpm-*.tar.gz ............ untouched distribution tarball of the RPM tool michael@13: config-*.tar.gz ......... untouched distribution tarball of the GNU config scripts michael@13: openpkg-registry-*.tar.gz untouched distribution tarball of the OpenPKG Registry michael@13: openpkg-tools-*.tar.gz .. untouched distribution tarball of the OpenPKG Tool Chain michael@13: openssl-*.tar.gz ........ untouched distribution tarball of the OpenSSL toolkit michael@13: perl-*-mini.tar.gz ...... stripped down distribution tarball of the Perl tool michael@13: michael@13: make.patch .............. patch for GNU make michael@13: bash.patch .............. patch for GNU bash michael@13: tar.patch ............... patch for GNU tar michael@13: beecrypt.patch .......... patch for BeeCrypt michael@13: openssl.patch ........... patch for OpenSSL michael@13: perl.patch .............. patch for Perl michael@13: gzip.c .................. replacement file for GNU gzip michael@13: rpm.patch.bugfix ........ patch for RPM (bugfixing parts) michael@13: rpm.patch.feature ....... patch for RPM (new features parts) michael@13: rpm.patch.porting ....... patch for RPM (portability enhancement parts) michael@13: rpm.patch.regen ......... patch for RPM (re-generated files parts) michael@13: michael@13: rpmpopt ................. replacements/extensions for RPM's POPT configuration michael@13: rpmmacros ............... replacements/extensions for RPM's macros michael@13: rpmrc ................... replacements for RPM's run-command configuration michael@13: michael@13: root.README ............. the source for installed /README michael@13: local.README ............ the source for installed /local/README michael@13: dot.bashrc .............. the source for installed /.bashrc michael@13: dot.bash_login .......... the source for installed /.bash_login michael@13: dot.lsyncrc ............. the source for installed /local/.lsyncrc michael@13: michael@13: openpkg.c ............... the OpenPKG frontend (set-uid wrapper) michael@13: openpkg.sh .............. the OpenPKG frontend (main script) michael@13: openpkg.pod ............. the OpenPKG frontend manual page (source) michael@13: openpkg.1 ............... the OpenPKG frontend manual page (pre-generated output) michael@13: michael@13: rc ...................... the OpenPKG run-command handling script michael@13: rc.func ................. the OpenPKG run-command function definitions michael@13: rc.conf ................. the OpenPKG run-command configuration template michael@13: rc.openpkg .............. the OpenPKG run-command script for the bootstrap package michael@13: rc.pod .................. the OpenPKG run-command script manual page (source) michael@13: rc.8 .................... the OpenPKG run-command script manual page (pre-generated output) michael@13: michael@13: release.sh .............. the OpenPKG release information utility script michael@13: release.pod ............. the OpenPKG release information utility manual page (source) michael@13: release.8 ............... the OpenPKG release information utility manual page (pre-generated output) michael@13: michael@13: uuid.sh ................. the OpenPKG UUID management utility script michael@13: uuid.pod ................ the OpenPKG UUID management utility manual page (source) michael@13: uuid.8 .................. the OpenPKG UUID management utility manual page (pre-generated output) michael@13: michael@13: rpmdb ................... the OpenPKG RPM database management utility michael@13: michael@13: rpmtool ................. the rpmtool tool (program source) michael@13: rpmtool.8 ............... the rpmtool tool (manual page) michael@13: rpmtool.pod ............. the rpmtool tool (manual page source) michael@13: shtool .................. the portable shell tool (GNU shtool) michael@13: michael@13: rpm-config.sh ........... the RPM C API helper script michael@13: rpm-config.pod .......... the RPM C API helper manual page (source) michael@13: rpm-config.8 ............ the RPM C API helper manual page (pre-generated output) michael@13: michael@13: lsync ................... the lsync tool (program source) michael@13: lsync.8 ................. the lsync tool (manual page) michael@13: lsync.pod ............... the lsync tool (manual page source) michael@13: michael@13: aux.usrgrp.sh ........... user/group name/id determination script michael@13: aux.prereq.sh ........... prerequisite checking script michael@13: aux.wrapsrc.sh .......... wrapper script for generating openpkg-V-R.src.sh michael@13: aux.wrapbin.sh .......... wrapper script for generating openpkg-V-R.P-L.sh michael@13: michael@13: pod2man.sh .............. helper script for pre-generating manual page outputs michael@13: man.sh .................. helper script for "openpkg man" command michael@13: install.sh .............. helper script for "openpkg install" command michael@13: michael@13: openpkg.org.pgp ......... the OpenPGP public key "OpenPKG " michael@13: openpkg.com.pgp ......... the OpenPGP public key "OpenPKG GmbH " michael@13: openpkg.net.pgp ......... the OpenPGP public key "OpenPKG Foundation e.V. " michael@13: michael@13: The Bootstrapping Procedure michael@13: --------------------------- michael@13: michael@13: The complexity of this OpenPKG RPM package results from the fact that michael@13: we force us to treat this bootstrapping package equal to every other michael@13: regular OpenPKG RPM package. First, this implies that the packaging michael@13: tool RPM is packaged with itself as an OpenPKG RPM package (means: its michael@13: build procedure is a real RPM .spec file and it can be installed and michael@13: upgraded through a binary or source RPM). Second, RPM is installed michael@13: into the same filesystem hierarchy as all other packages. Third, RPM michael@13: manages its own files. The reason for this approach should be obvious: michael@13: 100% consistency for the whole OpenPKG software packaging facility! michael@13: michael@13: The drawback is that this package requires a very tricky bootstrapping michael@13: procedure which had cost a lot of time to figure out and establish. If michael@13: you ever wanted to know the gory details, here they are... michael@13: michael@13: The first step was that we wrote the regular openpkg.spec file for michael@13: building the bootstrap package with OpenPKG RPM under the assumption michael@13: that OpenPKG RPM is already available. This way we can provide OpenPKG michael@13: RPM as an RPM package. Just remains the problem how we actually michael@13: bootstrap in case where OpenPKG RPM is still not available, i.e., michael@13: when we reach a new platform and have to build the package from michael@13: scratch. Here the "openpkg.boot" script comes into play. It executes michael@13: the "openpkg.spec" build procedure very similar to the way the real michael@13: OpenPKG RPM would do ("openpkg rpm -bb"). That is, "openpkg.boot" michael@13: partly emulates OpenPKG RPM -- just enough that "openpkg.spec" works. michael@13: As a result, "openpkg.spec" cannot use any fancy OpenPKG RPM features michael@13: or other things before "openpkg.boot" is able to emulate it, of michael@13: course. michael@13: michael@13: After "openpkg.boot" executed the "%prep", "%build" and "%install" michael@13: scripts of "openpkg.spec", there is a fresh version of the target michael@13: filesystem hierarchy staying under a temporary "build root". The michael@13: "openpkg.boot" script then creates a very special temporary "openpkg michael@13: rpm" command which allows the installed "openpkg rpm" command inside michael@13: the "build root" to work (although it is built for the final target michael@13: filesystem path). Then the $RPM_BOOT variable is set and the package michael@13: is _again_ build via "openpkg.spec" -- but this time with the real michael@13: OpenPKG RPM. To avoid unneccessary re-compilation, the "openpkg.spec" michael@13: skips "%prep", "%build" and "%install" sections if $RPM_BOOT is michael@13: defined. So, on this second build phase, only the "%files" section is michael@13: executed, i.e., a binary OpenPKG RPM package "openpkg-V-R.P-T.rpm" michael@13: is rolled from the files in the "build root". Additionally, a source michael@13: OpenPKG RPM package "openpkg-V-R.src.rpm" is rolled for consistency michael@13: reasons. michael@13: michael@13: Finally, we override the installation in the "build root" michael@13: again by installing the now rolled binary OpenPKG RPM package michael@13: "openpkg-V-R.P-T.rpm" by using the real OpenPKG RPM. This way michael@13: we achieve that OpenPKG RPM is remembered as a real OpenPKG RPM michael@13: package in the RPM database. We just have to make sure the package michael@13: is still relocated to the "build root" while installing. For this michael@13: we could use "--prefix=$RPM_BUILD_ROOT%{l_prefix}", but this would michael@13: create an incorrect file list for the package "openpkg" in the RPM michael@13: database. Instead we use the tricky "--justdb" option for "openpkg michael@13: rpm" which means "openpkg rpm" behaves as it would install into the michael@13: real location, but does not actually install anything. But as a michael@13: side-effect, the database inside the "build root" is now correct. michael@13: michael@13: After this procedure, the "build root" contains the target filesystem michael@13: hierarchy with OpenPKG RPM installed with itself. What is now just michael@13: remaining is to roll a bootstrap package "openpkg" with this stuff for michael@13: initial installation without OpenPKG RPM. For this the "build root" michael@13: is packed into a "tarball", compressed, again wrapped into another michael@13: tarball together with the uncompression tools ("bzip2" and "tar"), michael@13: and finally wrapped into a self-extracting shell script by appending michael@13: "aux.wrapbin.sh" (padded to 64KB for easier unpacking of the attached michael@13: tarball) to its front. michael@13: michael@13: The result is the binary bootstrap script "openpkg-V-R.P-T.sh" which michael@13: can be used to install the target hierarchy from scratch without any michael@13: pre-installed OpenPKG RPM. Nevetheless, the installed target hierarchy michael@13: looks _exactly_ as it would have been installed with OpenPKG RPM. michael@13: If one later wants to upgrade this hierarchy one can just use the michael@13: generated (or a newer) "openpkg-V-R.P-T.rpm". michael@13: michael@13: To allow one to easily repeat this from-source bootstrapping procedure michael@13: on other machines, one can run "./openpkg.boot -s" which rolls michael@13: a "openpkg-V-R.src.sh" script which is a self-extracting script michael@13: containing an attached tarball of the sources of this directory. This michael@13: script contains the same contents like "openpkg-V-R.src.rpm", but michael@13: is intended for running the described bootstrapping procedure from michael@13: scratch without any OpenPKG RPM. michael@13: