forked from TronPaul/docker-znc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstart-znc-tor
executable file
·43 lines (33 loc) · 978 Bytes
/
start-znc-tor
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
35
36
37
38
39
40
41
42
43
#! /usr/bin/env bash
# Options.
DATADIR="/znc-data"
# Build modules from source.
if [ -d "${DATADIR}/modules" ]; then
# Store current directory.
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
# Go back to original directory.
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 a pemfile 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 znc:znc "$DATADIR"
# Start tor
sudo service tor start
# Start ZNC.
exec sudo -u znc proxychains znc --foreground --datadir="$DATADIR" $@