1
1
#! /bin/bash
2
2
SOURCE_DIR=/usr/src
3
3
LUA_VERSION=5.3.5
4
+ CWD=$( pwd)
4
5
5
6
install_luaoauth_var=false
6
7
rhel_based=false
@@ -57,7 +58,7 @@ install_deb_lua() {
57
58
apt-get install -y software-properties-common unzip build-essential libssl-dev lua5.3 liblua5.3-dev > /dev/null 2>&1
58
59
}
59
60
60
- install_luaoauth_deps () {
61
+ install_luaoauth_deps_debian () {
61
62
printf " \r[+] Installing haproxy-lua-oauth dependencies\n"
62
63
63
64
if [ ! -e $lua_dep_dir ]; then
@@ -71,7 +72,7 @@ install_luaoauth_deps() {
71
72
72
73
curl -sLO https://github.com/rxi/json.lua/archive/refs/heads/master.zip
73
74
unzip -qo master.zip && rm master.zip
74
- mv json.lua-master/json.lua $lua_dep_dir
75
+ cp json.lua-master/json.lua $lua_dep_dir
75
76
76
77
curl -sLO https://github.com/lunarmodules/luasocket/archive/refs/heads/master.zip
77
78
unzip -qo master.zip && rm master.zip
@@ -86,15 +87,43 @@ install_luaoauth_deps() {
86
87
cd ..
87
88
}
88
89
89
- install_luaoauth () {
90
- printf " \r[+] Installing haproxy-lua-oauth\n"
90
+ install_luaoauth_deps_rhel () {
91
+ printf " \r[+] Installing haproxy-lua-oauth dependencies\n"
92
+
91
93
if [ ! -e $lua_dep_dir ]; then
92
94
mkdir -p $lua_dep_dir ;
93
95
fi ;
94
96
97
+ dnf config-manager --set-enabled powertools
98
+ dnf update > /dev/null 2>&1
99
+ dnf install -y gcc openssl-devel lua-devel make readline-devel systemd-devel unzip > /dev/null 2>&1
100
+
95
101
cd $SOURCE_DIR
96
102
97
- mv ./lib/* .lua $lua_dep_dir
103
+ curl -sLO https://github.com/rxi/json.lua/archive/refs/heads/master.zip
104
+ unzip -qo master.zip && rm master.zip
105
+ mv json.lua-master/json.lua $lua_dep_dir
106
+
107
+ curl -sLO https://github.com/lunarmodules/luasocket/archive/refs/heads/master.zip
108
+ unzip -qo master.zip && rm master.zip
109
+ cd luasocket-master/
110
+ make clean all install-both LUAINC=/usr/include/ > /dev/null
111
+ cd ..
112
+
113
+ curl -sLO https://github.com/wahern/luaossl/archive/rel-20181207.zip
114
+ unzip -qo rel-20181207.zip && rm rel-20181207.zip
115
+ cd luaossl-rel-20181207/
116
+ make install > /dev/null
117
+ cd ..
118
+ }
119
+
120
+ install_luaoauth () {
121
+ printf " \r[+] Installing haproxy-lua-oauth\n"
122
+ if [ ! -e $lua_dep_dir ]; then
123
+ mkdir -p $lua_dep_dir ;
124
+ fi ;
125
+
126
+ cp $CWD /lib/* .lua $lua_dep_dir
98
127
}
99
128
100
129
case $1 in
@@ -106,19 +135,12 @@ case $1 in
106
135
esac
107
136
108
137
if $install_luaoauth_var ; then
109
- # Install Lua JWT
110
- # if ! $lua_installed; then
111
- # if $rhel_based; then
112
- # download_and_install_lua=(install_yum_deps download_rhel_lua build_lua install_rhel_lua)
113
- # elif $debian_based; then
114
- # download_and_install_lua=(install_deb_lua)
115
- # fi
116
- # for func in ${download_and_install_lua[*]}; do
117
- # $func &
118
- # display_working $!
119
- # done
120
- # fi
121
- download_and_install_luaoauth=(install_luaoauth_deps install_luaoauth)
138
+ if $rhel_based ; then
139
+ download_and_install_luaoauth=(install_luaoauth_deps_rhel install_luaoauth)
140
+ elif $debian_based ; then
141
+ download_and_install_luaoauth=(install_luaoauth_deps_debian install_luaoauth)
142
+ fi
143
+
122
144
for func in ${download_and_install_luaoauth[*]} ; do
123
145
$func &
124
146
display_working $!
0 commit comments