Skip to content

Commit

Permalink
Merge pull request #62 from asjoyner/asjoyner-support-for-cloudkey-ge…
Browse files Browse the repository at this point in the history
…n2-plus

Add support for UniFi Cloudkey Gen2 Plus
  • Loading branch information
notheotherben authored Jun 26, 2023
2 parents 4751578 + 3fcc368 commit 23d40f9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
19 changes: 18 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,24 @@ trap 'rm -rf ${WORKDIR}' EXIT
# Download the Tailscale-UDM package
curl -sSLf --ipv4 -o "${WORKDIR}/tailscale.tgz" "$PACKAGE_URL"

OS_VERSION="${FW_VERSION:-$(ubnt-device-info firmware_detail | grep -oE '^[0-9]+')}"
if [ -x "$(which ubnt-device-info)" ]; then
OS_VERSION="${FW_VERSION:-$(ubnt-device-info firmware_detail | grep -oE '^[0-9]+')}"
elif [ -f "/usr/lib/version" ]; then
# UCKP == Unifi CloudKey Gen2 Plus
# example /usr/lib/version file contents:
# UCKP.apq8053.v2.5.11.b2ebfc7.220801.1419
# UCKP.apq8053.v3.0.17.8102bbc.230210.1526
if [ "$(grep -c '^UCKP.*\.v[0-9]\.' /usr/lib/version)" = '1' ]; then
OS_VERSION="$(sed -e 's/UCKP.*.v\(.\)\..*/\1/' /usr/lib/version)"
else
echo "Could not detect OS Version. /usr/lib/version contains:"
cat /usr/lib/version
exit 1
fi
else
echo "Could not detect OS Version. No ubnt-device-info, no version file."
exit 1
fi

if [ "$OS_VERSION" = '1' ]; then
export PACKAGE_ROOT="/mnt/data/tailscale"
Expand Down
19 changes: 18 additions & 1 deletion package/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@
set -e

PACKAGE_ROOT="${PACKAGE_ROOT:-"$(dirname -- "$(readlink -f -- "$0";)")"}"
OS_VERSION="${FW_VERSION:-$(ubnt-device-info firmware_detail | grep -oE '^[0-9]+')}"
if [ -x "$(which ubnt-device-info)" ]; then
OS_VERSION="${FW_VERSION:-$(ubnt-device-info firmware_detail | grep -oE '^[0-9]+')}"
elif [ -f "/usr/lib/version" ]; then
# UCKP == Unifi CloudKey Gen2 Plus
# example /usr/lib/version file contents:
# UCKP.apq8053.v2.5.11.b2ebfc7.220801.1419
# UCKP.apq8053.v3.0.17.8102bbc.230210.1526
if [ "$(grep -c '^UCKP.*\.v[0-9]\.' /usr/lib/version)" = '1' ]; then
OS_VERSION="$(sed -e 's/UCKP.*.v\(.\)\..*/\1/' /usr/lib/version)"
else
echo "Could not detect OS Version. /usr/lib/version contains:"
cat /usr/lib/version
exit 1
fi
else
echo "Could not detect OS Version. No ubnt-device-info, no version file."
exit 1
fi

if [ "$OS_VERSION" = '1' ]; then
# shellcheck source=package/unios_1.x.sh
Expand Down

0 comments on commit 23d40f9

Please sign in to comment.