BESTMobile/android/scripts/generateSQLiteDB.sh

39 lines
947 B
Bash
Executable File

#!/bin/bash
#
# Author: Macgregor
# Liscense: GPLv3
# Date: 25th Oct 2012
#
#
source "env.sh"
if [ -f ${DATA_SQLITE_DB_CORE} ] ; then
rm -vf ${DATA_SQLITE_DB_CORE}
fi
echo -n "Info: Generating sqlite data base ... "
# Create the DB
cat ${DATA_SQLITE_DB_CREATE} | sqlite3 ${DATA_SQLITE_DB_CORE}
# Import the data
echo .separator \"${SQLITE_DB_IMPORT_SEP}\" >${TMP_WORK_FILE}
echo .import \"${FILE_OUT_STOPS_NAMES}\" stop_names >>${TMP_WORK_FILE}
echo .import \"${FILE_OUT_STOPS_GEO}\" stop_geo >>${TMP_WORK_FILE}
echo .import \"${FILE_OUT_FREQ}\" bus_max_freq >>${TMP_WORK_FILE}
echo .import \"${FILE_OUT_ROUTES}\" routes >>${TMP_WORK_FILE}
echo .import \"${FILE_OUT_TRIPS}\" trips >>${TMP_WORK_FILE}
echo .import \"${FILE_OUT_CALENDAR}\" schedule_rules >>${TMP_WORK_FILE}
echo .import \"${FILE_OUT_STOP_SEQ}\" stops_on_trip >>${TMP_WORK_FILE}
cat ${TMP_WORK_FILE} | sqlite3 ${DATA_SQLITE_DB_CORE}
rm -f ${TMP_WORK_FILE}
echo "done."