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