Add four major features to enhance SecuBox AppStore: 1. Feed Source Management: - Feed types: published, unpublished, development - Share tokens for private feed access - CLI: secubox feed list/add/share/import - LuCI: Feed type badges and share URLs in catalog-sources 2. Profile Export/Import: - Export configurations with feed sources embedded - Import from URL or file with merge/replace modes - CLI: secubox profile export/import/share - LuCI: New profiles.js view with export/import dialogs 3. Skill System: - Capability discovery from module catalogs - Quality indicators based on provider count - CLI: secubox skill list/providers/install/check - LuCI: New skills.js view with provider browser 4. Feedback Loop: - Issue reporting and resolution tracking - Search existing resolutions - CLI: secubox feedback report/resolve/search/list - LuCI: New feedback.js view for knowledge base Technical changes: - RPCD backend with 17 new API methods - POSIX shell compatibility fixes (ESC via printf, tr A-Z a-z) - LuCI menu entries for new views Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
119 lines
3.0 KiB
Bash
Executable File
119 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# SecuBox Feed Health Check
|
|
# Returns JSON status for HAProxy health monitoring and Gitea CI/CD
|
|
# Copyright 2026 CyberMind <contact@cybermind.fr>
|
|
|
|
FEED_DIR="/www/secubox-feed"
|
|
OPKG_LIST="/var/opkg-lists/secubox"
|
|
OUTPUT_FORMAT="${1:-json}"
|
|
|
|
# Check components
|
|
check_feed_dir() {
|
|
[ -d "$FEED_DIR" ] && return 0
|
|
return 1
|
|
}
|
|
|
|
check_packages_file() {
|
|
[ -f "$FEED_DIR/Packages" ] && return 0
|
|
return 1
|
|
}
|
|
|
|
check_packages_count() {
|
|
if [ -f "$FEED_DIR/Packages" ]; then
|
|
grep -c '^Package:' "$FEED_DIR/Packages" 2>/dev/null || echo 0
|
|
else
|
|
echo 0
|
|
fi
|
|
}
|
|
|
|
check_opkg_synced() {
|
|
[ -f "$OPKG_LIST" ] && return 0
|
|
return 1
|
|
}
|
|
|
|
check_uhttpd() {
|
|
pgrep uhttpd >/dev/null 2>&1 && return 0
|
|
return 1
|
|
}
|
|
|
|
check_feed_accessible() {
|
|
if command -v curl >/dev/null 2>&1; then
|
|
curl -sf -o /dev/null "http://127.0.0.1/secubox-feed/Packages" 2>/dev/null && return 0
|
|
elif command -v wget >/dev/null 2>&1; then
|
|
wget -q --spider "http://127.0.0.1/secubox-feed/Packages" 2>/dev/null && return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
# Calculate overall status
|
|
calculate_status() {
|
|
local score=0
|
|
local max=5
|
|
|
|
check_feed_dir && score=$((score + 1))
|
|
check_packages_file && score=$((score + 1))
|
|
[ "$(check_packages_count)" -gt 0 ] && score=$((score + 1))
|
|
check_opkg_synced && score=$((score + 1))
|
|
check_uhttpd && score=$((score + 1))
|
|
|
|
if [ "$score" -eq "$max" ]; then
|
|
echo "healthy"
|
|
elif [ "$score" -ge 3 ]; then
|
|
echo "degraded"
|
|
else
|
|
echo "unhealthy"
|
|
fi
|
|
}
|
|
|
|
# Output results
|
|
case "$OUTPUT_FORMAT" in
|
|
json)
|
|
cat << EOF
|
|
{
|
|
"status": "$(calculate_status)",
|
|
"timestamp": "$(date -Iseconds 2>/dev/null || date +%Y-%m-%dT%H:%M:%S)",
|
|
"checks": {
|
|
"feed_directory": $(check_feed_dir && echo true || echo false),
|
|
"packages_file": $(check_packages_file && echo true || echo false),
|
|
"packages_count": $(check_packages_count),
|
|
"opkg_synced": $(check_opkg_synced && echo true || echo false),
|
|
"uhttpd_running": $(check_uhttpd && echo true || echo false),
|
|
"http_accessible": $(check_feed_accessible && echo true || echo false)
|
|
},
|
|
"feed_path": "$FEED_DIR",
|
|
"opkg_list": "$OPKG_LIST"
|
|
}
|
|
EOF
|
|
;;
|
|
simple)
|
|
status=$(calculate_status)
|
|
count=$(check_packages_count)
|
|
echo "$status:$count"
|
|
[ "$status" = "healthy" ] && exit 0
|
|
[ "$status" = "degraded" ] && exit 1
|
|
exit 2
|
|
;;
|
|
nagios)
|
|
status=$(calculate_status)
|
|
count=$(check_packages_count)
|
|
case "$status" in
|
|
healthy)
|
|
echo "OK - SecuBox feed healthy, $count packages"
|
|
exit 0
|
|
;;
|
|
degraded)
|
|
echo "WARNING - SecuBox feed degraded, $count packages"
|
|
exit 1
|
|
;;
|
|
*)
|
|
echo "CRITICAL - SecuBox feed unhealthy"
|
|
exit 2
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
echo "Usage: $0 [json|simple|nagios]"
|
|
exit 1
|
|
;;
|
|
esac
|