Compare commits

..

1 Commits

3 changed files with 53 additions and 3 deletions
+2 -2
View File
@@ -29,12 +29,12 @@ function update_script() {
exit exit
fi fi
if check_for_gh_release "threadfin-app" "threadfin/threadfin"; then if check_for_gh_release "threadfin" "threadfin/threadfin"; then
msg_info "Stopping Service" msg_info "Stopping Service"
systemctl stop threadfin systemctl stop threadfin
msg_ok "Stopped Service" msg_ok "Stopped Service"
fetch_and_deploy_gh_release "threadfin-app" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64" fetch_and_deploy_gh_release "threadfin" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64"
msg_info "Starting Service" msg_info "Starting Service"
systemctl start threadfin systemctl start threadfin
+3 -1
View File
@@ -20,7 +20,9 @@ $STD apt install -y \
vlc vlc
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
fetch_and_deploy_gh_release "threadfin-app" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64" fetch_and_deploy_gh_release "threadfin" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64"
mv /root/.threadfin /root/.threadfin_version
mkdir -p /root/.threadfin
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/threadfin.service cat <<EOF >/etc/systemd/system/threadfin.service
+48
View File
@@ -3504,6 +3504,52 @@ msg_menu() {
return 0 return 0
} }
# ------------------------------------------------------------------------------
# run_addon_updates()
#
# - Scans /usr/local/bin/update_* for addon update scripts installed alongside
# the main application (e.g. by tools/addon/*.sh)
# - For each found addon, prompts the user (60s timeout, default no) whether
# it should be updated as well
# - Skipped entirely when PHS_SILENT=1 to keep unattended updates predictable
# ------------------------------------------------------------------------------
run_addon_updates() {
shopt -s nullglob
local addons=(/usr/local/bin/update_*)
shopt -u nullglob
((${#addons[@]} == 0)) && return 0
if [[ "${PHS_SILENT:-0}" == "1" ]]; then
msg_info "Detected ${#addons[@]} addon update script(s) - skipping (PHS_SILENT)"
return 0
fi
echo
echo -e "${INFO}${YW} Detected installed addon update script(s):${CL}"
local a name
for a in "${addons[@]}"; do
echo -e "${TAB}- ${a##*/update_}"
done
echo
local ans
for a in "${addons[@]}"; do
name="${a##*/update_}"
printf 'Do you also want to update addon "%s"? (y/N) [60s]: ' "$name"
ans=""
if read -r -t 60 ans; then :; else echo; fi
case "${ans,,}" in
y | yes)
bash "$a" || msg_warn "Addon update for $name failed (rc=$?)"
;;
*)
msg_info "Skipped addon: $name"
;;
esac
done
}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# start() # start()
# #
@@ -3523,6 +3569,7 @@ start() {
ensure_profile_loaded ensure_profile_loaded
get_lxc_ip get_lxc_ip
update_script update_script
run_addon_updates
update_motd_ip update_motd_ip
cleanup_lxc cleanup_lxc
else else
@@ -3551,6 +3598,7 @@ start() {
ensure_profile_loaded ensure_profile_loaded
get_lxc_ip get_lxc_ip
update_script update_script
run_addon_updates
update_motd_ip update_motd_ip
cleanup_lxc cleanup_lxc
fi fi