create install.sh & readme

Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
sbwml 2025-06-17 17:25:41 +08:00
parent 51b4b7a98b
commit 37d32f521e
2 changed files with 184 additions and 0 deletions

61
README.md Normal file
View File

@ -0,0 +1,61 @@
# luci-app-openlist
🗂️ A file list program that supports multiple storage, powered by Gin and Solidjs.
## How to build
- Install `libfuse` development package.
- ubuntu/debian:
```shell
sudo apt update
sudo apt install libfuse-dev
```
- redhat:
```shell
sudo yum install fuse-devel
```
- arch:
```shell
sudo pacman -S fuse2
```
- Enter in your openwrt dir
- Openwrt official SnapShots
*1. requires golang 1.24.x or latest version (Fix build for older branches of OpenWrt.)*
```shell
rm -rf feeds/packages/lang/golang
git clone https://github.com/sbwml/packages_lang_golang -b 24.x feeds/packages/lang/golang
```
*2. get luci-app-openlist code & building*
```shell
git clone https://github.com/sbwml/luci-app-openlist package/openlist
make menuconfig # choose LUCI -> Applications -> luci-app-openlist
make package/openlist/luci-app-openlist/compile V=s # build luci-app-openlist
```
--------------
## How to install prebuilt packages
- Login OpenWrt terminal (SSH)
- Install `curl` package
```shell
opkg update
opkg install curl
```
- Execute install script (Multi-architecture support)
```shell
sh -c "$(curl -ksS https://raw.githubusercontent.com/sbwml/luci-app-openlist/main/install.sh)"
```
--------------
![luci-app-openlist](https://github.com/user-attachments/assets/80593704-1e02-4bcf-8290-a0c7c37012f4)

123
install.sh Executable file
View File

@ -0,0 +1,123 @@
#!/bin/sh
set -e
# Define color codes and output functions
RED='\033[1;31m'
GREEN='\033[1;32m'
RESET='\033[0m'
msg_red() { printf "${RED}%s${RESET}\n" "$*"; }
msg_green() { printf "${GREEN}%s${RESET}\n" "$*"; }
# Check if running on OpenWrt
if [ ! -f /etc/openwrt_release ]; then
msg_red "Unknown OpenWrt Version"
exit 1
fi
# Read architecture information
. /etc/openwrt_release
DISTRIB_ARCH="${DISTRIB_ARCH:-unknown}"
# Detect package manager and set SDK version
if [ -x "/usr/bin/apk" ]; then
PKG_MANAGER="apk"
SDK="SNAPSHOT"
elif command -v opkg >/dev/null 2>&1; then
PKG_MANAGER="opkg"
SDK="openwrt-24.10"
else
msg_red "No supported package manager found."
exit 1
fi
# Check LuCI version compatibility
if [ ! -d "/usr/share/luci/menu.d" ]; then
msg_red "OpenWrt LuCI version is not supported. The minimum required version is openwrt-21.02 or higher."
exit 1
fi
# Check available root partition space (at least 35MB required)
ROOT_SPACE=$(df -m /usr | awk 'END{print $4}')
if [ "$ROOT_SPACE" -lt 35 ]; then
msg_red "Error: The system storage space is less than 35MB."
exit 1
fi
# Create temporary directory and set up cleanup on exit
TEMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TEMP_DIR"' EXIT
# Check if the current platform is supported
msg_green "Checking platform..."
SUPPORTED_PLATFORMS="
aarch64_cortex-a53
aarch64_cortex-a72
aarch64_cortex-a76
aarch64_generic
arm_arm1176jzf-s_vfp
arm_arm926ej-s
arm_cortex-a15_neon-vfpv4
arm_cortex-a5_vfpv4
arm_cortex-a7
arm_cortex-a7_neon-vfpv4
arm_cortex-a7_vfpv4
arm_cortex-a8_vfpv3
arm_cortex-a9
arm_cortex-a9_neon
arm_cortex-a9_vfpv3-d16
arm_fa526
arm_xscale
i386_pentium-mmx
i386_pentium4
loongarch64_generic
mips64_mips64r2
mips64_octeonplus
mips64el_mips64r2
mips_24kc
mips_4kec
mips_mips32
mipsel_24kc
mipsel_24kc_24kf
mipsel_74kc
mipsel_mips32
riscv64_riscv64
x86_64
"
FOUND=0
for arch in $SUPPORTED_PLATFORMS; do
if [ "$DISTRIB_ARCH" = "$arch" ]; then
FOUND=1
break
fi
done
if [ "$FOUND" -ne 1 ]; then
msg_red "Error! The current \"$DISTRIB_ARCH\" platform is not supported."
exit 1
fi
# Download the corresponding package archive
PKG_FILE="$SDK-$DISTRIB_ARCH.tar.gz"
PKG_URL="https://github.com/sbwml/luci-app-openlist/releases/latest/download/$PKG_FILE"
msg_green "Downloading $PKG_URL ..."
if ! curl --connect-timeout 5 -m 300 -kLo "$TEMP_DIR/$PKG_FILE" "$PKG_URL"; then
msg_red "Download $PKG_FILE failed."
exit 1
fi
# Extract and install packages
msg_green "Installing Packages ..."
tar -zxf "$TEMP_DIR/$PKG_FILE" -C "$TEMP_DIR/"
for pkg in "$TEMP_DIR"/packages_ci/openlist*.ipk \
"$TEMP_DIR"/packages_ci/luci-app-openlist*.ipk \
"$TEMP_DIR"/packages_ci/luci-i18n-openlist-zh-cn*.ipk; do
[ -f "$pkg" ] && $PKG_MANAGER install "$pkg"
done
# Clean up temporary files and finish
rm -rf /tmp/luci-*
msg_green "Done!"