You are not logged in.

#1 2020-03-30 15:31:06

Thrawn
Member
Registered: 2012-05-01
Posts: 17

How to create a package for local configuration?

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

#2 2020-03-30 15:33:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: How to create a package for local configuration?

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

#3 2020-03-30 15:34:56

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: How to create a package for local configuration?

Also, do not upload anything like this to the AUR. It is not a personal backup server.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2020-03-30 15:36:27

Thrawn
Member
Registered: 2012-05-01
Posts: 17

Re: How to create a package for local configuration?

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

#5 2020-03-30 15:39:57

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: How to create a package for local configuration?


Jin, Jîyan, Azadî

Offline

#6 2020-03-30 15:41:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: How to create a package for local configuration?

Thrawn wrote:

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.

Thrawn wrote:

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

#7 2020-03-30 15:52:41

Thrawn
Member
Registered: 2012-05-01
Posts: 17

Re: How to create a package for local configuration?

Thanks, I'll have a look.

Trilby wrote:

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

#8 2020-03-30 16:03:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: How to create a package for local configuration?

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

#9 2020-03-30 16:36:24

ayekat
Member
Registered: 2011-01-17
Posts: 1,632

Re: How to create a package for local configuration?

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.


pkgshackscfgblag

Offline

#10 2020-03-30 17:01:13

doskoi
Member
Registered: 2016-04-10
Posts: 24

Re: How to create a package for local configuration?

ayekat wrote:

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

Board footer

Powered by FluxBB