Better handling of xmpp upgrades
This commit is contained in:
parent
c938e6313a
commit
f24ad2cd17
|
@ -293,53 +293,58 @@ function upgrade_xmpp_server {
|
||||||
function_check update_prosody_modules
|
function_check update_prosody_modules
|
||||||
update_prosody_modules
|
update_prosody_modules
|
||||||
|
|
||||||
if [ -d ${INSTALL_DIR}/${prosody_filename} ]; then
|
curr_prosody_filename=$(cat $COMPLETION_FILE | grep "prosody_filename" | awk -F ':' '{print $2}')
|
||||||
# ensure that the binaries have not been overwritten
|
if [[ "$curr_prosody_filename" != "$prosody_filename" ]]; then
|
||||||
# by an operating system upgrade
|
if [ -d ${INSTALL_DIR}/${prosody_filename} ]; then
|
||||||
cd ${INSTALL_DIR}/${prosody_filename}
|
# ensure that the binaries have not been overwritten
|
||||||
make prefix=/usr install
|
# by an operating system upgrade
|
||||||
else
|
cd ${INSTALL_DIR}/${prosody_filename}
|
||||||
cd $INSTALL_DIR
|
make prefix=/usr install
|
||||||
# Try to get the source from the project repo
|
|
||||||
if [ -f /root/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz ]; then
|
|
||||||
cp /root/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz .
|
|
||||||
else
|
else
|
||||||
if [ -f /home/${MY_USERNAME}/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz ]; then
|
cd $INSTALL_DIR
|
||||||
cp /home/${MY_USERNAME}/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz .
|
# Try to get the source from the project repo
|
||||||
|
if [ -f /root/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz ]; then
|
||||||
|
cp /root/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz .
|
||||||
else
|
else
|
||||||
wget $prosody_nightly_url
|
if [ -f /home/${MY_USERNAME}/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz ]; then
|
||||||
|
cp /home/${MY_USERNAME}/${PROJECT_NAME}/image_build/${prosody_filename}.tar.gz .
|
||||||
|
else
|
||||||
|
wget $prosody_nightly_url
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ! -f ${INSTALL_DIR}/${prosody_filename}.tar.gz ]; then
|
||||||
|
echo $"Failed to download prosody nightly $prosody_nightly_url"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
if [ ! -f ${INSTALL_DIR}/${prosody_filename}.tar.gz ]; then
|
|
||||||
echo $"Failed to download prosody nightly $prosody_nightly_url"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
hash_value=$(sha256sum ${INSTALL_DIR}/${prosody_filename}.tar.gz | awk -F ' ' '{print $1}')
|
hash_value=$(sha256sum ${INSTALL_DIR}/${prosody_filename}.tar.gz | awk -F ' ' '{print $1}')
|
||||||
if [[ "$hash_value" != "$prosody_nightly_hash" ]]; then
|
if [[ "$hash_value" != "$prosody_nightly_hash" ]]; then
|
||||||
|
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
||||||
|
echo $'Unexpected hash value for prosody nightly download'
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar -xzvf ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
||||||
|
cd ${INSTALL_DIR}/${prosody_filename}
|
||||||
|
./configure --ostype=debian --prefix=/usr
|
||||||
|
make prefix=/usr
|
||||||
|
make prefix=/usr install
|
||||||
|
if [ -f /usr/local/bin/prosody ]; then
|
||||||
|
echo $'Failed to build prosody nightly to /usr/bin'
|
||||||
|
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
||||||
|
rm -rf ${INSTALL_DIR}/${prosody_filename}
|
||||||
|
return
|
||||||
|
fi
|
||||||
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
||||||
echo $'Unexpected hash value for prosody nightly download'
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tar -xzvf ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
# add onion addresses for known servers
|
||||||
cd ${INSTALL_DIR}/${prosody_filename}
|
if ! grep -q "onions_map =" /etc/prosody/prosody.cfg.lua; then
|
||||||
./configure --ostype=debian --prefix=/usr
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
||||||
make prefix=/usr
|
xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
|
||||||
make prefix=/usr install
|
|
||||||
if [ -f /usr/local/bin/prosody ]; then
|
|
||||||
echo $'Failed to build prosody nightly to /usr/bin'
|
|
||||||
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
|
||||||
rm -rf ${INSTALL_DIR}/${prosody_filename}
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
|
||||||
fi
|
|
||||||
|
|
||||||
# add onion addresses for known servers
|
set_completion_param "prosody_filename" "${prosody_filename}"
|
||||||
if ! grep -q "onions_map =" /etc/prosody/prosody.cfg.lua; then
|
|
||||||
echo '' >> /etc/prosody/prosody.cfg.lua
|
|
||||||
xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart prosody
|
systemctl restart prosody
|
||||||
|
@ -353,48 +358,57 @@ function upgrade_xmpp_client {
|
||||||
|
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
|
|
||||||
function_check set_repo_commit
|
CURR_LIBMESODE_COMMIT=$(cat $COMPLETION_FILE | grep "libmesode commit" | awk -F ':' '{print $2}')
|
||||||
set_repo_commit $INSTALL_DIR/libmesode "libmesode commit" "$LIBMESODE_COMMIT" $LIBMESODE_REPO
|
if [[ "$CURR_LIBMESODE_COMMIT" != "$LIBMESODE_COMMIT" ]]; then
|
||||||
cd $INSTALL_DIR/libmesode
|
function_check set_repo_commit
|
||||||
./bootstrap.sh
|
set_repo_commit $INSTALL_DIR/libmesode "libmesode commit" "$LIBMESODE_COMMIT" $LIBMESODE_REPO
|
||||||
./configure
|
cd $INSTALL_DIR/libmesode
|
||||||
make
|
./bootstrap.sh
|
||||||
make install
|
./configure
|
||||||
cp /usr/local/lib/libmesode* /usr/lib
|
make
|
||||||
|
make install
|
||||||
|
cp /usr/local/lib/libmesode* /usr/lib
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
|
|
||||||
function_check set_repo_commit
|
CURR_PROFANITY_COMMIT=$(cat $COMPLETION_FILE | grep "profanity commit" | awk -F ':' '{print $2}')
|
||||||
set_repo_commit $INSTALL_DIR/profanity "profanity commit" "$PROFANITY_COMMIT" $PROFANITY_REPO
|
if [[ "$CURR_PROFANITY_COMMIT" != "$PROFANITY_COMMIT" ]]; then
|
||||||
cd $INSTALL_DIR/profanity
|
function_check set_repo_commit
|
||||||
./bootstrap.sh
|
set_repo_commit $INSTALL_DIR/profanity "profanity commit" "$PROFANITY_COMMIT" $PROFANITY_REPO
|
||||||
./configure --disable-notifications --disable-icons --enable-otr --enable-pgp --enable-plugins --enable-c-plugins --enable-python-plugins --without-xscreensaver
|
cd $INSTALL_DIR/profanity
|
||||||
make
|
./bootstrap.sh
|
||||||
make install
|
./configure --disable-notifications --disable-icons --enable-otr --enable-pgp --enable-plugins --enable-c-plugins --enable-python-plugins --without-xscreensaver
|
||||||
|
make
|
||||||
# upgrade omemo plugins for all users
|
make install
|
||||||
set_repo_commit $INSTALL_DIR/profanity-omemo-plugin "profanity omemo plugin commit" "$PROFANITY_OMEMO_PLUGIN_COMMIT" $PROFANITY_OMEMO_PLUGIN_REPO
|
fi
|
||||||
cd $INSTALL_DIR/profanity-omemo-plugin
|
|
||||||
sed -i 's|python setup.py|python2.7 setup.py|g' $INSTALL_DIR/profanity-omemo-plugin/install.sh
|
CURR_PROFANITY_OMEMO_PLUGIN_COMMIT=$(cat $COMPLETION_FILE | grep "profanity omemo plugin commit" | awk -F ':' '{print $2}')
|
||||||
pip uninstall -y profanity-omemo-plugin
|
if [[ "$CURR_PROFANITY_OMEMO_PLUGIN_COMMIT" != "$PROFANITY_OMEMO_PLUGIN_COMMIT" ]]; then
|
||||||
./install.sh
|
# upgrade omemo plugins for all users
|
||||||
for d in /home/*/ ; do
|
set_repo_commit $INSTALL_DIR/profanity-omemo-plugin "profanity omemo plugin commit" "$PROFANITY_OMEMO_PLUGIN_COMMIT" $PROFANITY_OMEMO_PLUGIN_REPO
|
||||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
cd $INSTALL_DIR/profanity-omemo-plugin
|
||||||
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
sed -i 's|python setup.py|python2.7 setup.py|g' $INSTALL_DIR/profanity-omemo-plugin/install.sh
|
||||||
if [ ! -d /home/$USERNAME/.local/share/profanity/plugins ]; then
|
pip uninstall -y profanity-omemo-plugin
|
||||||
mkdir -p /home/$USERNAME/.local/share/profanity/plugins
|
./install.sh
|
||||||
fi
|
for d in /home/*/ ; do
|
||||||
if [ -f $INSTALL_DIR/profanity-omemo-plugin/omemo.py ]; then
|
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||||
rm $INSTALL_DIR/profanity-omemo-plugin/omemo.*
|
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
||||||
fi
|
if [ ! -d /home/$USERNAME/.local/share/profanity/plugins ]; then
|
||||||
cp $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py /home/$USERNAME/.local/share/profanity/plugins
|
mkdir -p /home/$USERNAME/.local/share/profanity/plugins
|
||||||
chown -R $USERNAME:$USERNAME /home/$USERNAME/.local
|
fi
|
||||||
fi
|
if [ -f $INSTALL_DIR/profanity-omemo-plugin/omemo.py ]; then
|
||||||
done
|
rm $INSTALL_DIR/profanity-omemo-plugin/omemo.*
|
||||||
if [ -f /etc/skel/.local/share/profanity/plugins/omemo.py ]; then
|
fi
|
||||||
rm /etc/skel/.local/share/profanity/plugins/omemo.*
|
cp $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py /home/$USERNAME/.local/share/profanity/plugins
|
||||||
|
chown -R $USERNAME:$USERNAME /home/$USERNAME/.local
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -f /etc/skel/.local/share/profanity/plugins/omemo.py ]; then
|
||||||
|
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
|
fi
|
||||||
cp $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py /etc/skel/.local/share/profanity/plugins
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_xmpp {
|
function upgrade_xmpp {
|
||||||
|
@ -516,6 +530,7 @@ function remove_xmpp {
|
||||||
|
|
||||||
remove_completion_param install_xmpp
|
remove_completion_param install_xmpp
|
||||||
sed -i '/xmpp/d' $COMPLETION_FILE
|
sed -i '/xmpp/d' $COMPLETION_FILE
|
||||||
|
sed -i '/prosody/d' $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function xmpp_email_headers {
|
function xmpp_email_headers {
|
||||||
|
@ -750,6 +765,8 @@ function install_xmpp_nightly {
|
||||||
exit 628732
|
exit 628732
|
||||||
fi
|
fi
|
||||||
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
||||||
|
|
||||||
|
set_completion_param "prosody_filename" "${prosody_filename}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_xmpp_main {
|
function install_xmpp_main {
|
||||||
|
|
Loading…
Reference in New Issue