Howto upgrade the libc.so.5 on a target FREESCO

This article will describe a technique used in package installation scripts to handle the upgrade of libc.so.5 on a target FREESCO 0.3.x system.

Why is this so different from other libs?

The libc.so.5 library is always in use on the target system because most of the linux software is written in the C (or C++) language. The libc.so.5 library is the so called run time library and it contains routines that are used by almost all software that's running on linux. This is why it's not possible to handle this lib as any other, because when you try the target system will crash!

Why do I need to upgrade?

The stock libc.so.5 on the FREESCO floppy is a stripped version of the library and only contains the most common functions. More elaborate software, like f.i. Apache need the full blown version of libc.so.5 and thus the installation package should provide a way to upgrade the library. The best way to try if your package needs the full blown libc.so.5 file, is to install your package on a fresh FREESCO system and see if the software runs with the stripped down version or not.

The technique

  • create a directory called libc in the pkg directory of your new package
  • compress the full blown libc.so.5, this file is 614840 bytes in size and compressed with gzip max. compression level it reduces to 246017 bytes. You can get the full blown version from your zipslack 3.9 development system.
gzip -9 libc.so.5
  • Place the resulting libc.so.5.gz file in the pkg/libc directory
  • In the postinstall section of the package installation script, add a check for the presence of the upgraded libc.so.5 on the target system:
     postinstall)

                if [ ! -f /pkg/lib/libc.so.5 ]; then
                   echo "${CR}Upgrading libc.so.5${CD}"
                   zcat < /pkg/libc/libc.so.5.gz > /pkg/lib/libc.so.5
                   chmod +x /pkg/lib/libc.so.5
                fi
                rm -fr /pkg/libc 2>/dev/null
                sync;sync
                pkg -rescan

As you can see this code checks for a file libc.so.5 in /pkg/lib on the target system and if not found uses the zcat tool (default present on FREESCO) to unpack the compressed file to /pkg/lib. It also adds the executable bit to the resulting libc.so.5. Then it cleans up by removing the libc directory from the /pkg directory. Finally it flushes the disk cache (twice to make sure) and runs the pkg script in rescan mode to make sure all symlinks are created.

  • Now package your package as usual and of course you'll need to test it by installing it on a bare bone FREESCO box. The first time it should upgrade the libc.so.5 library (message “Upgrading libc.so.5” is printed during installation), the 2nd installation on the same box, it should not perform the upgrade (library files are never removed, even when a package is uninstalled).

Of course, there are many other possible solutions to upgrade the libc.so.5 library (f.i. see the OpenSSL package, where the libc.so.5 file is downloaded during the preinstall section), so you're welcome to try other techniques if you like.

dingetje 2005/05/31 11:50

 
freesco/howtos/package_libc.txt (52839 views) · Last modified: 2005/09/14 00:49 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki