Try without the pep dance

This commit is contained in:
Bob Mottram 2017-08-07 18:15:36 +01:00
parent c80feb6768
commit d3b3bd1d9b
1 changed files with 7 additions and 12 deletions

View File

@ -94,7 +94,7 @@ function xmpp_add_onion_address {
if [ ${#onion_address} -eq 0 ]; then if [ ${#onion_address} -eq 0 ]; then
return return
fi fi
if ! grep "[\"${domain_name}\"] = \"${onion_address}\";" /etc/prosody/prosody.cfg.lua; then if ! grep "${onion_address}" /etc/prosody/prosody.cfg.lua; then
if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then
sed -i "s|[\"${domain_name}\"].*|[\"${domain_name}\"] = \"${onion_address}\";|g" /etc/prosody/prosody.cfg.lua sed -i "s|[\"${domain_name}\"].*|[\"${domain_name}\"] = \"${onion_address}\";|g" /etc/prosody/prosody.cfg.lua
else else
@ -138,14 +138,19 @@ function xmpp_remove_onion_address {
if [ ${#domain_name} -eq 0 ]; then if [ ${#domain_name} -eq 0 ]; then
return return
fi fi
xmpp_changed=
if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then
sed -i "/[\"${domain_name}\"]/d" /etc/prosody/prosody.cfg.lua sed -i "/[\"${domain_name}\"]/d" /etc/prosody/prosody.cfg.lua
xmpp_changed=1
fi fi
if grep -q "= \"${domain_name}\";" /etc/prosody/prosody.cfg.lua; then if grep -q "= \"${domain_name}\";" /etc/prosody/prosody.cfg.lua; then
sed -i "/= \"${domain_name}\";/d" /etc/prosody/prosody.cfg.lua sed -i "/= \"${domain_name}\";/d" /etc/prosody/prosody.cfg.lua
xmpp_changed=1
fi fi
if [ $xmpp_changed ]; then
systemctl restart prosody systemctl restart prosody
fi
} }
function xmpp_remove_onion_address_interactive { function xmpp_remove_onion_address_interactive {
@ -361,16 +366,6 @@ function update_prosody_modules {
fi fi
fi fi
# change to using pep rather than profile modules
if grep -q '"pep"' /etc/prosody/prosody.cfg.lua; then
# This strange dance seems to fix occasional breakage of PEP
# Is there a better solution?
sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
systemctl restart prosody
sleep 4
sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
systemctl restart prosody
fi
if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
systemctl stop prosody systemctl stop prosody
sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua