From 0b300fb9ab2c3296ce6f943def7b6293609a2f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Tue, 8 Jul 2025 21:26:13 +0200 Subject: [PATCH] Refactor: Emby (#5839) --- ct/emby.sh | 28 ++++++++++++++-------------- install/emby-install.sh | 9 +++------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ct/emby.sh b/ct/emby.sh index ad9ca562d..7f98da10b 100644 --- a/ct/emby.sh +++ b/ct/emby.sh @@ -23,26 +23,26 @@ function update_script() { header_info check_container_storage check_container_resources + if [[ ! -d /opt/emby-server ]]; then msg_error "No ${APP} Installation Found!" exit fi - LATEST=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) - msg_info "Stopping ${APP}" - systemctl stop emby-server - msg_ok "Stopped ${APP}" + RELEASE=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) + if [[ "${RELEASE}" != "$(cat ~/.emby 2>/dev/null)" ]] || [[ ! -f ~/.emby ]]; then + msg_info "Stopping ${APP}" + systemctl stop emby-server + msg_ok "Stopped ${APP}" - msg_info "Updating ${APP}" - $STD curl -fsSL "https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb" -o "emby-server-deb_${LATEST}_amd64.deb" - $STD dpkg -i "emby-server-deb_${LATEST}_amd64.deb" - rm "emby-server-deb_${LATEST}_amd64.deb" - msg_ok "Updated ${APP}" + fetch_and_deploy_gh_release "emby" "MediaBrowser/Emby.Releases" "binary" - msg_info "Starting ${APP}" - systemctl start emby-server - msg_ok "Started ${APP}" - msg_ok "Updated Successfully" - exit + msg_info "Starting ${APP}" + systemctl start emby-server + msg_ok "Started ${APP}" + + msg_ok "Updated Successfully" + exit + fi } start diff --git a/install/emby-install.sh b/install/emby-install.sh index 8dda80eb7..99f87b532 100644 --- a/install/emby-install.sh +++ b/install/emby-install.sh @@ -24,17 +24,15 @@ if [[ "$CTTYPE" == "0" ]]; then fi msg_ok "Set Up Hardware Acceleration" -LATEST=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +fetch_and_deploy_gh_release "emby" "MediaBrowser/Emby.Releases" "binary" -msg_info "Installing Emby" -curl -fsSL "https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb" -o "emby-server-deb_${LATEST}_amd64.deb" -$STD dpkg -i emby-server-deb_${LATEST}_amd64.deb +msg_info "Configuring Emby" if [[ "$CTTYPE" == "0" ]]; then sed -i -e 's/^ssl-cert:x:104:$/render:x:104:root,emby/' -e 's/^render:x:108:root,emby$/ssl-cert:x:108:/' /etc/group else sed -i -e 's/^ssl-cert:x:104:$/render:x:104:emby/' -e 's/^render:x:108:emby$/ssl-cert:x:108:/' /etc/group fi -msg_ok "Installed Emby" +msg_ok "Configured Emby" motd_ssh customize @@ -42,5 +40,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -rm emby-server-deb_${LATEST}_amd64.deb msg_ok "Cleaned"