Add post_install scripts to init_deps.sh and update install.sh

This commit is contained in:
Théophile Diot 2023-07-03 12:09:59 -04:00
parent 847ff5a3da
commit 544b4040e0
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
3 changed files with 30 additions and 28 deletions

View File

@ -17,13 +17,15 @@
"id": "modsecurity",
"name": "ModSecurity v3.0.9",
"url": "https://github.com/SpiderLabs/ModSecurity.git",
"commit": "205dac0e8c675182f96b5c2fb06be7d1cf7af2b2"
"commit": "205dac0e8c675182f96b5c2fb06be7d1cf7af2b2",
"post_install": "patch src/deps/src/modsecurity/configure.ac src/deps/misc/modsecurity.patch && rm -rf src/deps/src/modsecurity/others/libinjection"
},
{
"id": "modsecurity-nginx",
"name": "ModSecurity-nginx v1.0.3",
"url": "https://github.com/SpiderLabs/ModSecurity-nginx.git",
"commit": "d59e4ad121df702751940fd66bcc0b3ecb51a079"
"commit": "d59e4ad121df702751940fd66bcc0b3ecb51a079",
"post_install": "patch src/deps/src/modsecurity-nginx/src/ngx_http_modsecurity_log.c src/deps/misc/modsecurity-nginx.patch && patch src/deps/src/modsecurity-nginx/config src/deps/misc/config.patch && patch src/deps/src/modsecurity-nginx/src/ngx_http_modsecurity_common.h src/deps/misc/ngx_http_modsecurity_common.h.patch && patch src/deps/src/modsecurity-nginx/src/ngx_http_modsecurity_module.c src/deps/misc/ngx_http_modsecurity_module.c.patch"
},
{
"id": "nginx",
@ -83,7 +85,8 @@
"id": "lua-ffi-zlib",
"name": "lua-ffi-zlib v0.5",
"url": "https://github.com/hamishforbes/lua-ffi-zlib.git",
"commit": "1fb69ca505444097c82d2b72e87904f3ed923ae9"
"commit": "1fb69ca505444097c82d2b72e87904f3ed923ae9",
"post_install": "patch src/deps/src/lua-ffi-zlib/lib/ffi-zlib.lua src/deps/misc/lua-ffi-zlib.patch"
},
{
"id": "lua-gd",
@ -125,7 +128,8 @@
"id": "lua-resty-ipmatcher",
"name": "lua-resty-ipmatcher v0.6.1 (3 commits after just in case)",
"url": "https://github.com/api7/lua-resty-ipmatcher.git",
"commit": "7fbb618f7221b1af1451027d3c64e51f3182761c"
"commit": "7fbb618f7221b1af1451027d3c64e51f3182761c",
"post_install": "patch src/deps/src/lua-resty-ipmatcher/resty/ipmatcher.lua src/deps/misc/ipmatcher.patch"
},
{
"id": "lua-resty-lock",
@ -149,7 +153,8 @@
"id": "lua-resty-openssl",
"name": "lua-resty-openssl v0.8.23",
"url": "https://github.com/fffonion/lua-resty-openssl.git",
"commit": "b23c072a405b749ac60d21e3946cbf57a959b780"
"commit": "b23c072a405b749ac60d21e3946cbf57a959b780",
"post_install": "rm -r src/deps/src/lua-resty-openssl/t"
},
{
"id": "lua-resty-random",
@ -197,7 +202,8 @@
"id": "luajit-geoip",
"name": "luajit-geoip v2.1.0",
"url": "https://github.com/leafo/luajit-geoip.git",
"commit": "fde33e045083522d73665a6894d78dbf995b9e12"
"commit": "fde33e045083522d73665a6894d78dbf995b9e12",
"post_install": "patch src/deps/src/luajit-geoip/geoip/mmdb.lua src/deps/misc/mmdb.patch"
},
{
"id": "lualogging",

View File

@ -42,6 +42,7 @@ do
name="$(echo $repo | jq -r .name)"
url="$(echo $repo | jq -r .url)"
commit="$(echo $repo | jq -r .commit)"
post_install="$(echo $repo | jq -r .post_install)"
echo " Clone ${name} from ${url} at commit/version ${commit}"
@ -56,4 +57,9 @@ do
if [ -d "src/deps/src/${id}/.git" ] ; then
do_and_check_cmd rm -rf "src/deps/src/${id}/.git"
fi
if [ "$post_install" != "null" ] ; then
echo " Running post install script for ${name}"
do_and_check_cmd bash -c "$post_install"
fi
done

View File

@ -41,9 +41,7 @@ CHANGE_DIR="/tmp/bunkerweb/deps/src/zlib" do_and_check_cmd make install
echo " Compiling and installing ModSecurity"
# temp fix : Debian run it twice
# TODO : patch it in clone.sh
do_and_check_cmd patch /tmp/bunkerweb/deps/src/modsecurity/configure.ac /tmp/bunkerweb/deps/misc/modsecurity.patch
CHANGE_DIR="/tmp/bunkerweb/deps/src/modsecurity" do_and_check_cmd rm -rf others/libinjection
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/libinjection /tmp/bunkerweb/deps/src/modsecurity/others/libinjection
do_and_check_cmd mv /tmp/bunkerweb/deps/src/libinjection /tmp/bunkerweb/deps/src/modsecurity/others/libinjection
cd /tmp/bunkerweb/deps/src/modsecurity && ./build.sh > /dev/null 2>&1
CHANGE_DIR="/tmp/bunkerweb/deps/src/modsecurity" do_and_check_cmd sh build.sh
CHANGE_DIR="/tmp/bunkerweb/deps/src/modsecurity" do_and_check_cmd ./configure --disable-dependency-tracking --disable-static --disable-examples --disable-doxygen-doc --disable-doxygen-html --disable-valgrind-memcheck --disable-valgrind-helgrind --prefix=/usr/share/bunkerweb/deps --with-maxmind=/usr/share/bunkerweb/deps
@ -69,7 +67,7 @@ CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-dns" do_and_check_cmd make PREFIX=
# Installing lua-resty-session
echo " Installing lua-resty-session"
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/lua-resty-session/lib/resty/* /usr/share/bunkerweb/deps/lib/lua/resty
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lua-resty-session/lib/resty/* /usr/share/bunkerweb/deps/lib/lua/resty/
# Installing lua-resty-random
echo " Installing lua-resty-random"
@ -96,7 +94,7 @@ CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-http" do_and_check_cmd make PREFIX
# Download and install lualogging
echo " Installing lualogging"
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/lualogging/src/* /usr/share/bunkerweb/deps/lib/lua
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lualogging/src/* /usr/share/bunkerweb/deps/lib/lua/
# Compiling and installing luasocket
echo " Compiling and installing luasocket"
@ -110,7 +108,6 @@ CHANGE_DIR="/tmp/bunkerweb/deps/src/luasec" do_and_check_cmd make LUACPATH=/usr/
# Installing lua-resty-ipmatcher
echo " Installing lua-resty-ipmatcher"
do_and_check_cmd patch /tmp/bunkerweb/deps/src/lua-resty-ipmatcher/resty/ipmatcher.lua /tmp/bunkerweb/deps/misc/ipmatcher.patch
CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-ipmatcher" do_and_check_cmd make INST_PREFIX=/usr/share/bunkerweb/deps INST_LIBDIR=/usr/share/bunkerweb/deps/lib/lua INST_LUADIR=/usr/share/bunkerweb/deps/lib/lua install
# Installing lua-resty-redis
@ -123,24 +120,23 @@ CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-upload" do_and_check_cmd make PREF
# Installing lujit-geoip
echo " Installing luajit-geoip"
do_and_check_cmd patch /tmp/bunkerweb/deps/src/luajit-geoip/geoip/mmdb.lua /tmp/bunkerweb/deps/misc/mmdb.patch
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/luajit-geoip/geoip /usr/share/bunkerweb/deps/lib/lua
do_and_check_cmd mv /tmp/bunkerweb/deps/src/luajit-geoip/geoip /usr/share/bunkerweb/deps/lib/lua/
# Installing lbase64
echo " Installing lbase64"
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/lbase64/base64.lua /usr/share/bunkerweb/deps/lib/lua
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lbase64/base64.lua /usr/share/bunkerweb/deps/lib/lua/
# Installing lua-resty-env
echo " Installing lua-resty-env"
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/lua-resty-env/src/resty/env.lua /usr/share/bunkerweb/deps/lib/lua/resty
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lua-resty-env/src/resty/env.lua /usr/share/bunkerweb/deps/lib/lua/resty/
# Installing lua-resty-mlcache
echo " Installing lua-resty-mlcache"
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/lua-resty-mlcache/lib/resty/* /usr/share/bunkerweb/deps/lib/lua/resty
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lua-resty-mlcache/lib/resty/* /usr/share/bunkerweb/deps/lib/lua/resty/
# Installing lua-resty-template
echo " Installing lua-resty-template"
do_and_check_cmd cp -r /tmp/bunkerweb/deps/src/lua-resty-template/lib/resty/* /usr/share/bunkerweb/deps/lib/lua/resty
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lua-resty-template/lib/resty/* /usr/share/bunkerweb/deps/lib/lua/resty/
# Installing lua-resty-lock
echo " Installing lua-resty-lock"
@ -148,25 +144,19 @@ CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-lock" do_and_check_cmd make PREFIX
# Installing lua-resty-openssl
echo " Installing lua-resty-openssl"
do_and_check_cmd rm -r /tmp/bunkerweb/deps/src/lua-resty-openssl/t
CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-openssl" do_and_check_cmd make LUA_LIB_DIR=/usr/share/bunkerweb/deps/lib/lua install
do_and_check_cmd cp /tmp/bunkerweb/deps/src/lua-resty-openssl/lib/resty/openssl.lua /usr/share/bunkerweb/deps/lib/lua/resty
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lua-resty-openssl/lib/resty/openssl.lua /usr/share/bunkerweb/deps/lib/lua/resty/
# Installing lua-ffi-zlib
echo " Installing lua-ffi-zlib"
do_and_check_cmd patch /tmp/bunkerweb/deps/src/lua-ffi-zlib/lib/ffi-zlib.lua /tmp/bunkerweb/deps/misc/lua-ffi-zlib.patch
do_and_check_cmd cp /tmp/bunkerweb/deps/src/lua-ffi-zlib/lib/ffi-zlib.lua /usr/share/bunkerweb/deps/lib/lua
do_and_check_cmd mv /tmp/bunkerweb/deps/src/lua-ffi-zlib/lib/ffi-zlib.lua /usr/share/bunkerweb/deps/lib/lua/
# Installing lua-resty-signal
echo " Installing lua-resty-signal"
CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-signal" do_and_check_cmd make PREFIX=/usr/share/bunkerweb/deps -j $NTASK
CHANGE_DIR="/tmp/bunkerweb/deps/src/lua-resty-signal" do_and_check_cmd make PREFIX=/usr/share/bunkerweb/deps LUA_LIB_DIR=/usr/share/bunkerweb/deps/lib/lua install
do_and_check_cmd patch /tmp/bunkerweb/deps/src/modsecurity-nginx/src/ngx_http_modsecurity_log.c /tmp/bunkerweb/deps/misc/modsecurity-nginx.patch
do_and_check_cmd patch /tmp/bunkerweb/deps/src/modsecurity-nginx/config /tmp/bunkerweb/deps/misc/config.patch
do_and_check_cmd patch /tmp/bunkerweb/deps/src/modsecurity-nginx/src/ngx_http_modsecurity_common.h /tmp/bunkerweb/deps/misc/ngx_http_modsecurity_common.h.patch
do_and_check_cmd patch /tmp/bunkerweb/deps/src/modsecurity-nginx/src/ngx_http_modsecurity_module.c /tmp/bunkerweb/deps/misc/ngx_http_modsecurity_module.c.patch
do_and_check_cmd cp /tmp/bunkerweb/deps/misc/ngx_http_modsecurity_access.c /tmp/bunkerweb/deps/src/modsecurity-nginx/src
do_and_check_cmd mv /tmp/bunkerweb/deps/misc/ngx_http_modsecurity_access.c /tmp/bunkerweb/deps/src/modsecurity-nginx/src/
# Compile dynamic modules
echo " Compiling and installing dynamic modules"
@ -185,7 +175,7 @@ do_and_check_cmd chmod +x "/tmp/bunkerweb/deps/src/nginx/configure-fix.sh"
CHANGE_DIR="/tmp/bunkerweb/deps/src/nginx" LUAJIT_LIB="/usr/share/bunkerweb/deps/lib -Wl,-rpath,/usr/share/bunkerweb/deps/lib" LUAJIT_INC="/usr/share/bunkerweb/deps/include/luajit-2.1" MODSECURITY_LIB="/usr/share/bunkerweb/deps/lib" MODSECURITY_INC="/usr/share/bunkerweb/deps/include" do_and_check_cmd ./configure-fix.sh
CHANGE_DIR="/tmp/bunkerweb/deps/src/nginx" do_and_check_cmd make -j $NTASK modules
do_and_check_cmd mkdir /usr/share/bunkerweb/modules
CHANGE_DIR="/tmp/bunkerweb/deps/src/nginx" do_and_check_cmd cp ./objs/*.so /usr/share/bunkerweb/modules
CHANGE_DIR="/tmp/bunkerweb/deps/src/nginx" do_and_check_cmd mv ./objs/*.so /usr/share/bunkerweb/modules/
# Dependencies are installed
echo " Dependencies for BunkerWeb successfully compiled and installed !"