make install script work with freebsd
This commit is contained in:
parent
876d97bfe5
commit
88d46a31e3
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# 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: (sudo is optional)
|
||||||
# ===
|
# ===
|
||||||
# curl https://raw.githubusercontent.com/unifi-poller/unifi-poller/master/scripts/install.sh | sudo bash
|
# curl 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, this installs the latest rpm. If you're on Debian, it installs the latest deb package.
|
||||||
#
|
#
|
||||||
|
|
@ -30,7 +30,7 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "deb" ] || [ "$1" == "rpm" ]; 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.
|
||||||
|
|
@ -41,12 +41,17 @@ else
|
||||||
dpkg --version > /dev/null 2>&1
|
dpkg --version > /dev/null 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
FILE=deb
|
FILE=deb
|
||||||
|
else
|
||||||
|
pkg --version > /dev/null 2>&1
|
||||||
|
if [ "$?" = "0" ]; then
|
||||||
|
FILE=txz
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$FILE" = "" ]; then
|
if [ "$FILE" = "" ]; then
|
||||||
echo "No dpkg or rpm package managers found!"
|
echo "No pkg (freebsd), dpkg (debian) or rpm (redhat) package managers found; not sure what package to download!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -70,13 +75,15 @@ 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 at ${LATEST}"
|
echo "Error locating latest release for '${FILE} (${ARCH})' at ${LATEST}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INSTALLER="rpm -Uvh"
|
INSTALLER="rpm -Uvh"
|
||||||
if [ "$FILE" = "deb" ]; then
|
if [ "$FILE" = "deb" ]; then
|
||||||
INSTALLER="dpkg --force-confdef --force-confold --install"
|
INSTALLER="dpkg --force-confdef --force-confold --install"
|
||||||
|
elif [ "$FILE" = "txz" ]; then
|
||||||
|
INSTALLER="pkg install"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE=$(basename ${URL})
|
FILE=$(basename ${URL})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue