Skip to content
Snippets Groups Projects
Commit 370e5a9e authored by Bob Mottram's avatar Bob Mottram
Browse files

Tidying

parent 7c5b71c5
No related branches found
No related tags found
No related merge requests found
......@@ -676,6 +676,57 @@ function upgrade_xmppsend {
}
function prosody_remove_module_from_config {
remove_prosody_module_name="$1"
prosody_config_file="$2"
if [ ! "${remove_prosody_module_name}" ]; then
return
fi
if [ ! -f "${prosody_config_file}" ]; then
echo "Config file ${prosody_config_file} not found when removing module $remove_prosody_module_name"
return
fi
if grep -q "\"${remove_prosody_module_name}\"" "${prosody_config_file}"; then
sed -i "/\"${remove_prosody_module_name}\"/d" "${prosody_config_file}"
xmpp_restart=1
fi
}
function prosody_remove_module {
remove_prosody_module_name="$1"
prosody_remove_module_from_config "${remove_prosody_module_name}" /etc/prosody/prosody.cfg.lua
prosody_remove_module_from_config "${remove_prosody_module_name}" /etc/prosody/conf.avail/xmpp.cfg.lua
}
function prosody_add_module_to_config {
new_prosody_module_name="$1"
prosody_config_file="$2"
if [ ! "${new_prosody_module_name}" ]; then
return
fi
if [ ! -f "${prosody_config_file}" ]; then
echo "Config file ${prosody_config_file} not found when adding module $new_prosody_module_name"
return
fi
if ! grep -q "\"${new_prosody_module_name}\"" "$prosody_config_file"; then
sed -i "/\"pep\"/a \"${new_prosody_module_name}\";" "$prosody_config_file"
sed -i "s|\"${new_prosody_module_name}\"| \"${new_prosody_module_name}\"|g" "$prosody_config_file"
xmpp_restart=1
fi
}
function prosody_add_module {
new_prosody_module_name="$1"
prosody_add_module_to_config "${new_prosody_module_name}" /etc/prosody/prosody.cfg.lua
prosody_add_module_to_config "${new_prosody_module_name}" /etc/prosody/conf.avail/xmpp.cfg.lua
}
function upgrade_xmpp {
xmpp_restart=
......@@ -698,42 +749,21 @@ function upgrade_xmpp {
xmpp_server_blacklist /etc/prosody/prosody.cfg.lua
# add word filter to muc
if ! grep -q '"filter_words"' /etc/prosody/prosody.cfg.lua; then
sed -i '/"muc_limits"/a "filter_words";' /etc/prosody/prosody.cfg.lua
sed -i 's|"filter_words"| "filter_words"|g' /etc/prosody/prosody.cfg.lua
xmpp_restart=1
fi
prosody_add_module "filter_words"
if ! grep -q 'filter_words =' /etc/prosody/prosody.cfg.lua; then
echo 'filter_words = {}' >> /etc/prosody/prosody.cfg.lua
xmpp_restart=1
fi
# add battery saving
if grep -q '"csi_battery_saver"' /etc/prosody/prosody.cfg.lua; then
sed -i '/"csi"/a "csi_battery_saver"; -- Extra CSI battery saving' /etc/prosody/prosody.cfg.lua
sed -i 's|"csi_battery_saver"| "csi_battery_saver"|g' /etc/prosody/prosody.cfg.lua
xmpp_restart=1
fi
# extra battery saving
prosody_add_module "csi_battery_saver"
# remove muc logging
if grep -q '"muc_log"' /etc/prosody/prosody.cfg.lua; then
sed -i '/"muc_log"/d' /etc/prosody/prosody.cfg.lua
xmpp_restart=1
fi
if grep -q '"muc_log_http"' /etc/prosody/prosody.cfg.lua; then
sed -i '/"muc_log_http"/d' /etc/prosody/prosody.cfg.lua
xmpp_restart=1
fi
prosody_remove_module "muc_log"
prosody_remove_module "muc_log_http"
# remove any broadcast settings
if grep -q '"broadcast"' /etc/prosody/prosody.cfg.lua; then
sed -i '/broadcast/d' /etc/prosody/prosody.cfg.lua
xmpp_restart=1
fi
if grep -q '"broadcast"' /etc/prosody/conf.avail/xmpp.cfg.lua; then
sed -i '/broadcast/d' /etc/prosody/conf.avail/xmpp.cfg.lua
xmpp_restart=1
fi
prosody_remove_module "broadcast"
if grep -q "/etc/ssl/certs/xmpp.dhparam" /etc/prosody/prosody.cfg.lua; then
cp /etc/ssl/certs/xmpp.dhparam /etc/prosody/xmpp.dhparam
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment