47
submitted 2 weeks ago by edinbruh@feddit.it to c/linux@lemmy.ml

So, some times ago I had this question https://feddit.it/post/22496010 about how to manage my system configuration, storing it on a repository or something.

Many people recommended using ansible to manage the system as a whole, but my system was already up and running, what I wanted instead was something to move around files while fixing up their permissions, so I build a python script for that.

The script grew more refined as time went on, and so now I'm publishing it so anyone can use it.

p.s.: this script is purely python and has no external dependencies!

top 12 comments
sorted by: hot top controversial new old
[-] SrMono@feddit.org 9 points 2 weeks ago

What speaks against soft linking with for example GNU stow?

[-] edinbruh@feddit.it 11 points 2 weeks ago

That is a good question. I have considered using gnu stow before building this. But there's a couple of problems with that.

Git doesn't follow symlinks, it stores them as links in the repo, so your only option is to keep the files in the repo, and symlink from the config file location to the repo. This is fine for user config files (like from your .config folder), but if you want to keep system config files (like those from /etc) then the git process needs to run as root to modify those files, because symlinked files share permissions and ownership. And even then, git will always create everything as root because it only tracks permission bits, not ownership, so you will need to constantly fix up ownership of your files.

With this tool instead you explicitly tell it the ownership and permission of files, and it takes care of that for you (it still needs root permissions of course).

[-] N0x0n@lemmy.ml 2 points 2 weeks ago

Hey :) Thanks for sharing your project ! I'm still not 100% sure I need this because right now I just make backups of my dot files and config files and i'm relatively new with git and my self-hosted forgejo instance.

However, after experimenting the power of version control, i'm kinda interessted to host my dot/config files into my hosted forgejo instance ! But permissions and ownership are not natively supported and needs manual intervention !

Is that the issues your project is solving?

DID YOU skip the previous warning? Make sure you didn't skip it, as this might cause you to lose access to your own files!

😂🫡 Well written and funny documentation ! Thank you !

[-] edinbruh@feddit.it 2 points 2 weeks ago

Is that the issues your project is solving?

That's exactly it, and also the fact that git doesn't follow symlinks. Just a word of warning, If you are still inexperienced I suggest you run my tool manually instead of automating it with git hooks, as it is inherently less secure. In the post I linked in the description you can see some of the precautions I took to make it more secure. Still, running it manually is fine.

Feel free to give some feedback if you start using the tool 🙂

[-] Creat@discuss.tchncs.de 1 points 2 weeks ago

I'm also just using GNU stow into a git repo. It needs no configuration file and just works on any system. Rolling out a new system takes 2 commands. I really don't see the need for a specialized tool for this use case.

[-] edinbruh@feddit.it 6 points 2 weeks ago

Say you want to store /etc/ufw/sysctl.conf which is owned by root:adm and has permission 644 in your repo, but also /etc/ntfy/server.yml which is owned by ntfy:ntfy with permissions 664. How do you keep track of this with gnu stow?

[-] Creat@discuss.tchncs.de 5 points 2 weeks ago* (last edited 2 weeks ago)

Ah now I understand the purpose. I only use it for my (personal) dotfiles, which as a term is ambiguous at best, but in my case I mean config files. That was how I essentially misread your title. Obviously all those files are owned by my user, and most live in ~/.config or similar locations beneath my home directory. Things like application preferences, basically.

Obviously your tool also works for this, but I now understand it's more meant for system wide config files.

[-] edinbruh@feddit.it 4 points 2 weeks ago

Yeah, it's cool, people are mostly looking for something like your usecase. I got suggested stow or stow-like tools a lot when exploring this. And when they understood what I wanted, they just suggested ansible... Which would work when starting from scratch, but wasn't right for me. I made copicat mostly because I am actually using it, and then decided to make it public because really I didn't find anything like it.

[-] Creat@discuss.tchncs.de 1 points 2 weeks ago

I would like to add that I did look at the GitHub before commenting. And I still didn't get it. Matthew with just explain what it does, but also why is different from the common tools/suggestions that seem similar. Maybe it's more about highlighting the differences (or the additional capabilities).

[-] Haradion@lemmy.ml 1 points 1 week ago

Neat! I've been meaning to build something like this with OSTree as the storage backend, but it's mostly vaporware for now.

[-] arty@feddit.org 1 points 2 weeks ago

Is it much different from etckeeper?

[-] edinbruh@feddit.it 2 points 2 weeks ago* (last edited 2 weeks ago)

Yes, that was one of the tools I considered before making this. I do not remember the precise detail on why, but much like gnu stow is only good for versioning user dotfiles and not system config. Etckeeper is good for storing either your system config files or user's dotfiles, but not both at the same time. copicat doesn't care what you use it for because you explicitly tell it all the locations and permissions that you want.

this post was submitted on 30 Nov 2025
47 points (96.1% liked)

Linux

57274 readers
692 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS