From e0e590be90f1fba904ee0de997a5cf7f72c5a29c Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Sat, 22 May 2021 17:36:01 +0100 Subject: let's start with the template files --- usr/local/sbin/maj_prosodymods.sh | 10 ++++++++++ usr/local/sbin/update_conversejs.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 usr/local/sbin/maj_prosodymods.sh create mode 100755 usr/local/sbin/update_conversejs.sh (limited to 'usr/local') diff --git a/usr/local/sbin/maj_prosodymods.sh b/usr/local/sbin/maj_prosodymods.sh new file mode 100755 index 0000000..c7ffaed --- /dev/null +++ b/usr/local/sbin/maj_prosodymods.sh @@ -0,0 +1,10 @@ +#!/bin/sh +MODDIR="/usr/lib/prosody/modules/" + +if test -d $MODDIR; then + cd $MODDIR + hg pull --update +else + mkdir -p /usr/lib/prosody + hg clone https://hg.prosody.im/prosody-modules/ $MODDIR +fi diff --git a/usr/local/sbin/update_conversejs.sh b/usr/local/sbin/update_conversejs.sh new file mode 100755 index 0000000..971d980 --- /dev/null +++ b/usr/local/sbin/update_conversejs.sh @@ -0,0 +1,36 @@ +#!/bin/sh +TEMPDIR="$(mktemp -d)" +LOG=/var/log/update_conversejs.log +WWWDIR='/var/www/chat.exemple.fr' +WWWUSER='www-data' # this value will differ on the + # distro you're using: it'll be 'http' on + # Arch Linux nginx for example. + +mkdir -p $WWWDIR/dist +cd $TEMPDIR +printf "\n\n$(date) - INFO - Starting updating conversejs..." | tee -a $LOG +CURL_ERR=$(curl -s \ # let's grab latest release tarball of converse.js + https://api.github.com/repos/conversejs/converse.js/releases/latest | \ + grep -o "https://.*\.tgz" | \ + grep converse\.js- | \ + xargs curl -fsOJL) || \ + (printf "\n$(date) - ERR - Updating conversejs failed." | tee -a $LOG && exit) + +# we download the OMEMO library to use it in converse +if test -e "$WWWDIR/dist/libsignal-protocol.min.js"; then + printf "\n$(date) - TOK - Libsignal already installed, skipping." | tee -a $LOG +else + curl -fsOJL \ + https://cdn.conversejs.org/3rdparty/libsignal-protocol.min.js || \ + (printf "\n$(date) - ERR - Updating libsignal-protocol-javascript failed." | \ + tee -a $LOG) + cp libsignal*.js $WWWDIR/dist/ +fi + +tar xzf *.tgz +cp -rf package/dist $WWWDIR/ +sed "s/fullscreen\.html/index\.html/g" package/manifest.json > $WWWDIR/manifest.json +chown $WWWUSER:$WWWUSER -R $WWWDIR/ +chmod 755 -R $WWWDIR/ +rm -rf $TEMPDIR +printf "\n$(date) - TOK - Done." | tee -a $LOG -- cgit v1.2.3-70-g09d2