First, a quick note about speed. Doing git commands on a repository the size
of a oneSIS system image over NFS can be somewhat slow. If your NFS
server is a regular linux box, it is highly recommended that you run
all git commands directly on that box so that all access to the image
is direct to local disk rather than over NFS.
Git is an extremely powerful revision control system. It is advisable to
create and tinker with smaller repositories before jumping to a full system
image. Once you have a system image and are ready to put it into git, you can
follow this procedure.
Procedure 6Prepare an image for use with git.
Git is included in most modern distributions, but there is still an extra
script that is packaged with the git source that we need to use for
managing a system image.
Download and install git
Directions can be found at http://git-scm.com/download
Download setgitperms.perl
From git source tree: https://raw.github.com/git/git/master/contrib/hooks/setgitperms.perl
Create a git repository in your system image
# cd /var/lib/oneSIS/images/oneSIS_image_dir # git init
Create some hooks to enable tracking permissions/ownership
Create both .git/hooks/post-checkout and .git/hooks/post-merge
#/bin/sh
SUBDIRECTORY_OK=1 . git-sh-setup
$GIT_DIR/hooks/setgitperms.perl -w
Git does not track empty directories so make sure that none are empty
Put a .gitignore file in every empty directory
# find . -name .git -prune -o -type d -empty -exec touch {}/.gitignore ;
Git does not track device files so create a tar archive for them
# find . ( -type b -o -type c -o -type p ) -exec tar rf dev/devs.tar {} ;
Add all files into the git repository
This step may take some time. Be sure to add a useful comment to all commits.
# git add . # git commit
Thats it! The system image is now under revision-control. It is now
possible to detect any changes to the system image with a simple
git status, commit changes with git add and git commit,
and view the history with git log. Refer to git documentation for how
to use branching, merging, and other git capabilities.
Note: When cloning a git repository, the .git/hooks directory is not
cloned, so you will need to copy all the hooks over by hand and manually
untar the device file tarball on any new clone.
Procedure 7Cloning a system image repository.
Clone the repository
# git clone oneSIS_image_dir cloned_image_dir
Set up the hooks
# rm -rf cloned_image_dir/.git/hooks # cp -a oneSIS_image_dir/.git/hooks cloned_image_dir/.git/
Manually adjust permissions/ownership to match the repository
# cd cloned_image_dir # .git/hooks/setgitperms.perl -w