.\" -*- mode: troff; coding: utf-8 -*- .TH "" "5" "" .SH NAME .LP alpm-install-scriptlet – a custom install script for ALPM based packages. .SH DESCRIPTION .LP 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/\fR) 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\fR. .SS General Format .LP An \fBalpm-install-scriptlet\fR 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\fR command line option and calling named functions with additional arguments from the interpreter\(cqs 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\(cqs 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 .LP The available functions are listed below. They accept one or two arguments which are package versions, provided as \fBalpm-package-version\fR. .LP .EX pre_install .EE .PP Executed before a package is installed, with the new package version as its argument. .LP .EX post_install .EE .PP Executed after a package is installed, with the new package version as its argument. .LP .EX pre_upgrade .EE .PP Executed before a package is upgraded, with the following arguments: .IP "1." 3 New package version .if n \ .sp -1 .if t \ .sp -0.25v .IP "2." 3 Old package version .LP .EX post_upgrade .EE .LP Executed after a package is upgraded, with the following arguments: .IP "1." 3 New package version .if n \ .sp -1 .if t \ .sp -0.25v .IP "2." 3 Old package version .LP .EX pre_remove .EE .LP Executed before a package is removed, with the old package version as its argument. .LP .EX post_remove .EE .PP Executed after a package is removed, with the old package version as its argument. .SH EXAMPLES .LP Example of specifying an install script in the \fBPKGBUILD\fR file: .LP .EX install=example.install .EE .PP Example of a basic example.install script: .LP .EX pre_install() { echo \(dqPreparing to install package version $1\(dq } post_install() { echo \(dqPackage version $1 installed\(dq } pre_upgrade() { echo \(dqPreparing to upgrade from version $2 to $1\(dq } post_upgrade() { echo \(dqUpgraded from version $2 to $1\(dq } pre_remove() { echo \(dqPreparing to remove package version $1\(dq } post_remove() { echo \(dqPackage version $1 removed\(dq } .EE .SH SEE ALSO .LP \fBbash\fR(1), \fBsh\fR(1), \fBPKGBUILD\fR(5), \fBalpm-package-version\fR(7), \fBpacman\fR(8), \fBmakepkg\fR(8)