mirror of
https://github.com/SaraSmiseth/prosody.git
synced 2025-05-04 05:00:39 +00:00
Download prosody-modules only once.
This commit is contained in:
parent
2500028412
commit
9e24592826
5 changed files with 19 additions and 72 deletions
46
docker-prosody-module-install.bash
Executable file
46
docker-prosody-module-install.bash
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source="/usr/src/prosody-modules"
|
||||
target="/usr/local/lib/prosody/custom-modules"
|
||||
config="/usr/local/etc/prosody/conf.d/01-modules.cfg.lua"
|
||||
|
||||
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}/"
|
||||
|
||||
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}"
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue