【问题标题】:List all installed packages of specific repo in arch列出 arch 中特定 repo 的所有已安装包
【发布时间】:2021-06-08 14:09:59
【问题描述】:

假设我的 pacman.conf 配置文件中列出了 repo foo

[foo]
Include = /etc/pacman.d/mirrolist-custom

我想简单地从foo repo 列出我系统的已安装包。

【问题讨论】:

    标签: archlinux pacman-package-manager


    【解决方案1】:

    您可以列出已安装的软件包、列出 repo 软件包并进行比较。输出将是您从 repo 安装的软件包。

    pacman -Qq | sort > tmp_installed.txt
    pacman -Slq foo | sort > tmp_foo.txt
    comm -12 tmp_installed.txt tmp_foo.txt
    

    如果你想重复做一个脚本。这里有一个名为 list_repo.sh 的脚本示例

    #!/bin/bash
    # List installed packages from repo
    if [ "$#" -lt "1" ] || [ "$#" -gt "2" ]; then
        echo "Invalid number of arguments"
        echo "Usage: $0 <repo>"
        exit
    fi
    
    pacman -Qq | sort > tmp_installed.txt
    pacman -Slq $1 | sort > tmp_repo.txt
    
    comm -12 tmp_installed.txt tmp_repo.txt
    rm tmp_installed.txt
    rm tmp_repo.txt
    

    运行如下:

    ./list_repo.sh foo

    【讨论】:

    • 它不起作用:我已经从world repo 安装了abiword,但它也在extralibre repos 中:(pacman -Ss abiword 只是给了我[installed]world 中。但abiword 出现tmp_foo.txt 中为foo=libre
    • Repositories 是预编译包的列表。如果两个列表具有相同的包,那么您将得到该结果。不知道有没有办法如你所愿区分。如果您使用 pacman -Qi abiword 检查整​​个包信息,则没有安装 repo 的信息。
    猜你喜欢
    • 2014-04-17
    • 2012-03-17
    • 1970-01-01
    • 2011-06-04
    • 1970-01-01
    • 2023-02-03
    • 2012-10-08
    • 2016-10-09
    相关资源
    最近更新 更多