#!/bin/sh # shellcheck disable=SC2068 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 # shellcheck disable=SC2336 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 ln -s /run/secrets/inspircd.key $INSPIRCD_ROOT/conf/key.pem ln -s /run/secrets/inspircd.crt $INSPIRCD_ROOT/conf/cert.pem fi # Make sure there is a certificate or generate a new one if [ ! -e $INSPIRCD_ROOT/conf/cert.pem ] && [ ! -e $INSPIRCD_ROOT/conf/key.pem ]; then cat > /tmp/cert.template <