hassio-murmur/rootfs/etc/cont-init.d/umurmur-init.sh
Paolo Asperti 98b7e0198c
All checks were successful
continuous-integration/drone/tag Build is passing
first commit
2022-03-13 18:44:54 +01:00

77 lines
2.1 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
cat >>/etc/umurmur/umurmurd.conf <<EOF
certificate = "${certfile";
private_key = "${keyfile}";
EOF
fi
touch /data/banfile.txt