unofficial-unifi / unifi-pfsense

A script that installs the UniFi Controller software on pfSense and other FreeBSD systems
BSD 2-Clause "Simplified" License
747 stars 240 forks source link

Only run pkg commands if there are discontinued packages to uninstall #309

Closed shaneallgeier closed 1 year ago

shaneallgeier commented 1 year ago

Currently, if there are no outdated/discontinued MongoDB packages installed, we get this output:

Usage: pkg lock [-lqy] [-a|[-Cgix] ]
       pkg lock --has-locked-packages
       pkg unlock [-lqy] [-a|[-Cgix] ]
For more information see 'pkg help lock'.
Usage: pkg delete [-DfnqRy] [-Cgix] ...
       pkg delete [-Dnqy] -a

This is due to the loop still running even if the $old_mongos variable is empty. My changes make it so the pkg unlock/delete commands only run if there are packages to delete.

shaneallgeier commented 1 year ago

Superseded by #310