Skip to content

Commit a6cb33e

Browse files
authored
OpenThread-BR: use official GitHub releases (#14916)
1 parent 7099acc commit a6cb33e

2 files changed

Lines changed: 28 additions & 26 deletions

File tree

ct/openthread-br.sh

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
33

44
# Copyright (c) 2021-2026 community-scripts ORG
5-
# Author: MickLesk (CanbiZ)
5+
# Author: MickLesk (CanbiZ) | Co-Author: Tom Frenzel (tomfrenzel)
66
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
77
# Source: https://openthread.io/guides/border-router
88

@@ -32,29 +32,23 @@ function update_script() {
3232
exit
3333
fi
3434

35-
cd /opt/ot-br-posix
36-
LOCAL_COMMIT=$(git rev-parse HEAD)
37-
$STD git fetch --depth 1 origin main
38-
REMOTE_COMMIT=$(git rev-parse origin/main)
35+
if check_for_gh_release "openthread-br" "openthread/ot-br-posix"; then
36+
msg_info "Stopping Services"
37+
systemctl stop otbr-web
38+
systemctl stop otbr-agent
39+
msg_ok "Stopped Services"
3940

40-
if [[ "${LOCAL_COMMIT}" == "${REMOTE_COMMIT}" ]]; then
41-
msg_ok "Already up to date (${LOCAL_COMMIT:0:7})"
42-
exit
43-
fi
44-
45-
msg_info "Stopping Services"
46-
systemctl stop otbr-web
47-
systemctl stop otbr-agent
48-
msg_ok "Stopped Services"
41+
msg_info "Backing up Configuration"
42+
cp /etc/default/otbr-agent /etc/default/otbr-agent.bak
43+
msg_ok "Backed up Configuration"
4944

50-
msg_info "Backing up Configuration"
51-
cp /etc/default/otbr-agent /etc/default/otbr-agent.bak
52-
msg_ok "Backed up Configuration"
53-
54-
msg_info "Updating Source"
55-
$STD git reset --hard origin/main
56-
$STD git submodule update --depth 1 --init --recursive
57-
msg_ok "Updated Source"
45+
msg_info "Fetching GitHub release OpenThread-BR (${CHECK_UPDATE_RELEASE#v})"
46+
cd /opt/ot-br-posix
47+
$STD git fetch --depth 1 origin tag "$CHECK_UPDATE_RELEASE"
48+
$STD git checkout -f "$CHECK_UPDATE_RELEASE"
49+
$STD git submodule update --depth 1 --init --recursive
50+
echo "${CHECK_UPDATE_RELEASE#v}" > ~/.openthread-br
51+
msg_ok "Deployed GitHub release OpenThread-BR (${CHECK_UPDATE_RELEASE#v})"
5852

5953
msg_info "Rebuilding OpenThread Border Router (Patience)"
6054
cd /opt/ot-br-posix/build
@@ -104,6 +98,7 @@ EOF
10498
systemctl start otbr-web
10599
msg_ok "Started Services"
106100
msg_ok "Updated successfully!"
101+
fi
107102
exit
108103
}
109104

install/openthread-br-install.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# Copyright (c) 2021-2026 community-scripts ORG
4-
# Author: MickLesk (CanbiZ)
4+
# Author: MickLesk (CanbiZ) | Co-Author: Tom Frenzel (tomfrenzel)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
66
# Source: https://openthread.io/guides/border-router
77

@@ -39,12 +39,19 @@ msg_ok "Installed Dependencies"
3939

4040
setup_nodejs
4141

42-
msg_info "Cloning OpenThread Border Router"
42+
RELEASE=$(get_latest_gh_tag "openthread/ot-br-posix")
43+
if [[ -z "$RELEASE" ]]; then
44+
msg_error "Failed to fetch latest release tag"
45+
exit 1
46+
fi
47+
48+
msg_info "Fetching GitHub release OpenThread-BR (${RELEASE#v})"
4349
# git clone is needed to fetch submodules, fetch_and_deploy_gh_release doesn't support this. We use --depth 1 to minimize the amount of data cloned, but it still may take a while.
44-
$STD git clone --depth 1 https://github.com/openthread/ot-br-posix /opt/ot-br-posix
50+
$STD git clone --depth 1 --branch "$RELEASE" https://github.com/openthread/ot-br-posix /opt/ot-br-posix
4551
cd /opt/ot-br-posix
4652
$STD git submodule update --depth 1 --init --recursive
47-
msg_ok "Cloned OpenThread Border Router"
53+
echo "${RELEASE#v}" > ~/.openthread-br
54+
msg_ok "Deployed GitHub release OpenThread-BR (${RELEASE#v})"
4855

4956
msg_info "Building OpenThread Border Router (Patience)"
5057
mkdir -p build && cd build

0 commit comments

Comments
 (0)