2022-09-03 09:50:33 +00:00
|
|
|
|
---
|
|
|
|
|
title: pacman
|
|
|
|
|
keywords:
|
|
|
|
|
- Arch Linux
|
|
|
|
|
- pacman
|
|
|
|
|
categories:
|
|
|
|
|
- Linux
|
|
|
|
|
tags:
|
|
|
|
|
- Arch Linux
|
|
|
|
|
date: 2022-08-31 14:08:30
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
``` bash 使用 rankmirrors 将 mirrorlist 中的 mirrors 进行排序
|
|
|
|
|
rankmirrors /etc/pacman.d/mirrorlist.china > /etc/pacman.d/mirrorlist
|
|
|
|
|
```
|
2022-09-03 18:47:29 +00:00
|
|
|
|
|
|
|
|
|
# 自动清理老旧的包缓存
|
|
|
|
|
|
|
|
|
|
建立一个 hook 文件在 `/etc/pacman.d/hooks/clean_package_cache.hook`,内容如下:
|
|
|
|
|
|
|
|
|
|
``` conf
|
|
|
|
|
[Trigger]
|
|
|
|
|
Operation = Upgrade
|
|
|
|
|
Operation = Install
|
|
|
|
|
Operation = Remove
|
|
|
|
|
Type = Package
|
|
|
|
|
Target = *
|
|
|
|
|
[Action]
|
|
|
|
|
Description = Cleaning pacman cache...
|
|
|
|
|
When = PostTransaction
|
|
|
|
|
Exec = /usr/bin/paccache -rk3
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
系统会在每次安装升级卸载以后执行 `/usr/bin/paccache -rk3` 删除包的历史缓存,仅保留最近的3个版本。
|