X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=INSTALL.sh;h=f95cf916ac2c7afff9232f6393543ce92a97a053;hb=d951bcaafbc7f0f091879d6f47043492534d2d08;hp=a82e5307c091da8843bf6bbcecc140f2ddbedd25;hpb=1532532dd4d3670d6d55560bbc3cbb0b238f74cd;p=brisk.git diff --git a/INSTALL.sh b/INSTALL.sh index a82e530..f95cf91 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -3,17 +3,25 @@ # # Defaults # +CONFIG_FILE="$HOME/.brisk_spu_install" + +apache_path="/etc/apache2/sites-available/" +apache_conf="default" + 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="brisk_spu_auth.conf.pho" +brisk_debug="0x0400" +# brisk_debug="0xffff" +web_path="/home/nastasi/web/brisk" +ftok_path="/home/nastasi/brisk-priv/ftok/brisk" +proxy_path="/home/nastasi/brisk-priv/proxy/brisk" +legal_path="/home/nastasi/brisk-priv/brisk" +cookie_path="/brisk/" +brisk_conf="brisk_spu.conf.pho" web_only="FALSE" -brisk_conf="brisk.conf.pho" + if [ "$1" = "chk" ]; then set -e @@ -49,8 +57,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 @@ -196,6 +204,8 @@ if [ $? -ne 0 ]; then exit 1 fi +IFS=' +' # # Installation # @@ -246,7 +256,7 @@ if [ "$web_only" = "FALSE" ]; then chmod 777 ${ftokk_path}/bin5 fi - for i in $(seq 0 $max_players); do + for i in $(seq 0 $((tables_n - 1))); do if [ ! -d ${ftokk_path}/bin5/table$i ]; then mkdir ${ftokk_path}/bin5/table$i fi @@ -257,26 +267,23 @@ if [ "$web_only" = "FALSE" ]; then touch ${ftokk_path}/bin5/table$i/user$e chmod 666 ${ftokk_path}/bin5/table$i/user$e done + # create subdirectories in proxy path + if [ ! -d ${proxy_path}/bin5/table$i ]; then + mkdir -p ${proxy_path}/bin5/table$i + fi done + chmod -R 777 ${proxy_path}/bin5 - # 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 +for i in $(find web -type d | sed 's/^....//g'); do install -d ${web_path}__/$i done -for i in $(find web -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' | grep -v /CVS | sed 's/^....//g'); do - install -m 644 web/$i ${web_path}__/$i +for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' | sed 's/^....//g'); do + install -m 644 "web/$i" "${web_path}__/$i" done - -cd web -find . -name '.htaccess' -exec install -m 644 {} ${web_path}__/{} \; -cd - >/dev/null 2>&1 +chmod 755 "${web_path}__/spush/brisk-spush.php" if [ $players_n -eq 5 ]; then send_time=250 @@ -290,29 +297,32 @@ sed -i "s/PLAYERS_N *= *[0-9]\+/PLAYERS_N = $players_n/g" $(find ${web_path}__ - sed -i "s/^var G_send_time *= *[0-9]\+/var G_send_time = $send_time/g" $(find ${web_path}__ -type f -name '*.js' -exec grep -l '^var G_send_time *= *[0-9]\+' {} \;) # .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 *( *'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 *( *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 *( *'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,[^)]*)' {} \;) +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',[^)]*)" {} \;) -sed -i "s@define *( *TABLES_N,[^)]*)@define(TABLES_N, $tables_n)@g" ${web_path}__/Obj/brisk.phh +sed -i "s@define *( *'TABLES_N',[^)]*)@define('TABLES_N', $tables_n)@g" ${web_path}__/Obj/brisk.phh -sed -i "s@define *( *TABLES_AUTH_N,[^)]*)@define(TABLES_AUTH_N, $tables_auth_n)@g" ${web_path}__/Obj/brisk.phh +sed -i "s@define *( *'TABLES_AUTH_N',[^)]*)@define('TABLES_AUTH_N', $tables_auth_n)@g" ${web_path}__/Obj/brisk.phh -sed -i "s@define *( *BRISK_DEBUG,[^)]*)@define(BRISK_DEBUG, $brisk_debug)@g" ${web_path}__/Obj/brisk.phh +sed -i "s@define *( *'BRISK_DEBUG',[^)]*)@define('BRISK_DEBUG', $brisk_debug)@g" ${web_path}__/Obj/brisk.phh -sed -i "s@define *( *LEGAL_PATH,[^)]*)@define(LEGAL_PATH, \"$legal_path\")@g" ${web_path}__/Obj/brisk.phh +sed -i "s@define *( *'LEGAL_PATH',[^)]*)@define('LEGAL_PATH', \"$legal_path\")@g" ${web_path}__/Obj/brisk.phh -sed -i "s@define *( *PROXY_PATH,[^)]*)@define(PROXY_PATH, \"$proxy_path\")@g" ${web_path}__/Obj/brisk.phh +sed -i "s@define *( *'PROXY_PATH',[^)]*)@define('PROXY_PATH', \"$proxy_path\")@g" ${web_path}__/Obj/brisk.phh -sed -i "s@define *( *BRISK_CONF,[^)]*)@define(BRISK_CONF, \"$brisk_conf\")@g" ${web_path}__/Obj/brisk.phh +sed -i "s@define *( *'BRISK_CONF',[^)]*)@define('BRISK_CONF', \"$brisk_conf\")@g" ${web_path}__/Obj/brisk.phh -sed -i "s@define *( *BRISK_AUTH_CONF,[^)]*)@define(BRISK_AUTH_CONF, \"$brisk_auth_conf\")@g" ${web_path}__/Obj/auth.phh +sed -i "s@define *( *'BRISK_AUTH_CONF',[^)]*)@define('BRISK_AUTH_CONF', \"$brisk_auth_conf\")@g" ${web_path}__/Obj/auth.phh -sed -i "s@var \+xhr_rd_cookiepath \+= \+\"[^\"]*\";@var xhr_rd_cookiepath = \"$cookie_path\";@g" ${web_path}__/xhr.js +sed -i "s@\( \+xhr_rd_cookiepath *: *\)\"[^\"]*\" *,@\1 \"$cookie_path\",@g" ${web_path}__/http_streaming.js sed -i "s@var \+cookiepath \+= \+\"[^\"]*\";@var cookiepath = \"$cookie_path\";@g" ${web_path}__/commons.js +document_root="$(grep DocumentRoot "${apache_path}${apache_conf}" | awk '{ print $2 }')" +sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph* + if [ -d ${web_path} ]; then mv ${web_path} ${web_path}.old fi