if [ ! -f LuaJIT-$lj_ver.tar.gz ]; then wget "https://github.com/openresty/luajit2/archive/v$lj_ver.tar.gz" -O "LuaJIT-$lj_ver.tar.gz" fi tar -zxvf LuaJIT-$lj_ver.tar.gz > /dev/null
if [ ! -f openresty-${openresty_ver}.tar.gz ]; then wget --no-check-certificate https://openresty.org/download/openresty-${openresty_ver}.tar.gz fi tar -zxvpf openresty-${openresty_ver}.tar.gz > /dev/null
if [ "$1" == "update" ]; then for repo in"${repos[@]}"; do if [ -d "$repo" ]; then echo"updating $repo" pushd"$repo" git pull popd else git clone"https://github.com/api7/$repo.git" || exit 1 fi done else for repo in"${repos[@]}"; do if [ ! -d "$repo" ]; then git clone"https://github.com/api7/$repo.git" || exit 1 fi done fi
functioninstall_wasmtime() { pushd wasm-nginx-module || exit 1 if [ ! -d lib/ ]; then ./install-wasmtime.sh fi popd return 0 }
functioninstall_api7_module() { if [ ! -d /usr/local/openresty/lualib/resty/apisix/stream/xrpc ]; then pushd apisix-nginx-module || exit 1 sudo OPENRESTY_PREFIX="$OR_PREFIX" make install popd fi
if [ ! -d /usr/local/openresty/wasmtime-c-api/ ]; then pushd wasm-nginx-module || exit 1 sudo OPENRESTY_PREFIX="$OR_PREFIX" make install popd fi
functionmain() { if [ $(type -P nproc) == "" ]; then echo"need install nproc" exit 1 fi
case"$1"in "install") echo"new install for dev apisix" if [ -d ./build-apisix-dev ]; then pushd ./build-apisix-dev else mkdir ./build-apisix-dev pushd ./build-apisix-dev fi