aboutsummaryrefslogtreecommitdiffstats
path: root/main/haproxy
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-08-24 09:35:56 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-08-16 12:50:06 +0000
commitef4d70929c7b687a7b974e9ae438f6b8a164f16f (patch)
tree6041f94bf7a848bc2f26bf98f021ecf3456cab55 /main/haproxy
parent4bbb93d659452066ebe032015d4ccdbbc9f57abb (diff)
downloadaports-ef4d70929c7b687a7b974e9ae438f6b8a164f16f.tar.bz2
aports-ef4d70929c7b687a7b974e9ae438f6b8a164f16f.tar.xz
main/haproxy: move default config location
- move default config location to /etc/haproxy/ - provide install/upgrade script that moves existing config to new location - provide dummy config - create haproxy user and group
Diffstat (limited to 'main/haproxy')
-rw-r--r--main/haproxy/APKBUILD14
-rw-r--r--main/haproxy/haproxy.cfg13
-rw-r--r--main/haproxy/haproxy.initd2
l---------main/haproxy/haproxy.pre-install1
-rw-r--r--main/haproxy/haproxy.pre-upgrade12
5 files changed, 36 insertions, 6 deletions
diff --git a/main/haproxy/APKBUILD b/main/haproxy/APKBUILD
index 1889a5930f..2b7f820cf6 100644
--- a/main/haproxy/APKBUILD
+++ b/main/haproxy/APKBUILD
@@ -2,17 +2,18 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=haproxy
pkgver=1.4.22
-pkgrel=0
+pkgrel=1
pkgdesc="A TCP/HTTP reverse proxy for high availability environments"
url="http://haproxy.1wt.eu"
arch="all"
license="GPL"
depends=""
makedepends="pcre-dev"
-install=
+install="haproxy.pre-install haproxy.pre-upgrade"
subpackages="$pkgname-doc"
-source="http://haproxy.1wt.eu/download/1.4/src/$pkgname-$pkgver.tar.gz
- haproxy.initd"
+source="http://haproxy.1wt.eu/download/${pkgver%.*}/src/$pkgname-$pkgver.tar.gz
+ haproxy.initd
+ haproxy.cfg"
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -23,8 +24,11 @@ package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir" PREFIX=/usr DOCDIR=/usr/share/doc/haproxy \
install
+ install -d "$pkgdir"/usr/share/haproxy
install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -m644 -D "$srcdir"/haproxy.cfg "$pkgdir"/etc/haproxy/haproxy.cfg
}
md5sums="a0b007c76f6a78524f3b3dd5e704979c haproxy-1.4.22.tar.gz
-0891c7f7b98899b7e7bf767ae92b652e haproxy.initd"
+81319456a35408bf47443e9c314d2e94 haproxy.initd
+f043f27db8081ee135fb452920405c51 haproxy.cfg"
diff --git a/main/haproxy/haproxy.cfg b/main/haproxy/haproxy.cfg
new file mode 100644
index 0000000000..38f4625bbd
--- /dev/null
+++ b/main/haproxy/haproxy.cfg
@@ -0,0 +1,13 @@
+# dummy config
+global
+ user haproxy
+ group haproxy
+ chroot /usr/share/haproxy
+ daemon
+
+defaults
+ contimeout 5000
+ clitimeout 50000
+
+listen dummy1 127.0.0.1:10001
+
diff --git a/main/haproxy/haproxy.initd b/main/haproxy/haproxy.initd
index 3d48ab96eb..fb1d70ed81 100644
--- a/main/haproxy/haproxy.initd
+++ b/main/haproxy/haproxy.initd
@@ -7,7 +7,7 @@ extra_commands="checkconfig"
extra_started_commands="reload"
command=/usr/sbin/haproxy
-CONFFILE=${HAPROXY_CONF:-/etc/${SVCNAME}.cfg}
+CONFFILE=${HAPROXY_CONF:-/etc/haproxy/${SVCNAME}.cfg}
PIDFILE=/var/run/${SVCNAME}.pid
depend() {
diff --git a/main/haproxy/haproxy.pre-install b/main/haproxy/haproxy.pre-install
new file mode 120000
index 0000000000..a5f553dcf0
--- /dev/null
+++ b/main/haproxy/haproxy.pre-install
@@ -0,0 +1 @@
+haproxy.pre-upgrade \ No newline at end of file
diff --git a/main/haproxy/haproxy.pre-upgrade b/main/haproxy/haproxy.pre-upgrade
new file mode 100644
index 0000000000..fa9083dc41
--- /dev/null
+++ b/main/haproxy/haproxy.pre-upgrade
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+addgroup haproxy 2>/dev/null
+adduser -S -H -h /usr/share/haproxy -s /bin/false -D \
+ -G haproxy haproxy 2>/dev/null
+
+# move config to new location
+if [ -e /etc/haproxy.cfg ] && ! [ -e /etc/haproxy/haproxy.cfg ]; then
+ mkdir -p /etc/haproxy
+ mv /etc/haproxy.cfg /etc/haproxy/haproxy.cfg
+fi
+