add CONFIGFILE and .brosk_install config file
[brisk.git] / INSTALL.sh
index 9864b2e..e2f2b51 100755 (executable)
@@ -3,17 +3,22 @@
 #
 # Defaults
 #
+CONFIG_FILE="$HOME/.brosk_install"
+
 players_n=3
-tables_n=16
-tables_auth_n=6
-brisk_auth_conf="brisk_auth2.conf.pho"
-brisk_debug="0xffff"
-web_path="$HOME/brisk"
-legal_path="$HOME/brisk-priv"
-ftok_path="$HOME/brisk-priv/ftok"
-proxy_path="$HOME/brisk-priv/proxy"
+tables_n=44
+tables_auth_n=12
+brisk_auth_conf="brosk_auth.conf.pho"
+brisk_debug="0x0400"
+# brisk_debug="0xffff"
+web_path="/home/nastasi/web/brosk"
+ftok_path="/home/nastasi/brisk-priv/ftok/brosk"
+proxy_path="/home/nastasi/brisk-priv/proxy/brosk"
+legal_path="/home/nastasi/brisk-priv/brosk"
+cookie_path="/brosk/"
+brisk_conf="brosk.conf.pho"
 web_only="FALSE"
-brisk_conf="brisk.conf.pho"
+
 
 if [ "$1" = "chk" ]; then
     set -e
@@ -49,8 +54,8 @@ if [ "$1" = "pkg" ]; then
     exit 0
 fi
     
-if [ -f $HOME/.brisk_install ]; then
-   . $HOME/.brisk_install
+if [ -f "$CONFIG_FILE" ]; then
+   source "$CONFIG_FILE"
 fi
 
 if [ "x$cookie_path" = "x" ]; then
@@ -183,6 +188,8 @@ if [ ! -z "$outconf" ]; then
     echo "web_only=\"$web_only\""
   ) > "$outconf"
 fi
+
+max_players=$((40 + players_n * tables_n))
 #
 #  Pre-check
 #
@@ -234,14 +241,34 @@ if [ "$web_only" = "FALSE" ]; then
     chmod 666 ${ftokk_path}/warrant
     touch ${ftokk_path}/poll
     chmod 666 ${ftokk_path}/poll
-    for i in $(seq 0 99); do 
-        touch ${ftokk_path}/table$i
-        chmod 666 ${ftokk_path}/table$i
-    done
-    for i in $(seq 0 299); do
+    for i in $(seq 0 $max_players); do
         touch ${ftokk_path}/user$i
         chmod 666 ${ftokk_path}/user$i
     done
+
+    if [ ! -d ${ftokk_path}/bin5 ]; then
+        mkdir ${ftokk_path}/bin5
+        chmod 777 ${ftokk_path}/bin5
+    fi
+
+    for i in $(seq 0 $max_players); do
+        if [ ! -d ${ftokk_path}/bin5/table$i ]; then
+            mkdir ${ftokk_path}/bin5/table$i
+        fi
+        chmod 777 ${ftokk_path}/bin5/table$i
+        touch ${ftokk_path}/bin5/table$i/table
+        chmod 666 ${ftokk_path}/bin5/table$i/table
+        for e in $(seq 0 4); do
+            touch ${ftokk_path}/bin5/table$i/user$e
+            chmod 666 ${ftokk_path}/bin5/table$i/user$e
+        done
+    done
+
+    # create subdirectories in proxy path
+    if [ ! -d ${proxy_path}/bin5 ]; then
+        mkdir ${proxy_path}/bin5
+    fi
+    chmod 777 ${proxy_path}/bin5
 fi
 install -d ${web_path}__
 for i in $(find web -type d | grep -v /CVS | sed 's/^....//g'); do
@@ -270,7 +297,7 @@ sed -i "s/^var G_send_time *= *[0-9]\+/var G_send_time = $send_time/g" $(find ${
 # .ph[pho] substitutions
 sed -i "s/define *( *PLAYERS_N, *[0-9]\+ *)/define(PLAYERS_N, $players_n)/g" $(find ${web_path}__ -type f -name '*.ph*' -exec grep -l 'define *( *PLAYERS_N, *[0-9]\+ *)' {} \;)
 
-sed -i "s/define *( *BRISKIN5_PLAYERS_N, *[0-9]\+ *)/define(BRISKIN5_PLAYERS_N, $players_n)/g" $(find ${web_path}__ -type f -name '*.ph*' -exec grep -l 'define *( *BRISKIN5_PLAYERS_N, *[0-9]\+ *)' {} \;)
+sed -i "s/define *( *BIN5_PLAYERS_N, *[0-9]\+ *)/define(BIN5_PLAYERS_N, $players_n)/g" $(find ${web_path}__ -type f -name '*.ph*' -exec grep -l 'define *( *BIN5_PLAYERS_N, *[0-9]\+ *)' {} \;)
 
 sed -i "s@define *( *FTOK_PATH,[^)]*)@define(FTOK_PATH, \"$ftok_path\")@g" $(find ${web_path}__ -type f -name '*.ph*' -exec grep -l 'define *( *FTOK_PATH,[^)]*)' {} \;)