Optional IRC password

This commit is contained in:
Bob Mottram 2015-12-09 14:26:28 +00:00
parent 5df28375eb
commit b2084b8dc7
1 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,9 @@ CONFIGURATION_FILE="freedombone.cfg"
SSH_PORT=2222
IRC_PORT=6697
# An optional password to log into IRC. This applies to all users
IRC_PASSWORD=
# If this file exists it contains a global password used with
# disk image installs. This simplifies password management for
# deployment at scale
@ -868,6 +871,9 @@ function read_configuration {
if [[ $CONFIGURATION_FILE != '/root/freedombone.cfg' ]]; then
cp $CONFIGURATION_FILE /root/freedombone.cfg
fi
if grep -q "IRC_PASSWORD" $CONFIGURATION_FILE; then
IRC_PASSWORD=$(grep "IRC_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DEFAULT_LANGUAGE" $CONFIGURATION_FILE; then
DEFAULT_LANGUAGE=$(grep "DEFAULT_LANGUAGE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -6689,6 +6695,9 @@ function install_irc_server {
sed -i 's/;RequireAuthPing = no/RequireAuthPing = no/g' /etc/ngircd/ngircd.conf
sed -i "s/;Name = TheOper/Name = $MY_USERNAME/g" /etc/ngircd/ngircd.conf
sed -i "s/;Password = ThePwd/Password = $IRC_OPERATOR_PASSWORD/g" /etc/ngircd/ngircd.conf
if [ $IRC_PASSWORD ]; then
sed -i "0,/RE/s/Password =.*/Password = $IRC_PASSWORD/" /etc/ngircd/ngircd.conf
fi
# If we are on a mesh then DNS is not available
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
sed -i "s/;DNS =.*/DNS = no/g" /etc/ngircd/ngircd.conf