Description: Check config file to see if update should run
Author: Maarten L. Hekkelman <maarten@hekkelman.com>
Last-Update: Wed, 18 Nov 2020 09:58:40 +0100
Forwarded: yes

--- a/tools/update-dictionary-script
+++ b/tools/update-dictionary-script
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 set -e
 
@@ -7,14 +7,23 @@
 	exit
 fi
 
-# create cache directory if it doesn't exist
+if [ -f /etc/libcifpp.conf ] ; then
+	. /etc/libcifpp.conf
+fi
+
+# check to see if we're supposed to run at all
+if [ "$update" != "true" ] ; then
+	exit
+fi
+
+# if cache directory doesn't exist, exit. 
 if ! [ -d /var/cache/libcifpp ]; then
-	install -d -m755 /var/cache/libcifpp
+	exit
 fi
 
 # fetch the dictionary
 
-dict=/var/cache/libcifpp/mmcif_pdbx_v50.cif
+dict=/var/cache/libcifpp/mmcif_pdbx_v50.dic
 source=http://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz
 
 wget -O${dict}.gz ${source}
