From 3bb787d74650864f2bb8f661da31f057142e8c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Fri, 1 Aug 2025 07:23:27 +0200 Subject: [PATCH] Refactor (#6434) --- ct/owncast.sh | 23 ++++++++++++++++++----- frontend/public/json/owncast.json | 2 +- install/owncast-install.sh | 8 +------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ct/owncast.sh b/ct/owncast.sh index ffc3f3c98..4cbc786d4 100644 --- a/ct/owncast.sh +++ b/ct/owncast.sh @@ -27,10 +27,23 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating $APP LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" + + RELEASE=$(curl -fsSL https://api.github.com/repos/owncast/owncast/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f ~/.owncast ]] || [[ "${RELEASE}" != "$(cat ~/.owncast)" ]]; then + msg_info "Stopping ${APP}" + systemctl stop owncast + msg_ok "Stopped ${APP}" + + fetch_and_deploy_gh_release "owncast" "owncast/owncast" "prebuild" "latest" "/opt/owncast" "owncast*linux-64bit.zip" + + msg_info "Starting ${APP}" + systemctl start owncast + msg_ok "Started ${APP}" + + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}." + fi exit } @@ -41,4 +54,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" -echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/admin${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/admin${CL}" diff --git a/frontend/public/json/owncast.json b/frontend/public/json/owncast.json index 230064726..55fc27334 100644 --- a/frontend/public/json/owncast.json +++ b/frontend/public/json/owncast.json @@ -6,7 +6,7 @@ ], "date_created": "2024-05-02", "type": "ct", - "updateable": false, + "updateable": true, "privileged": false, "interface_port": 8080, "documentation": "https://owncast.online/docs/", diff --git a/install/owncast-install.sh b/install/owncast-install.sh index 4976f296c..efb181cb3 100644 --- a/install/owncast-install.sh +++ b/install/owncast-install.sh @@ -17,13 +17,7 @@ msg_info "Installing Dependencies (Patience)" $STD apt-get install -y ffmpeg msg_ok "Installed Dependencies" -msg_info "Installing Owncast" -mkdir /opt/owncast -cd /opt/owncast -curl -fsSL "$(curl -fsSL https://api.github.com/repos/owncast/owncast/releases/latest | grep download | grep linux-64bit | cut -d\" -f4)" -o $(basename "$(curl -fsSL https://api.github.com/repos/owncast/owncast/releases/latest | grep download | grep linux-64bit | cut -d\" -f4)") -$STD unzip owncast*.zip -rm owncast*.zip -msg_ok "Installed Owncast" +fetch_and_deploy_gh_release "owncast" "owncast/owncast" "prebuild" "latest" "/opt/owncast" "owncast*linux-64bit.zip" msg_info "Creating Service" cat </etc/systemd/system/owncast.service