Donnerstag, 16. Februar 2012

etckeeper-ng: Taking the distributed version control to the next level

Update:
A lot has changed since the last time i wrote about this project. First i moved the project to a different github.
Since the project and the code has gotten more complex. i separated etckeepr-ng completely from bashtools and spited up the functions in modularized files. Each function lives in his own file now.
So far i announced version 0.2.1 which is still to buggy for use in a productive environment although i fixed most known bugs i found.
I do have speakable commands now because they are more flexible to add than - options. Type "etckepper-ng help" to view all commands known for etckeeper-ng. There are however some new commands as you might have noticed already. With "reset" at least you are able to reset /etc to the last backed up commit. A smaller command is the "list-excludes" command which simply does a cat on your $EXCLUDEFILE.
Also i wrote etckkerper-ng it is able to parse Variables from the configuration file /etc/keeper.conf
There is a lot todo for now. So if you are a programmer and able to help to hack on etckeeper-ng you are welcome to check out the git repository and ask back for a push request. Also report bugs to me whenever you might find one.

Update:
Santas Hacking night :D
I got the -f option working for backup one single file. I strongly recommend using this for doing backups now every time you change a configuration file. It's a lot faster to backup just one file instead of doing this for the whole /etc all the time. Also this might be more secure since you only need to backup files which you are sure about. Before doing a backup use -c option to verify what has changed After verifying these changes add those files to the backup and be certain this changes are ok.

Update:
fixed some bugs in the Script today. Also the Script detects a change with the -c Option, the diff is logged to a logfile. So you can see what has changed.
I have completely disabled the -r Option though since this was highly unusa
ble.

Hi girls and guys,

today i present you with a new incarnation of the etckeeper. My Script etckeeper-ng rsyncs the /etc directory into a backup directory. As usual you can find the etckeeper-ng in my github directory and get it from there.

By default the Script syncs the /etc to /root/.etcbackup/. You can change this by editing the $BACKUPDIR variable in the script.

After initializing the Script with -i option it saves a copy of /etc to /root/.etcbackup/etc and a file /root/.etcbackup/content.bak which contains the permissions user and owner of every file in the original /etc directory. All files under $BACKUPDIR than gets under version control by git.

Whenever you have done some changes in the configuration files, you can check them in and commit them to git by using the -b option to etckeeper-ng. The Backup function takes a little bit longer though, since the script also tests whether any permission or ownership or groupship has changed. In this case the Script will ask you, if you would like to restore the original permissions or commit the changed permissions and store them in the content.bak file.

You can list your commits by using the -l option.

However you will be notified that you should define some files like /etc/passwd or /etc/shadow that should not be included in the backup. You can define the /etc/passwd
file from being backed up by issuing the Script etckeeper-ng -e passwd. You have to give the relative path from /etc to say which files you wish to exlclude from being backed up. This will create a file /root/.etcbackup/excludes which will be read by the rsync programm with the --exclude-from option.

Checking if someone has something changed can be archived by using the -c option. This will create a second copy of the backup directory and will rsync the /etc to this particular second copy. The directory can be set by editing the variable $COMPAREDIR. The script will use git status -s and a check function for the permissions to check against content.bak if the user, the group and the permissions of all files are genuine.

If someone or yourself by accident change the permissions of a particular file you can reset this by using the -C option. Note: It's a capital C.

And finaly restoring the /etc directory can be archived by using the -r
were you can use HEAD restoring from the latest commit or the md5sum which is listed after "commit" when you using -l

Hope this script makes the live a little bit easier for you.

And please tell me if you find any bugs.


That's all folks.

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.