File indexing completed on 2024-05-12 16:39:43
0001 #!/bin/sh 0002 set -e 0003 0004 # Builds a single .kexi file from a .sql file specified as $1. 0005 # The destination .kexi file is saved with name specified as $2 0006 # and is set as read-only. 0007 # $2 if optional if $1 is of a form "name.kexi.sql" then 0008 # the destination file will be "name.kexi". 0009 # Only .kexi file that is older than .sql file is recreated. 0010 # sqlite3 command line tool is needed on the $PATH. 0011 0012 which sqlite3 > /dev/null 0013 0014 [ $# -lt 1 ] && echo "Missing .sql filename." && exit 1 0015 0016 if [ $# -lt 2 ] ; then 0017 kexi_file=`echo $1 | sed -e "s/\.kexi\.sql/\.kexi/"` 0018 else 0019 kexi_file=$2 0020 fi 0021 0022 if test -f "$kexi_file" -a ! "$kexi_file" -ot "$1" ; then 0023 echo "Local $kexi_file is newer than $1 - skipping it" 0024 exit 0 0025 fi 0026 0027 rm -f "$kexi_file" 0028 echo "Creating \"$kexi_file\" ... " 0029 sqlite3 "$kexi_file" < "$1" 0030 chmod a-w "$kexi_file" 0031 echo "OK"