Better handling of xmpp upgrades

This commit is contained in:
Bob Mottram 2017-03-11 16:14:24 +00:00
parent c938e6313a
commit f24ad2cd17
1 changed files with 93 additions and 76 deletions

View File

@ -293,6 +293,8 @@ function upgrade_xmpp_server {
function_check update_prosody_modules
update_prosody_modules
curr_prosody_filename=$(cat $COMPLETION_FILE | grep "prosody_filename" | awk -F ':' '{print $2}')
if [[ "$curr_prosody_filename" != "$prosody_filename" ]]; then
if [ -d ${INSTALL_DIR}/${prosody_filename} ]; then
# ensure that the binaries have not been overwritten
# by an operating system upgrade
@ -342,6 +344,9 @@ function upgrade_xmpp_server {
xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
fi
set_completion_param "prosody_filename" "${prosody_filename}"
fi
systemctl restart prosody
}
@ -353,6 +358,8 @@ function upgrade_xmpp_client {
rm -rf /tmp/*
CURR_LIBMESODE_COMMIT=$(cat $COMPLETION_FILE | grep "libmesode commit" | awk -F ':' '{print $2}')
if [[ "$CURR_LIBMESODE_COMMIT" != "$LIBMESODE_COMMIT" ]]; then
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/libmesode "libmesode commit" "$LIBMESODE_COMMIT" $LIBMESODE_REPO
cd $INSTALL_DIR/libmesode
@ -361,9 +368,12 @@ function upgrade_xmpp_client {
make
make install
cp /usr/local/lib/libmesode* /usr/lib
fi
rm -rf /tmp/*
CURR_PROFANITY_COMMIT=$(cat $COMPLETION_FILE | grep "profanity commit" | awk -F ':' '{print $2}')
if [[ "$CURR_PROFANITY_COMMIT" != "$PROFANITY_COMMIT" ]]; then
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/profanity "profanity commit" "$PROFANITY_COMMIT" $PROFANITY_REPO
cd $INSTALL_DIR/profanity
@ -371,7 +381,10 @@ function upgrade_xmpp_client {
./configure --disable-notifications --disable-icons --enable-otr --enable-pgp --enable-plugins --enable-c-plugins --enable-python-plugins --without-xscreensaver
make
make install
fi
CURR_PROFANITY_OMEMO_PLUGIN_COMMIT=$(cat $COMPLETION_FILE | grep "profanity omemo plugin commit" | awk -F ':' '{print $2}')
if [[ "$CURR_PROFANITY_OMEMO_PLUGIN_COMMIT" != "$PROFANITY_OMEMO_PLUGIN_COMMIT" ]]; then
# upgrade omemo plugins for all users
set_repo_commit $INSTALL_DIR/profanity-omemo-plugin "profanity omemo plugin commit" "$PROFANITY_OMEMO_PLUGIN_COMMIT" $PROFANITY_OMEMO_PLUGIN_REPO
cd $INSTALL_DIR/profanity-omemo-plugin
@ -395,6 +408,7 @@ function upgrade_xmpp_client {
rm /etc/skel/.local/share/profanity/plugins/omemo.*
fi
cp $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py /etc/skel/.local/share/profanity/plugins
fi
}
function upgrade_xmpp {
@ -516,6 +530,7 @@ function remove_xmpp {
remove_completion_param install_xmpp
sed -i '/xmpp/d' $COMPLETION_FILE
sed -i '/prosody/d' $COMPLETION_FILE
}
function xmpp_email_headers {
@ -750,6 +765,8 @@ function install_xmpp_nightly {
exit 628732
fi
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
set_completion_param "prosody_filename" "${prosody_filename}"
}
function install_xmpp_main {