Skip to content

Commit

Permalink
corehttp
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Oct 23, 2023
1 parent f6a1ec5 commit c896690
Show file tree
Hide file tree
Showing 14 changed files with 963 additions and 91 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@
[submodule "deps/corehttp"]
path = deps/corehttp
url = https://github.com/FreeRTOS/coreHTTP.git
ignore = dirty
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set(ZLIB_LIBRARY ${CMAKE_BINARY_DIR}/deps/zlib/libz.a)
set(MbedTLS_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/mbedtls/include)
set(MbedTLS_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/deps/mbedtls/library/libmbedtls.a)

include(${CMAKE_SOURCE_DIR}/deps/coreHTTP/httpFilePaths.cmake)
include(${CMAKE_SOURCE_DIR}/deps/corehttp/httpFilePaths.cmake)

# include_directories(deps/lua/ ${ZLIB_INCLUDE_DIR} ${HTTP_INCLUDE_PUBLIC_DIRS} deps/libzip deps/mbedtls/include deps/curl/include ${CMAKE_SOURCE_DIR}/deps/zlib)
include_directories(deps/lua/ ${ZLIB_INCLUDE_DIR} ${HTTP_INCLUDE_PUBLIC_DIRS} deps/libzip deps/mbedtls/include ${CMAKE_SOURCE_DIR}/deps/zlib ${CMAKE_SOURCE_DIR}/deps/lua-corehttp/include)
Expand All @@ -58,7 +58,7 @@ target_include_directories(lssocket PRIVATE ${ELI_EXTRA_UTILS_INCLUDE} ${HTTP_IN
target_compile_definitions(lssocket PRIVATE LSS_HAS_BUNDLED_ROOT_CERTIFICATES)
add_subdirectory(deps/lua-corehttp/)
target_include_directories(lcorehttp PRIVATE ${ELI_EXTRA_UTILS_INCLUDE} ${HTTP_INCLUDE_PUBLIC_DIRS} ${LSS_INCLUDE})
add_subdirectory(deps/coreHTTP/)
add_subdirectory(deps/corehttp/)
add_subdirectory(deps/eli-env-extra/)
target_include_directories(eli_env_extra PRIVATE ${ELI_EXTRA_UTILS_INCLUDE})
add_subdirectory(deps/eli-fs-extra/)
Expand Down
2 changes: 1 addition & 1 deletion deps/hjson-lua
34 changes: 25 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
#!/bin/sh

TMP_NAME="/tmp/$(head -n 1 -c 32 /dev/urandom | tr -dc 'a-zA-Z0-9'| fold -w 32)"
TMP_NAME="/tmp/$(head -n 1 -c 32 /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32)"

if which curl > /dev/null; then
if curl --help 2>&1 | grep "--progress-bar" > /dev/null 2>&1; then
if which curl >/dev/null; then
if curl --help 2>&1 | grep "--progress-bar" >/dev/null 2>&1; then
PROGRESS="--progress-bar"
fi

set -- curl -L $PROGRESS -o "$TMP_NAME"
LATEST=$(curl -sL https://api.github.com/repos/alis-is/eli/releases/latest | grep tag_name | sed 's/ "tag_name": "//g' | sed 's/",//g')
if [ "$1" = "--prerelease" ]; then
LATEST=$(curl -sL https://api.github.com/repos/alis-is/eli/releases | grep tag_name | sed 's/ "tag_name": "//g' | sed 's/",//g' | head -n 1)
else
LATEST=$(curl -sL https://api.github.com/repos/alis-is/eli/releases/latest | grep tag_name | sed 's/ "tag_name": "//g' | sed 's/",//g')
fi
else
if wget --help 2>&1 | grep "--show-progress" > /dev/null 2>&1; then
if wget --help 2>&1 | grep "--show-progress" >/dev/null 2>&1; then
PROGRESS="--show-progress"
fi
set -- wget -q $PROGRESS -O "$TMP_NAME"
LATEST=$(wget -qO- https://api.github.com/repos/alis-is/eli/releases/latest | grep tag_name | sed 's/ "tag_name": "//g' | sed 's/",//g')
if [ "$1" = "--prerelease" ]; then
LATEST=$(wget -qO- https://api.github.com/repos/alis-is/eli/releases | grep tag_name | sed 's/ "tag_name": "//g' | sed 's/",//g' | head -n 1)
else
LATEST=$(wget -qO- https://api.github.com/repos/alis-is/eli/releases/latest | grep tag_name | sed 's/ "tag_name": "//g' | sed 's/",//g')
fi
fi

if eli -v | grep "$LATEST"; then
Expand All @@ -23,13 +31,21 @@ if eli -v | grep "$LATEST"; then
fi

PLATFORM=$(uname -m)
echo "Downloading eli-linux-$PLATFORM $LATEST..."
if [ "$1" = "--prerelease" ]; then
echo "Downloading latest eli prerelease for $PLATFORM..."
else
echo "Downloading eli-linux-$PLATFORM $LATEST..."
fi

if "$@" "https://github.com/alis-is/eli/releases/download/$LATEST/eli-linux-$PLATFORM" &&
mv "$TMP_NAME" /usr/sbin/eli &&
chmod +x /usr/sbin/eli; then
echo "eli $LATEST for $PLATFORM successfuly installed."
else
if [ "$1" = "--prerelease" ]; then
echo "Latest eli prerelease for $PLATFORM successfully installed."
else
echo "eli $LATEST for $PLATFORM successfully installed."
fi
else
echo "eli installation failed!" 1>&2
exit 1
fi
1 change: 0 additions & 1 deletion lib/eli/net/http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local corehttpLoaded, corehttp = pcall(require, "corehttp")
local io = require"io"
local util = require"eli.util"
local hjson = require"hjson"
local exString = require"eli.extensions.string"
local exTable = require"eli.extensions.table"
local netUrl = require"eli.net.url"
local zlib = require"zlib"
Expand Down
4 changes: 2 additions & 2 deletions lib/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ELI_LIB_VERSION = 'dev'
ELI_VERSION = 'dev'
ELI_LIB_VERSION = '0.32.0-dev'
ELI_VERSION = '0.32.0-dev'
do
local path = require"eli.path"
local _eos = require"eli.os"
Expand Down
Loading

0 comments on commit c896690

Please sign in to comment.