6 CONFIG_FILE="$HOME/.xynt_install"
8 web_path="/home/nastasi/web/brosk"
10 if [ "$1" = "pkg" ]; then
11 if [ "$2" != "" ]; then
16 nam1="xynt_${tag}.tgz"
17 echo "Build packages ${nam1}."
18 read -p "Proceed [y/n]: " a
19 if [ "$a" != "y" -a "$a" != "Y" ]; then
22 git archive --format=tar --prefix=xynt-${tag}/ $tag | gzip > ../$nam1
26 if [ -f "$CONFIG_FILE" ]; then
33 echo "$1 pkg - build xynt package."
34 echo "$1 [-p outfile] [-f conffile] [-w web_dir]"
36 echo " -f use this config file"
37 echo " -p save preferences in the file"
38 echo " -w dir where place the web tree - def. \"$web_path\""
43 function get_param () {
44 echo "X$2" | grep -q "^X$1\$"
57 function searchetc() {
63 while [ "$pp" != "/" ]; do
64 if [ -d "$pp/$dname" ]; then
77 while [ $# -gt 0 ]; do
81 -f*) conffile="$(get_param "-f" "$1" "$2")"; sh=$?;;
82 -p*) outconf="$(get_param "-p" "$1" "$2")"; sh=$?;;
83 -w*) web_path="$(get_param "-w" "$1" "$2")"; sh=$?;;
84 -h) usage $0; exit 0;;
87 if [ ! -z "$conffile" ]; then
88 if [ ! -f "$conffile" ]; then
89 echo "config file [$conffile] not found"
100 echo " outconf: \"$outconf\""
101 echo " web_path: \"$web_path\""
103 if [ ! -z "$outconf" ]; then
106 echo "# Produced automatically by xynt::INSTALL.sh"
108 echo "web_path=\"$web_path\""
112 max_players=$((40 + players_n * tables_n))
116 # check for etc path existence
117 # dsta="$(dirname "$web_path")"
118 # etc_path="$(searchetc "$dsta" Etc)"
119 # if [ $? -ne 0 ]; then
120 # echo "Etc directory not found"
127 if [ -d ${web_path}.old ]; then
128 rm -rf ${web_path}.old
131 if [ -d ${web_path} ]; then
132 mv ${web_path} ${web_path}.old
135 for i in $(find web -type d | sed 's/^....//g'); do
136 install -d ${web_path}/$i
139 for i in $(find web -name '*.html' -o -name '*.php' -o -name '*.phh' -o -name '*.png' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name '.htaccess' | sed 's/^....//g'); do
140 install -m 644 "web/$i" "${web_path}/$i"
145 sed -i '/^[\t \/]*console.log.*;[\t ]*$/d' $(find ${web_path} -type f -name '*.js' -exec grep -l '^[\t /]*console.log.*;[\t ]*$' {} \;)