fix: Fix secubox-profile script syntax and directory path (v0.6.0-r14)
- Changed bash brace expansion `*.{yaml,yml,json}` to POSIX-compliant loops
- Removed `2>/dev/null` from for loop glob (not supported in busybox sh)
- Changed PROFILE_DIR from /etc/secubox/profiles to /usr/share/secubox/profiles
- Fixes "syntax error: unexpected redirection" error
- Fixes listProfiles RPC returning "No response"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e203a8d8c2
commit
5903547fe8
@ -8,7 +8,7 @@
|
|||||||
. /usr/share/libubox/jshn.sh
|
. /usr/share/libubox/jshn.sh
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
PROFILE_DIR="/etc/secubox/profiles"
|
PROFILE_DIR="/usr/share/secubox/profiles"
|
||||||
TEMPLATE_DIR="/etc/secubox/templates"
|
TEMPLATE_DIR="/etc/secubox/templates"
|
||||||
MACRO_DIR="/etc/secubox/macros"
|
MACRO_DIR="/etc/secubox/macros"
|
||||||
STATE_DIR="/var/run/secubox"
|
STATE_DIR="/var/run/secubox"
|
||||||
@ -21,10 +21,12 @@ list_profiles() {
|
|||||||
json_init
|
json_init
|
||||||
json_add_array "profiles"
|
json_add_array "profiles"
|
||||||
|
|
||||||
for profile in "$PROFILE_DIR"/*.{yaml,yml,json} 2>/dev/null; do
|
for ext in yaml yml json; do
|
||||||
[ -f "$profile" ] || continue
|
for profile in "$PROFILE_DIR"/*.$ext; do
|
||||||
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
[ -f "$profile" ] || continue
|
||||||
json_add_string "" "$name"
|
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
||||||
|
json_add_string "" "$name"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
json_close_array
|
json_close_array
|
||||||
@ -36,10 +38,12 @@ list_profiles() {
|
|||||||
if [ -z "$(ls -A "$PROFILE_DIR" 2>/dev/null)" ]; then
|
if [ -z "$(ls -A "$PROFILE_DIR" 2>/dev/null)" ]; then
|
||||||
echo " (none)"
|
echo " (none)"
|
||||||
else
|
else
|
||||||
for profile in "$PROFILE_DIR"/*.{yaml,yml,json} 2>/dev/null; do
|
for ext in yaml yml json; do
|
||||||
[ -f "$profile" ] || continue
|
for profile in "$PROFILE_DIR"/*.$ext; do
|
||||||
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
[ -f "$profile" ] || continue
|
||||||
echo " - $name"
|
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
||||||
|
echo " - $name"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user