You are not logged in.
I would like to track my /etc in git, and more specifically how my /etc is different from the default /etc.
Of course, "default /etc" is different for each system, because different packages installed means different /etc.
Ideally, I would have one branch containing the default /etc for my system, where every time I upgrade or remove packages, it adapts this branch accordingly.
Then, my real /etc would be in a different branch that follows this branch, by maintaining a patchset on top of it (using git rebase). this would also make it easy to copy changes to another system, by merging or cherry-picking commits.
There is a program like this, etckeeper: http://kitenet.net/~joey/code/etckeeper/, but:
- it requires a package manager with hooks. and pacman won't have hooks in the short term (see https://wiki.archlinux.org/index.php/Us … man_Hooks)
- etckeeper is mostly focused on tracking your own /etc in git, not so much the default /etc.
If anyone has some ideas how to do this, tell me. (or who wants to improve hooks support in pacman ![]()
To experiment, I wrote a small script build-default-etc.sh that goes over all installed packages and copies all their files matching ^/etc from the package file (from your cache) into a tmp dir.
This represents sort of (see caveats in the code) the "default /etc for your system"
#!/bin/bash
# limitations:
# - does not work with packages not in your cache (i.e. installed from AUR)
# - only catches what's in /etc in the package file, not what is generated with postinstall hooks
tmpdir=$(mktemp -d)
cd $tmpdir
# generate a listing with lines like: zsh zsh-4.3.11-2
pkgs=$(pacman -Qi | awk '/^Name/ { pkg=$3}; /^Version/ { printf "%s %s-%s\n",pkg, pkg,$3}')
while read pkg pkg_ver
do
# if I don't use ls, it seems to store the literal glob :s
# (even with matching file, so independent of nullglob)
pkgfile="$(ls /var/cache/pacman/pkg/$pkg_ver* 2>/dev/null)"
if [ -z "$pkgfile" ]
then
echo "> $pkg_ver [skipping: not in package cache]"
else
# apparently tar thinks it's an error if it doesn't find anything
# matching the wildcard, so we help it a bit..
if pacman -Ql $pkg | grep -q ' /etc.*[^/]$'
then
echo "> $pkg_ver [extracting]"
tar -xf $pkgfile --wildcards 'etc/*'
else
echo "> $pkg_ver [skipping: no files in /etc]"
fi
fi
done < <(echo "$pkgs")
echo $tmpdir< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline