[英]Run script when uninstalling aur package using PKGBUILD
I have this code in my PKGBUILD
我的
PKGBUILD
中有此代码
package() {
cd "$pkgname"
install -Dm755 ./lnScript.sh "$pkgdir/opt/pycharm-professional/bin/re
lnScript.sh"
install -Dm751 ./lnp.hook "$pkgdir/etc/pacman.d/hooks/lnp.hook"
cd /opt/pycharm-professional/bin
sudo patch --forward --strip=4 --input="${srcdir}/$pkgname/lnsh.pat
ch"
I need to reverse this patch when the user uninstalls the package because the original program does not belong to this package.当用户卸载package时,我需要反转这个补丁,因为原程序不属于这个package。
So, Is this possible to execute a script when is the user uninstalling an aur package?那么,当用户卸载 aur package 时,这是否可以执行脚本?
You should get used to reading the Arch Wiki, Anyways It's Mentioned Here: https://wiki.archlinux.org/title/PKGBUILD你应该习惯阅读 Arch Wiki,无论如何这里提到: https://wiki.archlinux.org/title/PKGBUILD
6.3 install
6.3 安装
The name of the.install script to be included in the package.
要包含在 package 中的 .install 脚本的名称。
pacman has the ability to store and execute a package-specific script when it installs, removes or upgrades a package.
pacman 能够在安装、删除或升级 package 时存储和执行特定于软件包的脚本。 The script contains the following functions which run at different times:
该脚本包含以下在不同时间运行的函数:
pre_install
— The script is run right before files are extracted.pre_install
— 该脚本在文件被提取之前运行。 One argument is passed: new package version.传递了一个参数:新的 package 版本。
post_install
— The script is run right after files are extracted.post_install
— 该脚本在文件被提取后立即运行。 One argument is passed: new package version.传递了一个参数:新的 package 版本。
pre_upgrade
— The script is run right before files are extracted.pre_upgrade
— 脚本在文件被提取之前运行。 Two arguments are passed in the following order: new package version, old package version.两个 arguments 按以下顺序通过:新 package 版本,旧 package 版本。
post_upgrade
— The script is run right after files are extracted.post_upgrade
— 脚本在文件被提取后立即运行。 Two arguments are passed in the following order: new package version, old package version.两个 arguments 按以下顺序通过:新 package 版本,旧 package 版本。
pre_remove
— The script is run right before files are removed.pre_remove
— 脚本在文件被删除之前运行。 One argument is passed: old package version.传递了一个参数:旧的 package 版本。
post_remove
— The script is run right after files are removed.post_remove
— 脚本在文件被删除后立即运行。 One argument is passed: old package version.传递了一个参数:旧的 package 版本。
this is a sample .install
file:这是一个示例
.install
文件:
# This is a default template for a post-install scriptlet.
# Uncomment only required functions and remove any functions
# you don't need (and this header).
## arg 1: the new package version
pre_install() {
# do something here
}
## arg 1: the new package version
post_install() {
# do something here
}
## arg 1: the new package version
## arg 2: the old package version
pre_upgrade() {
# do something here
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
# do something here
}
## arg 1: the old package version
pre_remove() {
# do something here
}
## arg 1: the old package version
post_remove() {
# do something here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.