aheinecke@5097: #!/bin/bash
aheinecke@5097: set -e
aheinecke@5097: 
aheinecke@5097: # See README for more information
aheinecke@5097: 
aheinecke@5097: # The working directory. Resulting tarball will be placed in the directory above.
tom@5520: PKG_DIR=~/tmp/flys-importer
aheinecke@5097: # Path to the flys checkout
tom@5520: FLYS_DIR=~/flys/flys/
aheinecke@5179: # Tarball that will be extracted into flys-imprter/opt
aheinecke@5179: EXTRAS=$1
aheinecke@5097: 
aheinecke@5097: rm -fr $PKG_DIR
aheinecke@5097: mkdir -p $PKG_DIR/hydr_morph
aheinecke@5097: mkdir -p $PKG_DIR/geodaesie
aheinecke@5097: mkdir -p $PKG_DIR/opt/lib64
aheinecke@5097: mkdir -p $PKG_DIR/schema
aheinecke@5179: mkdir -p $PKG_DIR/conf
aheinecke@5179: 
aheinecke@5179: cat > "$PKG_DIR/conf/log4j.properties" << "EOF"
aheinecke@5179: log4j.rootLogger=DEBUG, IMPORTER
aheinecke@5179: log4j.appender.IMPORTER.layout=org.apache.log4j.PatternLayout
aheinecke@5179: log4j.appender.IMPORTER.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
aheinecke@5179: log4j.appender.IMPORTER=org.apache.log4j.RollingFileAppender
aheinecke@5179: log4j.appender.IMPORTER.File=./import.log
aheinecke@5179: log4j.appender.IMPORTER.MaxFileSize=100000KB
aheinecke@5179: log4j.appender.IMPORTER.MaxBackupIndex=10
aheinecke@5179: EOF
aheinecke@5097: 
aheinecke@5097: cd ${FLYS_DIR}/flys-backend
aheinecke@5097: mvn -f pom-oracle.xml clean compile assembly:single
aheinecke@5097: cp target/flys-backend-1.0-SNAPSHOT-jar-with-dependencies.jar \
aheinecke@5097:     $PKG_DIR/hydr_morph/importer.jar
aheinecke@5172: mvn -f pom.xml clean compile assembly:single
aheinecke@5172: cp target/flys-backend-1.0-SNAPSHOT-jar-with-dependencies.jar \
aheinecke@5172:     $PKG_DIR/hydr_morph/importer_psql.jar
aheinecke@5097: cp ${FLYS_DIR}/flys-backend/contrib/shpimporter/*.py $PKG_DIR/geodaesie
aheinecke@5097: cp ${FLYS_DIR}/flys-backend/contrib/run_geo.sh \
aheinecke@5097:     ${FLYS_DIR}/flys-backend/contrib/run_hydr_morph.sh \
aheinecke@5172:     ${FLYS_DIR}/flys-backend/contrib/import_river.sh \
aheinecke@5097:     $PKG_DIR
aheinecke@5163: cp ${FLYS_DIR}/flys-backend/doc/annotation-types.xml $PKG_DIR/conf
aheinecke@5199: if [ -f "$EXTRAS" ]; then
aheinecke@5179:     cd $PKG_DIR
aheinecke@5199:     tar -xzf "$EXTRAS"
aheinecke@5179: fi
aheinecke@5097: 
aheinecke@5097: cp ${FLYS_DIR}/flys-backend/doc/schema/*.sql $PKG_DIR/schema
tom@5520: 
tom@5520: cd ${FLYS_DIR}/flys-backend/doc/documentation/de/
tom@5520: make importer-manual.pdf
tom@5520: cp importer-manual.pdf $PKG_DIR
aheinecke@5097: 
aheinecke@5097: sed -i 's/shpimporter\/shp/geodaesie\/shp/' $PKG_DIR/run_geo.sh
aheinecke@5097: 
aheinecke@5097: cd $PKG_DIR/..
aheinecke@5417: DATE=$(date +%Y%m%d%H%M)
aheinecke@5179: tar -czf flys-importer_${DATE}.tar.gz flys-importer
aheinecke@5179: sha1sum flys-importer_${DATE}.tar.gz > flys-importer_${DATE}.tar.gz.sha1
aheinecke@5186: echo Package is at: `readlink -f flys-importer_${DATE}.tar.gz`