bsdperimeter/pfsense — pull request #67 by phil-davis (2012-03-23 07:30:02+00:00)
Title: Bug #2301: More fixes to pbi package install and removal

remove_freebsd_package: check that a symlink exists and is currently pointing into the pbidir of the current package, then unlink it. This avoids possibly deleting real files, or deleting a symlink that points into some other package. (When removing squidGuard this logic is needed, otherwise some symlinks to the squid pbidir would get removed)

pkg_fetch_recursive: remove a bonus "$" in the symlink target specification. This was causing symlinks from /usr/local/bin to not be generated validly.
install_package_xml: make the grep for a pbi package name more robust by anchoring the search for the name to be at the start. This will prevent potential problems, e.g. with a package "bar" matching "foobar".
install_package_xml: check that the target pbi dir exists before creating the symlink. There can be extra conf files in /user/local/etc/... that are not in the PBI dir tree. This can happen with squidGuard on top of squid, particularly after adding/removing/adding the packages.