changeset 353:d71f9efac6a8

Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead. This allows working with jails in future versions also.
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 08 Dec 2022 00:46:28 +0100
parents 619a32c6baaa
children f1c8fc3af3e1
files etc/periodic/daily/800.local-ipv6-refresh
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/etc/periodic/daily/800.local-ipv6-refresh	Thu Dec 08 00:15:21 2022 +0100
+++ b/etc/periodic/daily/800.local-ipv6-refresh	Thu Dec 08 00:46:28 2022 +0100
@@ -13,21 +13,11 @@
 fi
 
 #
-# Source in RC configurations also because we need the value of the
-# IPv6 default router (if any).
-#
-if [ -r /etc/defaults/rc.conf ]
-then
-    . /etc/defaults/rc.conf
-    source_rc_confs
-fi
-
-#
 # Default configuration variables
 #
 : ${daily_local_ipv6_refresh_enable:="NO"}
 : ${daily_local_ipv6_refresh_flags="-n -w2 -q2 -m1 -I"}
-: ${daily_local_ipv6_refresh_target:="${ipv6_defaultrouter}"}
+: ${daily_local_ipv6_refresh_target=""}
 
 rc=0
 
@@ -44,8 +34,12 @@
     ;;
 esac
 
+if [ -z "${daily_local_ipv6_refresh_target}" ]; then
+    daily_local_ipv6_refresh_target="$(/usr/sbin/sysrc -i -n ipv6_defaultrouter)"
+fi
+
 case "${daily_local_ipv6_refresh_target}" in
-"NO")
+[Nn][Oo])
     # SKIP because no target or no static IPv6 router given
     echo "$0: WARNING: \$daily_local_ipv6_refresh_target is \`NO'" 1>&2
     ;;