s4

changeset 757:2d45b0478d45 feature-world

s4-funcs.sh stay callable from command line
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 06 Jun 2020 16:32:45 +0900
parents a4523e15dfd6
children 369602864de8
files s4-funcs.sh
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Sat Jun 06 11:43:42 2020 +0900
     1.2 +++ b/s4-funcs.sh	Sat Jun 06 16:32:45 2020 +0900
     1.3 @@ -2,25 +2,25 @@
     1.4  # Here's global variable table.  Do not use this names.
     1.5  # $HGid$
     1.6  
     1.7 +test -n "$HTTP_HOST" && isCGI=true
     1.8 +if $isCGI; then
     1.9 +  case "$0" in
    1.10 +    *-world-*)
    1.11 +      S4WORLD=${0#*world-}
    1.12 +      S4WORLD=${S4WORLD%.*}
    1.13 +      echo S4WORLD=$S4WORLD >&2
    1.14 +      worldconf=s4-config-${S4WORLD}.sh
    1.15 +      ;;
    1.16 +  esac
    1.17  
    1.18 -case "$0" in
    1.19 -  *-world-*)
    1.20 -    S4WORLD=${0#*world-}
    1.21 -    S4WORLD=${S4WORLD%.*}
    1.22 -    echo S4WORLD=$S4WORLD >&2
    1.23 -    worldconf=s4-config-${S4WORLD}.sh
    1.24 -    ;;
    1.25 -esac
    1.26 -
    1.27 -echo worldconf=$worldconf >&2
    1.28 -[ -f s4-config.sh ] && . ./s4-config.sh
    1.29 -[ -n "$worldconf" -a -e "$worldconf" ] && . ./$worldconf
    1.30 -echo DB=$DB >&2
    1.31 -
    1.32 +  echo worldconf=$worldconf >&2
    1.33 +  [ -f s4-config.sh ] && . ./s4-config.sh
    1.34 +  [ -n "$worldconf" -a -e "$worldconf" ] && . ./$worldconf
    1.35 +  echo DB=$DB >&2
    1.36 +fi
    1.37  myname=`basename ${SCRIPT_NAME:-$0}`
    1.38  mydir=`dirname ${SCRIPT_FILENAME:-$0}`
    1.39  myargs="$@"
    1.40 -test -n "$HTTP_HOST" && isCGI=true
    1.41  PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH
    1.42  tmpdir=${TMPDIR:-tmp}
    1.43  dbdir=${DBDIR:-db}