Annotation of pkgsrc/www/cppcms/patches/patch-bin_cppcms__run, revision 1.1

1.1     ! joerg       1: $NetBSD$
        !             2: 
        !             3: --- bin/cppcms_run.orig        2013-01-02 22:26:03.000000000 +0000
        !             4: +++ bin/cppcms_run
        !             5: @@ -1,4 +1,4 @@
        !             6: -#!/usr/bin/env bash
        !             7: +#!/bin/sh
        !             8:  
        !             9:  ############################################################################
        !            10:  #                                                                             
        !            11: @@ -8,8 +8,7 @@
        !            12:  #
        !            13:  ############################################################################
        !            14:  
        !            15: -locate_server()
        !            16: -{
        !            17: +locate_server() {
        !            18:        NAME=$1
        !            19:        if [ "$WEB_SERVER" != "" ] ; then
        !            20:                return
        !            21: @@ -29,7 +28,7 @@ locate_server()
        !            22:                        return
        !            23:                fi
        !            24:        done
        !            25: -      if [ "$2" == "exit" ] ; then
        !            26: +      if [ "$2" = "exit" ] ; then
        !            27:                echo "Failed to locate server $NAME, exitting"
        !            28:                echo "Try providing PATH valiable"
        !            29:                exit 1
        !            30: @@ -39,7 +38,7 @@ locate_server()
        !            31:  lighttpd() {
        !            32:  
        !            33:  locate_server lighttpd $1
        !            34: -[ "$WEB_SERVER" == "" ] && return
        !            35: +[ "$WEB_SERVER" = "" ] && return
        !            36:  
        !            37:  CONFIG_FILE=$DIR/lighty.conf
        !            38:  
        !            39: @@ -47,7 +46,7 @@ case $API in
        !            40:        fastcgi) ;;
        !            41:        scgi) ;;
        !            42:        http)   if [ "$SOCKET" != "" ]; then
        !            43: -                      if [ "$1" == "exit" ]; then
        !            44: +                      if [ "$1" = "exit" ]; then
        !            45:                                echo "http is supported over TCP/IP only" ; exit 1 
        !            46:                        else
        !            47:                                WEB_SERVER=""
        !            48: @@ -57,7 +56,7 @@ case $API in
        !            49:  
        !            50:                ;;
        !            51:        *) 
        !            52: -              if [ "$1" == "exit" ]; then
        !            53: +              if [ "$1" = "exit" ]; then
        !            54:                        echo "Mod $API is not supported by lightppd" ; exit 1 
        !            55:                else
        !            56:                        WEB_SERVER=""
        !            57: @@ -66,7 +65,7 @@ case $API in
        !            58:        ;;
        !            59:  esac
        !            60:  
        !            61: -if [ "$API" == "http" ]; then
        !            62: +if [ "$API" = "http" ]; then
        !            63:        LIGHTTPD_MODULE=proxy
        !            64:  else
        !            65:        LIGHTTPD_MODULE=$API
        !            66: @@ -175,12 +174,12 @@ nginx()
        !            67:  
        !            68:  locate_server nginx $1
        !            69:  
        !            70: -[ "$WEB_SERVER" == "" ] && return
        !            71: +[ "$WEB_SERVER" = "" ] && return
        !            72:  
        !            73:  case $API in
        !            74:        fastcgi) ;;
        !            75:        scgi)   if [ "$HTTP_HEADERS" != "true" ] ; then
        !            76: -                      if [ "$1" == "exit" ]; then
        !            77: +                      if [ "$1" = "exit" ]; then
        !            78:                                echo "service.generate_http_headers is false, nginx SCGI module requires it to be set to true"
        !            79:                                exit 1
        !            80:                        else
        !            81: @@ -190,7 +189,7 @@ case $API in
        !            82:                fi
        !            83:                ;;
        !            84:        http)   if [ "$SOCKET" != "" ]; then
        !            85: -                      if [ "$1" == "exit" ]; then
        !            86: +                      if [ "$1" = "exit" ]; then
        !            87:                                echo "http is supported over TCP/IP only" ; exit 1 
        !            88:                        else
        !            89:                                WEB_SERVER=""
        !            90: @@ -200,8 +199,8 @@ case $API in
        !            91:  
        !            92:                ;;
        !            93:        *) 
        !            94: -              if [ "$1" == "exit" ]; then
        !            95: -                      echo "Mod $API is not supported by lightppd" ; exit 1 
        !            96: +              if [ "$1" = "exit" ]; then
        !            97: +                      echo "Mod $API is not supported by nginx" ; exit 1 
        !            98:                else
        !            99:                        WEB_SERVER=""
        !           100:                        return
        !           101: @@ -289,7 +288,7 @@ http {
        !           102:          }
        !           103:  EOF
        !           104:  
        !           105: -if [ "$API" == "fastcgi" ]; then 
        !           106: +if [ "$API" = "fastcgi" ]; then 
        !           107:  
        !           108:  cat >>$CONFIG_FILE <<EOF
        !           109:  
        !           110: @@ -319,7 +318,7 @@ cat >>$CONFIG_FILE <<EOF
        !           111:        }
        !           112:  EOF
        !           113:  
        !           114: -elif [ "$API" == "scgi" ] ; then
        !           115: +elif [ "$API" = "scgi" ] ; then
        !           116:  
        !           117:  cat >>$CONFIG_FILE <<EOF
        !           118:  
        !           119: @@ -370,8 +369,7 @@ WEB_SERVER="$WEB_SERVER -c $CONFIG_FILE"
        !           120:  }
        !           121:  
        !           122:  
        !           123: -apache()
        !           124: -{
        !           125: +apache() {
        !           126:  
        !           127:  locate_server apache2
        !           128:  locate_server httpd2 
        !           129: @@ -379,8 +377,8 @@ locate_server apache
        !           130:  locate_server httpd $1
        !           131:  
        !           132:  
        !           133: -[ "$WEB_SERVER" == "" ] && return
        !           134: -if [ "$APACHE_MOD_DIR" == "" ] ; then
        !           135: +[ "$WEB_SERVER" = "" ] && return
        !           136: +if [ "$APACHE_MOD_DIR" = "" ] ; then
        !           137:        for p in /usr/lib/apache2/modules \
        !           138:                 /usr/local/lib/apache2/modules \
        !           139:                 /opt/lib/apache2/modules \
        !           140: @@ -419,8 +417,8 @@ if [ "$APACHE_MOD_DIR" == "" ] ; then
        !           141:        done
        !           142:  fi
        !           143:  
        !           144: -if [ "$APACHE_MOD_DIR" == "" ] ; then
        !           145: -      if [ "$1" == "exit" ] ; then
        !           146: +if [ "$APACHE_MOD_DIR" = "" ] ; then
        !           147: +      if [ "$1" = "exit" ] ; then
        !           148:                echo "Can't find apache modules directory try specifing APACHE_MOD_DIR"
        !           149:                exit 1;
        !           150:        else
        !           151: @@ -430,8 +428,8 @@ if [ "$APACHE_MOD_DIR" == "" ] ; then
        !           152:  fi
        !           153:  
        !           154:  
        !           155: -if ! [ -f "$APACHE_MOD_DIR/mod_fastcgi.$APACHE_MOD_EXT" ] && [ "$API" == "fastcgi" ]; then
        !           156: -      if [ "$1" == "exit" ] ; then 
        !           157: +if ! [ -f "$APACHE_MOD_DIR/mod_fastcgi.$APACHE_MOD_EXT" ] && [ "$API" = "fastcgi" ]; then
        !           158: +      if [ "$1" = "exit" ] ; then 
        !           159:                echo "Can't find apache fastcgi modue"
        !           160:                exit 1
        !           161:        else
        !           162: @@ -439,8 +437,8 @@ if ! [ -f "$APACHE_MOD_DIR/mod_fastcgi.$
        !           163:        fi
        !           164:  fi
        !           165:  
        !           166: -if ! [ -f "$APACHE_MOD_DIR/mod_scgi.$APACHE_MOD_EXT" ] && [ "$API" == "scgi" ]; then
        !           167: -      if [ "$1" == "exit" ] ; then 
        !           168: +if ! [ -f "$APACHE_MOD_DIR/mod_scgi.$APACHE_MOD_EXT" ] && [ "$API" = "scgi" ]; then
        !           169: +      if [ "$1" = "exit" ] ; then 
        !           170:                echo "Can't find apache scgi modue"
        !           171:                exit 1
        !           172:        else
        !           173: @@ -448,8 +446,8 @@ if ! [ -f "$APACHE_MOD_DIR/mod_scgi.$APA
        !           174:        fi
        !           175:  fi
        !           176:  
        !           177: -if ! [ -f "$APACHE_MOD_DIR/mod_proxy_http.$APACHE_MOD_EXT" ] && [ "$API" == "http" ]; then
        !           178: -      if [ "$1" == "exit" ] ; then 
        !           179: +if ! [ -f "$APACHE_MOD_DIR/mod_proxy_http.$APACHE_MOD_EXT" ] && [ "$API" = "http" ]; then
        !           180: +      if [ "$1" = "exit" ] ; then 
        !           181:                echo "Can't find apache proxy_http modue"
        !           182:                exit 1
        !           183:        else
        !           184: @@ -457,8 +455,8 @@ if ! [ -f "$APACHE_MOD_DIR/mod_proxy_htt
        !           185:        fi
        !           186:  fi
        !           187:  
        !           188: -if [ "$API" == "scgi" ] && [ "$SOCKET" != "" ]; then
        !           189: -      if [ "$1" == "exit" ] ; then 
        !           190: +if [ "$API" = "scgi" ] && [ "$SOCKET" != "" ]; then
        !           191: +      if [ "$1" = "exit" ] ; then 
        !           192:                echo "Apache2 supports scgi over tcp sockets only"
        !           193:                exit 1
        !           194:        else
        !           195: @@ -514,7 +512,7 @@ cat >$DIR/apache.conf << EOF
        !           196:        LoadModule mime_module $APACHE_MOD_DIR/mod_mime.$APACHE_MOD_EXT
        !           197:  EOF
        !           198:  
        !           199: -if [ "$API" == "fastcgi" ];
        !           200: +if [ "$API" = "fastcgi" ];
        !           201:  then
        !           202:  
        !           203:  
        !           204: @@ -529,7 +527,7 @@ cat >>$DIR/apache.conf <<EOF
        !           205:  EOF
        !           206:  
        !           207:  
        !           208: -elif [ "$API" == "scgi" ];
        !           209: +elif [ "$API" = "scgi" ];
        !           210:  then
        !           211:  
        !           212:  
        !           213: @@ -538,7 +536,7 @@ cat >>$DIR/apache.conf <<EOF
        !           214:        SCGIMount $SCRIPT $SERVICE_IP:$SERVICE_PORT
        !           215:  EOF
        !           216:  
        !           217: -elif [ "$API" == "http" ]; 
        !           218: +elif [ "$API" = "http" ]; 
        !           219:  then
        !           220:  
        !           221:  
        !           222: @@ -559,8 +557,7 @@ WEB_SERVER="$WEB_SERVER -f $DIR/apache.c
        !           223:  
        !           224:  }
        !           225:  
        !           226: -find_param()
        !           227: -{
        !           228: +find_param() {
        !           229:        if [ -e ./cppcms_config_find_param ]; then
        !           230:                ./cppcms_config_find_param $2 $1
        !           231:        else
        !           232: @@ -568,8 +565,7 @@ find_param()
        !           233:        fi
        !           234:  }
        !           235:  
        !           236: -help()
        !           237: -{
        !           238: +help() {
        !           239:        echo "Usage cppcms_run [-e] [ -S server ] [-p port] [-h host] \\"
        !           240:        echo "                 [-r /document/root ] [-s /script ]"
        !           241:        echo "                 program -c config.txt [ additional parameters ]"
        !           242: @@ -593,21 +589,21 @@ PORT=8080
        !           243:  ROOT=`pwd`
        !           244:  
        !           245:  while ! [ -e "$1" ] ; do
        !           246: -      if [ "$1" == "-s" ] ;  then
        !           247: +      if [ "$1" = "-s" ] ;  then
        !           248:                SCRIPT="$2"
        !           249:                shift
        !           250: -      elif [ "$1" == "-S" ] ; then
        !           251: +      elif [ "$1" = "-S" ] ; then
        !           252:                TRY_SETUP="$2"
        !           253:                shift
        !           254: -      elif [ "$1" == "-h" ]; then
        !           255: +      elif [ "$1" = "-h" ]; then
        !           256:                HOST="$2"
        !           257:                shift
        !           258: -      elif [ "$1" == "-p" ]; then
        !           259: +      elif [ "$1" = "-p" ]; then
        !           260:                PORT="$2";
        !           261:                shift
        !           262: -      elif [ "$1" == "-e" ]; then
        !           263: +      elif [ "$1" = "-e" ]; then
        !           264:                NO_APP=yes
        !           265: -      elif [ "$1" == "-r" ]; then
        !           266: +      elif [ "$1" = "-r" ]; then
        !           267:                ROOT="$2"
        !           268:                shift
        !           269:        else
        !           270: @@ -618,13 +614,13 @@ done
        !           271:  
        !           272:  PROGRAM="$1"
        !           273:  
        !           274: -if [ "$2" != "-c" ] || [ "$3" == "" ] ; then
        !           275: +if [ "$2" != "-c" ] || [ "$3" = "" ] ; then
        !           276:        help
        !           277:  fi
        !           278:  
        !           279:  APP_CONFIG_FILE="$3"
        !           280:  
        !           281: -if [ "$SCRIPT" == "" ] ; then
        !           282: +if [ "$SCRIPT" = "" ] ; then
        !           283:        SCRIPT="/$PROGRAM"
        !           284:  fi
        !           285:  
        !           286: @@ -636,17 +632,17 @@ SERVICE_PORT=`find_param $APP_CONFIG_FIL
        !           287:  API=`find_param $APP_CONFIG_FILE service.api`
        !           288:  HTTP_HEADERS=`find_param $APP_CONFIG_FILE service.generate_http_headers`
        !           289:  
        !           290: -if [ "$API" == "" ] ; then
        !           291: +if [ "$API" = "" ] ; then
        !           292:        echo "Can't find service.api or service.socket in $APP_CONFIG_FILE"
        !           293:        echo "Aborting"
        !           294:        exit 1
        !           295:  fi
        !           296:  
        !           297: -if [ "$SERVICE_IP" == "" ]; then
        !           298: +if [ "$SERVICE_IP" = "" ]; then
        !           299:        SERVICE_IP=127.0.0.1
        !           300:  fi
        !           301:  
        !           302: -if [ "$SOCKET" == "" ] && [ "$SERVICE_PORT" == "" ] ; then
        !           303: +if [ "$SOCKET" = "" ] && [ "$SERVICE_PORT" = "" ] ; then
        !           304:        echo "Can't find service.socket or service.ip and service.port in $APP_CONFIG_FILE"
        !           305:        echo "Aborting"
        !           306:        exit 1
        !           307: @@ -682,9 +678,9 @@ if [ "$TRY_SETUP" != "" ]; then
        !           308:        esac
        !           309:  else
        !           310:        lighttpd 
        !           311: -      [ "$WEB_SERVER" == "" ] && nginx
        !           312: -      [ "$WEB_SERVER" == "" ] && apache 
        !           313: -      if [ "$WEB_SERVER" == "" ]; then
        !           314: +      [ "$WEB_SERVER" = "" ] && nginx
        !           315: +      [ "$WEB_SERVER" = "" ] && apache 
        !           316: +      if [ "$WEB_SERVER" = "" ]; then
        !           317:                echo "Can't find sutiable web server (nginx/lighttpd/apache)"
        !           318:                echo "You may try to change PATH variable. In case of Apache2"
        !           319:                echo "You may want to define APACHE_MOD_DIR variable"

CVSweb <webmaster@jp.NetBSD.org>