Installing packages from an input file or script - best practices?

I would like to automate applications installation after a fresh install of Endeavour OS by using an input file with all manually installed packages. Something like this should work:

pacman -Qqe > packages.txt (from existing installation)
sudo pacman -S < packages.txt (after fresh Endeavour installation)

I have packages installed from official repositories, AUR and flatpaks. Can the experts here recommend a way to first create a list of all my manually installed packages only and then install them automatically (from an input file or script?) with every new Endeavour OS installation? What is the simplest and most efficient way of doing this?

Thank you

Installing repo packages automatically is a fine practice that can save you a lot of time.

So, if you saved the list of explicitly installed packages from the repos like this:

pacman -Qqne > pkglist.txt

you can easily install them like this:

sudo pacman -S --needed - < pkglist.txt

You can save a list of explicitly installed foreign packages (which are typically from the AUR) like this:

pacman -Qqme > pkglist-foreign.txt

But you should never automate the installation of AUR packages, you should always go manually through the list and install them one by one, so that you can check the PKGBUILD file and ensure everything is in order. In order to benefit from the AUR’s transparency, and to ensure the packages’ trustworthiness, the user’s input is, unfortunately, necessary.

1 Like

I would take the output from this:

pacman -Qqe > packages.txt

and then pass it to an aur helper like yay along with --needed. That way you can install all the AUR packages and repo packages without having to worry about which is which.


If you’re after something a little more

then you can script archinstall to install a profile you create, then it will install the same things every time. You could likely extend this to the EnOS installer and create an offline installer image that installs your own specific custom spin.

Neither of these are simple, but they are highly effective.

Worked perfectly. This is exactly what I needed.

Thank you!

1 Like

N ot quite sure what the point of this statement is - these AUR packages have already been checked (hopefully) before being installed in t\he first place - the list is generated from existing pkgs, not a wish list. Any OTHER circumstance, such as getting them in the first place, they need to be checked out as much as you can manage…

Just because they were safe a month ago, does not mean they are safe now. They could have changed the maintainer, and that’s the perfect time to insert something malicious into them.

You have to check the AUR packages every time you install or update them.

Would it not make more sense to restrict the extra checking to -git versions of the pkgs? If the version hasn’t changed from what you have been running, the risks should be low at worst.

One could easily verify that versions have not changed by checking the ‘before’ and ‘after’ lists…

I guess I’m not sufficiently worried to limit myself to 1 by 1 installs, especially if doing multiple builds in a day…

Well, you’re responsible for your own computer… You’re a grown man, I wont tell you what to do :slight_smile:

Not too sure that ‘grown old’ equates to the same thing you reference(!) but I’ll let it go at that! Most of the AUR entries I use would be difficult to compromise (and likely not worth, due to low uptake) in my opinion, being most theme related or a theme-changed music player, a theme changing NOCSD lib, or fonts. In fact, here’s the current list for giggles…

AUR list
┌17:20:03 WD= [~]
└───freebird@nest ─▶$ pacman -Qm
audacious-gtk3 4.1-1
audacious-plugins-gtk3 4.1-1
breeze-amber-cursor-theme 1.0-3
brother-dcp7060d 2.0.4-2
ckb-next-git 1:0.4.4.r102.gdc04037a-1
conky-cairo 1.12.1-1
conkywx 210321-1
dnslookup-bin 1.4.8-1
font-manager-git 0.7.7.r31.g7feded7-1
glmark2-git r960.ca8de51-2
hardcode-fixer-git 1:r539.f812186-1
kvantum-theme-arc 20180614-3
libaudclient 3.4.90-1
libopenaptx 0.2.0-1
libxfce4ui-nocsd 4.16.0-1
mintstick 1.4.6-1
openrgb-git r1788.9f18edf9-1
popsicle-git 1.3.0.r44.gda43ab9-1
python-pyparted 3.11.7-1
rainlendar-beta 1:2.14.3.b161-1
ruby-mdless 1.0.14-1
screenkey-git 1.1.r10.g9312e68-1
ttf-mac-fonts 20100901.134-1
xfce4-panel-profiles 1.0.13-1

There are oddities in there, but, I thought, nothing of much common usage to bother compromising. Anyway - I am sure that browsers and such are more likely targets for the enemies of green life everywhere!


Very OT, but I see you have this Brother installed?
Does it work normal?
I have the DCP-135C, AIO, usb-connected printer, but it stopped printing a couple of weeks ago. (I have a topic concerning this issue)

Like I said, if you think that is safe (and in your particular case, I would tend to agree), I won’t treat you like a child and tell you to do it differently. It’s your own responsibility, if you mess up, you’ll suffer the consequences.

In general, automating the installation of the AUR packages is a stupid thing to do. That’s why I generally recommend against it. But in specific cases, when you are sure that what you’re doing is fine, then it’s fine. :man_shrugging:t3:

If you are unsure (and you don’t seem unsure), my recommendation is to do it manually.

both are already integrated into EOS-Installer :wink:
3 implementations can be used for this:

  • user packages list
  • user commands
  • user dotfiles

Not very good documented as we are still on testing this implementations, and there is no gui app to use this options …


Would be a great tool to use in the future once tested and documented.

Thank you for doing great work and giving us the BEST Arch linux distro. Appreciate everything you do for us!

Only slightly OT :grin: - and yes, it is a USB connected printer that works perfectly - once I got it to work at all. It didn’t get picked up by the GUI aided apps, but once I tried to install it with a ‘close relative’ driver, on the last step the correct driver suddenly showed up and all went well from there.

I’ll try to have a look at your post to see if anything shows up for me

Often have - partly because I’m not sure how best to automate (of I’m going to!). Not like the nifty command I use for the main repo lists - provided by you! I guess I could yay it, or I could do them scripted but separately or… but anyway - just wanted to make the point that it isn’t ALWAYS a stupid thing, just usually!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.