Skip to content

Commit 2586c9f

Browse files
authored
Refactor: Threadfin (+ updateble) (#5783)
1 parent 5c5d5d5 commit 2586c9f

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

ct/threadfin.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,24 @@ function update_script() {
2727
msg_error "No ${APP} Installation Found!"
2828
exit
2929
fi
30-
msg_info "Updating $APP"
31-
systemctl stop threadfin.service
32-
curl -fsSL "https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64" -o "/opt/threadfin/threadfin"
33-
chmod +x /opt/threadfin/threadfin
34-
systemctl start threadfin.service
35-
msg_ok "Updated $APP"
30+
31+
RELEASE=$(curl -fsSL https://api.github.com/repos/threadfin/threadfin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
32+
if [[ "${RELEASE}" != "$(cat ~/.threadfin 2>/dev/null)" ]] || [[ ! -f ~/.threadfin ]]; then
33+
34+
msg_info "Stopping $APP"
35+
systemctl stop threadfin
36+
msg_ok "Stopped $APP"
37+
38+
fetch_and_deploy_gh_release "threadfin" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64"
39+
40+
msg_info "Starting $APP"
41+
systemctl start threadfin
42+
msg_ok "Started $APP"
43+
44+
msg_ok "Updated Successfully"
45+
else
46+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
47+
fi
3648
exit
3749
}
3850

frontend/public/json/threadfin.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/threadfin-install.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apt-get install -y ffmpeg
18-
$STD apt-get install -y vlc
17+
$STD apt-get install -y \
18+
ffmpeg \
19+
vlc
1920
msg_ok "Installed Dependencies"
2021

21-
msg_info "Installing Threadfin"
22-
mkdir -p /opt/threadfin
23-
curl -fsSL "https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64" -o "/opt/threadfin/threadfin"
24-
chmod +x /opt/threadfin/threadfin
25-
26-
msg_ok "Installed Threadfin"
22+
fetch_and_deploy_gh_release "threadfin" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64"
2723

2824
msg_info "Creating Service"
2925
cat <<EOF >/etc/systemd/system/threadfin.service

0 commit comments

Comments
 (0)