From 9ace8a736a7bcb833ae829c6748d5a3c47d1de01 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 19 Oct 2015 07:23:43 -0200 Subject: Remove all PBIs before upgrade to 2.3, it fixes #5221 --- src/usr/local/share/pfSense/pre_upgrade_command | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/usr/local/share/pfSense/pre_upgrade_command b/src/usr/local/share/pfSense/pre_upgrade_command index 2ad365f..66fbbbe 100644 --- a/src/usr/local/share/pfSense/pre_upgrade_command +++ b/src/usr/local/share/pfSense/pre_upgrade_command @@ -12,6 +12,36 @@ echo $PRIOR_VERSION > /tmp/pre_upgrade_version # De-activate sync on the root slice only. This will not match NanoBSD since it already has sync,noatime /usr/bin/sed -i '' 's/^\(\/.*[[:space:]]*\/[[:space:]]*ufs[[:space:]]*\)rw,sync\([[:space:]]*[[:digit:]][[:space:]]*[[:digit:]]\)$/\1rw\2/' /etc/fstab +# Cleanup PBIs +if which pbi_info >/dev/null 2>&1; then + for pbi in $(pbi_info); do + pbi_prefix=$(pbi_info ${pbi} | awk '$1 == "Prefix:" { print $2 }') + if [ ! -d "${pbi_prefix}" ]; then + continue + fi + + for subdir in bin sbin; do + if [ ! -d "${pbi_prefix}/${subdir}" ]; then + continue + fi + + for pbiopt in ${pbi_prefix}/${subdir}/*.pbiopt; do + link_name=$(awk '$1 == "TARGET:" { print $2 }' ${pbiopt}) + + if [ -z "${link_name}" ]; then + continue + fi + + if [ -L /usr/local/${link_name} ]; then + rm -f /usr/local/${link_name} + fi + done + done + + pbi_delete ${pbi} + done +fi + # Hack to workaround ticket #3749 if [ ${PRIOR_VERSION} -le 8 ] && grep -q 'sh /etc/rc.reboot' /etc/rc.firmware; then PROC=$(ps axwww | grep '/etc/rc.firmware *pfSenseupgrade') -- cgit v1.1