From 41086adf85e65d75bf4ebdb96fc9b289f59b8b3a Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 14 Aug 2024 08:17:19 +0200 Subject: [PATCH] firmware: address duplication and unnecessary shell invokes After staring at the issue long enough this seems to make sense. --- src/etc/rc.syshook.d/update/10-refresh.sh | 17 ++--------------- src/etc/rc.syshook.d/upgrade/90-cleanup.sh | 7 ++----- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/etc/rc.syshook.d/update/10-refresh.sh b/src/etc/rc.syshook.d/update/10-refresh.sh index fe0b65b69..f1e368a2c 100755 --- a/src/etc/rc.syshook.d/update/10-refresh.sh +++ b/src/etc/rc.syshook.d/update/10-refresh.sh @@ -3,18 +3,5 @@ # refresh relevant configuration files /usr/local/etc/rc.configure_firmware -# a copy of this cleanup exists in 90-cleanup.sh -daemon /bin/sh -s << EOF -# remove our stale pyc files not handled by pkg -find /usr/local/opnsense -type f -name "*.pyc" -delete - -for DIR in /boot /usr/libexec/bsdinstall /usr/local; do - # remove spurious files from pkg - find \${DIR} ! \( -type d \) -a \ - \( -name "*.pkgsave" -o -name ".pkgtemp.*" \) -delete - - # processs spurious directories from pkg - # (may not be empty so -delete does not work) - find \${DIR} -type d -name ".pkgtemp.*" -print0 | xargs -0 -n1 rm -r -done -EOF +# background the cleanup job to avoid blocking +daemon /usr/local/etc/rc.syshook.d/upgrade/90-cleanup.sh diff --git a/src/etc/rc.syshook.d/upgrade/90-cleanup.sh b/src/etc/rc.syshook.d/upgrade/90-cleanup.sh index b08b9e552..83122d672 100755 --- a/src/etc/rc.syshook.d/upgrade/90-cleanup.sh +++ b/src/etc/rc.syshook.d/upgrade/90-cleanup.sh @@ -1,17 +1,14 @@ #!/bin/sh -# a copy of this cleanup exists in 10-refresh.sh -/bin/sh -s << EOF # remove our stale pyc files not handled by pkg find /usr/local/opnsense -type f -name "*.pyc" -delete for DIR in /boot /usr/libexec/bsdinstall /usr/local; do # remove spurious files from pkg - find \${DIR} ! \( -type d \) -a \ + find ${DIR} ! \( -type d \) -a \ \( -name "*.pkgsave" -o -name ".pkgtemp.*" \) -delete # processs spurious directories from pkg # (may not be empty so -delete does not work) - find \${DIR} -type d -name ".pkgtemp.*" -print0 | xargs -0 -n1 rm -r + find ${DIR} -type d -name ".pkgtemp.*" -print0 | xargs -0 -n1 rm -r done -EOF