rpm – deconstructing rpm – hello

Reading Time: < 1 minute

Last Update: 10/11/2024

A post I am doing to create a rpm using the classical hello is longer than expected. To help simply the construction task I am going to break down the analysis task to this post. Hopefully this makes things simpler.

In order to do that one does need to understand some of the functions of rpm

-rw-r--r-- 1 root root   57452 May  9  2022 hello-2.10-bp154.1.27.x86_64.rpm

For more complicated RPMS we would expect the PRE and POST actions. It turns out that this actions are not stored as separate files, but included as part of the SPEC for the rpm.

localhost:~/rpms # rpm -qlp --scripts hello-2.10-bp154.1.27.x86_64.rpm
error: open of rpm failed: No such file or directory
warning: hello-2.10-bp154.1.27.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 65176565: NOKEY
postinstall scriptlet (using /bin/sh):

    ALL_ARGS=(--info-dir=/usr/share/info /usr/share/info/hello.info.gz)
    if test -x /sbin/install-info ; then
        /sbin/install-info "${ALL_ARGS[@]}" || :
    fi ;
postuninstall scriptlet (using /bin/sh):

    test -n "$FIRST_ARG" || FIRST_ARG=$1
    if test -x /sbin/install-info ; then
        if [ "$FIRST_ARG" = 0 ]; then
            /sbin/install-info --quiet --delete --info-dir=/usr/share/info /usr/share/info/hello.info.gz || :
        fi ;
    fi ;
/usr/bin/hello
/usr/share/doc/packages/hello
/usr/share/doc/packages/hello/ABOUT-NLS
/usr/share/doc/packages/hello/COPYING
/usr/share/doc/packages/hello/NEWS
/usr/share/doc/packages/hello/README
/usr/share/doc/packages/hello/THANKS
/usr/share/doc/packages/hello/TODO
/usr/share/info/hello.info.gz
/usr/share/man/man1/hello.1.gz

From this we gather that the pre/post install actions use the install-info command to manipulate

References:
https://stackoverflow.com/questions/5616668/view-rpm-scripts-with-rpm-scripts-qp
https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Invoking-install_002dinfo.html

This entry was posted in Development, RPM. Bookmark the permalink.