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
|
||||
. /lib/functions.sh
|
||||
|
||||
PROFILE_DIR="/etc/secubox/profiles"
|
||||
PROFILE_DIR="/usr/share/secubox/profiles"
|
||||
TEMPLATE_DIR="/etc/secubox/templates"
|
||||
MACRO_DIR="/etc/secubox/macros"
|
||||
STATE_DIR="/var/run/secubox"
|
||||
@ -21,10 +21,12 @@ list_profiles() {
|
||||
json_init
|
||||
json_add_array "profiles"
|
||||
|
||||
for profile in "$PROFILE_DIR"/*.{yaml,yml,json} 2>/dev/null; do
|
||||
[ -f "$profile" ] || continue
|
||||
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
||||
json_add_string "" "$name"
|
||||
for ext in yaml yml json; do
|
||||
for profile in "$PROFILE_DIR"/*.$ext; do
|
||||
[ -f "$profile" ] || continue
|
||||
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
||||
json_add_string "" "$name"
|
||||
done
|
||||
done
|
||||
|
||||
json_close_array
|
||||
@ -36,10 +38,12 @@ list_profiles() {
|
||||
if [ -z "$(ls -A "$PROFILE_DIR" 2>/dev/null)" ]; then
|
||||
echo " (none)"
|
||||
else
|
||||
for profile in "$PROFILE_DIR"/*.{yaml,yml,json} 2>/dev/null; do
|
||||
[ -f "$profile" ] || continue
|
||||
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
||||
echo " - $name"
|
||||
for ext in yaml yml json; do
|
||||
for profile in "$PROFILE_DIR"/*.$ext; do
|
||||
[ -f "$profile" ] || continue
|
||||
local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//')
|
||||
echo " - $name"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user