Skip to content

Is there a way to automate pkg install with yay and pacman

Hey everyone, I have a list of pkgs I want to install. Some of them are from the aur other are official. also I noticed even though yay doesn't require sudo, it does ask for password during installation. I'd apprecihate if someone can recommend a way I can automate the process of installing packages without worrying about is it part of aur or official

Thanks

0 points14 comments
Open on Reddit
About this post
Posted
Archived
Score
0 · 50% up
Kind
Text
ID
jtaraj

Author

19
posts
101
comments
1
media
View profile

17 comments

yay's --sudoloop option will solve one of the issues you're talking about here. Just enter your password once and come back when it's all done. Add --noconfirm for even more automated decision making.

3 points
unknown author

Deleted before we saved it.

1 points

Create a user. Add that user to sudoers with NOPASSWD. Run yay as that user. It will not ask for password that. Creating and adding a user can be automated too.

2 points

Oh that very new. Seems logical. Can you please elaborate more or kindly add steps so I can translate to a script. It would help a lot

1 points

yay can install packages from both the Official repos and the AUR. Just give put all the packages you want to install at the end of yay -S

1 points

Nice, can I pass sudo with it ? since almost all the time it ask for pass .

echo password | sudo -S yay -S pkg ?

1 points

Dont use yay with sudo. it explicitly tells you not to, as it can cause problems since yay uses fakeroot to limit security flaws.

You would probably have to read the manual entry for it to figure out how to automate it, im not sure on that as I prefer knowing what my packages are doing.

to do that, use man yay

3 points

Is sudo sh -c "cmd1 && cmd2 && cmd3 && ..." an option?

0 points

If yay asks for a password and times out, you can either re-run the yay command and the package will be reinstalled, or run pacman -U <package> on the package that was compiled but not installed because of the timeout.

1 points

Since I'm creating an automation script this won't be an option. But thanks for your thoughts.

1 points
unknown author

Deleted before we saved it.

3 points
unknown author3 hidden

Just wanted to add that one the developers of yay abandoned it in favor of paru, which does the same thing but in Rust instead of Go.

EDIT: One of the developers.

-2 points

One of the developers abandoned it. There's still an active developer working on yay.

5 points
unknown author

Edited, thanks.

1 points
unknown author

Deleted before we saved it.

0 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.