-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-znc
More file actions
executable file
·34 lines (28 loc) · 856 Bytes
/
start-znc
File metadata and controls
executable file
·34 lines (28 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env bash
DATADIR="/znc-data"
# Build modules from source.
if [ -d "${DATADIR}/modules" ]; then
cwd="$(pwd)"
# Find module sources.
modules=$(find "${DATADIR}/modules" -name "*.cpp")
# Build modules.
for module in $modules; do
cd "$(dirname "$module")"
znc-buildmod "$module"
done
cd "$cwd"
fi
# Create default config if it doesn't exist
if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
mkdir -p "${DATADIR}/configs"
cp /src/znc.conf.default "${DATADIR}/configs/znc.conf"
fi
# Create pem if it doesn't exist
if [ ! -f "${DATADIR}/znc.pem" ]; then
znc --datadir="$DATADIR" --makepem
fi
# Make sure $DATADIR is owned by znc user. This effects ownership of the
# mounted directory on the host machine too.
chown -R "$UID_ZNC" "$DATADIR"
# Start ZNC.
exec sudo -u \#$UID_ZNC znc --foreground --datadir="$DATADIR" $@