test:luci_app_zzz

This commit is contained in:
dichgrem
2025-09-22 16:24:38 +08:00
parent 1f5a0d262f
commit 7b76d43741
11 changed files with 359 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
zzz/files/etc/config/zzz Normal file
View File

@@ -0,0 +1,7 @@
config general 'general'
option enabled '0'
config auth 'auth'
option username ''
option password ''
option device 'eth0'

54
zzz/files/etc/init.d/zzz Normal file
View File

@@ -0,0 +1,54 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
CONFIG=/etc/zzz/config.ini
start_service() {
# 检查是否启用
local enabled=$(uci -q get zzz.general.enabled)
[ "$enabled" = "1" ] || {
echo "zzz is disabled"
return 1
}
generate_config
procd_open_instance
procd_set_param command /usr/bin/zzz "$CONFIG"
procd_set_param respawn
procd_close_instance
}
stop_service() {
procd_kill zzz
}
generate_config() {
mkdir -p /etc/zzz
# 获取UCI配置
local username=$(uci -q get zzz.auth.username)
local password=$(uci -q get zzz.auth.password)
local device=$(uci -q get zzz.auth.device)
# 检查必要参数
[ -z "$username" ] && {
logger -t zzz "Error: username not configured"
return 1
}
[ -z "$password" ] && {
logger -t zzz "Error: password not configured"
return 1
}
# 生成INI配置文件
cat >"$CONFIG" <<EOF
[auth]
username = $username
password = $password
device = ${device:-eth0}
EOF
}

View File

@@ -0,0 +1,7 @@
# Default configuration for zzz 802.1x client
# This file will be generated by UCI system
[auth]
username =
password =
device = eth0

View File

@@ -0,0 +1,29 @@
#!/bin/sh
# /usr/bin/zzz-device-info
# Helper script to get device information for zzz configuration
echo "Available network devices:"
echo "=========================="
if command -v zzz >/dev/null 2>&1; then
zzz -mode info 2>/dev/null | grep -E "(Found|device|hardware_description)" | while read line; do
echo "$line"
done
else
echo "zzz binary not found. Showing available network interfaces:"
for dev in /sys/class/net/*; do
if [ -d "$dev" ]; then
iface=$(basename "$dev")
if [ "$iface" != "lo" ]; then
echo "Device: $iface"
if [ -f "$dev/address" ]; then
echo " MAC: $(cat "$dev/address")"
fi
if [ -f "$dev/operstate" ]; then
echo " State: $(cat "$dev/operstate")"
fi
echo ""
fi
fi
done
fi