Making a repository out of a given directory is quite straightforward. Here, I need to backup only some sparse files and directories which are spread out in the directory tree. Say, some configuration files, like /etc/ssh/sshd_config
, /etc/fail2ban/jail.local
, and the /var/www/
, ~/.local/bin/
and ~/.config/
directories. Such, that just by cloning the repository the system gets configured after a fresh installation.
Using Mercurial, where should I init the repository, and how to add and commit the specific files and directories (using the examples above)?
It appears like you need a version control for those specific files which you just want to just install on a freshly installed system. The best way to go with this is to track all these files in the same directory (or directory structure of your choice) and package those files in to an rpm/deb package so that when installed, it will replace the files on the freshly installation.