From 2c9cb63c0af9a84a14461bc5ad76a1d8bba8025a Mon Sep 17 00:00:00 2001 From: "Clifford T. Matthews" Date: Mon, 5 Aug 2019 16:47:51 -0700 Subject: [PATCH] Make it so that conf/*.sh can be trivially overridden by the user Closes #90 Prior to this commit, editing the conf/*.conf files resulted in changed configuration parameters, but editing the conf/*.sh files did not. Furthermore, there was a comment in the conf/*.sh files that could be misconstrued. With this commit the conf/*.sh and conf/*.conf files behave the same. conf/*.sh files can be edited and then docker -v can be used to bind mount the conf directory and the changes will take effect. --- Dockerfile | 2 +- conf/config.sh | 11 ----------- conf/inspircd.conf | 12 ++++++------ conf/links.sh | 10 ---------- conf/opers.sh | 10 ---------- conf/services.sh | 10 ---------- entrypoint.sh | 16 ---------------- 7 files changed, 7 insertions(+), 64 deletions(-) diff --git a/Dockerfile b/Dockerfile index adf84aa..c88c931 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,9 +40,9 @@ RUN apk add --no-cache libgcc libstdc++ gnutls gnutls-utils $RUN_DEPENDENCIES && addgroup -g 10000 -S inspircd && \ adduser -u 10000 -h /inspircd/ -D -S -G inspircd inspircd -COPY --chown=inspircd:inspircd conf/ /conf/ COPY --chown=inspircd:inspircd entrypoint.sh /entrypoint.sh COPY --from=builder --chown=inspircd:inspircd /inspircd/ /inspircd/ +COPY --chown=inspircd:inspircd conf/ /inspircd/conf/ USER inspircd diff --git a/conf/config.sh b/conf/config.sh index ccddf1e..9285af3 100755 --- a/conf/config.sh +++ b/conf/config.sh @@ -1,17 +1,6 @@ #!/bin/sh # shellcheck disable=SC2039 -######################################## -### ### -### DON'T EDIT THIS FILE AFTER BUILD ### -### ### -### USE ENVIRONMENT VARIABLES ### -### INSTEAD ### -### ### -######################################## - - - # Default variables cat < - + #-#-#-#-#-#-#-#-#-#-#-#- SERVER DESCRIPTION -#-#-#-#-#-#-#-#-#-#-#-#- # # @@ -542,11 +542,11 @@ - - - - - + + + + + diff --git a/conf/links.sh b/conf/links.sh index f3ded6a..0f591d9 100755 --- a/conf/links.sh +++ b/conf/links.sh @@ -1,15 +1,5 @@ #!/bin/sh -######################################## -### ### -### DON'T EDIT THIS FILE AFTER BUILD ### -### ### -### USE ENVIRONMENT VARIABLES ### -### INSTEAD ### -### ### -######################################## - - # generateLinkBlock generateLinkBlock() { if [ "$6" = "" ]; then diff --git a/conf/opers.sh b/conf/opers.sh index fbaef5c..dbb5b58 100755 --- a/conf/opers.sh +++ b/conf/opers.sh @@ -1,14 +1,4 @@ #!/bin/sh -######################################## -### ### -### DON'T EDIT THIS FILE AFTER BUILD ### -### ### -### USE ENVIRONMENT VARIABLES ### -### INSTEAD ### -### ### -######################################## - - # Prevent breaking changes if [ "$INSP_OPER_PASSWORD_HASH" = "" ] && [ "$INSP_OPER_PASSWORD" != "" ]; then diff --git a/conf/services.sh b/conf/services.sh index e920e40..1581db0 100755 --- a/conf/services.sh +++ b/conf/services.sh @@ -1,15 +1,5 @@ #!/bin/sh -######################################## -### ### -### DON'T EDIT THIS FILE AFTER BUILD ### -### ### -### USE ENVIRONMENT VARIABLES ### -### INSTEAD ### -### ### -######################################## - - # When not specified, try to be smart and predict a allowmask if [ "$INSP_SERVICES_ALLOWMASK" = "" ]; then INSP_SERVICES_ALLOWMASK=$(ip route show dev eth0 | grep -v default | cut -d" " -f1 | head -1) diff --git a/entrypoint.sh b/entrypoint.sh index d1ccdc3..0203270 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,22 +3,6 @@ INSPIRCD_ROOT="/inspircd" -# TODO fix/make configuration better -# Make sure that the volume contains a default config but don't override an existing one -if [ ! -e $INSPIRCD_ROOT/conf/inspircd.conf ] && [ -w $INSPIRCD_ROOT/conf/ ]; then - cp -r /conf/* $INSPIRCD_ROOT/conf/ -elif [ ! -w $INSPIRCD_ROOT/conf/ ]; then - echo " - ################################## - ### ### - ### Can't write to volume! ### - ### Please change owner ### - ### to uid 10000 ### - ### ### - ################################## - " -fi - # Link certificates from secrets # See https://docs.docker.com/engine/swarm/secrets/ if [ -e /run/secrets/inspircd.key ] && [ -e /run/secrets/inspircd.crt ]; then