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
|
HAPROXY_VER='1.6'
HAPROXY_PATCH_VER='9'
HAPROXY_PACK="haproxy-${HAPROXY_VER}.${HAPROXY_PATCH_VER}"
HAPROXY_RPM="${HAPROXY_PACK}-1.fc24.x86_64.rpm"
HAPROXY_SRC_URL="ftp://fr2.rpmfind.net/linux/fedora/linux/updates/24/x86_64/h/${HAPROXY_RPM}"
HAPROXY_CFG='haproxy.cfg'
HAPROXY_SPEC='haproxy.spec'
RPMBUILD_USER=rpmbuild
RPMBUILD_PASSWORD=hogehoge
yum install pecl-devel openssl-devel
yum install rpmdevtools
yum install pcre-devel
yum install binutuils
useradd ${RPMBUILD_USER}
echo "${RPMBUILD_PASSWORD}" | passwd --stdin ${RPMBUILD_USER}
su - ${RPMBUILD_USER}
HAPROXY_VER='1.6'
HAPROXY_PATCH_VER='9'
HAPROXY_PACK="haproxy-${HAPROXY_VER}.${HAPROXY_PATCH_VER}"
HAPROXY_TAR_GZ="${HAPROXY_PACK}.tar.gz"
HAPROXY_SRC_URL="http://www.haproxy.org/download/${HAPROXY_VER}/src/${HAPROXY_TAR_GZ}"
HAPROXY_CFG='haproxy.cfg'
HAPROXY_SPEC='haproxy.spec'
RPMBUILD_USER=rpmbuild
RPMBUILD_PASSWORD=hogehoge
rpmdev-setuptree
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
cd /home/${RPMBUILD_USER}/rpmbuild/SRPMS
wget ${HAPROXY_SRC_URL}
tar zxvf ${HAPROXY_TAR_GZ}
cd ${HAPROXY_PACK}
cd examples
touch ${HAPROXY_CFG}
cp -p ${HAPROXY_SPEC} ~/${RPMBUILD_USER}/SPECS/
# OpenSSL対応したいならば以下
# RDS ReadReplicaバランシングなので今回はやらない
# sed -i "s|TARGET=linux26|TARGET=linux26 USE_OPENSSL=1|" ~/${RPMBUILD_USER}/SPECS/${HAPROXY_SPEC}
cd ~/rpmbuild/SOURCES
cp -a /home/${RPMBUILD_USER}/rpmbuild/SRPMS/${HAPROXY_PACK} ./
# tar zcvf をする際に、./ でする必要がある
tar zcvf ./${HAPROXY_TAR_GZ} ${HAPROXY_PACK}
rm -rf ${HAPROXY_PACK}
cd ~/rpmbuild/SPECS/
rpmbuild -ba ${HAPROXY_SPEC}
|