Skip to content

Commit 00f618c

Browse files
committed
Make destination install directory configurable.
This helps use multiple haproxy versions, e.g. using redhat scl: ``` DEST_BASE_DIR=/opt/rh/rh-haproxy191/root SYSTEMD_NAME=rh-haproxy191-haproxy.service ```
1 parent b220099 commit 00f618c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

install.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22
SOURCE_DIR=/usr/src
3+
DEST_BASE_DIR=""
4+
SYSTEMD_NAME=haproxy.service
35
HAPROXY_VERSION=1.9.1
46
LUA_VERSION=5.3.5
57

@@ -8,7 +10,7 @@ install_luajwt_var=false
810
rhel_based=false
911
debian_based=false
1012
lua_installed=false
11-
lua_dep_dir=/usr/local/share/lua/5.3/
13+
lua_dep_dir=$DEST_BASE_DIR/usr/local/share/lua/5.3/
1214

1315
if [ -f /etc/redhat-release ]; then
1416
rhel_based=true
@@ -61,8 +63,8 @@ build_haproxy() {
6163

6264
install_rhel_haproxy() {
6365
printf "\r[+] Installing HAProxy\n"
64-
/bin/cp $SOURCE_DIR/haproxy-$HAPROXY_VERSION/haproxy /usr/sbin/
65-
mkdir -p /etc/haproxy/pem
66+
/bin/cp $SOURCE_DIR/haproxy-$HAPROXY_VERSION/haproxy $DEST_BASE_DIR/usr/sbin/
67+
mkdir -p $DEST_BASE_DIR/etc/haproxy/pem
6668
}
6769

6870
install_deb_haproxy() {
@@ -76,8 +78,8 @@ install_deb_haproxy() {
7678
install_haproxy_systemd() {
7779
cd $SOURCE_DIR/haproxy-$HAPROXY_VERSION/contrib/systemd
7880
make clean >/dev/null
79-
make PREFIX=/usr >/dev/null
80-
/bin/cp haproxy.service /usr/lib/systemd/system/
81+
make PREFIX=$DEST_BASE_DIR/usr >/dev/null
82+
/bin/cp haproxy.service /usr/lib/systemd/system/$SYSTEMD_NAME
8183
systemctl daemon-reload
8284
}
8385

0 commit comments

Comments
 (0)