#! /bin/sh # # newpkg # # Shell script to create a directory for a new package and/or make the # link from the include/ area in a test release under the BaBar code system # # Glenn Cooper May 1997 # # Function: # # If they don't already exist, then: # - create the named directory; # - copy in an example GNUmakefile, with 'foo' replaced by ; # - make a link in the include/ area to the new package. # # Options: # # Arguments: # package name # ################################################################ USAGE="Usage: $0 [package]" # check for correct number of arguments if [ "$#" -ne 1 ]; then echo "Sorry, I only understand one argument." echo $USAGE exit 2 fi package=$1 ############################################################### #-> create the directory for the package if it doesn't already exist if [ -d $package ]; then echo "New package subdirectory $package already exists." else mkdir $package; fi #-> if there isn't already a GNUmakefile in $package, copy in an example if [ -r $package/GNUmakefile ]; then echo "File $package/GNUmakefile already exists." else sed -e "s/foo/$package/g" $BFDIST/releases/$BFCURRENT/SoftRelTools/GNUmakefile.example > $package/GNUmakefile fi #-> create the include link if [ -L include/$package ]; then rm -f include/$package fi if [ -d $package/$package ]; then ln -s ../$package/$package include/$package elif [ -d $package/include ]; then ln -s ../$package/include include/$package elif [ -d $package/src ]; then ln -s ../$package/src include/$package else ln -s ../$package/ include/$package fi