Content
Package content
A typical package for pkgmanager contains a tree of directory and files meant to be extracted to root and a directory with metadata.
Full example:
/usr/bin/something-awesome
/install/pkgname-2.34.build
/install/pkgname-2.34.dependency
/install/pkgname-2.34.tag
/install/pkgname-2.34.tree
/install/pkgname-postinstall.sh
/install/pkgname-postuninstall.sh
/install/pkgname-preinstall.sh
/install/pkgname-preuninstall.sh
/install/pkgname.conflicts
/install/pkgname.info
/install/pkgname.obsoletes
/install/pkgname.recommends
/install/pkgname.url
Meta file usage and origin
Meta files with version in name are automatically generated. They contain file lists with permissions and hash sums, build number information, tag name and a list of dependencies detected.
Others without version name must be put in place before packaging new software. Not all of them have to be present at once but the url file and info file have to be present to make a proper package. All others are optional and server purposes as described below
Package hooks
Hooks are small bash scripts with a special naming. When placed into the /install directory and packaged with pkgmanager they start being executed if the package in being installed removed or upgraded.
The preinstall file is executed right before the package is extracted to the system. The postinstall file is executed right after the new package was extracted to the system. This functionality is useful if you are updating daemonized services shutting them up and down while upgrading its packages.
Pre and postuninstall files serve the same purpose but only if the package is being uninstalled.
In case if we are updating a package with a full set of shell scripts with another one with a full set too, than the order of executing will be as shown:
- preinstall (new package)
- postinstall (new package)
- preuninstall (old package)
- postuninstall (old package)
Conflicts, recommends, obsoletes
The conflicts, recommends and obsoletes files contain package names.
If we have package A in B.conflicts then installation of A alongside B wont be allowed
If we have package A in B.obsoletes then A will be uninstalled and B installed.
If we add package A to B.recommends then A and be will be installed.