parental-control: use apps partition to store bundle related files

This commit is contained in:
Mohd Husaam Mehdi 2025-08-13 21:32:09 +05:30
parent 1337ba6d57
commit 078d7f237c
4 changed files with 12 additions and 10 deletions

View file

@ -83,14 +83,13 @@ start_service() {
config_load parentalcontrol
validate_global_section
[ -n "${bundle_path}" ] && mkdir -p ${bundle_path}
# add default bundles
process_default_bundles
# add firewall rules
configure_fw_rules
if [ "${urlfilter}" -eq "1" ]; then
if [ "${urlfilter}" -eq "1" ] && [ -d "/apps" ]; then
# add default bundles
[ -n "${bundle_path}" ] && mkdir -p ${bundle_path}
process_default_bundles
enable_urlfilter_dm
else
disable_urlfilter_dm
@ -100,7 +99,7 @@ start_service() {
# then /tmp/dhcp.leases will be empty until clients try to get a lease,
# in that case, hostnames will not be processed by the daemon,
# for this we copy /tmp/dhcp.leases to /etc/parentalcontrol/dhcp.leases
# which will be persistent acrros reboots and upgrade where settings are kept
# which will be persistent across reboots and upgrade (with keep settings)
# and will be used as a backup in case /tmp/dhcp.leases is empty
copy_dhcp_leases

View file

@ -1,5 +1,8 @@
#!/bin/sh
# if /apps partition is not present then we don't support urlfiltering
[ -d "/apps" ] || exit 0
COUNT=1
add_urlbundle()

View file

@ -13,7 +13,7 @@ IP_RULE=""
ACL_FILE=""
parentalcontrol_ipv4_forward=""
parentalcontrol_ipv6_forward=""
default_bundle_dir="/tmp/parentalcontrol/default/"
default_bundle_dir="/apps/parentalcontrol/default/"
bundle_archive="/etc/parentalcontrol/urlbundles.tar.xz"
log() {

View file

@ -8,7 +8,7 @@ LOCKFILE="/tmp/sync_bundles.lock"
# if its a remote file, then it would be downloaded and placed in bundle_dir
bundle_path="$(uci -q get parentalcontrol.globals.bundle_path)"
if [ -z "${bundle_path}" ]; then
bundle_path="/tmp/parentalcontrol"
bundle_path="/apps/parentalcontrol"
fi
stringstore_dir="${bundle_path}/stringstore"
@ -227,8 +227,8 @@ handle_filter_for_bundles() {
local urlfilter
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
if [ "${urlfilter}" -ne "1" ]; then
logger -p info "urlbundle not supported"
# if urlfilter is not enabled or apps partition is not present, then return
if [ "${urlfilter}" -ne "1" ] || [ ! -d "/apps" ]; then
return
fi