From 1612adc6ebdc533e57317a7f7bbd37af4c596035 Mon Sep 17 00:00:00 2001 From: ljm42 Date: Tue, 8 Dec 2020 10:00:01 -0800 Subject: [PATCH] fix(plg): check for existance of files before processing This prevents an "Output from your job" email warning that: Warning: file_get_contents(/boot/.gitattributes): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php on line 243 --- dynamix.unraid.net.plg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynamix.unraid.net.plg b/dynamix.unraid.net.plg index 1d136b600..7ecdfd459 100644 --- a/dynamix.unraid.net.plg +++ b/dynamix.unraid.net.plg @@ -1375,7 +1375,7 @@ if (!file_exists('/boot/.git/description') || strpos(file_get_contents('/boot/.g exec('git -C /boot config filter.noprivatekeys.clean /usr/local/emhttp/plugins/dynamix.unraid.net/scripts/git-noprivatekeys-clean >/dev/null'); // configure git to apply the noprivatekeys filter to wireguard config files -if (strpos(file_get_contents('/boot/.gitattributes'),'noprivatekeys') === false) { +if (!file_exists('/boot/.gitattributes') || strpos(file_get_contents('/boot/.gitattributes'),'noprivatekeys') === false) { file_put_contents('/boot/.gitattributes', '# file managed by Unraid, do not modify config/wireguard/*.cfg filter=noprivatekeys config/wireguard/*.conf filter=noprivatekeys @@ -1384,7 +1384,7 @@ config/wireguard/peers/*.conf filter=noprivatekeys } // setup git ignore for files we dont need in the flash backup -if (strpos(file_get_contents('/boot/.git/info/exclude'),'peers') === false) { +if (!file_exists('/boot/.git/info/exclude') || strpos(file_get_contents('/boot/.git/info/exclude'),'peers') === false) { file_put_contents('/boot/.git/info/exclude', '# file managed by Unraid, do not modify # Blacklist everything