summaryrefslogtreecommitdiff
path: root/pcr/cluster-glue/PKGBUILD
blob: 6c3618b5d94b9169580a3324f4b458a68852889a (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Maintainer: Márcio Silva <coadde@lavabit.com>

pkgname=cluster-glue
_pkgname1=${pkgname::7}
_pkgname2=${pkgname:8}
_pkgname=${_pkgname1^}_${_pkgname2^}
pkgver=1.0.11
pkgrel=14
pkgdesc='Set of libraries, tools and utilities suitable for the Heartbeat/Pacemaker cluster stack (Linux-HA)'
arch=(
  i686
  x86_64
  mips64el
)
group=linux-ha
url=http://$group.org/wiki/$_pkgname
license=(
  GPL2
  LGPL2.1
)
depends=(
  curl
  dbus-glib
  glib2
  libaio
  libesmtp
  libltdl
  libnet
  libxml2
  net-snmp
  openhpi
  openipmi
  openssh
  python2
  util-linux
)
optdepends=net-tools
makedepends=(
  help2man
  libxslt
  lynx
  net-tools
  openssh
  valgrind
  w3m
)
options=(!libtool)
provides=(ha-$_pkgname2)
conflicts=ha-$_pkgname2
replaces=ha-$_pkgname2
install=$pkgname.install
source=(
  http://hg.$group.org/$_pkgname2/archive/$_pkgname2-$pkgver.tar.bz2
  ha-log.service
  fixing-path.sed
  replace-linux_os-to-gnulinux_os-term.sed
  replace-opensource-to-free-term.sed
)
sha512sums=(
  35ac8ac555c39f24c11e3a768cc50eba051fe617edf4cdc0429dac73f45a472f144cfe6ec5faff575606f2b04ff76a2f732556d848b61410c2683d93ba928413
  bb5bc5c5a9347302be583c43b100c0c3760ec4dcc3348a9f9708d5b2c58ec02dd5782c5ac9dcb86223258493ad3fba8ddd8dc5670390f0f602c34869b26bee6d
  ce58a2af9f32265f12cc4984e9ae7f285fdb7737813ecccc0780015d048938d9dd79278635eb1cc6833f12f37a8c43211fec17411780220cf38fc44b91ecc076
  e59386aee4db5857fa131798327aa449a5efcd7d50c3ab45dadfa0becc31698a62367ce83b85ca739bdebaad4a9daf96d02c42673a4e26294ec0fa67323fdb5b
  c3116956fd1a35f686f2f4cbe1314b4b41c22e4dfab69f8be5d16043e083351219e389c534e95dba2e970a16f689eb4c85ea9e6783854b138a06fe8190cf9a1c
)

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-${_pkgname1^}-Components-$_pkgname2--$_pkgname2-$pkgver
  sed -i 's|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|;
          s| -O0||;
          s|AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)|AM_INIT_AUTOMAKE|;
          s|${localstatedir}/lock ${localstatedir}/spool/lock ${localstatedir}/spool/locks ${localstatedir}/lock|/run/lock|;
          s|/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin|/usr/bin|;
         ' configure.ac
  sed -i 's|INCLUDES|AM_CPPFLAGS|;
         ' $(grep -rlI INCLUDES | grep Makefile.am)

  # fixing path
  sed -i -f $srcdir/fixing-path.sed\
    $(grep -rlI /bin)\
    $(grep -rlI /sbin)\
    $(grep -rlI /lib)\
    $(grep -rlI /var)

  # fixing python2 path
  sed -i 's|bin/env python|bin/env python2|g;
          s|bin/python|bin/python2|g;
         ' $(grep -rlI 'bin/env python')\
           $(grep -rlI bin/python)

  # remove Linux (OS) term to GNU/Linux (OS) term
  sed -i -f $srcdir/replace-linux_os-to-gnulinux_os-term.sed\
    $(grep -rlI Linux)

  # replace Open Source term to Free term
  sed -i -f $srcdir/replace-opensource-to-free-term.sed\
    $(grep -rilI 'open.\{0,1\}source')
#}

#build() { # disabled, due that is needed internet for generating man pages with libxslt.
  cd $srcdir/Reusable-${_pkgname1^}-Components-$_pkgname2--$_pkgname2-$pkgver
  setarch $CARCH ./autogen.sh
  setarch $CARCH ./configure\
    --sysconfdir=/etc\
    --prefix=/usr\
    --exec-prefix=/usr\
    --bindir=/usr/bin\
    --sbindir=/usr/bin\
    --includedir=/usr/include\
    --oldincludedir=/usr/include\
    --libdir=/usr/lib\
    --libexecdir=/usr/lib\
    --datarootdir=/usr/share\
    --datadir=/usr/share\
    --docdir=/usr/share/doc/$pkgname\
    --dvidir=/usr/share/doc/$pkgname\
    --htmldir=/usr/share/doc/$pkgname\
    --pdfdir=/usr/share/doc/$pkgname\
    --psdir=/usr/share/doc/$pkgname\
    --infodir=/usr/share/info\
    --localedir=/usr/share/locale\
    --mandir=/usr/share/man\
    --localstatedir=/var\
    --disable-ansi\
    --disable-fatal-warnings\
    --disable-static\
    --enable-doc\
    --enable-libnet\
    --enable-shared\
    --enable-upstart\
    --with-daemon-group=haclient\
    --with-daemon-user=hacluster\
    --with-ocf-root=/usr/lib/ocf
  setarch $CARCH make
}

package() {
  cd $srcdir/Reusable-${_pkgname1^}-Components-$_pkgname2--$_pkgname2-$pkgver
  setarch $CARCH make DESTDIR=$pkgdir install

  install -d $pkgdir/usr/lib/systemd/system
  install -m644 $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: