From 3296e3dc2041a10d480263973c30eb6897244e8b Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 14 Sep 2015 13:48:06 -0300 Subject: Process pfSense.obsoletedfiles on base post-install script --- tools/templates/core_pkg/base/metadir/+INSTALL | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'tools/templates/core_pkg') diff --git a/tools/templates/core_pkg/base/metadir/+INSTALL b/tools/templates/core_pkg/base/metadir/+INSTALL index 895c39c..e59bde8 100644 --- a/tools/templates/core_pkg/base/metadir/+INSTALL +++ b/tools/templates/core_pkg/base/metadir/+INSTALL @@ -26,4 +26,31 @@ echo "===> Extracting new base tarball" # Install new base files tar -C / -xJPUf /usr/local/share/%%PRODUCT_NAME%%/base.txz -exit $? +echo "===> Removing static obsoleted files" + +# Set IFS to \n to deal with filenames containing spaces +oIFS=${IFS} +IFS=" +" + +PLATFORM=$(cat /etc/platform) + +# Process obsolete files +if [ "${PLATFORM}" != "nanobsd" -a -f /etc/%%PRODUCT_NAME%%.obsoletedfiles ]; then + for f in $(cat /etc/%%PRODUCT_NAME%%.obsoletedfiles); do + if [ -n "${f}" -a -d "${f}" ]; then + chflags -R noschg "${f}" + rm -rf "${f}" + elif [ -n "${f}" -a -f "${f}" ]; then + chflags noschg "${f}" + rm -f "${f}" + elif [ -n "${f}" -a -L "${f}" ]; then + rm -f "${f}" + fi + done +fi + +# Restore IFS +IFS=${oIFS} + +exit 0 -- cgit v1.1