Generally installation of a skelpkg is just an unpacking of the
bin archive to skelbins directory and creating a symbolic links
to files inside it. But there is ability to run "pre install"
(preinst
), "post install" (postinst
), "pre remove"
(prerm
) and "post remove" (postrm
) hooks.
Hook is a directory with at least one executable file. All executable
files in that directory are called in a lexicographical order. Each hook
is placed in $NAME-$hsh/skelpkg/$NAME-$hsh/hooks/$hook
directory.
Hook is executed inside the directory we performing skelpkg installation, directory with the local/ subdirectory. It expects to get following environmental variables:
$DST
Path to directory where we perform installation of the skelpkg.
$PKG
Name of the skelpkg user entered. As a rule it is more-or-less human readable name without any hashes.
$NAMENHASH
$NAME-$hsh
name of the package.
$BASS_ROOT, $BASS_RC, ...
One of the frequent uses of preinst
hook is installation of
runtime dependencies. For example cURL depends on OpenSSL, so let’s see
its hook:
$ tar xfO $SKELPKGS/$ARCH/curl-8.6.0 name | read namenhash $ tar xfO $SKELPKGS/$ARCH/curl-8.6.0 bin | tar tf - $namenhash/skelpkg/$namenhash/hooks/preinst $namenhash/skelpkg/$namenhash/hooks/preinst/010-rdeps $ tar xfO $SKELPKGS/$ARCH/curl-8.6.0 bin | tar xfO - $namenhash/skelpkg/$namenhash/hooks/preinst/010-rdeps #!/bin/sh -e exec "$BASS_ROOT"/build/bin/pkg-inst openssl-1.1.1w
postinst
hook can be used to alter $DST
’s rc file,
like pkgconf
skelpkg does:
$ tar xfO $SKELPKGS/$ARCH/pkgconf-2.1.1 name | read namenhash $ tar xfO $SKELPKGS/$ARCH/pkgconf-2.1.1 bin | tar xfO - $namenhash/skelpkg/$namenhash/hooks/postinst/01rc-add #!/bin/sh -e _localpath="$(realpath local)" cat >>rc <<EOF export PKG_CONFIG_PATH="$_localpath/lib/pkgconfig:\$PKG_CONFIG_PATH" export PKG_CONFIG_PATH="$_localpath/libdata/pkgconfig:\$PKG_CONFIG_PATH" EOF