Etckeeper

etckeeper is Article description::a collection of tools to store in a VCS (version control) repository, to keep a backup of changes to system configuration files. This allows to review or revert changes to, or to push the repository elsewhere for backups or cherry-picking configuration changes.

etckeeper hooks into Portage, to automatically commit changes made to during package upgrades. It tracks file metadata that git does not normally support, but that is important for, such as the permissions of.

etckeeper is modular and configurable, but simple to use for those who know how to use the underlying VCS.

Emerge
Install

Additional software
etckeeper supports the following version control systems:
 * git

Files
The main configuration file is. Following configuration options in the main configuration file need specific settings:

Cron
The cron job is enabled by default, to disable it, uncomment following configuration entry:

systemd
To enable the systemd timer, run:

Usage
First, it must be considered if sensitive files (such as private keys) shall be included in the repository. If there are concerns, it is suggested to create a file before running the etckeeper initialization.

Initialization of the repository is done by running:

When initialization is done through the command, the author of the commit will be set to the corresponding user:

The command creates a file in the  directory. If it already exist, then a "managed by etckeeper" comment block is added. It also sets up pre-commit hooks. This command does not yet commit files, but runs to ensure all interesting files are included in the initial commit later.

When specific files shall be excluded, effectiveness of the  file can be verified by running. In the following example it is tested whether shadow files will be checked in. If any files that shall be excluded show up as a new file, then the is not applied properly and needs fixing.

If not interesting files show up, it is suggested to undo the etckeeper initialization (as described later in the Removal section), fix the and start again.

Finally commit all changes in to the repository. A commit message can be specified. It is possible to use the underlying VCS to commit manually. Note that commit will notice if a user has used  or  to become root, and record the original username in the commit. At this time it is recommended to use the command.

If the initial version has been committed, from this time forward it is safe to use following command below to commit diffs:

or:

Pack git repository to save disk space:

Removal
Following commands deletes the directory:

Uninstall etckeeper:

External resources

 * README