Skip to content

Commit

Permalink
rc: defer newwanip not exectued during boot
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Jan 16, 2018
1 parent cd5e233 commit 257a93a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions plist
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
/usr/local/etc/rc.syshook.d/05-beep.stop
/usr/local/etc/rc.syshook.d/05-update.early
/usr/local/etc/rc.syshook.d/10-configd.early
/usr/local/etc/rc.syshook.d/10-newwanip.start
/usr/local/etc/rc.syshook.d/15-php.early
/usr/local/etc/rc.syshook.d/20-backup.early
/usr/local/etc/rc.syshook.d/20-freebsd.start
Expand Down
3 changes: 2 additions & 1 deletion src/etc/rc.newwanip
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ require_once("interfaces.inc");
$argument = isset($argv[1]) ? trim($argv[1]) : '';

if (file_exists('/var/run/booting')) {
log_error("IP renewal ignored during boot on '{$argument}'");
log_error("IP renewal deferred during boot on '{$argument}'");
file_put_contents('/tmp/newwanip_' . uniqid(), $argument);
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/etc/rc.newwanipv6
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ require_once("interfaces.inc");
$argument = isset($argv[1]) ? trim($argv[1]) : '';

if (file_exists('/var/run/booting')) {
log_error("IP renewal ignored during boot on '{$argument}'");
log_error("IP renewal deferred during boot on '{$argument}'");
file_put_contents('/tmp/newwanipv6_' . uniqid(), $argument);
return;
}

Expand Down
11 changes: 11 additions & 0 deletions src/etc/rc.syshook.d/10-newwanip.start
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

for IPV4 in $(find /tmp -type f -name "newwanip_*"); do
/usr/local/etc/rc.newwanip "$(cat "${IPV4}")"
rm "${IPV4}"
done

for IPV6 in $(find /tmp -type f -name "newwanipv6_*"); do
/usr/local/etc/rc.newwanipv6 "$(cat "${IPV6}")"
rm "${IPV6}"
done

0 comments on commit 257a93a

Please sign in to comment.