Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it so that conf/*.sh can be trivially overridden by the user #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions conf/config.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
#!/bin/sh
# shellcheck disable=SC2039

########################################
### ###
### DON'T EDIT THIS FILE AFTER BUILD ###
### ###
### USE ENVIRONMENT VARIABLES ###
### INSTEAD ###
### ###
########################################



# Default variables
cat <<EOF
# Network section
Expand Down
12 changes: 6 additions & 6 deletions conf/inspircd.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<config format="xml">

<include executable="./conf/config.sh" noexec="no">
<include executable="inspircd/conf/config.sh" noexec="no">

#-#-#-#-#-#-#-#-#-#-#-#- SERVER DESCRIPTION -#-#-#-#-#-#-#-#-#-#-#-#-
# #
Expand Down Expand Up @@ -542,11 +542,11 @@

<exception host="*@127.0.0.1" reason="localhost">

<include executable="conf/opers.sh">
<include executable="conf/links.sh LINK1">
<include executable="conf/links.sh LINK2">
<include executable="conf/links.sh LINK3">
<include executable="conf/services.sh">
<include executable="inspircd/conf/opers.sh">
<include executable="inspircd/conf/links.sh LINK1">
<include executable="inspircd/conf/links.sh LINK2">
<include executable="inspircd/conf/links.sh LINK3">
<include executable="inspircd/conf/services.sh">

<include file="modules.conf">

Expand Down
10 changes: 0 additions & 10 deletions conf/links.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
#!/bin/sh

########################################
### ###
### DON'T EDIT THIS FILE AFTER BUILD ###
### ###
### USE ENVIRONMENT VARIABLES ###
### INSTEAD ###
### ###
########################################


# generateLinkBlock <NAME> <IPADDR> <PORT> <SENDPASS> <RECVPASS> <ALLOWMASK> <MORE>
generateLinkBlock() {
if [ "$6" = "" ]; then
Expand Down
10 changes: 0 additions & 10 deletions conf/opers.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 0 additions & 10 deletions conf/services.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
16 changes: 0 additions & 16 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down