.TH "alpm-install-scriptlet" 5 .SH "NAME" .PP alpm\-install\-scriptlet \- a custom install script for ALPM based packages\. .SH "DESCRIPTION" .PP An optional shell script that defines custom actions to be performed during the installation, upgrade, or removal of a package\. .PP The shell functions are executed in the root (`\f[CR]/\fP`) of the system, so all paths inside of it must be absolute\. .PP Such files are located at the root of ALPM packages and are named \fB\.INSTALL\fP\. .SS "General Format" .PP An \fBalpm\-install\-scriptlet\fP may contain zero or more specific shell functions that define actions for different package lifecycle events\. All of the functions are optional and only those necessary for a given package may be included\. .PP The script may be written in a shell language that supports the `\f[CR]\-c\fP` commandline option and calling named functions with additional arguments from the interpreter's commandline interface\. .PP Note that the shell interpreter used by package management software to run the script is defined globally (e\.g\. per distribution)\. No shebang is used in the script and the decision on which shell to use for running it is not based on a package's metadata, but instead typically set at the distribution or system level\. This implies that the shell interpreter cannot be changed on a per\-package basis\. .SS "Functions" .PP The available functions are listed below\. They accept one or two arguments which are package versions, provided as \fBalpm\-package\-version\fP\. .RS .PP .nf pre_install .fi .RE .PP Executed before a package is installed, with the new package version as its argument\. .RS .PP .nf post_install .fi .RE .PP Executed after a package is installed, with the new package version as its argument\. .RS .PP .nf pre_upgrade .fi .RE .PP Executed before a package is upgraded, with the following arguments: .RS .Bl .IP 1. 4 New package version .El .Bl .IP 2. 4 Old package version .El .RE .RS .PP .nf post_upgrade .fi .RE .PP Executed after a package is upgraded, with the following arguments: .RS .Bl .IP 1. 4 New package version .El .Bl .IP 2. 4 Old package version .El .RE .RS .PP .nf pre_remove .fi .RE .PP Executed before a package is removed, with the old package version as its argument\. .RS .PP .nf post_remove .fi .RE .PP Executed after a package is removed, with the old package version as its argument\. .SH "EXAMPLES" .PP Example of specifying an install script in the \fBPKGBUILD\fP file: .RS .PP .nf install=example\.install .fi .RE .PP Example of a basic example\.install script: .RS .PP .nf pre_install() { echo "Preparing to install package version $1" } post_install() { echo "Package version $1 installed" } pre_upgrade() { echo "Preparing to upgrade from version $2 to $1" } post_upgrade() { echo "Upgraded from version $2 to $1" } pre_remove() { echo "Preparing to remove package version $1" } post_remove() { echo "Package version $1 removed" } .fi .RE .SH "SEE ALSO" .PP \fBbash\fP(1), \fBsh\fP(1), \fBPKGBUILD\fP(5), \fBalpm\-package\-version\fP(7), \fBpacman\fP(8), \fBmakepkg\fP(8)