Difference between revisions of "Patches and Updates"

From NST Wiki
Jump to navigationJump to search
(Initial notes on creating patches/updates)
 
 
Line 1: Line 1:
 +
= NO LONGER APPLICABLE SINCE v2.11.0 =
 +
 +
This patch system was used prior to the 2.11.0 release (before we switched to using RPMs and '''yum'''). This information is now deprecated and will probably be removed from the Wiki at some point in the future.
 +
 
= Creating Patches/Updates =
 
= Creating Patches/Updates =
  

Latest revision as of 12:00, 15 December 2009

NO LONGER APPLICABLE SINCE v2.11.0

This patch system was used prior to the 2.11.0 release (before we switched to using RPMs and yum). This information is now deprecated and will probably be removed from the Wiki at some point in the future.

Creating Patches/Updates

Patches and updates can be made for the NST distribution. The patch/update management system is found under the directory: "patches" and is composed of a collection of scripts, makefiles, XML and XSL files.

In a Nut Shell:

  • A new patch or update is stubbed in using a template.
  • The manifest file: nstpatch.xml is then updated.
  • The script file: nstpatch.sh is then updated (this is what will run on the NST probe).
  • Additional files required for the patch might need to be added to the patch directory.
  • The patch is tested using the probe-install make target.
  • The final patch is built and deployed using the patch and upload make targets.

Stubbing in a New Patch

Use the patch-create target to stub in the necessary files to create a new patch.

Creating a New Patch
[root@taco nst]# make -C patches patch-create
make: Entering directory `/root/nst/patches'
/root/nst/patches/templates/create "/root/nst" "P";
ID: "P200703091" already used
ID: "P200703092" available and claimed
Installing template: "/root/nst/patches/templates/nstpatch.sh.create" ...
Successfully installed template: "/root/nst/patches/templates/nstpatch.sh.create"
Installing template: "/root/nst/patches/templates/nstpatch.xml.create" ...
Successfully installed template: "/root/nst/patches/templates/nstpatch.xml.create"
make: Leaving directory `/root/nst/patches'
[root@taco nst]# ls patches/P200703092
nstpatch.sh  nstpatch.xml
[root@taco nst]#

Stubbing in a New Update

Use the update-create target to stub in the necessary files to create a new update.

Creating a New Update
[root@taco nst]# make -C patches update-create
make: Entering directory `/root/nst/patches'
/root/nst/patches/templates/create "/root/nst" "U";
ID: "U200703091" available and claimed
Installing template: "/root/nst/patches/templates/nstpatch.sh.create" ...
Successfully installed template: "/root/nst/patches/templates/nstpatch.sh.create"
Installing template: "/root/nst/patches/templates/nstpatch.xml.create" ...
Successfully installed template: "/root/nst/patches/templates/nstpatch.xml.create"
make: Leaving directory `/root/nst/patches'
[root@taco nst]# ls patches/U200703091
nstpatch.sh  nstpatch.xml
[root@taco nst]#

Files to Edit

nstpatch.xml

This is the "manifest" file. It provides a description of the patch as well as information on how the patch can be used. This file is well commented and indicates what needs to be changed/modified.

nstpatch.sh

This file contains the actual script which will run on the NST probe when deployed. You can use any bash commands you would like within this file. In addition, you will have access to ALL of the functions found in the .bash files found in the directory: src/include/functions.

Deploying Patches and Updates

Testing Patches and Updates

Before deploying a patch or update to the public, you should use the probe-install target to verify that the patch works on a local NST system. This is done using the following make invocation (id corresponds to the patch/update ID and HOST specifies the IP address of the NST system to perform the test on):

Testing a New Patch
[root@taco nst]# make -C patches probe-install id=P200702161 HOST=192.168.0.31
make: Entering directory `/root/nst/patches'
for f in *.zip *README.html summary.xml; do \
  if [ -f "${f}" ]; then /bin/rm -f "${f}"; fi; \
done
xsltproc -o "/root/nst/config/P200702161.sh" "xsl/nstpatch2createzip.xsl" "P20    02161/nstpatch.xml";
/bin/chmod 755 "/root/nst/config/P200702161.sh";
"/root/nst/config/P200702161.sh";

### Start Time: 2007-03-09 07:40:37
+ BEGIN   + Creating patch: /root/nst/patches/P200702161-100.zip
+ SUCCESS + Removed old directory: /root/nst/tmp/nstpatch/P200702161
+ SUCCESS + Created patch build directory: /root/nst/tmp/nstpatch/P200702161
+ NOTE    + Copying 2 files/directories
+ SUCCESS + Copied: /root/nst/patches/P200702161/nstpatch.sh
+ SUCCESS + Copied: /root/nst/patches/P200702161/nsthdinstall
+ SUCCESS + Generated: README.html
  adding: nsthdinstall (deflated 73%)
  adding: nstpatch.sh (deflated 73%)
  adding: README.html (deflated 69%)
/bin/rm -fr /root/nst/tmp/nstpatch/P200702161
+ SUCCESS + Created: /root/nst/patches/P200702161-100.zip
  <md5sum>AUTOMATICALLY_GENERATED</md5sum>
+ SUCCESS + Updated MD5 value to: "18a291d8f5d701072bab5a9e792477a8" in: "nstp    ch.xml"
+ END     + Finished creating patch: /root/nst/patches/P200702161-100.zip

Archive:  /root/nst/patches/P200702161-100.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
    78414  02-26-07 08:41   nsthdinstall
    68542  03-09-07 07:40   nstpatch.sh
     5108  03-09-07 07:40   README.html
 --------                   -------
   152064                   3 files

-------------------------------------------------------------
### End Time: 2007-03-09 07:40:38  Duration: +0000 00:00:01
Transferring patch to NST probe at: "192.168.0.31"
scp /root/nst/patches/P200702161-*.zip "root@192.168.0.31:/tmp/";
Enter passphrase for key '/root/.ssh/id_rsa':
Enter passphrase for key '/root/.ssh/id_dsa':
root@192.168.0.31's password:
P200702161-100.zip                              100%   40KB  40.5KB/s   00:00
Installing patch on NST probe at: "192.168.0.31"
ssh "root@192.168.0.31" "(rm -fr /tmp/patch && mkdir /tmp/patch && cd /tmp/patch && unzip /tmp/P200702161-*.zip && rm -f /bin/P200702161-*.zip && ./nstpatch.sh && cd .. && rm -fr /tmp/patch)"
Enter passphrase for key '/root/.ssh/id_rsa':
Enter passphrase for key '/root/.ssh/id_dsa':
root@192.168.0.31's password:
Archive:  /tmp/P200702161-100.zip
  inflating: nsthdinstall
  inflating: nstpatch.sh
  inflating: README.html

### Start Time: 2007-03-09 07:47:13
+ BEGIN   + Installing: "/usr/bin/nsthdinstall"
+ NOTE    + Installing via:
  /usr/bin/install --owner "root" --group "root" --mode "700" \
    "/tmp/patch/nsthdinstall" "/usr/bin"
+ SUCCESS + Patched/installed file: "/usr/bin/nsthdinstall"
+ END     + Installing: "/usr/bin/nsthdinstall"

+ SUCCESS + Patch Id: "P200702161", Version: "1.0.0" was successfully installed.
-------------------------------------------------------------
### End Time: 2007-03-09 07:47:13  Duration: +0000 00:00:00
make: Leaving directory `/root/nst/patches'
[root@taco nst]#

Making Patches/Updates Available to the Public

Once you've completed testing the patch, you can deploy it to the public web server to make it available to other NST users. This is done using the patch and upload targets as shown below:

Deploying a New Patch
[root@taco nst]# make -C patches patch id=P200702161
make: Entering directory `/root/nst/patches'
xsltproc -o "/root/nst/config/P200702161.sh" "xsl/nstpatch2createzip.xsl" "P200702161/nstpatch.xml";
/bin/chmod 755 "/root/nst/config/P200702161.sh";
"/root/nst/config/P200702161.sh";

### Start Time: 2007-03-09 07:54:41
+ BEGIN   + Creating patch: /root/nst/patches/P200702161-100.zip
+ SUCCESS + Removed old directory: /root/nst/tmp/nstpatch/P200702161
+ SUCCESS + Created patch build directory: /root/nst/tmp/nstpatch/P200702161
+ NOTE    + Copying 2 files/directories
+ SUCCESS + Copied: /root/nst/patches/P200702161/nstpatch.sh
+ SUCCESS + Copied: /root/nst/patches/P200702161/nsthdinstall
+ SUCCESS + Generated: README.html
+ SUCCESS + Removed old zip: /root/nst/patches/P200702161-100.zip
  adding: nsthdinstall (deflated 73%)
  adding: nstpatch.sh (deflated 73%)
  adding: README.html (deflated 69%)
/bin/rm -fr /root/nst/tmp/nstpatch/P200702161
+ SUCCESS + Created: /root/nst/patches/P200702161-100.zip
  <md5sum>cdd2e9e848aeab233ba4990a5143efde</md5sum>
+ SUCCESS + Updated MD5 value to: "5be2324440d48965bdeb9f1000649573" in: "nstpatch.xml"
+ END     + Finished creating patch: /root/nst/patches/P200702161-100.zip

Archive:  /root/nst/patches/P200702161-100.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
    78414  02-26-07 08:41   nsthdinstall
    68577  03-09-07 07:54   nstpatch.sh
     5108  03-09-07 07:54   README.html
 --------                   -------
   152099                   3 files

-------------------------------------------------------------
### End Time: 2007-03-09 07:54:42  Duration: +0000 00:00:01
printf "<?xml version=\"1.0\"?>\n\n<nstpatches posted=\"%s\">\n\n" "$(date +"%Y-%m-%d %H:%M:%S")" >| summary.xml;
for p in $(/usr/bin/find . -name "nstpatch.xml" | sort --reverse); do \
  echo "Extracting summary info from: ${p}"; \
  /usr/bin/xsltproc "xsl/nstpatch2summary.xsl" "${p}" >> summary.xml 2>/dev/null; \
done
Extracting summary info from: ./U200703091/nstpatch.xml
Extracting summary info from: ./U200703081/nstpatch.xml
Extracting summary info from: ./U200701181/nstpatch.xml
Extracting summary info from: ./U200606011/nstpatch.xml
Extracting summary info from: ./P200703092/nstpatch.xml
Extracting summary info from: ./P200703091/nstpatch.xml
Extracting summary info from: ./P200703061/nstpatch.xml
Extracting summary info from: ./P200702161/nstpatch.xml
Extracting summary info from: ./P200606051/nstpatch.xml
Extracting summary info from: ./P200606031/nstpatch.xml
Extracting summary info from: ./P200606012/nstpatch.xml
Finished building: summary.xml

Building: README.html
Finished building: README.html

make: Leaving directory `/root/nst/patches'
[root@taco nst]# make -C patches upload id=P200702161
make: Entering directory `/root/nst/patches'

... OMITTED OUTPUT ...

building file list ...
4 files to consider
P200702161-100.zip
       41472 100%    7.64MB/s    0:00:00 (xfer#1, to-check=3/4)
P200702161-100README.html
        5108 100%   49.39kB/s    0:00:00 (xfer#2, to-check=2/4)
README.html
       22710 100%  211.22kB/s    0:00:00 (xfer#3, to-check=1/4)
summary.xml
        3152 100%   29.04kB/s    0:00:00 (xfer#4, to-check=0/4)

sent 29839 bytes  received 672 bytes  4068.13 bytes/sec
total size is 72442  speedup is 2.37

... OMITTED OUTPUT ...

Succesfully updated the Web server with the NST patch/update...

make: Leaving directory `/root/nst/patches'
[root@taco nst]#