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

@ -40,7 +40,10 @@ for ext in $exts; do
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}"
# Skip this if the modules should not be added to modules_enabled.
if [ "$ext" != "http_upload" ] && [ "$ext" != "vcard_muc" ] ; then
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