首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用PKGBUILD卸载aur包时运行脚本

使用PKGBUILD卸载aur包时运行脚本
EN

Stack Overflow用户
提问于 2022-09-20 02:01:17
回答 1查看 48关注 0票数 1

我的PKGBUILD中有这段代码

代码语言:javascript
复制
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"

当用户卸载包时,我需要反转这个修补程序,因为原始程序不属于这个包。

所以,当用户卸载包时,可以执行脚本吗?

EN

回答 1

Stack Overflow用户

发布于 2022-09-20 14:36:08

你应该习惯于阅读Arch,不管怎么说,这里提到了:https://wiki.archlinux.org/title/PKGBUILD

6.3安装

包中包含的.install脚本的名称。

pacman能够在安装、删除或升级包时存储和执行特定于包的脚本。脚本包含以下函数,它们在不同的时间运行:

  • pre_install -在提取文件之前运行脚本。传递了一个参数:新包version.
  • post_install -该脚本在解压缩文件后立即运行。传递一个参数:新包version.
  • pre_upgrade -脚本在提取文件之前运行。两个参数按以下顺序传递:新包版本,旧包version.
  • post_upgrade -脚本在文件提取后立即运行。两个参数按以下顺序传递:新包版本,旧包version.
  • pre_remove -脚本在删除文件之前运行。传递一个参数:旧包version.
  • post_remove -脚本在文件删除后立即运行。传递了一个参数:旧包版本.

这是一个示例.install文件:

代码语言:javascript
复制
# 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
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73780901

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档