summaryrefslogtreecommitdiff
path: root/pcr/ha-glue/PKGBUILD
blob: ed46bc66d7a3acba0ecca77685ee00a58e93cd54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Maintainer (Parabola): Márcio Silva <coadde@lavabit.com>

pkgname=ha-glue
_pkgname=${pkgname:3}
pkgver=1.0.11
pkgrel=6
pkgdesc='Set of libraries, tools and utilities suitable for the Heartbeat/Pacemaker cluster stack'
arch=(
  i686
  x86_64
  mips64el
)
url=http://linux-ha.org/wiki/Cluster_${_pkgname^}
license=(
  GPL2
  LGPL2.1
)
depends=(
  curl
  dbus-glib
  glib2
  libaio
  libesmtp
  libnet
  libxml2
  net-snmp
  python
  util-linux
)
optdepends=(
  lynx
  net-tools
  openssh
  valgrind
  w3m
)
makedepends=(
  help2man
  libxslt
  lynx
  net-tools
  openssh
  valgrind
  w3m
)
options=!libtool
install=$pkgname.install
source=(
  http://hg.linux-ha.org/$_pkgname/archive/$_pkgname-$pkgver.tar.bz2
  ha-log.service
)
sha512sums=(
  35ac8ac555c39f24c11e3a768cc50eba051fe617edf4cdc0429dac73f45a472f144cfe6ec5faff575606f2b04ff76a2f732556d848b61410c2683d93ba928413
  9252472a6d7a1bbad765c63becdec4064d882b1eb98abdf27833a6e06d8750f06663b2460d32a4c72d04f10a7480ef0a2093b8a18b4d1fc62a989cde54ee056a
)

prepare() {
  export _CLUSTER_USER=hacluster
  export _CLUSTER_GROUP=haclient
  _DGID=666
  _DUID=666

  #verify the cluster user and group
  if ! getent group $_CLUSTER_GROUP >/dev/null;then
    msg 'BEFORE COMPILE THIS SOFTWARE YOU MUST CREATE A CLUSTER GROUP, EXECUTE AS ROOT:'
    echo -e "# groupadd -r -g $_DGID $_CLUSTER_GROUP\n"
    _EXITCODE=1
  fi
  if ! getent passwd $_CLUSTER_USER >/dev/null;then
    msg 'BEFORE COMPILE THIS SOFTWARE YOU MUST CREATE A CLUSTER USER, EXECUTE AS ROOT:'
    echo -e "# useradd -r -g $_CLUSTER_GROUP -u $_DUID -d /var/lib/heartbeat/cores/$_CLUSTER_USER -s /sbin/nologin -c \"cluster user\" $_CLUSTER_USER\n"
    _EXITCODE=1
  fi
  if [[ $_EXITCODE -eq 1 ]] ;then
    return 1
  fi

  cd $srcdir/Reusable-Cluster-Components-$_pkgname--$_pkgname-$pkgver
  sed -i 's|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|;
          s| -O0||;
          s|AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)|AM_INIT_AUTOMAKE|;
         ' configure.ac
  sed -i 's|INCLUDES|AM_CPPFLAGS|;
         ' {lib/{clplumbing,lrm,pils,plugins/{InterfaceMgr,compress,lrm,stonith},stonith},logd,lrm/{admin,lrmd,test},replace}/Makefile.am
}

build() {
  cd $srcdir/Reusable-Cluster-Components-$_pkgname--$_pkgname-$pkgver
  setarch $CARCH ./autogen.sh
  setarch $CARCH ./configure --prefix=/usr\
    --disable-fatal-warnings\
    --enable-static=no\
    --enable-upstart\
    --libdir=/usr/lib\
    --localstatedir=/var\
    --sysconfdir=/etc\
    --with-daemon-group=haclient\
    --with-daemon-user=hacluster\
    --with-ocf-root=/usr/lib/ocf
  setarch $CARCH make
}

package() {
  cd $srcdir/Reusable-Cluster-Components-$_pkgname--$_pkgname-$pkgver
  setarch $CARCH make DESTDIR=$pkgdir install

  install -d $pkgdir/usr/lib/systemd/system
  install -Dm644 $srcdir/ha-log.service $pkgdir/usr/lib/systemd/system

  msg 'AFTER COMPILE THIS SOFTWARE YOU MUST DELETE A CLUSTER USER AND A CLUSTER GROUP, EXECUTE AS ROOT:'
  echo -e "# userdel $_CLUSTER_USER"
  echo -e "# groupdel $_CLUSTER_GROUP"
}

# vim:set ts=2 sw=2 et: