Control the dotfiles!
When I was first learning to use GNU/Linux and scripting, I was dead set on creating the bestest backup script. You see, during this period I would very frequently hop distros and I wanted an easy way to restore various settings I wanted. I had never really used any kind of version control system, so methodical usage of tar
seemed like the logical choice. Even if it wasn't the best solution, I was trying to do what I could to get the most out of my experience working and playing within this ecosystem. I wanted to shape it as close to exactly what I wanted as possible, and maybe along the way find out new things to try and add to the mix.
It wasn't until a few years later that I was able to implement a system for achieving exactly what I was trying to do with a backups script but without making any traditional backups at all.
Using a so-called 'dotfiles repo' is a pretty common practice. When I was first exposed to the idea I remember thinking "that's neat, I should try something like that out" but didn't really jump on it. now it's not only how I deploy my crap (files, scripts, etc.) but also how I track and "back it up". A dotfiles repo, combined with a way to manage it's state on your system, can be a powerful way to keep your system configured the way you want it while still being simple to maintain.
My system consists of a few components:
- A directory tree of roughly the following structure to accomadate setups for multiple machines:
src/toasty-dotfiles
├── alucard
│ ├── bin
│ ├── etc
│ ├── games
│ ├── install_all_configs.sh
│ └── setup_alucard.sh
├── richter
│ ├── bin
│ ├── etc
│ ├── install_all_configs.sh
│ └── setup_richter.sh
└── soma
├── bin
├── desktops
├── etc
├── games
├── hosts
├── install_all_dotfiles.sh
└── setup_soma.sh
- A bunch of symlinks throughout my home directory pointing back here to various things
- Using git (or any other vcs) to version control all of it
There are two shell scripts at play on each machine; one for configuring files in my home directory, and one for taking care of system things after a new install. The new install setup script doesn't do anything crazier than using the package maneger to install desired packages, but it does also backup and and replace a few files under /etc
with versions from my repo.
That first file, install_all_dotfiles.sh
, contains a list of scripts (under bin
) that it needs to make symlinks to. The list is laid out like this:
.bashrc
bin/aliens-vs-predator-2000
bin/banished
bin/daggerfall
bin/diablo2
bin/doom3
bin/duke-server
bin/duke3d
bin/dukedc
bin/dukenwinter
bin/dukevacation
bin/dungeon-keeper
bin/dungeon-keeper2
bin/dwarf-fortress
bin/gta-san-andreas
bin/higan
bin/martian-dreams
bin/minecraft
bin/morrowind
bin/morrowind-launcher
bin/pcsx
bin/ppsspp
bin/rcr-dos
bin/sim-city-2000
bin/ultima6
bin/ultima7-forge-of-virtue
bin/ultima7-serpent-isle-silver-seed
bin/unreal-tournament-goty
bin/warcraft2
bin/winsteam
bin/winsteamwinecfg
.config/openbox/autostart
.config/openbox/rc.xml
.config/openbox/menu.xml
.config/openmw/openmw.cfg
.config/openmw/settings.cfg
.config/tint2/tintwizard.conf
.config/tint2/tint2rc
.conkyrc
.emacs.d/init.el
.exult.cfg
games/daggerfall.conf
games/dungeon_keeper.conf
games/earthworm_jim.conf
games/earthworm_jim2.conf
games/martian_dreams.conf
games/rcr.conf
games/sim_city_2k.conf
games/u6.conf
games/warcraft2.conf
.nuvierc
.oh-my-zsh/custom/mine.zsh
.oh-my-zsh/themes/larry34.zsh-theme
.ssh/config
.vimrc
.zshrc
The rest of the script consists of three simple bash functions: one to ensure a specific working directory, one to check for (and remove) existing symlinks or rename existing real files, and another to "install" the symlinks to my version-controlled scripts.
If I add a new script, I just add it to my list and run the installer. Simple as that I've got launchers for various things and fine-grained control over them.
You don't have to do it exactly the way I do, but I think that some kind of "dotfiles" repo is a great idea for managing your setup.