Skip to content

Commit

Permalink
fix the mongodb install issues on 2.7.0
Browse files Browse the repository at this point in the history
See also: unofficial-unifi#320 (comment),
but TL;DR:

- pfSense 2.7.0 forked off from FreeBSD 14.0-pre at some time N
- FreeBSD 14.0-pre switched to OpenSSL 3.0 in base at some time N+1
- we pull from `FreeBSD:14:x` "latest" here
- thus "latest" expects OpenSSL 3.0, but we (pfSense) have a base with
  OpenSSL 1.x

Thus, mongodb from FreeBSD:14:x errors out with missing `libssl.so.30`
linking errors.

pfsense/FreeBSD-src@b077aed
says that we're gonna get OpenSSL 3.0 *eventually* in pfSense, but for
now, we can pull from FreeBSD:13:x if we see that bad combination of
`(abi, pfSense version)`.
  • Loading branch information
DirectXMan12 committed Aug 8, 2023
1 parent 4fb37b5 commit 3dcf601
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions install-unifi/install-unifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ UNIFI_SOFTWARE_URL="https://dl.ui.com/unifi/7.2.97/UniFi.unix.zip"
RC_SCRIPT_URL="https://raw.githubusercontent.com/unofficial-unifi/unifi-pfsense/master/rc.d/unifi.sh"

CURRENT_MONGODB_VERSION=mongodb42
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
Expand Down Expand Up @@ -107,10 +113,11 @@ tar vfx packagesite.pkg

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="${base_url}`echo $pkginfo | pcregrep -o1 '"path":"(.*?)"' | head -1`"

# compare version for update/install
if [ `pkg info | grep -c $pkgname-$pkgvers` -eq 1 ]; then
Expand Down Expand Up @@ -161,7 +168,11 @@ AddPkg snappy
AddPkg cyrus-sasl
AddPkg icu
AddPkg boost-libs
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

Expand Down

0 comments on commit 3dcf601

Please sign in to comment.