Compile profanity from source with omemo support

This commit is contained in:
Bob Mottram 2016-12-19 15:40:35 +00:00
parent e0021a05a6
commit 7d7591f235
1 changed files with 95 additions and 3 deletions

View File

@ -46,6 +46,15 @@ prosody_nightly_hash='f1fdc8ce5b6f8bfa451d458616a0bbe5ed7c15881415e561586bab39bd
prosody_filename=prosody-${prosody_latest_version}-1nightly${prosody_nightly}
prosody_nightly_url="https://prosody.im/nightly/${prosody_latest_version}/latest/${prosody_filename}.tar.gz"
LIBMESODE_REPO="https://github.com/boothj5/libmesode"
LIBMESODE_COMMIT='e3db0e9bfba61b2d82193874343a94a88f910800'
PROFANITY_REPO="https://github.com/boothj5/profanity"
PROFANITY_COMMIT='b64646979ea50a13d0c7ec0b1a46969f661569a8'
PROFANITY_OMEMO_PLUGIN_REPO="https://github.com/ReneVolution/profanity-omemo-plugin"
PROFANITY_OMEMO_PLUGIN_COMMIT='8abc5bc1bf16e051d89824b9981fcd137ba03e78'
xmpp_variables=(ONION_ONLY
INSTALLED_WITHIN_DOCKER
XMPP_CIPHERS
@ -126,6 +135,12 @@ function change_password_xmpp {
echo ''
echo $'Currently Prosody requires password changes to be done interactively'
prosodyctl passwd ${curr_username}@${DEFAULT_DOMAIN_NAME}
XMPP_CLIENT_DIR=/home/$curr_username/.local/share/profanity
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
if [ -f $XMPP_CLIENT_ACCOUNTS ]; then
sed -i "s|password=.*|password=$new_user_password|g" $XMPP_CLIENT_ACCOUNTS
fi
}
function reconfigure_xmpp {
@ -183,6 +198,38 @@ function upgrade_xmpp {
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
fi
systemctl restart prosody
# update profanity client
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/libmesode "libmesode commit" "$LIBMESODE_COMMIT" $LIBMESODE_REPO
cd $INSTALL_DIR/libmesode
./bootstrap.sh
./configure
make
make install
cp /usr/local/lib/libmesode* /usr/lib
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/profanity "profanity commit" "$PROFANITY_COMMIT" $PROFANITY_REPO
cd $INSTALL_DIR/profanity
./bootstrap.sh
./configure --disable-notifications --disable-icons --enable-otr --enable-pgp --enable-plugins --enable-c-plugins --enable-python-plugins --without-xscreensaver
make
make install
# 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
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [ ! -d /home/$USERNAME/.local/share/profanity/plugins ]; then
mkdir -p /home/$USERNAME/.local/share/profanity/plugins
fi
cp $INSTALL_DIR/profanity-omemo-plugin/omemo.py /home/$USERNAME/.local/share/profanity/plugins
chown -R $USERNAME:$USERNAME /home/$USERNAME/.local
fi
done
cp $INSTALL_DIR/profanity-omemo-plugin/omemo.py /etc/skel/.local/share/profanity/plugins
}
function backup_local_xmpp {
@ -690,10 +737,55 @@ function install_xmpp_main {
}
function install_xmpp_client {
# install profanity from source in order to get OMEMO support
if [[ $(app_is_installed xmpp_client) == "1" ]]; then
return
fi
apt-get -yq install profanity
if [ ! -d $INSTALL_DIR ]; then
mkdir -p $INSTALL_DIR
fi
apt-get -yq install automake autoconf autoconf-archive libtool build-essential
apt-get -yq install libncursesw5-dev libglib2.0-dev libcurl3-dev sqlite3
apt-get -yq install libotr5-dev libgpgme11-dev python-dev libreadline-dev
# dependency for profanity not available in debian
git_clone $LIBMESODE_REPO $INSTALL_DIR/libmesode
cd $INSTALL_DIR/libmesode
git checkout $LIBMESODE_COMMIT -b $LIBMESODE_COMMIT
./bootstrap.sh
./configure
make
make install
cp /usr/local/lib/libmesode* /usr/lib
# build profanity
git_clone $PROFANITY_REPO $INSTALL_DIR/profanity
cd $INSTALL_DIR/profanity
git checkout $PROFANITY_COMMIT -b $PROFANITY_COMMIT
./bootstrap.sh
./configure --disable-notifications --disable-icons --enable-otr --enable-pgp --enable-plugins --enable-c-plugins --enable-python-plugins --without-xscreensaver
make
make install
if [ ! -f /usr/local/bin/profanity ]; then
echo $'Unable to build profanity'
exit 7825272
fi
# install the omemo plugin
git_clone $PROFANITY_OMEMO_PLUGIN_REPO $INSTALL_DIR/profanity-omemo-plugin
cd $INSTALL_DIR/profanity-omemo-plugin
git checkout $PROFANITY_OMEMO_PLUGIN_COMMIT -b $PROFANITY_OMEMO_PLUGIN_COMMIT
if [ ! -f $INSTALL_DIR/profanity-omemo-plugin/omemo.py ]; then
echo $'omemo.py not found'
exit 389225
fi
mkdir -p /etc/skel/.local/share/profanity/plugins
cp $INSTALL_DIR/profanity-omemo-plugin/omemo.py /etc/skel/.local/share/profanity/plugins
cp $INSTALL_DIR/profanity-omemo-plugin/omemo.py /home/$MY_USERNAME/.local/share/profanity/plugins
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.local
XMPP_CLIENT_DIR=/home/$MY_USERNAME/.local/share/profanity
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
@ -706,7 +798,7 @@ function install_xmpp_client {
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
echo "jid=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
echo "muc.service=conference.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
echo "muc.service=chat.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS
@ -730,7 +822,7 @@ function install_xmpp_client {
fi
echo "jid=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
echo "muc.service=conference.${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo "muc.service=${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS