#Create a *nix copy to be easily distribute
if [  $# = 0 ]; then
  echo "Usage: $0 folder_to_create [tar.bz2]"
  exit
fi

mkdir $1
cp myserver $1
cp myserver-configure $1
cp myserver-daemon $1
cp *.default $1
cp readme.txt $1
cp ../COPYING $1
cp ../INSTALL $1
cp ../NEWS $1
cp ../README $1
cp ../TODO $1

mkdir $1/web
cp web/*.html $1/web
cp web/*.png $1/web

mkdir $1/certificates
cp certificates/*.txt $1/certificates

mkdir $1/system
cp system/*.css $1/system
cp system/security $1/system

mkdir $1/system/errors
cp system/errors/*.html $1/system/errors

mkdir $1/system/icons

mkdir $1/system/icons/codes
cp system/icons/codes/*.png $1/system/icons/codes

mkdir $1/languages
cp languages/*.xml $1/languages

mkdir $1/languages/configure
cp languages/configure/*.xml $1/languages/configure

mkdir $1/web/cgi-bin
cp web/cgi-bin/*.html $1/web/cgi-bin
cp web/cgi-bin/*.readme $1/web/cgi-bin
cp web/cgi-bin/*.mscgi $1/web/cgi-bin

mkdir $1/logs
touch $1/logs/.keep_me

mkdir $1/web/downloads
cp web/downloads/*.txt $1/web/downloads
cp web/downloads/*.php $1/web/downloads
cp web/downloads/*.sh $1/web/downloads

mkdir $1/cgi-lib
cp cgi-lib/cgi-lib.so $1/cgi-lib
cp cgi-lib/cgi_manager.h $1/cgi-lib
cp cgi-lib/license.txt $1/cgi-lib

mkdir $1/web/documentation
cp ../documentation/english/index.htm $1/web/documentation/

mkdir $1/web/documentation/texts
cp ../documentation/english/texts/*.htm $1/web/documentation/texts/

mkdir $1/web/documentation/style
cp ../documentation/english/style/*.css $1/web/documentation/style/

mkdir $1/web/documentation/images
cp ../documentation/english/images/*.png $1/web/documentation/images/
cp ../documentation/english/images/*.jpg $1/web/documentation/images/


if [  $# = 2 ]; then
tar -cvf $2.tar $1
bzip2 $2.tar 
rm -f -r $1
fi
