mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 16:15:13 +08:00
🍉 Sync 2026-09-06 13:36:06
This commit is contained in:
1 parent
da7d5957ad
commit
813df5818f
12 files changed
+2656
-46
No files matched your search
@@ -0,0 +1,33 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright (C) 2026 luci-app-sysctl contributors
|
||||
#
|
||||
# LuCI application: manage kernel sysctl parameters from the web UI.
|
||||
#
|
||||
# Build inside OpenWrt 24.10 buildroot/SDK:
|
||||
# - copy this directory to package/luci-app-sysctl (needs luci feed installed), or
|
||||
# - copy to feeds/luci/applications/luci-app-sysctl and re-run feeds update/install
|
||||
# then: make menuconfig -> LuCI -> Applications -> luci-app-sysctl
|
||||
# make package/luci-app-sysctl/compile V=s
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-sysctl
|
||||
PKG_VERSION:=1.5.9
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_MAINTAINER:=luci-app-sysctl contributors
|
||||
|
||||
LUCI_TITLE:=LuCI application to manage kernel sysctl parameters
|
||||
LUCI_DESCRIPTION:=View live kernel parameters and manage custom sysctl entries \
|
||||
stored in /etc/sysctl.d/99-luci-sysctl.conf from the LuCI web interface. \
|
||||
Supports browsing /proc/sys, searching parameters, one-click apply and \
|
||||
immediate runtime activation of single parameters.
|
||||
LUCI_DEPENDS:=+luci-base +rpcd +rpcd-mod-ucode
|
||||
LUCI_CONFFILES:=/etc/sysctl.d/99-luci-sysctl.conf
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# build-ipk.sh - pack luci-app-sysctl into an opkg-installable .ipk
|
||||
# without requiring the OpenWrt SDK/buildroot.
|
||||
#
|
||||
# Usage:
|
||||
# ./build-ipk.sh [output-directory]
|
||||
#
|
||||
# The produced .ipk targets OpenWrt 24.10 (opkg, "all" architecture):
|
||||
# opkg install luci-app-sysctl_<version>-<release>_all.ipk
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PKG_DIR="$SCRIPT_DIR"
|
||||
OUT_DIR="${1:-$PKG_DIR}"
|
||||
|
||||
# --- read package identity from the OpenWrt Makefile -----------------------
|
||||
get_var() {
|
||||
sed -n "s/^$1:=//p" "$PKG_DIR/Makefile" | head -1
|
||||
}
|
||||
|
||||
PKG_NAME="$(get_var PKG_NAME)"
|
||||
PKG_VERSION="$(get_var PKG_VERSION)"
|
||||
PKG_RELEASE="$(get_var PKG_RELEASE)"
|
||||
|
||||
for v in PKG_NAME PKG_VERSION PKG_RELEASE; do
|
||||
if [ -z "$(eval "echo \$$v")" ]; then
|
||||
echo "ERROR: $v not found in $PKG_DIR/Makefile" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
IPK_NAME="${PKG_NAME}_${PKG_VERSION}-${PKG_RELEASE}_all.ipk"
|
||||
|
||||
# --- sanity checks ----------------------------------------------------------
|
||||
for f in \
|
||||
"$PKG_DIR/htdocs/luci-static/resources/view/sysctl.js" \
|
||||
"$PKG_DIR/root/usr/share/rpcd/ucode/luci.sysctl" \
|
||||
"$PKG_DIR/root/usr/share/luci/menu.d/$PKG_NAME.json" \
|
||||
"$PKG_DIR/root/usr/share/rpcd/acl.d/$PKG_NAME.json" \
|
||||
"$PKG_DIR/root/etc/sysctl.d/99-luci-sysctl.conf"
|
||||
do
|
||||
if [ ! -f "$f" ]; then
|
||||
echo "ERROR: required file missing: $f" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# --- staging ----------------------------------------------------------------
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
DATA="$WORK/data"
|
||||
CTRL="$WORK/control"
|
||||
|
||||
mkdir -p "$DATA" "$CTRL"
|
||||
|
||||
# root/ maps to /
|
||||
cp -a "$PKG_DIR/root/." "$DATA/"
|
||||
|
||||
# htdocs/ maps to /www
|
||||
mkdir -p "$DATA/www"
|
||||
cp -a "$PKG_DIR/htdocs/." "$DATA/www/"
|
||||
|
||||
# uniform ownership/permissions; rpcd refuses world-writable ucode plugins
|
||||
find "$DATA" -type d -exec chmod 755 {} +
|
||||
find "$DATA" -type f -exec chmod 644 {} +
|
||||
|
||||
# --- control metadata ---------------------------------------------------------
|
||||
cat > "$CTRL/control" <<EOF
|
||||
Package: $PKG_NAME
|
||||
Version: $PKG_VERSION-$PKG_RELEASE
|
||||
Architecture: all
|
||||
Maintainer: luci-app-sysctl contributors
|
||||
Section: luci
|
||||
Priority: optional
|
||||
Depends: libc, luci-base, rpcd, rpcd-mod-ucode
|
||||
Description: LuCI application to manage kernel sysctl parameters
|
||||
View live kernel parameters and manage custom sysctl entries
|
||||
in /etc/sysctl.d/99-luci-sysctl.conf from the LuCI web interface.
|
||||
EOF
|
||||
|
||||
cat > "$CTRL/conffiles" <<'EOF'
|
||||
/etc/sysctl.d/99-luci-sysctl.conf
|
||||
EOF
|
||||
|
||||
cat > "$CTRL/postinst" <<'EOF'
|
||||
#!/bin/sh
|
||||
# register the new ubus object and invalidate the LuCI menu cache
|
||||
if [ -x /etc/init.d/rpcd ]; then
|
||||
/etc/init.d/rpcd restart
|
||||
fi
|
||||
rm -f /tmp/luci-indexcache* 2>/dev/null
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod 755 "$CTRL/postinst"
|
||||
chmod 644 "$CTRL/control" "$CTRL/conffiles"
|
||||
|
||||
# --- archive ----------------------------------------------------------------
|
||||
TAR_FLAGS=(--owner=0 --group=0 --numeric-owner)
|
||||
|
||||
tar "${TAR_FLAGS[@]}" -czf "$WORK/data.tar.gz" -C "$DATA" ./etc ./usr ./www
|
||||
tar "${TAR_FLAGS[@]}" -czf "$WORK/control.tar.gz" -C "$CTRL" ./control ./conffiles ./postinst
|
||||
|
||||
printf '2.0\n' > "$WORK/debian-binary"
|
||||
|
||||
IPK_PATH="$OUT_DIR/$IPK_NAME"
|
||||
mkdir -p "$OUT_DIR"
|
||||
rm -f "$IPK_PATH"
|
||||
tar -czf "$IPK_PATH" -C "$WORK" debian-binary control.tar.gz data.tar.gz
|
||||
|
||||
echo "OK: $IPK_PATH"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,10 @@
|
||||
# Custom kernel parameters managed by luci-app-sysctl.
|
||||
#
|
||||
# Entries added or modified through the LuCI web interface
|
||||
# (System -> 内核参数 / Kernel Parameters) are stored in this file.
|
||||
#
|
||||
# A line prefixed with "#" means the entry is disabled, e.g.:
|
||||
# # net.core.somaxconn = 4096
|
||||
#
|
||||
# This file is loaded at boot time by /etc/init.d/sysctl and can be
|
||||
# re-applied at runtime from the LuCI page ("应用配置" button).
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"admin/system/sysctl": {
|
||||
"title": "内核参数",
|
||||
"order": 65,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "sysctl"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-sysctl" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"luci-app-sysctl": {
|
||||
"description": "Grant access to kernel sysctl parameters",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci.sysctl": [
|
||||
"status",
|
||||
"list",
|
||||
"browse",
|
||||
"search",
|
||||
"preset_status",
|
||||
"preset_fetch",
|
||||
"preset_check",
|
||||
"file_view",
|
||||
"preset_list"
|
||||
]
|
||||
}
|
||||
},
|
||||
"write": {
|
||||
"ubus": {
|
||||
"luci.sysctl": [
|
||||
"set",
|
||||
"remove",
|
||||
"apply",
|
||||
"preset_import",
|
||||
"preset_remove",
|
||||
"file_set",
|
||||
"file_delete"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user