|
|
|
|
|
by ludocode
1865 days ago
|
|
I use a normal dotfiles repository with an install script that symlinks files out. My solution for multi-machine is that the install script just checks for a file suffixed by -$HOSTNAME to link instead: install() {
SRC=$DOTFILES/$1
if [ -e "$SRC-$HOSTNAME" ]; then
SRC="$SRC-$HOSTNAME"
fi
echo "installing $SRC -> $2"
mkdir -p $(dirname "$2")
ln -sf "$SRC" "$2"
}
install vim ~/.vim
install bashrc ~/.bashrc
install gitconfig ~/.gitconfig
# etc.
This is much simpler than messing around with branches since 99% of files are the same on different machines. Just add e.g. gitconfig-workpc to use a different git identity at work.For some files I also support a +$HOSTNAME suffix that will append instead of override. In this case it assembles the destination file rather than creating a symlink. This is a bit annoying because you can't edit the destination file; you have to edit the originals and re-run the install script. But it's worth it in a few cases (e.g. i3 config) to reduce duplication. |
|