Skip to content

Commit

Permalink
Merge pull request #66 from movementgyms/main
Browse files Browse the repository at this point in the history
another cloudkey workaround
  • Loading branch information
notheotherben authored Nov 2, 2023
2 parents 1596599 + 3dfed38 commit cf9e67b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion package/on-boot.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
#!/bin/sh
set -e

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
# UCKG2 == UniFi CloudKey Gen2
# example /usr/lib/version file contents:
# UCKG2.apq8053.v3.1.13.3584673.230626.2239
if [ "$(grep -c '^UCKP.*\.v[0-9]\.' /usr/lib/version)" = '1' ]; then
OS_VERSION="$(sed -e 's/UCKP.*.v\(.\)\..*/\1/' /usr/lib/version)"
elif [ "$(grep -c '^UCKG2.*\.v[0-9]\.' /usr/lib/version)" = '1' ]; then
OS_VERSION="$(sed -e 's/UCKG2.*.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
TAILSCALE_ROOT="/mnt/data/tailscale"
Expand Down

0 comments on commit cf9e67b

Please sign in to comment.