From 5e6f8a729b951808d34dfdf5b9a0d8753729d9dc Mon Sep 17 00:00:00 2001 From: sikorsky Date: Wed, 10 Sep 2008 21:44:55 +0000 Subject: [PATCH] Example of booted image versioning using CVS. We want to know, with what configuration (version of the image) each node was booted. Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. /etc/IMGVERSION cat look like: smbec02n001(smbec02b01n01):~ #cat /etc/IMGVERSION #-- $Id: base.pkglist,v 1.4 2008/09/02 15:40:12 sikorsky Exp $ #-- $Id: base.exlist,v 1.3 2008/09/02 14:57:08 sikorsky Exp $ #-- $Id: base.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $ #-- $Id: base.repolist,v 1.3 2008/09/02 14:57:08 sikorsky Exp $ $Id: syslog,v 1.2 2008/09/02 14:54:29 sikorsky Exp $ $Id: remoteshell,v 1.2 2008/09/02 14:54:29 sikorsky Exp $ $Id: sa_set_net,v 1.5 2008/09/04 11:32:07 gdasstm Exp $ $Id: sa_gpfs,v 1.4 2008/09/02 17:30:05 sikorsky Exp $ git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2137 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/netboot/sles/compute.postinstall | 10 ++++++++++ xCAT/postscripts/cvs_template.pl | 11 +++++++++++ xCAT/postscripts/cvs_template.sh | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100755 xCAT/postscripts/cvs_template.pl create mode 100755 xCAT/postscripts/cvs_template.sh diff --git a/xCAT-server/share/xcat/netboot/sles/compute.postinstall b/xCAT-server/share/xcat/netboot/sles/compute.postinstall index 0ce70de5a..74f99e350 100755 --- a/xCAT-server/share/xcat/netboot/sles/compute.postinstall +++ b/xCAT-server/share/xcat/netboot/sles/compute.postinstall @@ -1,4 +1,7 @@ #!/bin/sh +#-- Do not remove following line if you want to make use of CVS version tracking +#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $ +#-- jurij.sikorsky@t-systems.cz #-- #-- this script is run after all packages from $profile.pkglist are installed #-- @@ -27,4 +30,11 @@ workdir=$5 #none /var/tmp tmpfs defaults,size=10m 0 2 #END +#-- Example of booted image versioning +#-- We want to know, with what configuration (version of the image) each node was booted. +#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. +#cat /dev/null > $installroot/etc/IMGVERSION +#for ext in pkglist exlist postinstall repolist; do +# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION +#done diff --git a/xCAT/postscripts/cvs_template.pl b/xCAT/postscripts/cvs_template.pl new file mode 100755 index 000000000..6d84d0cf3 --- /dev/null +++ b/xCAT/postscripts/cvs_template.pl @@ -0,0 +1,11 @@ +#!/usr/bin/perl +#-- Example of "CVS-enabled" postscript +#-- Keeps track of every postscript run and it's version in /etc/IMGVERSION +#-- jurij.sikorsky@t-systems.cz +#-------------------------------------------------------------------------------- +#-- DO NOT remove following lines +open (IMG,">>/etc/IMGVERSION"); +print IMG '$Id: cvs_template.pl,v 1.1 2008/09/05 08:40:16 sikorsky Exp $',"\n"; +#-------------------------------------------------------------------------------- +#-- + diff --git a/xCAT/postscripts/cvs_template.sh b/xCAT/postscripts/cvs_template.sh new file mode 100755 index 000000000..2eda69938 --- /dev/null +++ b/xCAT/postscripts/cvs_template.sh @@ -0,0 +1,10 @@ +#!/bin/sh +#-- Example of "CVS-enabled" postscript +#-- Keeps track of every postscript run and it's version in /etc/IMGVERSION +#-- jurij.sikorsky@t-systems.cz +#-------------------------------------------------------------------------------- +#-- DO NOT remove following line +echo '$Id: cvs_template.sh,v 1.3 2008/09/02 14:54:29 sikorsky Exp $' >> /etc/IMGVERSION +#-------------------------------------------------------------------------------- +#-- +