summaryrefslogtreecommitdiff
path: root/usr/local/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/sbin')
-rwxr-xr-xusr/local/sbin/maj_prosodymods.sh10
-rwxr-xr-xusr/local/sbin/update_conversejs.sh36
2 files changed, 46 insertions, 0 deletions
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