It is possible that the uci configuration file will be added to the system
later. Therefore, ucitrack json definitions are always added to ucitrack
triggers and it is not checked whether the uci configuration file exists.
Reported-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
}
register_trigger() {
- local uci="$1"
- local file="$2"
+ local file="$1"
local config init exec affects affected
local prev
json_init
json_load_file "${file}" >/dev/null 2>&1
json_get_var config 'config'
- [ "$config" = "$uci" ] || {
- json_set_namespace "$prev"
- return
- }
json_get_var init 'init'
json_get_var exec 'exec'
json_get_values affects 'affects'
done
}
-check_trigger() {
+service_triggers() {
local config="$1"
local file
for file in /usr/share/ucitrack/*.json; do
[ -f "$file" ] || continue
- register_trigger "$config" "$file"
- done
-}
-
-service_triggers() {
- for config in /etc/config/*; do
- check_trigger "${config##*/}"
+ register_trigger "$file"
done
}