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