createReleaseInformation.bash
#!/bin/bash
#***************************************************************************************************
#                                                                                                  *
# createReleaseInformation.bash: set some variables to contain release information.                *
#                                                                                                  *
#***************************************************************************************************

#***************************************************************************************************
#                                                                                                  *
#     Copyright (C) 2003, 2004 Joerg Kunze                                                         *
#                                                                                                  *
#     This file is part of siliconBrain.                                                           *
#                                                                                                  *
#     siliconBrain is free software; you can redistribute it and/or modify                         *
#     it under the terms of the GNU General Public License as published by                         *
#     the Free Software Foundation; either version 2 of the License, or                            *
#     (at your option) any later version.                                                          *
#                                                                                                  *
#     siliconBrain is distributed in the hope that it will be useful,                              *
#     but WITHOUT ANY WARRANTY; without even the implied warranty of                               *
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                *
#     GNU General Public License for more details.                                                 *
#                                                                                                  *
#     You should have received a copy of the GNU General Public License                            *
#     along with this program; if not, write to the Free Software                                  *
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                    *
#                                                                                                  *
#***************************************************************************************************

siliconBrainRelease='$siliconBrainRelease: 0.2.3 $'
siliconBrainRcsIdentifier='$Id: createReleaseInformation.bash,v 1.26 2004/12/14 23:31:26 joerg Exp $'
siliconBrainSaveStamp='$siliconBrainSaveStamp: 2004/12/14 22:25:21, Joerg Kunze$'

#***************************************************************************************************
#                                                                                                  *
# defineVariable:                                                                                  *
#                                                                                                  *
#***************************************************************************************************
function defineVariable {
   local variable=$1
   shift
   eval "$variable=\"$*\""
   variables="$variables $variable"
}

#***************************************************************************************************
#                                                                                                  *
# main:                                                                                            *
#                                                                                                  *
#***************************************************************************************************

#----------------------#
# detect output format #
#----------------------#
case $1 in
--texinfo )
   emcasTypeIdentifier="@c -*-texinfo-*-"
   comment="@c"
   function variableDefinition {
      echo "@set $1 $2"
   };;

--bash )
   emcasTypeIdentifier="#!/bin/bash"
   comment="#"
   function variableDefinition {
      echo "$1=\"$2\""
   };;

--perl )
   emcasTypeIdentifier="#!/usr/bin/perl"
   comment="#"
   function variableDefinition {
      echo "\$$1=\"$2\";"
   };;

* )
   echo "invalid output format specification: \"$1\"" >&2
   exit 42
esac

export TZ=UTC0

defineVariable releaseFile             "RELEASE"
defineVariable release                 "$(<$releaseFile)"
defineVariable releaseWithUnderscores  "$(echo $release | tr '.' '_')"
defineVariable releasePackageName      "${siliconBrainPackageName}_$releaseWithUnderscores"
defineVariable releaseArchive          "$releasePackageName.tar.gz"
defineVariable releaseDate             "$(date --universal '+%A %B %d %T %Y')"
defineVariable siliconBrainPackageName "$siliconBrainPackageName"

echo "$emcasTypeIdentifier"

formatHeader "$comment"                 \
   "$siliconBrainRelease"               \
   "$releaseFile"                       \
   "$siliconBrainSaveStamp"             \
   "central definition of all release information" \
   "$siliconBrainRelease"               \
   "$siliconBrainRcsIdentifier"         \
   "$siliconBrainSaveStamp"

for variable in $variables; do
   eval "variableDefinition \$variable \"\$$variable\""
done

# $Log: createReleaseInformation.bash,v $
# Revision 1.26  2004/12/14 23:31:26  joerg
# published for new release 0.2.3
#
# Revision 1.25  2004/12/14 23:17:05  joerg
# published for new release 0.2.2
#
# Revision 1.24  2004/12/14 22:42:22  joerg
# allFiles: all sources have a Log CVS keyword at the end now.
#