Skip to content

Commit

Permalink
Update install-unifi.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
tong2x authored Aug 14, 2023
1 parent 144f7f9 commit 1ce9ec0
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions install-unifi/install-unifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

1 comment on commit 1ce9ec0

@dvdp
Copy link

@dvdp dvdp commented on 1ce9ec0 Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it on pfSense 2.7 - FreeBSD 14 but still getting

Exception in thread "launcher" java.lang.NullPointerException: Web context failed to initialize

    at java.base/java.util.Objects.requireNonNull(Objects.java:235)
    at com.ubnt.net.C.ÖÒ0000(Unknown Source)
    at com.ubnt.net.C.Òo0000(Unknown Source)
    at com.ubnt.service.ooOO.øÓ0000(Unknown Source)
    at com.ubnt.ace.Launcher.Ó00000(Unknown Source)
    at com.ubnt.ace.Launcher.main(Unknown Source)

Please sign in to comment.