Hey everyone! I'm looking for some help with a little automation. I have this file called packages.txt that lists all my explicitly installed packages, which I generated from the command `pacman -Qe`. I want to make sure I can recover quickly if something goes wrong. The problem is, I'm kind of lazy and find it tedious to manually update this file every time I install or remove a package. What's the easiest way to set it up so that it automatically updates every time I run any pacman command? Thanks for the assistance!
5 Answers
Consider checking out the resources page on the wiki. There’s a lot of helpful information there that could guide you on this topic. Remember to back up regularly and test your commands in a VM to avoid any mishaps!
You can use a post hook for pacman to achieve this! It's a straightforward way to automate the update process for your packages.txt file whenever you run pacman commands. Just check out the Arch Wiki for detailed instructions on setting up hooks.
Happy cake day! Glad you're celebrating while helping out!
Instead of handling a .txt file, you might want to create a .sh script. Start your script with `#` for comments and then add the install commands for your favorite apps on the following lines. It makes it more organized!
You could set an alias like this: `alias packman=echo packman $@ > packages.txt; packman $@`. That might work for you, though I'm not entirely sure!
I found this page useful for tips on pacman: https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#List_of_installed_packages. It should give you more insight into how you can handle package lists effectively.
Wonderful, thank you so much for this tip!