diff --git a/install-unifi/install-unifi.sh b/install-unifi/install-unifi.sh index 759b45d..c2a2dde 100644 --- a/install-unifi/install-unifi.sh +++ b/install-unifi/install-unifi.sh @@ -11,7 +11,15 @@ RC_SCRIPT_URL="https://raw.githubusercontent.com/unofficial-unifi/unifi-pfsense/ # List of valid/supported mongodb package names, sorted with the latest being first # As UniFi adds support for new mongodb versions, just prepend them to this list -SUPPORTED_MONGODB_PACKAGES="mongodb50 mongodb44 mongodb42 mongodb40 mongodb36 mongodb34 mongodb32 mongodb" +SUPPORTED_MONGODB_PACKAGES="mongodb44 mongodb42 mongodb40 mongodb36 mongodb34 mongodb32 mongodb" + +CURRENT_MONGODB_VERSION=mongodb44 +MONGO_NEEDS_FALLBACK_VERSION="2.7." +MONGO_NEEDS_SSL="/usr/lib/libssl.so.30" +if [ $(pkg config abi | grep -c "FreeBSD:14:") -eq 1 ] && [ $(grep -c $MONGO_NEEDS_FALLBACK_VERSION /etc/version) -eq 1 ] && [ ! -f $MONGO_NEEDS_SSL ]; then + FALLBACK_MONGO_ABI="FreeBSD:13:$(pkg config abi | awk -F ':' '{print $3}')" + FALLBACK_MONGO_PACKAGE_URL="https://pkg.freebsd.org/${FALLBACK_MONGO_ABI}/latest/" +fi # If pkg-ng is not yet installed, bootstrap it: if ! /usr/sbin/pkg -N 2> /dev/null; then @@ -125,10 +133,12 @@ echo "Installing required packages..." AddPkg () { pkgname=$1 + base_url=${2:-$FREEBSD_PACKAGE_URL} pkg unlock -yq $pkgname pkginfo=`grep "\"name\":\"$pkgname\"" packagesite.yaml` pkgvers=`echo $pkginfo | pcregrep -o1 '"version":"(.*?)"' | head -1` - pkgurl="${FREEBSD_PACKAGE_URL}`echo $pkginfo | pcregrep -o1 '"path":"(.*?)"' | head -1`" + #pkgurl="${FREEBSD_PACKAGE_URL}`echo $pkginfo | pcregrep -o1 '"path":"(.*?)"' | head -1`" + pkgurl="${base_url}`echo $pkginfo | pcregrep -o1 '"path":"(.*?)"' | head -1`" # compare version for update/install if [ `pkg info | grep -c $pkgname-$pkgvers` -eq 1 ]; then @@ -198,8 +208,10 @@ AddPkg boost-libs AddPkg libunwind AddPkg snowballstemmer AddPkg yaml-cpp -if [ ! -z "$CURRENT_MONGODB_VERSION" ]; then - AddPkg ${CURRENT_MONGODB_VERSION} +if [ -n "$FALLBACK_MONGO_PACKAGE_URL" ]; then + AddPkg ${CURRENT_MONGODB_VERSION} ${FALLBACK_MONGO_PACKAGE_URL} +else + AddPkg ${CURRENT_MONGODB_VERSION} fi AddPkg unzip AddPkg pcre