hassio-murmur/rootfs/etc/cont-init.d/umurmur-init.sh

79 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/with-contenv bashio
declare max_users
declare channel_name
declare channel_description
declare ban_length
declare admin_password
declare certfile
declare keyfile
max_users=$(bashio::config 'max_users' 10)
channel_name=$(bashio::config 'channel_name' 'channel_name')
channel_description=$(bashio::config 'channel_description' 'channel_description')
ban_length=$(bashio::config 'ban_length' 3600)
admin_password=$(bashio::config 'admin_password')
cat >/etc/umurmur/umurmurd.conf <<EOF
# This configuration is based on the official example configuration. More information can be found
# at http://code.google.com/p/umurmur/wiki/Configuring02x
max_bandwidth = 48000;
welcometext = "Welcome to uMurmur!";
password = "";
admin_password = "${admin_password}";
max_users = ${max_users};
sync_banfile = true;
allow_textmessage = true;
ban_length = ${ban_length};
banfile = "/data/banfile.txt";
# Specify port and/or address to bind to. Typically not needed.
# Default is '*' for address and 64738 for port.
# Can also be specified on the command line, which takes precedence if
# both are specified.
bindport = 64738;
bindaddr = "0.0.0.0";
# Specify this for privilege dropping. If username is specified but not
# the groupname, the user's login group is used.
username = "umurmur";
groupname = "umurmur";
# Root channel must always be defined first.
# If a channel has a parent, the parent must be defined before the child channel(s).
channels = ( {
name = "Root";
parent = "";
description = "The Root of all channels";
noenter = true;
},
{
name = "${channel_name}";
parent = "Root";
description = "${channel_description}";
}
);
channel_links = ();
default_channel = "${channel_name}";
EOF
if bashio::config.true 'enable_ban'; then
echo "enable_ban = true;" >>/etc/umurmur/umurmurd.conf
else
echo "enable_ban = false;" >>/etc/umurmur/umurmurd.conf
fi
bashio::config.require.ssl
if bashio::config.true 'ssl'; then
certfile=$(bashio::config 'certfile' 10)
keyfile=$(bashio::config 'keyfile' 10)
cat >>/etc/umurmur/umurmurd.conf <<EOF
certificate = "/ssl/${certfile}";
private_key = "/ssl/${keyfile}";
EOF
fi
touch /data/banfile.txt