Skip to content

Automated install

I started in the world of Arch first with Manjaro, I transitioned from Ubuntu because the rolling release model sounded interesting and I kept hearing good things about Pacman.

Now I've finally fully transitioned one of my (Thinkpad) laptops to Arch from scratch and I've got one laptop left to install Arch and get rid of Manjaro, which ... in my opinion...creates more problems that it solves.

The instalation of Arch was dead easy on my X240 but once inside the new system the process of installing one by one all the programs I regularly used and gave for granted that would be there, was a little painful. It was ultimately rewarding because I developed in the process an awareness of all the stuff I didn't need.

But now I want to transition my good old e545 to Arch and considering I can see all the packages I have with a simple

Pacman -Q

... I do wonder whats the best way to automatically install them all. Should I just write a script that reads a file with all of those packages and pass them as arguments to pacman/yay?

Or do people use some "custom distro creator" for this taks? I just want to be sure I'm not reinventing the wheel, specially if there's a better way I'm not aware of.

What do you guys think I should do?

1 points17 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 100% up
Kind
Text
ID
atk5vm

Author

17
posts
106
comments
8
media
View profile

17 comments

2 points

Hmmm, after soaking my brain in the knowledge of that link I've decided Pacmanity does what I need.

​

Thank you. There's so much stuff in Arch's wiki that is impossible to know what is it that you don't know.

1 points

I've been using pacmanity for some months now and I'm very happy with it. I also maintain a local copy by doing a git pull to a home directory.

Side effect: if you use the pamac GUI you may see a message at the end of the process about pacmanity being unable to log into your GitHub account - it's a by product of the way pamac handles permissions. To make life easier I do all my package management from the terminal now (with yay) which is by all accounts preferable!

I use the GUI as a handy database still...

2 points

...after soaking my brain in the knowledge of that link I've decided Pacmanity does what I need.

I think you're over complicating things but if it gets the job done.

2 points

Interesting, I see in the link

Tip: These tasks can be automated. See bacpacAUR, packupAUR, pacmanityAUR, and pugAUR for examples.

Thank you.

1 points

pacman -Qeq > list

< list pacman -S --needed -

2 points

Thanks but there's a problem with this example. It won't get me the ones from the AUR that I need

1 points

pacman -Qeqn lists all explicitly installed packages from the repos.

pacman -Qeqm lists all explicitly installed foreign packages. Chances are that's all AUR stuff for you.

1 points

​

This is what i do:

#!/bin/bash
x=$(cat x.txt)
y=$(cat y.txt)
sudo pacman -Sy $x --noconfirm
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay
yay -S $y --noconfirm

yay -S toilet --noconfirm
toilet DONE! --gay

x and y are variables that extract with cat command the contents of x.txt and y.txt. Those contents are placed in substitution of $x and $y.

Pacman needs to be executed as root, Yay must NOT be executed as root. I use Yay to install AUR packages, ofc you can use whatever else.

Inside x.txt and y.txt write the packages you want to install without commas. For example "plasma konsole firefox kate".

I personally made a script that installs and configures Arch like i want it, at the end it also installs extra packages from two txt files like above. I use those extra TXTs because it's easier to update them instead of the actual script.

EDIT: No, last two lines are not needed. .-.

1 points

There's so much wrong here.

  • You're installing yay via pacman so I assume you're running manjaro not arch.
  • -Sy should not be used.
  • Both yay and pacman support reading stdin so there's no need for the cat nonsense. Any even if they did not you could just use xargs.
  • Installing a ton of AUR packages with noconfirm is not something I would recommend.
  • --needed should be used just to save on installing stuff you already have.
3 points

Well, i'm new with Arch (two days ago) and yeah i got it wrong, i forgot that Yay needs to be downloaded from github. I'll edit the script above. The point is that i made a script that installs Yay for me, which is why i forgot (all excuses, i know, LOL).

"-Sy should not be used" Again, i got it wrong... I never executed that command TBH...

"Installing a ton of AUR packages with noconfirm is not something I would recommend" Why not? Ya know how slow Yay is? It takes an ethernity to install 4 apps. It's for a fresh install anyway, it's not like you can mess up something important. The worst scenario i got is a building failure.

"--needed should be used just to save on installing stuff you already have" Didn't know that, cool, but i don't think it's needed in this case, as i'd install packages that i know Arch and Plasma (in my case) don't install.

"Both yay and pacman support reading stdin" Well, that's something i should learn for sure...

1 points

but this does the same as pacmanity and in a less practical way because there's no version controlling, nor is it uploaded anywhere for you to enjoy, whenever you install anything.

1 points

No, Pacmanity at installation needs GitHub login, which i find it a waste of time. And i have uploaded these two files in GitHub together with my Arch+KDE installation script. No hassle. Just one pacman -Sy git and git clone for all what i need.

1 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.