Subversion Repositories DevTools

Rev

Rev 7299 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/bash
########################################################################
#
#   JATS Post Installation Setup for SOLARIS/LINUX
#
#   This command is to be executed in the directory in which it is found
#
#   Note: This MUST be a UNIX format file, not a DOS formatted file
#
#   The script may be called automatically when the package is released
#   into dpkg_archive. If this is then three arguments will be provided:
#       archive - name of the archive
#       name    - Name of this package
#       version - version of this package
#   This installer will create a symlink in the parent directory to 
#   assist in the timely rollout of a new version of jats.
#       The script will create a symlink from jats2_new to this version
#
#       Every night a cronjob on hte master package server will run to
#       update the jats2_current symlink, from the jats2_new symlink
#   
########################################################################
#
#
#   Sanity test
#
echo "JATS setup"
if [ ! -d ./TOOLS ] ; then
    echo "ERROR: TOOLS directory not found"
    exit 1
fi

#
#   Ensure some essential scripts are not in DOS format
#   The TOOLS/*.pl file conversion will ensure that pod2usage() operates
#
for file in ./TOOLS/armerge ./BIN.*/links.sh $( find ./TOOLS -name *.pl ); do
    chmod +w $file
    dos2unix -ascii $file $file 2>/dev/null
    chmod -w $file 2>/dev/null
done

#
#   Make executables executable
#
chmod -fR a+x ./TOOLS 2>/dev/null
chmod -fR a+x ./BIN.* 2>/dev/null

#
#   Release links for all targets.
#
for dir in ./BIN.*; do
    if [ -d $dir ] ; then
        cd $dir
        echo "Processing links in $dir"
        [ -f ./links.sh ] && sh ./links.sh
        cd - > /dev/null
    fi
done

#
#   Possibly - if run by the build system
#       Must have at least 3 args
#       3rd arg must be this version of the package    
#   Create a symlink in the parent diretory to this version
#
if [ $# -ge 3 ]; then
    thisVer=${PWD##*/}
    if [ "$3" = "$thisVer" ] ; then
        echo "Creating jats2_new symlink to $thisVer"
        pushd .. >/dev/null
        rm -f jats2_new
        ln -s $thisVer jats2_new
        popd >/dev/null
    fi
fi

echo "JATS setup complete"