How to Install From Lists Using pacman and yay or paru on Arch Linux

a) Making List of Packages

Create a plain text file containing the desired packages, separated by a new line.

arch-wiki-docs
dovecot
opendkim
php
php-fpm
php-gd
php-pgsql
postfix
postfix-pcre
postgresql
postgresql-docs
postgresql-ip4r
postgresql-libs

Here’s an exmaple file.

b) Making List of AUR Packages

Create a plain text file containing the desired packages, separated by a new line.

bitscoper-cyber-toolbox-bin
bitscoper-usb-logger
icecast
mistserver
satdump
sdrangel-bin
sdrpp-git
virtio-win-stable
zenmap

Here’s an example file.

c) Installing the Packages

Pass the lists to the pacman and yay or paru.
sudo pacman -S --needed - <./pacman_Packages.txt
and
yay -S --needed - <./AUR_Packages.txt
or
paru -S --needed - <./AUR_Packages.txt
Do not run yay with sudo!
I am using the following script.

#!/bin/bash

# By Abdullah As-Sadeed

if [ -n "$SUDO_USER" ]; then
    echo -e "\e[31mPlease do not run with sudo!\e[0m"
    exit
fi

# Install yay
if ! command -v yay &>/dev/null; then
    # Trace mode
    set -x

    git clone https://aur.archlinux.org/yay-bin.git

    cd yay-bin || exit

    makepkg -si

    cd ..

    rm -rf yay-bin
fi

# Trace mode if not set
if [[ "$(set -o | grep xtrace)" == *"off"* ]]; then
    set -x
fi

sudo pacman -Syyu

sudo pacman -S --needed - <./pacman_Packages.txt

yay -S --needed - <./AUR_Packages.txt

sudo pacman -Rsn - <./Unwanted_pacman_Packages.txt

sudo pacman -Rns $(sudo pacman -Qtdq)

yay -Scc

“I use Arch BTW!”

Abdullah As-Sadeed
Abdullah As-Sadeed

Prefers coding from scratch. Loves the Linux kernel.

Leave a Reply