PKG-SCRIPT(5)

πŸ“¦ version 2.7.5, in nixos 26.05, nixpkgs unstable

🌸 NAME 🌸

okay so this is PKG-SCRIPT(5) straight out of the File Formats Manual, and it's all about shell scripts β€” literally shell scripts that are run by pkg(8). bestie, that's the whole name section, and it ate. πŸ’…


✨ DESCRIPTION ✨

okay so pkg(8) may run scripts at given phases of the process it is executing. The phases are the following, and yes, they all matter:

  • pre-install β€” run before installing the files on the system. πŸŽ€
  • post-install β€” run after installing the files on the system. ✨
  • pre-deinstall β€” run before removing the files on the system. πŸ¦‹
  • post-deinstall β€” run after removing the files on the system. 🌸

In the particular case of an upgrade the scripts are run in the following order:

  1. new pre-install
  2. old pre-deinstall
  3. replace binaries
  4. new post-install

that's the upgrade choreography, bestie β€” no cap, that's the order. πŸ’œ

πŸ¦‹ Environment πŸ¦‹

The following environment variables are exported to be used by the script. these are the little exported besties your script gets to work with: 🫢

  • PKG_NAME β€” Represents the name of the package. iykyk, it's the package's whole identity. ✨
  • PKG_PREFIX β€” PREFIX defined within the package at build time. iconic build-time info. πŸŽ€
  • PKG_ROOTDIR β€” represents the root directory where the package will be installed as specified by the -r arguments passed to pkg(8). 🌈
  • PKG_METALOG β€” When set, provides the path to a mtree(5) METALOG file in which package file metadata (e.g., ownership, mode) should be recorded. This is typically used when installing packages as a non-root user. literally the metadata moment. ⭐
  • PKG_MSGFD β€” Number of a file descriptor to be used to be able to send messages to the user that will be shown at the end of the pkg(8) process. πŸ’Œ
  • PKG_CHROOTED β€” Set to β€œtrue” when pkg(8) is operating inside a chroot via -c. chroot era, iykyk. πŸ”₯
  • PKG_UPGRADE β€” This variable is set when a script is run in the context of an upgrade of a package. upgrade vibes detected. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

bestie, the guest list is LONG and every single one made the cut: πŸ’–

πŸ’– okay bestie, that's the whole PKG-SCRIPT(5) page. footer energy: Debian, December 12, 2025, PKG-SCRIPT(5) β€” and that's officially a wrap. periodt. πŸŽ€

πŸ“¦ where this page comes from