unofficial-unifi / unifi-pfsense

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

version & architechture checks #57

Closed ColdFultonBSD closed 7 years ago

ColdFultonBSD commented 7 years ago

Installation script does not stop when version & architecture mis-match; (ie FreeBSD:11:armv6 like NetGate SG-1000)

gozoinks commented 7 years ago

How should the script detect and handle this?

jmcphail commented 7 years ago

Someone should donate a SG-1000 for us to test. https://netgate.com/products/sg-1000.html

ColdFultonBSD commented 7 years ago

Check CLI shell environment variables: like from tcsh, "version tcsh 6.18.01 (Astron) 2012-02-14 (arm32-acorn-FreeBSD) options wide,nls,dl,al,kan,sm,rh,color,filec"

If you'll need something compiled, then if should prompt for go ahead. Compiling on the ARM platforms burns up SD cards.

This is an edge case for your script. If you already know what Architectures it doesn't work; say so; conversely, If you know what has been tested on, say that AMD64, i386, raspberry, begalbone, etc;

Ask for others to test on different processors....

ColdFultonBSD commented 7 years ago

This is the issue line, $FREEBSD_PACKAGE_URL

I only have this: "

!/bin/sh

PKG="/usr/local/etc/pkg.conf" ABI=$(awk ' {if ((x=index($1,"=")) > 0) {printf "%s ", substr($1,x+1)}}' $PKG) " The thought was to: " FREEBSD_PACKAGE_URL="https://pkg.freebsd.org/${ABI}:${OS_ARCH}/latest/All/" " But only need the ABI string from pkg.conf, but

pkg.conf is deprecated | forums.freebsd.orgforums.freebsd.org/threads/43506/

jmcphail commented 7 years ago

What is the output of the following commands on your system: uname -r and uname -m

ColdFultonBSD commented 7 years ago

[2.4.0-BETA][admin@fuzzball]/root: uname -r 11.0-RELEASE-p6 [2.4.0-BETA][admin@fuzzball]/root: uname -m arm [2.4.0-BETA][admin@fuzzball]/root: cat /usr/local/etc/pkg.conf ABI=FreeBSD:11:armv6 ALTABI=freebsd:11:32:el:eabi:hardfp

jmcphail commented 7 years ago

For testing, why not just set the BSD package URL to the following: FREEBSD_PACKAGE_URL="https://pkg.freebsd.org/FreeBSD:11:armv6/latest/All/"

Mind you, with running BSD 11 and 2.4 BETA, the package versions are likely different, you should check each of the package numbers first and update the script before running it.

ColdFultonBSD commented 7 years ago

I checked a couple of packages; they are there, but not same URL method....

https://pkg.freebsd.org says FreeBSD:11:armv6 is Tier-2 support package set

The workaround is to use the FreeBSD-11 packages via the following trick: env ABI=freebsd:11:armv6 pkg bootstrap

Modifying the script to kludge it to work: / ABI="freebsd:10:x86:32" if [ "expr \"$MACHTYPE\" : \"armv6\"" == "0" ]; then ABI="FreeBSD:11:armv6" fi FREEBSD_PACKAGE_URL="https://pkg.freebsd.org/${ABI}/latest/All/" /

ColdFultonBSD commented 7 years ago

I'd already done that before I'd know about the URL path differences; The packages didn't fetch;

I already have UniFi & Domotz Pro running on a Raspberry Pi B 2 under 2016-11-25-raspbian-jessie;

But I take your point; The SG-1000 running a beta version of pfSense; Don't want to hose the package tree.

I'll spin up a FreeBSD Pi image & give it a go;

jmcphail commented 7 years ago

Sounds like a cool project, interested to see how it turns out and will look into it a bit more myself.