#!/bin/sh
-SRC_DIR=stg-2.4-`date "+%Y.%m.%d-%H.%M.%S"`
+if [ "$1" != "" ]
+then
+ SRC_DIR="$1"
+else
+ PREFIX="stg-2.4"
+ SRC_DIR=$(date "+${PREFIX}-%Y.%m.%d-%H.%M.%S")
+fi
+
ARC_NAME=$SRC_DIR.tar.gz
-git clone git://madf.dyndns.org/stg.git $SRC_DIR
+git clone git@stg.codes:stg.git -b stg-2.409 $SRC_DIR
+
+if [ $? != 0 ]
+then
+ echo "Failed to clone repository"
+ exit -1
+fi
-rm -r $SRC_DIR/.git
+rm -rf $SRC_DIR/.git
+rm -f $SRC_DIR/.gitignore
rm -r $SRC_DIR/projects/make_tarball
-rm -r $SRC_DIR/projects/traffcounter
-rm -r $SRC_DIR/projects/stargazer/plugins/other/userstat
+rm -r $SRC_DIR/projects/sgauthstress
+rm -r $SRC_DIR/projects/rlm_stg
rm -r $SRC_DIR/projects/stargazer/plugins/authorization/stress
-rm -r $SRC_DIR/projects/stargazer/plugins/store/db
+rm -r $SRC_DIR/doc/help
+rm $SRC_DIR/doc/help.odt
+
+if [ -f /usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl ]
+then
+ echo "Building doc..."
+ make -C $SRC_DIR/doc/xmlrpc
+ make -C $SRC_DIR/doc/help
+else
+ echo "No XSL stylesheets, skipping doc build"
+fi
-tar -zcf $arc_name $src_dir
+tar -zcf $ARC_NAME $SRC_DIR