From mboxrd@z Thu Jan 1 00:00:00 1970 From: fabbione@sourceware.org Date: 14 Jan 2008 05:26:21 -0000 Subject: [Cluster-devel] cluster/rgmanager/src/resources apache.sh Message-ID: <20080114052621.1136.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: fabbione at sourceware.org 2008-01-14 05:26:21 Modified files: rgmanager/src/resources: apache.sh Log message: Allow the resource to run on Debian/Ubuntu systems without manual patching, by checking for the apache2 daemon if httpd is not available. Replace =~ '^/' sintax with less bash dependent version. Use grep -E instead of -P as perl regexp support is not built on all distros. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.sh.diff?cvsroot=cluster&r1=1.10&r2=1.11 --- cluster/rgmanager/src/resources/apache.sh 2007/04/05 15:08:19 1.10 +++ cluster/rgmanager/src/resources/apache.sh 2008/01/14 05:26:21 1.11 @@ -32,7 +32,11 @@ . $(dirname $0)/utils/messages.sh . $(dirname $0)/utils/ra-skelet.sh -declare APACHE_HTTPD=/usr/sbin/httpd +if [ -x /usr/sbin/httpd ]; then + declare APACHE_HTTPD=/usr/sbin/httpd +elif [ -x /usr/sbin/apache2 ]; then + declare APACHE_HTTPD=/usr/sbin/apache2 +fi declare APACHE_serverConfigFile declare APACHE_pid_file="`generate_name_for_pid_file`" declare APACHE_conf_dir="`generate_name_for_conf_dir`" @@ -42,7 +46,7 @@ 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=$'\n' - 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