#!/bin/bash

# Struktur:

# +-versions
# +-distributions
# +-hompage
# +-documents
# +-manual
# +-bugreports
# `-trunc
#   +-data
#   | +-cardsets
#   | | `...
#   | +-translations
#   | | `...
#   | +-ai
#   | | `...
#   | +-backgrounds
#   | | `...
#   | +-bin
#   | | `...
#   | +-rules
#   | | `...
#   | +-setup
#   | | `...
#   | +-FreeDokorc
#   | +-Makefile
#   | `-Namen
#   +-src
#   | +-Makefile.local
#   | +...
#   +-doc
#   | +-de
#   | | `...
#   | +-en
#   | | `...
#   | +-GPL
#   | `...
#   +-ChangeLog
#   +-Version
#   +-AUTHORS
#   +-COPYING
#   +-LIESMICH
#   +-README
#   +-Makefile
#   +-Makefile.os
#   `-Makefile.version

# Alte Daten löschen
rm -rf /home/src/FreeDoko
rm -rf `find . -name "*.svn"`

# Repository erstellen
svnadmin create --fs-type fsfs /home/src/FreeDoko

# Struktur anlegen
svn mkdir -m "initialization" \
	file:///home/src/FreeDoko/versions	\
	file:///home/src/FreeDoko/distributions	\
	file:///home/src/FreeDoko/homepage	\
	file:///home/src/FreeDoko/documents	\
	file:///home/src/FreeDoko/manual	\
	file:///home/src/FreeDoko/bugreports	\
	file:///home/src/FreeDoko/trunk

# Daten übertragen

# Daten und Quelltext
svn checkout file:///home/src/FreeDoko/trunk .
svn -q add ChangeLog Version AUTHORS COPYING LIESMICH README Makefile Makefile.os Makefile.version
svn -q -N add data
svn -q add data/translations data/rules data/ai data/cardsets data/backgrounds data/bin data/setup data/Makefile
mv doc/documents doc/_additional doc/manual .
svn -q add doc
mv documents _additional manual doc/
make -s -C src clean
svn -q add src
svn -q commit -m "initialization"

# Fehlerberichte (einfach)
svn -q import Bugreports/ file:///home/src/FreeDoko/bugreports -m "initialization"

# Internetseite
pushd .
cd homepage 
svn -q checkout file:///home/src/FreeDoko/homepage .
svn -q add index.html *.css Makefile de en images
svn -q commit -m "initialization"
popd

# Dokumentation
pushd .
cd doc/documents/
svn -q checkout file:///home/src/FreeDoko/documents .
svn -q add *
svn -q commit -m "initialization"
popd

# Handbuch
pushd .
cd doc/manual
svn -q checkout file:///home/src/FreeDoko/manual .
svn -q add *
svn -q commit -m "initialization"
popd
