make install script work on freebsd
This commit is contained in:
parent
88d46a31e3
commit
a3f985983d
5
Makefile
5
Makefile
|
|
@ -250,13 +250,14 @@ package_build_linux_armhf: package_build_linux armhf
|
||||||
|
|
||||||
# Build an environment that can be packaged for freebsd.
|
# Build an environment that can be packaged for freebsd.
|
||||||
package_build_freebsd: readme man freebsd
|
package_build_freebsd: readme man freebsd
|
||||||
mkdir -p $@/usr/local/bin $@/usr/local/etc/{rc.d,$(BINARY)} $@/usr/local/share/man/man1 $@/usr/local/share/doc/$(BINARY)
|
mkdir -p $@/usr/local/bin $@/usr/local/etc/$(BINARY) $@/usr/local/share/man/man1 $@/usr/local/share/doc/$(BINARY)
|
||||||
cp $(BINARY).amd64.freebsd $@/usr/local/bin/$(BINARY)
|
cp $(BINARY).amd64.freebsd $@/usr/local/bin/$(BINARY)
|
||||||
cp *.1.gz $@/usr/local/share/man/man1
|
cp *.1.gz $@/usr/local/share/man/man1
|
||||||
cp examples/$(CONFIG_FILE).example $@/usr/local/etc/$(BINARY)/
|
cp examples/$(CONFIG_FILE).example $@/usr/local/etc/$(BINARY)/
|
||||||
cp examples/$(CONFIG_FILE).example $@/usr/local/etc/$(BINARY)/$(CONFIG_FILE)
|
cp examples/$(CONFIG_FILE).example $@/usr/local/etc/$(BINARY)/$(CONFIG_FILE)
|
||||||
cp LICENSE *.html examples/*?.?* $@/usr/local/share/doc/$(BINARY)/
|
cp LICENSE *.html examples/*?.?* $@/usr/local/share/doc/$(BINARY)/
|
||||||
cp init/bsd/unifi-poller.rc $@/usr/local/etc/rc.d/unifi-poller
|
[ "$(FORMULA)" != "service" ] || mkdir -p $@/usr/local/etc/rc.d
|
||||||
|
[ "$(FORMULA)" != "service" ] || cp init/bsd/unifi-poller.rc $@/usr/local/etc/rc.d/unifi-poller
|
||||||
|
|
||||||
package_build_freebsd_386: package_build_freebsd freebsd386
|
package_build_freebsd_386: package_build_freebsd freebsd386
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
|
||||||
|
|
@ -2,35 +2,51 @@
|
||||||
|
|
||||||
# This is a quick and drity script to install the latest Linux package.
|
# This is a quick and drity script to install the latest Linux package.
|
||||||
#
|
#
|
||||||
# Use it like this: (sudo is optional)
|
# Use it like this, pick curl or wget: (sudo is optional)
|
||||||
# ===
|
# ----
|
||||||
# curl https://raw.githubusercontent.com/unifi-poller/unifi-poller/master/scripts/install.sh | sudo sh
|
# curl -s https://raw.githubusercontent.com/unifi-poller/unifi-poller/master/scripts/install.sh | sudo sh
|
||||||
# ===
|
# wget -qO- https://raw.githubusercontent.com/unifi-poller/unifi-poller/master/scripts/install.sh | sudo sh
|
||||||
# If you're on redhat, this installs the latest rpm. If you're on Debian, it installs the latest deb package.
|
# ----
|
||||||
|
#
|
||||||
|
# - If you're on RedHat/CentOS/Fedora, installs the latest rpm package.
|
||||||
|
# - If you're on Debian/Ubuntu/Gentoo, installs the latest deb package.
|
||||||
|
# - If you're on FreeBSD, installs the latest txz package.
|
||||||
#
|
#
|
||||||
# This is part of application-builder.
|
# This is part of application-builder.
|
||||||
# https://github.com/golift/application-builder
|
# https://github.com/golift/application-builder
|
||||||
|
|
||||||
REPO=unifi-poller/unifi-poller
|
REPO=unifi-poller/unifi-poller
|
||||||
|
BREW=golift/mugs/unifi-poller
|
||||||
LATEST=https://api.github.com/repos/${REPO}/releases/latest
|
LATEST=https://api.github.com/repos/${REPO}/releases/latest
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
OS=$(uname -s)
|
||||||
|
P=" ==>"
|
||||||
|
echo "<-------------------------------------------------->"
|
||||||
|
|
||||||
|
if [ "$OS" = "Darwin" ]; then
|
||||||
|
echo "${P} On a mac? Use Homebrew:"
|
||||||
|
echo " brew install ${BREW}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
# $ARCH is passed into egrep to find the right file.
|
# $ARCH is passed into egrep to find the right file.
|
||||||
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
|
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
|
||||||
ARCH="x86_64|amd64"
|
ARCH="x86_64|amd64"
|
||||||
elif [[ $ARCH == *386* ]] || [[ $ARCH == *686* ]]; then
|
elif [[ $ARCH = *386* ]] || [[ $ARCH = *686* ]]; then
|
||||||
ARCH="i386"
|
ARCH="i386"
|
||||||
elif [[ $ARCH == *arm64* ]] || [[ $ARCH == *armv8* ]] || [[ $ARCH == *aarch64* ]]; then
|
elif [[ $ARCH = *arm64* ]] || [[ $ARCH = *armv8* ]] || [[ $ARCH = *aarch64* ]]; then
|
||||||
ARCH="arm64"
|
ARCH="arm64"
|
||||||
elif [[ $ARCH == *armv6* ]] || [[ $ARCH == *armv7* ]]; then
|
elif [[ $ARCH = *armv6* ]] || [[ $ARCH = *armv7* ]]; then
|
||||||
ARCH="armhf"
|
ARCH="armhf"
|
||||||
else
|
else
|
||||||
echo "Unknown Architecture. Submit a pull request to fix this, please."
|
echo "${P} [ERROR] Unknown Architecture: ${ARCH}"
|
||||||
echo ==> $ARCH
|
echo "${P} $(uname -a)"
|
||||||
|
echo "${P} Please report this, along with the above OS details:"
|
||||||
|
echo " https://github.com/${REPO}/issues/new"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "deb" ] || [ "$1" == "rpm" ] || [ "$1" == "txz" ]; then
|
if [ "$1" = "deb" ] || [ "$1" = "rpm" ] || [ "$1" = "txz" ]; then
|
||||||
FILE=$1
|
FILE=$1
|
||||||
else
|
else
|
||||||
# If you have both, rpm wins.
|
# If you have both, rpm wins.
|
||||||
|
|
@ -51,23 +67,26 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$FILE" = "" ]; then
|
if [ "$FILE" = "" ]; then
|
||||||
echo "No pkg (freebsd), dpkg (debian) or rpm (redhat) package managers found; not sure what package to download!"
|
echo "${P} [ERROR] No pkg (freebsd), dpkg (debian) or rpm (redhat) package managers found; not sure what package to download!"
|
||||||
|
echo "${P} $(uname -a)"
|
||||||
|
echo "${P} If you feel this is a mistake, please report this along with the above OS details:"
|
||||||
|
echo " https://github.com/${REPO}/issues/new"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# curl or wget?
|
# curl or wget?
|
||||||
curl --version > /dev/null 2>&1
|
curl --version > /dev/null 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
CMD="curl -L"
|
CMD="curl -sL"
|
||||||
else
|
else
|
||||||
wget --version > /dev/null 2>&1
|
wget --version > /dev/null 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
CMD="wget -O-"
|
CMD="wget -qO-"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CMD" = "" ]; then
|
if [ "$CMD" = "" ]; then
|
||||||
echo "Need curl or wget - could not find either!"
|
echo "${P} [ERROR] Could not locate curl nor wget - please install one to download packages!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -75,7 +94,10 @@ fi
|
||||||
URL=$($CMD ${LATEST} | egrep "browser_download_url.*(${ARCH})\.${FILE}\"" | cut -d\" -f 4)
|
URL=$($CMD ${LATEST} | egrep "browser_download_url.*(${ARCH})\.${FILE}\"" | cut -d\" -f 4)
|
||||||
|
|
||||||
if [ "$?" != "0" ] || [ "$URL" = "" ]; then
|
if [ "$?" != "0" ] || [ "$URL" = "" ]; then
|
||||||
echo "Error locating latest release for '${FILE} (${ARCH})' at ${LATEST}"
|
echo "${P} [ERROR] Missing latest release for '${FILE}' file ($OS/${ARCH}) at ${LATEST}"
|
||||||
|
echo "${P} $(uname -a)"
|
||||||
|
echo "${P} Please report error this, along with the above OS details:"
|
||||||
|
echo " https://github.com/${REPO}/issues/new"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -87,17 +109,17 @@ elif [ "$FILE" = "txz" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE=$(basename ${URL})
|
FILE=$(basename ${URL})
|
||||||
echo "Downloading: ${URL} to /tmp/${FILE}"
|
echo "${P} Downloading: ${URL}"
|
||||||
|
echo "${P} To Location: /tmp/${FILE}"
|
||||||
$CMD ${URL} > /tmp/${FILE}
|
$CMD ${URL} > /tmp/${FILE}
|
||||||
|
|
||||||
# Install it.
|
# Install it.
|
||||||
if [ "$(id -u)" = "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
echo "==================================="
|
echo "${P} Downloaded. Installing the package!"
|
||||||
echo "Downloaded. Installing the package!"
|
echo "${P} Executing: ${INSTALLER} /tmp/${FILE}"
|
||||||
echo "Running: ${INSTALLER} /tmp/${FILE}"
|
|
||||||
$INSTALLER /tmp/${FILE}
|
$INSTALLER /tmp/${FILE}
|
||||||
|
echo "<-------------------------------------------------->"
|
||||||
else
|
else
|
||||||
echo "================================"
|
echo "${P} Downloaded. Install the package like this:"
|
||||||
echo "Downloaded. Install the package:"
|
echo " sudo $INSTALLER /tmp/${FILE}"
|
||||||
echo "sudo $INSTALLER /tmp/${FILE}"
|
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue