firmware: address duplication and unnecessary shell invokes

After staring at the issue long enough this seems to make sense.
This commit is contained in:
Franco Fichtner 2024-08-14 08:17:19 +02:00
parent c3af228910
commit 41086adf85
2 changed files with 4 additions and 20 deletions

View File

@ -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

View File

@ -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