diff --git a/config/show_config b/config/show_config index 34b3b30c73..566d7edd6c 100644 --- a/config/show_config +++ b/config/show_config @@ -105,6 +105,7 @@ show_config() { config_message="${config_message}\n - SAMBA mounting support:\t\t $SAMBA_SUPPORT" config_message="${config_message}\n - SAMBA server support:\t\t $SAMBA_SERVER" config_message="${config_message}\n - SFTP server support:\t\t\t $SFTP_SERVER" + config_message="${config_message}\n - HTTP server support:\t\t\t $SIMPLE_HTTP_SERVER" config_message="${config_message}\n - OpenVPN support:\t\t\t $OPENVPN_SUPPORT" config_message="${config_message}\n - WireGuard support:\t\t\t $WIREGUARD_SUPPORT" config_message="${config_message}\n - ZeroTier support:\t\t\t $ZEROTIER_SUPPORT" diff --git a/distributions/JELOS/options b/distributions/JELOS/options index ada9612605..1a8b20f998 100644 --- a/distributions/JELOS/options +++ b/distributions/JELOS/options @@ -77,6 +77,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" +# build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="no" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/packages/network/simple-http-server/package.mk b/packages/network/simple-http-server/package.mk new file mode 100644 index 0000000000..0dd47c7c2c --- /dev/null +++ b/packages/network/simple-http-server/package.mk @@ -0,0 +1,35 @@ +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) +# Copyright (C) 2023-present NeoTheFox (https://github.com/NeoTheFox) + +PKG_NAME="simple-http-server" +PKG_VERSION="0.6.7" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/TheWaWaR/simple-http-server" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Simple http server in Rust" +PKG_TOOLCHAIN="manual" + +case ${ARCH} in + x86_64) + PKG_URL="${PKG_SITE}/releases/download/v${PKG_VERSION}/x86_64-unknown-linux-musl-simple-http-server" + ;; + arm) + PKG_URL="${PKG_SITE}/releases/download/v${PKG_VERSION}/armv7-unknown-linux-musleabihf-simple-http-server" + ;; + aarch64) + PKG_URL="${PKG_SITE}/releases/download/v${PKG_VERSION}/aarch64-unknown-linux-musl-simple-http-server" + ;; +esac + +unpack() { + mkdir -p ${PKG_BUILD} + cp ${SOURCES}/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.${ARCH}*${PKG_NAME} ${PKG_BUILD}/simple-http-server +} + +makeinstall_target() { + mkdir -p ${INSTALL}/usr/bin + install -Dm755 ${PKG_BUILD}/simple-http-server ${INSTALL}/usr/bin + + mkdir -p ${INSTALL}/usr/lib/systemd/system + install -Dm644 ${PKG_DIR}/system.d/simple-http-server.service ${INSTALL}/usr/lib/systemd/system +} diff --git a/packages/network/simple-http-server/system.d/simple-http-server.service b/packages/network/simple-http-server/system.d/simple-http-server.service new file mode 100644 index 0000000000..f88fb527ae --- /dev/null +++ b/packages/network/simple-http-server/system.d/simple-http-server.service @@ -0,0 +1,14 @@ +[Unit] +Description=simple-http-server +Wants=network-pre.target +After=network-pre.target + +[Service] +ExecStart=/usr/bin/bash -c "source /etc/profile.d/001-functions && /usr/bin/simple-http-server -i -p 80 -a root:$(get_setting root.password) -s -u /storage" +Restart=always +KillMode=process +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target diff --git a/packages/virtual/network/package.mk b/packages/virtual/network/package.mk index 0d7ca0cf64..de77b99ef1 100644 --- a/packages/virtual/network/package.mk +++ b/packages/virtual/network/package.mk @@ -19,6 +19,10 @@ if [ "${SAMBA_SERVER}" = "yes" ] || [ "$SAMBA_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} samba" fi +if [ "${SIMPLE_HTTP_SERVER}" = "yes" ]; then + PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} simple-http-server" +fi + if [ "${OPENVPN_SUPPORT}" = "yes" ]; then PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} openvpn" fi diff --git a/projects/Amlogic/devices/S922X/options b/projects/Amlogic/devices/S922X/options index 21793470ba..66a843bcbf 100644 --- a/projects/Amlogic/devices/S922X/options +++ b/projects/Amlogic/devices/S922X/options @@ -108,6 +108,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/projects/PC/devices/AMD64/options b/projects/PC/devices/AMD64/options index 4f50349f34..fdf0f3ff22 100644 --- a/projects/PC/devices/AMD64/options +++ b/projects/PC/devices/AMD64/options @@ -92,6 +92,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/projects/Rockchip/devices/RK3326/options b/projects/Rockchip/devices/RK3326/options index 005eb5fcb8..3b385933f7 100644 --- a/projects/Rockchip/devices/RK3326/options +++ b/projects/Rockchip/devices/RK3326/options @@ -118,6 +118,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/projects/Rockchip/devices/RK3399/options b/projects/Rockchip/devices/RK3399/options index a0dfa6dbf0..417bb42535 100644 --- a/projects/Rockchip/devices/RK3399/options +++ b/projects/Rockchip/devices/RK3399/options @@ -118,6 +118,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/projects/Rockchip/devices/RK3566-X55/options b/projects/Rockchip/devices/RK3566-X55/options index 5d0b81281b..6fa8d72614 100644 --- a/projects/Rockchip/devices/RK3566-X55/options +++ b/projects/Rockchip/devices/RK3566-X55/options @@ -109,6 +109,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/projects/Rockchip/devices/RK3566/options b/projects/Rockchip/devices/RK3566/options index ff8acbc0c9..771deed4b9 100644 --- a/projects/Rockchip/devices/RK3566/options +++ b/projects/Rockchip/devices/RK3566/options @@ -109,6 +109,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no" diff --git a/projects/Rockchip/devices/RK3588/options b/projects/Rockchip/devices/RK3588/options index 58130a3519..12422c2a14 100755 --- a/projects/Rockchip/devices/RK3588/options +++ b/projects/Rockchip/devices/RK3588/options @@ -119,6 +119,9 @@ # build and install SFTP Server (yes / no) SFTP_SERVER="yes" + # build and install Simple HTTP Server (yes / no) + SIMPLE_HTTP_SERVER="yes" + # build and install OpenVPN support (yes / no) OPENVPN_SUPPORT="no"