Arch Linux clarifies use of alpm-install-scriptlet and alpm-hooks
Arch Linux developers have analyzed 120 package repositories to distinguish between the use cases of package-specific scriptlets and system-wide hooks.
Summary
Arch Linux developers released a technical overview explaining the differences between alpm-install-scriptlet(5) and alpm-hooks(5). The research, based on 120 official package repositories, aims to guide maintainers on how to handle system integration tasks like user creation, directory management, and service reloading. The report highlights that scriptlets are best for version-specific messaging, while hooks are better for declarative system changes.
Scriptlets vs. Hooks
- alpm-install-scriptlet(5): Executed during specific package transactions (install/upgrade/remove). They have access to version information but are limited by the shell used by the package manager (Bash on Arch) and lack defined runtime requirements.
- alpm-hooks(5): Declarative files residing on the target system that run before or after entire transaction blocks. They are more generic and can be triggered by changes to specific paths or packages.
- Common use cases for hooks: Running systemd-sysusers, systemd-tmpfiles, deleting cache files, or restarting systemd units using markers.
- Common use cases for scriptlets: Displaying version-specific upgrade messages or handling breaking changes in configuration files.
Why it matters
This guidance helps package maintainers avoid common pitfalls in system integration, such as hardcoding user IDs or running tasks at the wrong time during a transaction.
Original reference: devblog.archlinux.page →