{"thread":{"id":"8226","subject":"Using git to store /etc, redux","startedAt":"2007-05-19T17:48:15Z","lastAt":"2007-05-22T12:16:40Z","messageCount":5,"participants":["David Härdeman","david@lang.hm","Jan Hudec"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"42635","messageId":"20070519174815.GA5124@hardeman.nu","threadId":"8226","inReplyTo":null,"subject":"Using git to store /etc, redux","fromName":"David Härdeman","fromEmail":"david@hardeman.nu","sentAt":"2007-05-19T17:48:15Z","receivedAt":"2007-05-19T17:48:15Z","isPatch":false,"sender":{"key":"david@hardeman.nu","avatar":"https://gravatar.com/avatar/9d166a5d9d3ce5c7aea74a0080677a73785727b9b25f0c3e547d5b359bff27d5?d=mp&s=160"},"body":"I recently had the idea to store and track /etc using git. When googling \nthe topic I came across the \"Using git to store /etc\" thread from the \nend of last year which provided some interesting details on what would \nbe necessary.\n\nIt seems the file metadata (owner, group, mode, xattrs, etc) was the big \nstumbling point, so I wrote up a tool over the last few days which \nallows the metadata to be stored in a separate file which can be stored \nalong with the rest of the data in the repo (or separately).\n\nThis is also useful for tripwire type checks and for other types of \nstorage which drops some of the metadata (tar comes to mind)...\n\nThe tool (metastore) is available from: \ngit://git.hardeman.nu/metastore.git\n\nNot completely cleaned up yet (it lacks a real README and some Makefile \ntargets) but I hope it might be useful to others (it sure is to me).\n\nPlease CC me on any replies.\n\n-- \nDavid Härdeman\n"},{"id":"42658","messageId":"Pine.LNX.4.64.0705191611150.6938@asgard.lang.hm","threadId":"8226","inReplyTo":"20070519174815.GA5124@hardeman.nu","subject":"Re: Using git to store /etc, redux","fromName":"","fromEmail":"david@lang.hm","sentAt":"2007-05-19T23:37:54Z","receivedAt":"2007-05-19T23:37:54Z","isPatch":false,"sender":{"key":"david@lang.hm","avatar":null},"body":"On Sat, 19 May 2007, David Härdeman wrote:\n\n> I recently had the idea to store and track /etc using git. When googling the \n> topic I came across the \"Using git to store /etc\" thread from the end of last \n> year which provided some interesting details on what would be necessary.\n>\n> It seems the file metadata (owner, group, mode, xattrs, etc) was the big \n> stumbling point, so I wrote up a tool over the last few days which allows the \n> metadata to be stored in a separate file which can be stored along with the \n> rest of the data in the repo (or separately).\n>\n> This is also useful for tripwire type checks and for other types of storage \n> which drops some of the metadata (tar comes to mind)...\n>\n> The tool (metastore) is available from: git://git.hardeman.nu/metastore.git\n>\n> Not completely cleaned up yet (it lacks a real README and some Makefile \n> targets) but I hope it might be useful to others (it sure is to me).\n>\n> Please CC me on any replies.\n\nas I understand the issue, the problem isn't creating a tool to store the \nmetadata, but in integrating things with git.\n\nwhen checking something in a pre-commit hook needs to run the tool to \nstore the data.\n\ngit supports this and it's pretty simple to do this.\n\nhowever when checking things out there are approaches\n\n1. modify git to have a post-checkout hook to set the metadata to match\n    what was stored at checkin and accept the fact that this leaves a\n    window where the file has the wrong metadata on it (between when the\n    file is written and when the hook runs), or use a staging area to have\n    copies of the files during check-in and check-out\n\n2. modify git to know that it needs to check some files out before any\n    others and use an expernal program to write the files to disk. Then\n    this program can use the data stored at checkin to write the files with\n    the appropriate metadata\n\nunforutnantly until one of these is done by someone the utility of \nprograms like your metastore are limited.\n\nDavid Lang"},{"id":"42680","messageId":"20070520094835.GA6971@hardeman.nu","threadId":"8226","inReplyTo":"Pine.LNX.4.64.0705191611150.6938@asgard.lang.hm","subject":"Re: Using git to store /etc, redux","fromName":"David Härdeman","fromEmail":"david@hardeman.nu","sentAt":"2007-05-20T09:48:35Z","receivedAt":"2007-05-20T09:48:35Z","isPatch":false,"sender":{"key":"david@hardeman.nu","avatar":"https://gravatar.com/avatar/9d166a5d9d3ce5c7aea74a0080677a73785727b9b25f0c3e547d5b359bff27d5?d=mp&s=160"},"body":"On Sat, May 19, 2007 at 04:37:54PM -0700, david@lang.hm wrote:\n>On Sat, 19 May 2007, David Härdeman wrote:\n>\n>>I recently had the idea to store and track /etc using git. When googling \n>>the topic I came across the \"Using git to store /etc\" thread from the end \n>>of last year which provided some interesting details on what would be \n>>necessary.\n>>\n>>It seems the file metadata (owner, group, mode, xattrs, etc) was the big \n>>stumbling point, so I wrote up a tool over the last few days which allows \n>>the metadata to be stored in a separate file which can be stored along \n>>with the rest of the data in the repo (or separately).\n>>\n>>This is also useful for tripwire type checks and for other types of \n>>storage which drops some of the metadata (tar comes to mind)...\n>>\n>>The tool (metastore) is available from: git://git.hardeman.nu/metastore.git\n>>\n>>Not completely cleaned up yet (it lacks a real README and some Makefile \n>>targets) but I hope it might be useful to others (it sure is to me).\n>>\n>>Please CC me on any replies.\n>\n>as I understand the issue, the problem isn't creating a tool to store the \n>metadata, but in integrating things with git.\n\nThat is also important of course, the problem is that there are many \ndifferent scenarios for how people might want to work with the metadata \n(e.g. whether changed metadata should be stored automatically or only \nwith user interaction, etc).\n\nFor the \"store /etc in git\" solution which is what got me into this, it \nmight be enough to have a pre-commit hook if all changes are made in \n/etc and committed to /etc/.git periodically (meaning there are no real \ncheckouts to speak of).\n\n>when checking something in a pre-commit hook needs to run the tool to \n>store the data.\n>\n>git supports this and it's pretty simple to do this.\n\nYes, I already have hook scripts in my local setup which does this, \nit was not clear whether pre-commit hooks could change the commit by \nadding more files to be committed but it seems to work, essentially \nthe pre-commit hook is just:\n\nmetastore -s\ngit-add .metadata\n\n>however when checking things out there are approaches\n>\n>1. modify git to have a post-checkout hook to set the metadata to match\n>    what was stored at checkin and accept the fact that this leaves a\n>    window where the file has the wrong metadata on it (between when the\n>    file is written and when the hook runs), or use a staging area to have\n>    copies of the files during check-in and check-out\n\nRight, I use a non-hook script for this right now which changes umask to \n0077, pulls the changes, shows the difference in metadata and asks for \nconfirmation and then applies the metadata (which undoes the effects of \nthe umask setting).\n\nI think I'll add both scripts to my git repo as examples soon.\n\n-- \nDavid Härdeman\n"},{"id":"42914","messageId":"20070521183239.GB5082@efreet.light.src","threadId":"8226","inReplyTo":"20070519174815.GA5124@hardeman.nu","subject":"Re: Using git to store /etc, redux","fromName":"Jan Hudec","fromEmail":"bulb@ucw.cz","sentAt":"2007-05-21T18:32:39Z","receivedAt":"2007-05-21T18:32:39Z","isPatch":false,"sender":{"key":"bulb@ucw.cz","avatar":null},"body":"On Sat, May 19, 2007 at 19:48:15 +0200, David Härdeman wrote:\n> I recently had the idea to store and track /etc using git. When googling \n> the topic I came across the \"Using git to store /etc\" thread from the \n> end of last year which provided some interesting details on what would \n> be necessary.\n> \n> It seems the file metadata (owner, group, mode, xattrs, etc) was the big \n> stumbling point, so I wrote up a tool over the last few days which \n> allows the metadata to be stored in a separate file which can be stored \n> along with the rest of the data in the repo (or separately).\n> \n> This is also useful for tripwire type checks and for other types of \n> storage which drops some of the metadata (tar comes to mind)...\n> \n> The tool (metastore) is available from: \n> git://git.hardeman.nu/metastore.git\n> \n> Not completely cleaned up yet (it lacks a real README and some Makefile \n> targets) but I hope it might be useful to others (it sure is to me).\n> \n> Please CC me on any replies.\n\nHave you looked at IsiSetup (http://www.isisetup.ch/, linked from\nhttp://git.or.cz/gitwiki/InterfacesFrontendsAndTools) yet? It's a front-end\nto git specifically targeted for versioning configuration. From a quick\nglance at it's web I don't see whether it already stores the metadata you\ndescribe, but in either case it could be interesting for you.\n\n-- \n\t\t\t\t\t\t Jan 'Bulb' Hudec <bulb@ucw.cz>\n"},{"id":"42978","messageId":"17042.145.64.134.244.1179836200.squirrel@www.hardeman.nu","threadId":"8226","inReplyTo":"20070521183239.GB5082@efreet.light.src","subject":"Re: Using git to store /etc, redux","fromName":"David Härdeman","fromEmail":"david@hardeman.nu","sentAt":"2007-05-22T12:16:40Z","receivedAt":"2007-05-22T12:16:40Z","isPatch":false,"sender":{"key":"david@hardeman.nu","avatar":"https://gravatar.com/avatar/9d166a5d9d3ce5c7aea74a0080677a73785727b9b25f0c3e547d5b359bff27d5?d=mp&s=160"},"body":"On Mon, May 21, 2007 20:32, Jan Hudec wrote:\n> Have you looked at IsiSetup (http://www.isisetup.ch/, linked from\n> http://git.or.cz/gitwiki/InterfacesFrontendsAndTools) yet? It's a\n> front-end\n> to git specifically targeted for versioning configuration. From a quick\n> glance at it's web I don't see whether it already stores the metadata you\n> describe, but in either case it could be interesting for you.\n\nYes, it was mentioned in the previous thread about tracking /etc in git.\nI've looked at it but it seemed to not store any metadata. Also, it seemed\nlike overkill for just keeping a history of my /etc.\n\nIt also used a lot of hairy \"grep -v\" and similar tricks to run git but to\nmangle the output before it's shown to the user. I'd prefer to interact\ndirectly with git which I'm already familiar with...and git already has\neverything I need for tracking /etc with the exception of the metadata.\n\n-- \nDavid Härdeman\n"}]}