Tag Archives: unix

Quick Unix helper for updating Jazz profile*.ini files

When you are deploying to WebSphere there are a number of paths that need to be configured as fully qualified or absolute paths, since the JVM is now running from the WebSphere directory instead of the local Tomcat install. One of those paths is for the provision profiles in order to load the OSGI runtime environment from the update sites. It is not a bad practice to do this regardless as it will work anywhere once properly configured, so even for a Tomcat only install this will work just fine. I’ll show how I use it in a later post where I give an example of a shared update site location for multiple servers.

This can be a pain to update them and make sure that they have been updated correctly, hence the idea for spending a few extra minutes creating a re-usable script instead of just wasting my time doing this operation manually every time it comes up.

The script is not horribly complex, just setup a few variables about your current deployment, and it will iterate each context root and each corresponding profile*.ini file.

#!/bin/bash

## Script variables
TSTAMP=`date +%s`

## Environment variables
## TODO: Update to match your local environment.
JAZZ_HOME=/opt/IBM/3010/JazzTeamServer
JAZZ_CONF=${JAZZ_HOME}/server/conf
CONTEXT_ROOTS=(jts ccm qm rm)

function update {

    for i in "${CONTEXT_ROOTS[@]}"
    do
        echo "Working on context root: $i "

	PP_BAKS=${JAZZ_CONF}/${i}/provision_profiles.${TSTAMP}
	REPL_PATTERN=$(echo "file://$JAZZ_CONF/$i/sites" | perl -lpe 's/\//\\\//g')
	echo $REPL_PATTERN	

	mkdir ${PP_BAKS}

	for ppfile in ${JAZZ_CONF}/${i}/provision_profiles/*.ini
	do
	    cp ${ppfile} ${PP_BAKS}
# here is the magic, could probably be a magic one-liner
	    cat ${PP_BAKS}/`basename ${ppfile}` | sed -e "s/file\:${i}\/sites/$REPL_PATTERN/g" > ${ppfile}
	    echo "Update diff for [${ppfile}] and [${PP_BAKS}/${ppfile}]"
	    diff ${ppfile} ${PP_BAKS}/${ppfile}
	done

    done
}

function restore {
    restore_timestamp=$1

    for i in "${CONTEXT_ROOTS[@]}"
    do
	restore_from_dir=${JAZZ_CONF}/${i}/provision_profiles.${restore_timestamp}
	if [ -d ${restore_from_dir} ]
	then
	    mv ${restore_from_dir} ${JAZZ_CONF}/${i}/provision_profiles
	else
	    echo "Could not restore [${restore_from_dir}], directory does not exist."
	fi
    done
}

function usage {
cat <  [options]
	  $0 update
	  $0 restore 
USAGE

}

# main entry point
case "$1" in
    update)
	echo "update"
        update
        ;;
    restore)
        echo "restore to timestamp $2"
        restore $2
        ;;
    *)
        echo "Unknown input: [$0 $@]"
        usage
        ;;
esac

Well that is it, give it a try, it backs up your old files and even gives you a way to go back to them if you break something :)

Installing OpenBSD 4.8 on a Soekris 5501

I tried to do the install via a direct install to the CF via a USB media reader on my laptop, that gave me the runaround for a bit, turns out most USB style CF card readers work but I managed to find one that does not [5].

Turns out I was just being a dummy, and using the bsd.rd from my local amd64 install and not the i386 one I should have been using, swapped those out and the rest of the install is standard fare OpenBSD. To get the setup working I found a pretty solid guide [1] that is a few years old but gives a pretty good start to finish view of the process. I ended up setting up an OpenBSD image in VirtualBox and exposing it via bridged networking so I could access it via the rest of my network. On that machine I installed tftp and ftp, and used my existing router to point at there [2]. As for the actual install see the instructions for the best up to date guidance [7], once the pxeboot part is out of the way the install proceeds as expected, depending on the size of your media select your options appropriately, if the drive is under 2G you may have to be more careful.  In this case I am using an 8G Seagate ST1.2 CF microdrive, so it is less of an issue of space, but still an issue of minimizing read/write cycles but that we don’t really deal with that until after the install.

Once the OS is installed we can reboot, and double check the ComBios settings to set the correct boot device [3] [4] so it boots back up automatically in the future.  Now back into OpenBSD we want to address the fact that we are on a Compact Flash drive, essentially we want to setup a read-only filesystem [8]. I stumbled across a number of implementations of this using mfs [6] which provides a in memory virtual disk to perform the majority of the reading and writing. I ‘ll be following up on that in another post when I can dig into mfs and start configuring this little baby to take over my networks heavy lifting, stay tuned…

[[9]] Installing OpenBSD 3.9 on a Soekris 4801 - http://blog.postmaster.gr/2006/05/08/installing-openbsd-3-9-on-a-soekris-4801/ [[9]]

Footnotes    (↵ returns to text)
  1. Flasdist CF card readers supported –  http://www.nmedia.net/flashdist/flashadapter-whatworks.html
  2. OpenBSD network install instructions  -  http://www.stsx.org/openbsd/obsd-bootsoekris.html
  3. Setting up PXEBoot on a Tomato based router –  http://www.seephar.com/2008/09/pxe-boot-with-tomato/
  4. OpenBSD 4.8 Installation Guide - http://www.openbsd.org/faq/faq4.html
  5.  Installing OpenBSD on a Soekris 4801 - http://www.packetwatch.net/documents/guides/2007041201.php
  6. Running OpenBSD 4.2 on the Soekris net 5501 -  http://bsd.dischaos.com/2008/04/28/running-openbsd-42-on-the-soekris-net-5501/
  7.  OpenBSD Soekris Read Only Root -  http://wtf.hijacked.us:8080/wiki/index.php/OpenBSD_Soekris_Read_Only_Root
  8. OpenBSD on Soekris — A Cheater’s Guide - http://blog.spoofed.org/2007/12/openbsd-on-soekris-cheaters-guide.html