#!/bin/sh 
#
#
# For Linux:
#    - Generate mpi modules
#    - Generate and store checkpoint key
#    - BSR support configuration

# Generate mpi modules
  gen_xlf=`grep PE_LATEST_LEVEL /etc/ppe.cfg | cut -f2 -d ' ' `/mpich2/sbin/xlf_gen_mpimod
  if [ -x $gen_xlf ] ; then
      $gen_xlf
  fi

if [ ! -z "$NODESETSTATE" ]; then
    if [ "$NODESETSTATE" != "netboot" ] || [ "$NODESETSTATE" != "statelite" ]; then
        /sbin/srcmstr &
        stopsrc -s pnsd
        startsrc -s pnsd
    fi
fi

#Generate checkpoint key and store it into the image, ckpt script could ust it after boot.
#    KEY=$(dd if=/dev/random count=1 2>/dev/null | sha1sum | awk '{print $1}')
#    echo $KEY > /root/.ckpt.key
#    chmod 400   /root/.ckpt.key
#

# BSR configuration, uncomment the following lines to enable BSR configuration on Power Linux cluster.  
#        groupadd bsr
#        mkdir -p /var/lib/bsr
#        chown root:bsr /var/lib/bsr
#        chmod g+sw /var/lib/bsr


# pelinks script support, uncomment the following lines and change to the correct pe version that you intend to use.
#PE_VERSION=1202
#    if [ -f "/proc/cmdline" ]; then
#        MP_CONFIG=$PE_VERSION /opt/ibmhpc/pe$PE_VERSION/ppe.poe/bin/pelinks
#    fi
