You are not logged in.
Hello!!
I would like to create a AUR custom package that would backup my computer configuration. For example, my files /etc/pacman.conf but user specific configuration as well, such as ~/.gitconfig file or ~/.ssh folder, and similar. Does anyone have an example of PKGBUILD to perform such actions?
Thanks in advance!!
Thrawn
Offline
No, a PKGBUILD is entirely the wrong tool for this. Packages do not install to your home directory. Even if that wasn't the case, why would you even want to use a package? Where would the source files be hosted? Once the source files are hosted somewhere, you'd have your backup.
If you want to manage "dot files" look for tools specifically for that:
https://wiki.archlinux.org/index.php/Dotfiles
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Also, do not upload anything like this to the AUR. It is not a personal backup server.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I was thinking of a file that won't be public, just a way to have all my conf exported as a single archive from one computer to another.
Regarding the first part of the question, can I create a package that would install a bunch of software I'm regularly needing as well as some global system files (like /etc/pacman.conf)?
Offline
Jin, Jîyan, Azadî
Offline
Regarding the first part of the question, can I create a package that would install a bunch of software I'm regularly needing
"Install"? No. But you can create a metapackage that depends on all of the packages you'd want installed. This is what "base" is for example.
... as well as some global system files (like /etc/pacman.conf)?
No. /etc/pacman.conf is owned by pacman.
But here too, a PKGBUILD is completely the wrong tool for the job. If you want to automate deployment of configured systems, look for tools made for that job, e.g., ansible (there are many others, but I don't have any background in them).
Do you sense a theme here? You have a bunch of goals, and you think that writing a PKGBUILD will achieve those goals. This is the very definition of an X-Y problem.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks, I'll have a look.
Do you sense a theme here? You have a bunch of goals, and you think that writing a PKGBUILD will achieve those goals. This is the very definition of an X-Y problem.
Sorry, I wasn't clear. My main goal is to re-install my computer with minimal effort, for all the packages, all the configuration tweaks, and all my dotfiles.
From my experience with Ansible, it's overkill to achieve that for a single computer, and has a pretty high overhead (for example, I still need to manually install a bunch of dependencies before being able to run ansible, such as yay, git, python, ansible, ssh key, clone the ansible repo, etc). I was looking for a simpler solution for a single personal computer; what I had in mind was a PKGBUILD that backup my configuration, and I could simply export this package with a USB key and re-install it on the new computer.
Edit: if you have an example of ansible repo used to install a single personal computer, that could be helpful to me.
Last edited by Thrawn (2020-03-30 15:59:27)
Offline
I've never used ansible and know very little about it - but many people use it specifically to deploy a set configuration to a large number of systems easily. However, if you are not deploying to a large number of systems and just want to be able to replicate what you have on a new system, then tools like ansible may be overkill. Instead, just have a thought out backup strategy:
https://wiki.archlinux.org/index.php/Sy … nce#Backup
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
For user configuration specifically, also see https://wiki.archlinux.org/index.php/Dotfiles.
For system-wide configuration, I guess Earnestly's approach there is interesting, but I sense conflict with the repo packages, as Arch tends to often ship files in /etc/ along with the packages.
Offline
For user configuration specifically, also see https://wiki.archlinux.org/index.php/Dotfiles.
For system-wide configuration, I guess Earnestly's approach there is interesting, but I sense conflict with the repo packages, as Arch tends to often ship files in /etc/ along with the packages.
You can use holo for this. You put your config changes in /usr/share/holo/files/, and holo patches the real config when packages are updated.
Offline