Files
small-package/luci-app-tinyfilemanager/root/usr/libexec/tinyfilemanager-config-save
2024-12-14 00:26:27 +08:00

14 lines
326 B
Bash
Executable File

#!/bin/sh
CONFIG_NAME='tinyfilemanager'
while :; do
inotifywait -e modify $CONF 2>/dev/null
CONFIG="$(sed -En "/^\\\$CONFIG\s*=.*/{s|^.+'(.+)'.*|\1|p}" $CONF)"
if [ -n "$CONFIG" ]; then
uci set $CONFIG_NAME.@$TYPEDSECTION[0].defconf="$CONFIG"
[ -z "$(uci changes $CONFIG_NAME)" ] || uci commit $CONFIG_NAME
fi
done