87 lines
2.1 KiB
Bash
Executable File
87 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# @RDE_HEADER@
|
|
# $Id$
|
|
# $HeadURL$
|
|
# $Author$
|
|
#
|
|
|
|
if [ "$#" -ne 3 ]; then
|
|
echo "Please pass: <VERSION>, <location>, <absPathTo_import_<location>.csv> like '1234.54123 <ba0|ba1|ba2|ba3|ba4|salchau> /shd/...../import_ba0.csv'"
|
|
exit 1
|
|
fi
|
|
|
|
version=$1
|
|
location=$2
|
|
import_csv=$3
|
|
outdir_rel=guez_buildings_${location}_buildingviewer-${version}
|
|
tmpdir=/tmp
|
|
outdir=${tmpdir}/${outdir_rel}
|
|
outdir_ive=${outdir}/StaticMeshes
|
|
outdir_txt=${outdir}/texture
|
|
|
|
rm -rf ${outdir}
|
|
|
|
echo "Attn: must be called in directory with building subdirs!"
|
|
|
|
if [ ! -e ${outdir_ive} ]; then
|
|
mkdir -p ${outdir_ive}
|
|
fi
|
|
if [ ! -e ${outdir_txt} ]; then
|
|
mkdir -p ${outdir_txt}
|
|
fi
|
|
|
|
# remove old directory
|
|
rm -r $outdir_txt
|
|
# copy texture directory for conversion
|
|
cp -r texture ${outdir_txt}
|
|
# copy all files in texture to upper case (windows...)
|
|
for f in `ls -1 ${outdir_txt}`; do
|
|
f_upper="${f^^}"
|
|
f_lower="${f,,}"
|
|
if [ "${f}x" != "${f_upper}x" ]; then
|
|
cp ${outdir_txt}/$f ${outdir_txt}/$f_upper
|
|
fi
|
|
if [ "${f}x" != "${f_lower}x" ]; then
|
|
cp ${outdir_txt}/$f ${outdir_txt}/$f_lower
|
|
fi
|
|
done
|
|
|
|
dirs=`find . -maxdepth 1 -type d | sort -n`
|
|
pwd=`pwd`
|
|
cd $outdir_ive
|
|
infile=${import_csv}
|
|
if [ ! -e ${infile} ]; then
|
|
echo "Can not find import file ${infile}"
|
|
exit 1
|
|
fi
|
|
|
|
for d in `cat ${infile} | cut -d ';' -f 1 | cut -d '.' -f 1`; do
|
|
d=`basename $d`
|
|
srcdir=${pwd}/${d}
|
|
# nur fertig, wenn .flt und .flt.xml vorhanden sind
|
|
if [ -e ${srcdir}/${d}.flt ] && [ -e ${srcdir}/${d}.flt.xml ]; then
|
|
echo "converting $srcdir ..."
|
|
osgconv --compressed ${srcdir}/${d}.flt ${outdir_ive}/${d}.flt.ive -O "compressed"
|
|
cp ${srcdir}/$d.*.xml ${outdir_ive}/
|
|
cp ${srcdir}/$d.*.xml.wrl ${outdir_ive}/
|
|
echo "... finished"
|
|
else
|
|
echo " does not exist: " ${d}
|
|
fi
|
|
done
|
|
rm -r $outdir_txt
|
|
|
|
cp ${infile} ${outdir_ive}
|
|
cd ${tmpdir}
|
|
tar cvzf ~/rpmbuild/SOURCES/guez_buildings_${location}_buildingviewer-${version}.tar.gz ${outdir_rel}
|
|
if [ $? -ne 0 ]; then
|
|
exit 2
|
|
fi
|
|
rm -rf ${outdir_rel}
|
|
cd ${pwd}
|
|
|
|
echo "tar.tgz created: guez_buildings_${location}_buildingviewer-${version}.tar.gz"
|
|
echo "Now you can run rpmbuild -bb --target=noarch guez_buildings_${location}_buildingviewer.spec"
|
|
|