1
0
Fork 0
forked from mirror/prosody

Refactor module install scripts to remove duplicate code. Fixes #6.

This commit is contained in:
Sara Aimée Smiseth 2020-06-27 19:47:57 +02:00
parent 9e24592826
commit 476dbd06b8
3 changed files with 7 additions and 47 deletions

View file

@ -77,9 +77,7 @@ RUN docker-prosody-module-install.bash \
e2e_policy `# require end-2-end encryption` \ e2e_policy `# require end-2-end encryption` \
filter_chatstates `# disable "X is typing" type messages` \ filter_chatstates `# disable "X is typing" type messages` \
smacks `# stream management (XEP-0198)` \ smacks `# stream management (XEP-0198)` \
throttle_presence `# presence throttling in CSI` throttle_presence `# presence throttling in CSI` \
RUN docker-prosody-module-copy.bash \
http_upload `# file sharing (XEP-0363)` \ http_upload `# file sharing (XEP-0363)` \
vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)` vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)`

View file

@ -1,41 +0,0 @@
#!/bin/bash
set -e
source="/usr/src/prosody-modules"
target="/usr/local/lib/prosody/custom-modules"
cd ${source}
usage() {
echo "usage: $0 ext-name [ext-name ...]"
echo " ie: $0 carbons e2e_policy proxy65"
echo
echo 'Possible values for ext-name:'
find . -mindepth 1 -maxdepth 1 -type d | sort | sed s/\.\\/mod_//g | xargs
}
exts=
for ext; do
if [ -z "mod_$ext" ]; then
continue
fi
if [ ! -d "mod_$ext" ]; then
echo >&2 "error: $PWD/mod_$ext does not exist"
echo >&2
usage >&2
exit 1
fi
exts="$exts $ext"
done
if [ -z "$exts" ]; then
usage >&2
exit 1
fi
for ext in $exts; do
echo "Installing mod_${ext}"
echo " - copying to ${target}"
cp -r "${source}/mod_${ext}" "${target}/"
done

View file

@ -40,7 +40,10 @@ for ext in $exts; do
echo " - copying to ${target}" echo " - copying to ${target}"
cp -r "${source}/mod_${ext}" "${target}/" cp -r "${source}/mod_${ext}" "${target}/"
echo " - enabling within ${config}" # Skip this if the modules should not be added to modules_enabled.
new_config=$(cat "${config}" | module="${ext}" perl -0pe 's/(modules_enabled[ ]*=[ ]*{[^}]*)};/$1\n\t"$ENV{module}";\n};/') if [ "$ext" != "http_upload" ] && [ "$ext" != "vcard_muc" ] ; then
echo "${new_config}" > "${config}" echo " - enabling within ${config}"
new_config=$(cat "${config}" | module="${ext}" perl -0pe 's/(modules_enabled[ ]*=[ ]*{[^}]*)};/$1\n\t"$ENV{module}";\n};/')
echo "${new_config}" > "${config}"
fi
done done