From b6c195ffb583e7c86f3df859a38d3a244b76eb02 Mon Sep 17 00:00:00 2001 From: Pierce McGoran Date: Thu, 6 Sep 2018 12:05:22 -0400 Subject: [PATCH] Avoid needlessly running znc-buildmod at every startup --- full/30-build-modules.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/full/30-build-modules.sh b/full/30-build-modules.sh index c6de6af..b429bf1 100644 --- a/full/30-build-modules.sh +++ b/full/30-build-modules.sh @@ -3,15 +3,23 @@ if [ -d "${DATADIR}/modules" ]; then cd "${DATADIR}/modules" || exit 11 - # Find module sources. - modules=$(find . -name "*.cpp") - - if [ -n "$modules" ]; then - # Build modules. - echo "Building modules $modules..." - /opt/znc/bin/znc-buildmod $modules || exit 12 + # if version file doesn't exist, create it + if [ ! -f ".version" ]; then + touch .version fi + # Check version we were at when znc-buildmod was last run + if [ "$ZNC_VERSION" != "$(cat .version)" ]; then + + # Find module sources. + modules=$(find . -name "*.cpp") + + if [ -n "$modules" ]; then + # Build modules. + echo "Building modules $modules..." + /opt/znc/bin/znc-buildmod $modules || exit 12 + fi + echo -n $ZNC_VERSION > .version + fi cd / fi -