Debian Codegraph @

debian/libcifpp-data.postinst

raw
1 #!/bin/sh
2
3 CONFIGFILE=/etc/libcifpp.conf
4
5 set -e
6
7 if [ -e /usr/share/debconf/confmodule ] ; then
8 . /usr/share/debconf/confmodule
9 export debconfavailable="yes"
10 fi
11
12 SHARE_DIR=/usr/share/libcifpp
13 CACHE_DIR=/var/cache/libcifpp
14
15 case "$1" in
16 configure)
17
18 # Generate config file, if it doesn't exist.
19 if [ ! -e $CONFIGFILE ]; then
20 echo "# Config file for my libcifpp" > $CONFIGFILE
21 echo "# To automatically update the mmcif_pdbx.dic file, use true or false" >> $CONFIGFILE
22 echo "update=false" >> $CONFIGFILE
23 fi
24
25 # Substitute in the values from the debconf db.
26 db_get libcifpp/update
27
28 update="$RET"
29
30 cp -a -f $CONFIGFILE $CONFIGFILE.tmp
31
32 test -z "$update" || grep -Eq '^ *update=' $CONFIGFILE || \
33 echo "update=false" >> $CONFIGFILE
34
35 sed -e "s/^ *update=.*/update=\"$update\"/" \
36 < $CONFIGFILE > $CONFIGFILE.tmp
37 mv -f $CONFIGFILE.tmp $CONFIGFILE
38
39 if ! [ -f ${CACHE_DIR}/mmcif_pdbx.dic ]; then
40 install -d -m755 ${CACHE_DIR};
41 install -m644 ${SHARE_DIR}/mmcif_pdbx.dic ${CACHE_DIR}/mmcif_pdbx.dic;
42 fi
43
44 # run the update
45 /etc/cron.weekly/update-libcifpp-data
46 ;;
47 esac
48
49 #DEBHELPER#