Declarative package management
How can I manage packages installed with xbps and xbps-src from say a text file?
As example there is an arch package that does that for pacman - pacmanfile
Can I provide a packages.txt file with a package on every new line and have xbps and xbps-src uninstall everything that is not there and then install any missing package on my system?
Best
Open comment sort options
Best
Top
New
Controversial
Old
Q&A
If I do move to void, I will try to make a script and will add a link to it here.
If you're going to recreate this script, at least learn the
commcommand.diffis not the right tool for this task.Thanks for the tip!
List all the packages that you want installed in a file and then just run
xbps-install -Sy $(cat packages.txt)
With xbps-src you can do it with a script but it’s not as simple by no means is it hard though.
And about removing all explicitly installed packages which are not on the list?
Same thing, use a little script or a one line bash command. This is the basic idea of what it would do:
List your installed packages, probably to a temporary text file.
Compare the two files probably using diff. Or any tool to find the differences, could even use grep as someone else mentioned.
Uninstall any files that don’t match.
Also can I ask why you would be uninstalling packages that aren’t on the list if your installing packages on the list, especially on Void where you get a minimal install from the beginning? Just curious as to how or why someone would want to do that.
I think you can compare package lists using grep.
Do you perhaps mean installed packages that aren't deps of explicitly installed packages?