Commit 88b3c87b by Maarten L. Hekkelman

fixes for automatic update of data

parent 7fd7dfd9
...@@ -50,8 +50,10 @@ jobs: ...@@ -50,8 +50,10 @@ jobs:
- name: Build - name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release
- name: Test - name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }} working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config Release --output-on-failure run: ctest --build-config Release --output-on-failure
- name: Install
run: cmake --install ${{ steps.strings.outputs.build-output-dir }} --config Release
...@@ -66,12 +66,17 @@ if(NOT(BUILD_FOR_CCP4 AND WIN32)) ...@@ -66,12 +66,17 @@ if(NOT(BUILD_FOR_CCP4 AND WIN32))
option(BUILD_SHARED_LIBS "Build a shared library instead of a static one" OFF) option(BUILD_SHARED_LIBS "Build a shared library instead of a static one" OFF)
endif() endif()
# Lots of code depend on the availability of the components.cif file if(BUILD_FOR_CCP4)
option(CIFPP_DOWNLOAD_CCD "Download the CCD file components.cif during installation" ON) unset(CIFPP_DOWNLOAD_CCD)
unset(CIFPP_INSTALL_UPDATE_SCRIPT)
else()
# Lots of code depend on the availability of the components.cif file
option(CIFPP_DOWNLOAD_CCD "Download the CCD file components.cif during installation" ON)
# An optional cron script can be installed to keep the data files up-to-date # An optional cron script can be installed to keep the data files up-to-date
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT BUILD_FOR_CCP4) if(UNIX)
option(CIFPP_INSTALL_UPDATE_SCRIPT "Install the script to update CCD and dictionary files" ON) option(CIFPP_INSTALL_UPDATE_SCRIPT "Install the script to update CCD and dictionary files" ON)
endif()
endif() endif()
# When CCP4 is sourced in the environment, we can recreate the symmetry operations table # When CCP4 is sourced in the environment, we can recreate the symmetry operations table
...@@ -564,7 +569,7 @@ if(CIFPP_INSTALL_UPDATE_SCRIPT) ...@@ -564,7 +569,7 @@ if(CIFPP_INSTALL_UPDATE_SCRIPT)
else() else()
set(CIFPP_CRON_DIR "${CIFPP_ETC_DIR}/cron.weekly" CACHE PATH "The cron directory, for the update script") set(CIFPP_CRON_DIR "${CIFPP_ETC_DIR}/cron.weekly" CACHE PATH "The cron directory, for the update script")
endif() endif()
elseif(UNIX) # assume all others are like FreeBSD... elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(CIFPP_CRON_DIR "${CIFPP_ETC_DIR}/periodic/weekly" CACHE PATH "The cron directory, for the update script") set(CIFPP_CRON_DIR "${CIFPP_ETC_DIR}/periodic/weekly" CACHE PATH "The cron directory, for the update script")
else() else()
message(FATAL_ERROR "Don't know where to install the update script") message(FATAL_ERROR "Don't know where to install the update script")
......
...@@ -10,7 +10,7 @@ euid=${EUID:-$(id -u)} ...@@ -10,7 +10,7 @@ euid=${EUID:-$(id -u)}
if [ "${euid}" -ne 0 ]; then if [ "${euid}" -ne 0 ]; then
echo "Please run as root" echo "Please run as root"
exit exit 1
fi fi
if [ -f "@CIFPP_ETC_DIR@/libcifpp.conf" ]; then if [ -f "@CIFPP_ETC_DIR@/libcifpp.conf" ]; then
...@@ -19,12 +19,13 @@ fi ...@@ -19,12 +19,13 @@ fi
# check to see if we're supposed to run at all # check to see if we're supposed to run at all
if [ "$update" != "true" ]; then if [ "$update" != "true" ]; then
exit exit 0
fi fi
# if cache directory doesn't exist, exit. # if cache directory doesn't exist, exit.
if ! [ -d "@CIFPP_CACHE_DIR@" ]; then if ! [ -d "@CIFPP_CACHE_DIR@" ]; then
exit echo "Cache directory '@CIFPP_CACHE_DIR@' does not exist"
exit 1
fi fi
# Create a temp file in the right directory and # Create a temp file in the right directory and
...@@ -60,12 +61,16 @@ update_dictionary() { ...@@ -60,12 +61,16 @@ update_dictionary() {
# Update the dictionaries # Update the dictionaries
update_dictionary "@CIFPP_CACHE_DIR@/components.cif" "https://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz" update_dictionary "@CIFPP_CACHE_DIR@/components.cif" "https://files.wwpdb.org/pub/pdb/data/monomers/components.cif.gz"
update_dictionary "@CIFPP_CACHE_DIR@/mmcif_pdbx.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz" update_dictionary "@CIFPP_CACHE_DIR@/mmcif_pdbx.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
update_dictionary "@CIFPP_CACHE_DIR@/mmcif_ma.dic" "https://github.com/ihmwg/ModelCIF/raw/master/dist/mmcif_ma.dic" update_dictionary "@CIFPP_CACHE_DIR@/mmcif_ma.dic" "https://github.com/ihmwg/ModelCIF/raw/master/dist/mmcif_ma.dic"
# notify subscribers, will fail on FreeBSD # notify subscribers, using find instead of run-parts to make it work on FreeBSD as well
if [ -d "@CIFPP_ETC_DIR@/libcifpp/cache-update.d" ] && [ -x /bin/run-parts ]; then if [ -d "@CIFPP_ETC_DIR@/libcifpp/cache-update.d" ]; then
run-parts --arg "@CIFPP_CACHE_DIR@" -- "@CIFPP_ETC_DIR@/libcifpp/cache-update.d" find "@CIFPP_ETC_DIR@/libcifpp/cache-update.d" \
-exec test -x {} \; -and -not -exec test -d {} \; \
-exec {} "@CIFPP_CACHE_DIR@" \;
fi fi
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment