Revision 1608fcd51f192da7299a51e9b71fe1f99b40ffdf authored by Valentin Lorentz on 29 January 2020, 15:15:40 UTC, committed by Valentin Lorentz on 29 January 2020, 15:50:10 UTC
1 parent 68702b5
Raw File
dot_add_content
#!/bin/bash

DOT_FILE="$1"
DOT_EXTRA="$2"
SQL_SCHEMA="../swh/storage/sql/30-swh-schema.sql"
if [ -z "$DOT_FILE" -o -z "$DOT_EXTRA" ] ; then
    echo "Usage: $0 DOT_FILE DOT_EXTRA"
    exit 1
fi

if ! [ -f "$SQL_SCHEMA" ] ; then
    echo "Cannot find SQL schema ${SQL_SCHEMA}" 1>&2
    exit 2
fi
schema_version=$(grep -i -A 1 '^insert into dbversion' "$SQL_SCHEMA" | tail -n 1 \
	      | sed -e 's/.*values(//i' -e 's/,.*//')

head -n -1 "$DOT_FILE"  # all of $DOT_FILE but last line
sed "s/@@VERSION@@/$schema_version/" "$DOT_EXTRA"
echo "}"
back to top