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
dbeaver
dovecot
icecast
opendkim
php
php-fpm
php-gd
php-pgsql
postfix
postfix-mysql
postfix-pcre
postfix-pgsql
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.

butt
librewolf-bin
ungoogled-chromium-bin
vscodium-bin

Here's and 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 gnu-free-fonts

sudo pacman -Rns $(pacman -Qtdq)

yay -Scc

I use Arch BTW!
Abdullah As-Sadeed

Abdullah As-Sadeed