Hi, I'm trying something in package management. While there are quite a lot pkgmngt systems out there, I try to implement a tiny little one just by myself. That is more for learning how things to do but for getting a full- featured pkgmngr.
When getting bored by reading long text, goto **Q** blow ;-) I based my system on scriptlets in bash which are doing the build. Those scripts looks mostly like ===== snip ===== HOMEPAGE= PKGNAME=elfutils VERSION=0.157 TARBALLS=( https://fedorahosted.org/releases/e/l/elfutils/$VERSION/elfutils-${VERSION}.tar.bz2 ) # Check the info-pages install dir! # If there are none, comment it out INFODIR= DESTDIR_ENABLED=yes function build_package() { local pkgdir="elfutils-$VERSION" && unpack ${TARBALLS[0]} && pushd $pkgdir && apply_patches && if [ -z "$BELFS_DESTDIR" ]; then pre_install; fi && belfs_configure --prefix=/usr --program-prefix="eu-" && belfs_make $MAKEJOBS && belfs_make_install && if [ -z "$BELFS_DESTDIR" ]; then post_install; fi && echo -n "Build size: " && du -sh . && popd && rm -rf $pkgdir } # Note: The comment at the end of a function # needs to have the function name in it! function pre_install() { true } # end pre_install function post_install() { true } # end post_install ===== snip ===== As you see, the behavior of the function is different depending on BELFS_DESTDIR is set or not. In case not, the build and installation is done on the current machine. If the BELFS_DESTDIR is set, only the main part of the function is executed, the pre- and post_install functions are put to another script which is included in the final binary tarball. When installing the binary, the pre_install function is executed first, than the binary content of the package is put to the filesystem and after this, the post_install function is called. That all seems to work fine. The drawback of this method is, that I have to write those scripts for every package i want to install or to create a bin- package. This is what I want to address. The idea was to take the BLFS book pages as jhalfs does for LFS and create the scripts automatically. That seems not work as in terms of package management, the time and the machine where the build is done is different to the machine where the package gets installed. So, for example in apache-httpd, the creation of the apache user is something I'd place in my pre_install function. That is because the user is not required while building but it is required later on the machine where the package got installed. As a result, there are some more phases to think about as when compiling and installing on the same machine at one time: - with pkgmngt * pre-build actions * build (compile and install to DESTDIR) * post build action (mostly only cleanup) PLUS (at a different time on a different machine) * pre-install actions (where the user creation could go to) * install binaries * post-install (configuration stuff) - without pkgmngt * pre-build + pre-install actions * build and install (to unset DESTDIR) * post-build + post-install actions You see that for doing it that way, it is required to know which command belongs to the *pre-install* and which one to the *post-install* phase. The rest of the commands are more or less in *build-phase*. **Q** Long text, short question: How can I distinct pre-install, build-time- and post-install commands using the books instructions? I feel I can't as I can't see any different roles or such. Or is there something I missed? If no, are there plans to introduce something to the book and - more general - is there interest in doing that at all? -- Thomas -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
