From b2b2c4133b1b0beb355c88b2a5f00ddf25e98731 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 30 Oct 2023 11:36:25 +0100 Subject: [PATCH] firmware: clear more pkg garbage While here serialize the background script into one as that may be less straining on the system since we need to clean up more now. --- src/etc/rc.syshook.d/update/10-refresh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/etc/rc.syshook.d/update/10-refresh b/src/etc/rc.syshook.d/update/10-refresh index a4d5abbf5..c3452dfd0 100755 --- a/src/etc/rc.syshook.d/update/10-refresh +++ b/src/etc/rc.syshook.d/update/10-refresh @@ -6,10 +6,17 @@ # create a unique timestamp for our asset caching touch /usr/local/opnsense/www/index.php -# remove spurious .pkgsave files pkg may have created -for DIR in /boot /usr/libexec/bsdinstall /usr/local; do - daemon -f find ${DIR} -type f -name "*.pkgsave" -delete -done - +daemon /bin/sh -s << EOF # remove our stale pyc files not handled by pkg -daemon -f find /usr/local/opnsense -type f -name "*.pyc" -delete +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