From 10fe321bf3b43bded57e8f59170852e9787de022 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 20 Aug 2020 16:44:41 +0200 Subject: [PATCH] system: restore damaged bogons files on startup; closes #4277 --- src/etc/rc.subr.d/recover | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/etc/rc.subr.d/recover b/src/etc/rc.subr.d/recover index c5f3aba9a..d790ba4c8 100755 --- a/src/etc/rc.subr.d/recover +++ b/src/etc/rc.subr.d/recover @@ -2,7 +2,7 @@ + * Copyright (c) 2015-2020 Franco Fichtner * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -280,6 +280,14 @@ function recover_pkg() { recover_ports(); recover_rebuild(); + + echo "===> Restoring critical core files\n"; + + foreach (['/usr/local/etc/bogons', '/usr/local/etc/bogonsv6'] as $file) { + if (!file_exists($file) || filesize($file) === 0) { + @copy("{$file}.sample", $file); + } + } } $stage = isset($argv[1]) ? $argv[1] : 'both';