BirdNET-stream/daemon/database/scripts/create.sh

21 lines
513 B
Bash
Raw Normal View History

2022-08-12 18:01:01 +02:00
#! /usr/bin/env bash
# Load config file
2022-08-21 06:13:15 +02:00
config_filepath="./config/birdnet.conf"
2022-08-12 18:01:01 +02:00
if [ -f "$config_filepath" ]; then
source "$config_filepath"
else
echo "Config file not found: $config_filepath"
exit 1
fi
# Check if database location is specified
if [ -z "$DATABASE" ]; then
echo "DATABASE location not specified"
echo "Defaults to ./var/db.sqlite"
DATABASE="./var/db.sqlite"
fi
# Create database according to schema in structure.sql
sqlite3 "$DATABASE" < ./daemon/database/structure.sql