first bit allows to run the resource on Debian/Ubuntu systems without
manual patching, by checking for the apache2 daemon if httpd is not
available.
second bit makes that piece of code to work. For some reasons the sintax
=~ '^/' doesn't work in recent bash. Replace with something more generic
and less bash dependent.
third bit: not all versions of grep are built with perl regexp support.
For this specific instance, there is no point to use -P. Use -E that
achieve the same result and avoid warnings.
Please apply or ACK.
Thanks
Fabio
PS I am investigating a more deep rewrite of this script as it is buggy in
several different ways... is the original author still working on it or
interested in working with me?
apache_serverConfigFile()
{
- if [[ "$OCF_RESKEY_config_file" =~ '^/' ]]; then
+ if $(echo $OCF_RESKEY_config_file | grep -q "^/"); then
APACHE_serverConfigFile="$OCF_RESKEY_config_file"
else
APACHE_serverConfigFile="$OCF_RESKEY_server_root/$OCF_RESKEY_config_file"
@@ -135,7 +139,7 @@
IFS_old="$IFS"
IFS=$'
'
- for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -P '(^Listen)|(^Port)' | grep -v ':'`; do
+ for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -E '(^Listen)|(^Port)' | grep -v ':'`; do
port=`echo $i | sed 's/^Listen (.*)/1/;s/^Port (.*)/1/'`;
IFS=$' ';
for z in $ip_addresses; do
--
I'm going to make him an offer he can't refuse.