Hi,

On Mon, Nov 22, 2010 at 05:48:19PM +0200, Alexander Bodnarashik wrote:
> Finally i've managed to build and run heartbeat/pacemaker on FreeBSD 8.1 host.

I guess that you pulled the yesterday's resource-agents with the
autoconf fix to exclude tickle if struct iphdr is not available.
Of course, BSD has a corresponding struct, but slightly
different.

> Attached you'll find csh script (with few comments inside)
> which will automate installation on clean system (no error
> checking, sorry, just draft script to save some time and
> keypresses).
> Due to different paths to programs on Linux and FreeBSD i've
> made few ugly symlinks and applied few patches to fix Linux
> specific code (or FreeBSD specific :) )
> I'm pretty sure most of them are not required and it may be
> fixed by autotools, but i have zero-knowledge there.
> I haven't tested if cluster behaves properly yet.

It would be interesting to hear if it does.

> #!/bin/csh
> 
> # Prerequisites:
> # clean FreeBSD 8.1. Standard installation, distribution: user
> 
> pkg_add -rv gcc42 bash gmake autotools python libxslt glib20 libnet113-devel 
> dbus-glib e2fsprogs-libuuid help2man libltdl22
> 
> setenv MAKE gmake
> # Note: PREFIX should be /usr (at least OCF_ROOT_DIR must be /usr/lib/ocf)
> # From the definition of ocf RAs: 
> # "OCF Resource Agents are those found in /usr/lib/ocf/resource.d/{provider}" 
> setenv PREFIX /usr
> setenv LCRSODIR $PREFIX/libexec/lcrso 
> setenv OCF_ROOT_DIR $PREFIX/lib/ocf
> setenv PATH /usr/local/bin:$PATH
> setenv CC /usr/local/bin/gcc42
> 
> setenv CLUSTER_USER hacluster
> setenv CLUSTER_GROUP haclient
> getent group ${CLUSTER_GROUP} >/dev/null || pw groupadd ${CLUSTER_GROUP}
> getent passwd ${CLUSTER_USER} >/dev/null || pw useradd ${CLUSTER_USER} -g 
> ${CLUSTER_GROUP} -d /var/lib/heartbeat/cores/hacluster -s /sbin/nologin -c 
> "cluster user"
> setenv CLUSTER_USER_ID `id -u hacluster`
> setenv CLUSTER_GROUP_ID `pw group show haclient |cut -d ':' -f 3`
> 
> ln -s /usr/local/bin/gcc42 /usr/local/bin/gcc
> ln -s /usr/local/bin/bash /bin/bash
> ln -s /usr/local/bin/python /usr/bin/python
> 
> # Cluster Glue
> fetch -o cluster-glue.tar.bz2 http://hg.linux-ha.org/glue/archive/tip.tar.bz2
> tar jxvf cluster-glue.tar.bz2
> cd Reusable-Cluster-Components-*
> ./autogen.sh
> # configure script is looking for libnet-config
> ln -s /usr/local/bin/libnet113-config /usr/local/bin/libnet-config
> ./configure --prefix=$PREFIX --with-daemon-user=${CLUSTER_USER} 
> --with-daemon-group=${CLUSTER_GROUP} --with-ocf-root=${OCF_ROOT_DIR} 
> --disable-fatal-warnings
> gmake
> gmake install
> cd ..
> 
> # Resource Agents
> fetch -o resource-agents.tar.bz2 
> http://hg.linux-ha.org/agents/archive/tip.tar.bz2
> tar jxvf resource-agents.tar.bz2
> cd Cluster-Resource-Agents-*
> ./autogen.sh
> ./configure --prefix=$PREFIX --with-ocf-root=${OCF_ROOT_DIR} 
> --disable-fatal-warnings
> # fix wrong include in system libnet: 
> /usr/local/include/libnet113/./libnet/libnet-types.h
> ln -s include/config.h .
> # fix wrong bash location (can we use /bin/sh which seems to be more 
> crossplatform? or at least /usr/bin/env bash) <-- hotfixed by bash symlink

Yes, I think that we could do the latter. Using /bin/sh is not an
option, since it may be a shell not compatible with bash. The crm
needs to say /usr/bin/env python too.

Thanks,

Dejan

> # heartbeat/AoEtarget
> # heartbeat/ManageRAID
> # heartbeat/ManageVE
> # heartbeat/Squid
> # heartbeat/SysInfo
> # heartbeat/drbd
> # heartbeat/eDir88
> # heartbeat/fio
> # heartbeat/iSCSILogicalUnit
> # heartbeat/iSCSITarget
> # heartbeat/syslog-ng
> # heartbeat/jboss
> gmake
> gmake install
> cd ..
> 
> # Heartbeat
> fetch -o heartbeat.tar.bz2 http://hg.linux-ha.org/dev/archive/tip.tar.bz2
> tar jxvf heartbeat.tar.bz2
> cd Heartbeat-*
> ./bootstrap
> ./configure --prefix=$PREFIX --disable-fatal-warnings 
> --with-group-id=${CLUSTER_GROUP_ID} --with-ccmuser-id=${CLUSTER_USER_ID} 
> CFLAGS="-fstack-protector"
> gmake
> gmake install
> cd ..
> 
> # Pacemaker
> fetch -o pacemaker.tar.bz2 
> http://hg.clusterlabs.org/pacemaker/stable-1.0/archive/tip.tar.bz2
> tar jxvf pacemaker.tar.bz2
> cd Pacemaker-1-0-*
> ./autogen.sh
> ./configure --prefix=$PREFIX --with-lcrso-dir=$LCRSODIR 
> --disable-fatal-warnings CFLAGS="-fstack-protector"
> #### patch lib/cib/cib_remote.c (taken from 
> http://www.koders.com/c/fid2A7C7FE2239BE0488BC8E7F95DC344CE15E41AC8.aspx?s=cdefs)
> patch <<EOD
> --- lib/cib/cib_remote.c.orig   2010-11-22 12:48:04.000000000 +0000
> +++ lib/cib/cib_remote.c        2010-11-22 12:48:32.000000000 +0000
> @@ -53,7 +53,10 @@ typedef void gnutls_session;
>  #endif
>  
>  #include <arpa/inet.h>
> -#include <sgtty.h>
> +#ifndef USE_OLD_TTY
> +#define USE_OLD_TTY
> +#endif
> +#include <sys/ioctl.h>
>  
>  #define DH_BITS 1024
>  
> EOD
> patch <<EOD
> --- tools/pingd.c.orig  2010-11-22 12:50:11.000000000 +0000
> +++ tools/pingd.c       2010-11-22 12:50:26.000000000 +0000
> @@ -46,6 +46,7 @@
>  
>  #include <arpa/inet.h>
>  #include <netinet/ip.h>
> +#include <netinet/in.h>
>  #include <netinet/ip_icmp.h>
>  #include <netinet/ip6.h>
>  #include <netinet/icmp6.h>
> EOD
> #### patch tools/crm_mon.c (find proper place? handle SIGCLD/SIGCHLD on 
> configure/autotools stage?)
> patch <<EOD
> --- tools/crm_mon.c.orig        2010-11-22 12:51:13.000000000 +0000
> +++ tools/crm_mon.c     2010-11-22 12:52:07.000000000 +0000
> @@ -186,6 +186,9 @@ mon_shutdown(int nsig)
>  }
>  
>  #if CURSES_ENABLED
> +#ifndef HAVE_SIGHANDLER_T
> +typedef void (*sighandler_t)(int);
> +#endif
>  static sighandler_t ncurses_winch_handler;
>  static void
>  mon_winresize(int nsig)
> @@ -331,7 +334,7 @@ main(int argc, char **argv)
>  
>  #ifndef ON_DARWIN
>      /* prevent zombies */
> -    signal(SIGCLD, SIG_IGN);
> +    signal(SIGCHLD, SIG_IGN);
>  #endif
>      
>      if (strcmp(crm_system_name, "crm_mon.cgi")==0) {
> EOD
> gmake
> gmake install
> cd ..
> 
> cat << EOD > /usr/etc/ha.d/ha.cf
> # Logging
> debug 1
> use_logd false
> logfacility daemon
> 
> # Misc Options
> traditional_compression off
> compression bz2
> coredumps true
> 
> # Communications
> mcast em0 239.0.0.1 694 1 0 #adjust appropriate
> autojoin any
> 
> # Thresholds (in seconds)
> keepalive 1
> warntime 6
> deadtime 10
> initdead 15
> 
> #crm
> crm respawn
> EOD
> 
> cat <<EOD > /usr/etc/ha.d/authkeys
> auth 1
> 1 md5 secret
> EOD
> chmod 0600 /usr/etc/ha.d/authkeys
> 
> # finally:
> #/usr/local/etc/rc.d/heartbeat.sh start
> 
> #### issues :
> # freebsd tries to run everything under /usr/local/etc/rc.d
> # Starting ldirectord... Can't locate Socket6.pm
> # touch: /var/lock/subsys/ldirectord: No such file or directory
> ####
> # "setenv PYTHONPATH /usr/lib/python2.6/site-packages" required to be able to 
> run crm
> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to