"Fossies" - the Fresh Open Source Software Archive

Member "citadel/scripts/mk_svn_revision.sh" (5 Jun 2021, 1415 Bytes) of package /linux/www/citadel.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 #
    3 # Script to generate svn_revision.c
    4 #
    5 
    6 ECHO=/usr/bin/printf
    7 
    8 
    9 SCRIPT_DIR=`dirname $0`
   10 SRC_DIR=`dirname $SCRIPT_DIR`
   11 CUR_DIR=`pwd`
   12 C_FILE="$CUR_DIR/svn_revision.c"
   13 H_FILE="$CUR_DIR/svn_revision.h"
   14 
   15 # determine if this code base came from subversion.
   16 if test -d $SRC_DIR/.svn  ; then
   17     echo "have subversion repository"
   18     SVNVERSION=`which svnversion`
   19     if test -x $SVNVERSION  ; then
   20         echo "have svnversion at $SVNVERSION"
   21         BUILD=`svnversion -n .`
   22         echo "This code base svn-revision: $BUILD"
   23         CAN_BUILD_SVN_REVISION="yes"
   24     fi
   25 else 
   26     if test -d $SRC_DIR/../.git  ; then
   27     echo "have Git repository."
   28     BUILD=`/usr/bin/git log -1 --pretty=%h . `
   29     echo "This code base git-revision: $BUILD"
   30     CAN_BUILD_SVN_REVISION="yes"
   31     else
   32     if test -f $C_FILE; then
   33         exit
   34     fi
   35     fi
   36 fi
   37 
   38 if [ "$CAN_BUILD_SVN_REVISION" = "yes" ] ; then
   39 
   40 cat <<EOF > $C_FILE
   41 /*
   42  * Subversion / GIT revision functions
   43  *
   44  * Autogenerated at make/release time
   45  *
   46  * Do not modify this file
   47  *
   48  */
   49  
   50 const char *svn_revision (void)
   51 {
   52     const char *SVN_Version = "$BUILD";
   53     return SVN_Version;
   54 }
   55 EOF
   56 
   57 elif test ! -f $C_FILE  ; then
   58 
   59 cat <<EOF > $C_FILE
   60 /*
   61  * Subversion / GIT revision functions
   62  *
   63  * Autogenerated at make time
   64  *
   65  * There should have been one with your source distribution
   66  *
   67  * Do not modify this file
   68  *
   69  */
   70  
   71 const char *svn_revision (void)
   72 {
   73     const char *SVN_Version = "(unknown)";
   74     return SVN_Version;
   75 }
   76 EOF
   77 
   78 fi