firmware: move cleanups to opnsense-update "-F"

This probably needs more engineering later on which makes
it a little harder to ship but in reality we want people
to run the portable command easily in order to unbreak their
environments as pkg-upgrade tripping over its own temporary
files and directories keeps happening in user reports.

While here use "-s" while at it to speed up the script call.
This also pertains to "-e" which is its sibling.
This commit is contained in:
Franco Fichtner 2024-08-20 11:25:28 +02:00
parent d8b58d6417
commit 689cf50cdf
4 changed files with 5 additions and 15 deletions

View File

@ -4,4 +4,4 @@
/usr/local/etc/rc.configure_firmware
# background the cleanup job to avoid blocking
daemon /usr/local/etc/rc.syshook.d/upgrade/90-cleanup.sh
daemon -f opnsense-update -Fs

View File

@ -1,14 +1,4 @@
#!/bin/sh
# 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
# run a cleanup beforehand to avoid later pkg-upgrade failures
opnsense-update -Fs

View File

@ -49,7 +49,7 @@ if opnsense-update -u > ${PIPEFILE} 2>&1; then
fi
# abort pending upgrades
opnsense-update -e >> ${LOCKFILE} 2>&1
opnsense-update -es >> ${LOCKFILE} 2>&1
fi
echo '***DONE***' >> ${LOCKFILE}

View File

@ -30,7 +30,7 @@ type:script_output
message:Requesting firmware upgrade log
[log.clear]
command:/usr/local/sbin/opnsense-update -e
command:/usr/local/sbin/opnsense-update -es
parameters:
type:script
message:Clearing firmware upgrade log