36 lines
655 B
Bash
Executable file
36 lines
655 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
## functions
|
|
|
|
function syntaxerror
|
|
{
|
|
echo "SYNTAX: build <revision> [<format>]" > /dev/stderr
|
|
exit 1
|
|
}
|
|
|
|
|
|
## consts
|
|
|
|
dir_source="source"
|
|
dir_build="build"
|
|
|
|
|
|
## args
|
|
|
|
if [ $# -ge 1 ] ; then revision=$1 && shift ; else syntaxerror ; fi
|
|
if [ $# -ge 1 ] ; then format=$1 && shift ; else format="sqlite" ; fi
|
|
|
|
|
|
## exec
|
|
|
|
mkdir -p ${dir_build}
|
|
|
|
echo "-- data"
|
|
cat ${dir_source}/structure/${revision}.sindri.json | tools/sindri/sindri -f database:${format}
|
|
echo ""
|
|
|
|
echo "-- meta"
|
|
echo "DROP TABLE IF EXISTS _meta;"
|
|
echo "CREATE TABLE _meta(revision VARCHAR(15) NOT NULL);"
|
|
echo "INSERT INTO _meta(revision) VALUES ('${revision}');"
|
|
echo ""
|