Refactor: ErsatzTV Script (#3365)

* Update ersatztv-install.sh

* Redesign ErsatzTV

* Update ersatztv-install.sh

* Update ersatztv.sh
This commit is contained in:
CanbiZ 2025-03-24 11:04:30 +01:00 committed by GitHub
parent 06491a9444
commit e2e6ad5935
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 26 deletions

View File

@ -26,29 +26,40 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1)
if [[ ! -f /opt/${APP}_version.txt && $(echo "x.x.x" > /opt/${APP}_version.txt) || "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping ErsatzTV"
systemctl stop ersatzTV
msg_ok "Stopped ErsatzTV"
msg_info "Updating ErsatzTV"
RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1)
cp -R /opt/ErsatzTV/ ErsatzTV-backup
rm ErsatzTV-backup/ErsatzTV
rm -rf /opt/ErsatzTV
wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt
mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV
temp_file=$(mktemp)
wget -qO- https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz -O "$temp_file"
tar -xzf "$temp_file"
mv /opt/ErsatzTV-${RELEASE}-linux-x64 /opt/ErsatzTV
cp -R ErsatzTV-backup/* /opt/ErsatzTV/
rm -rf ErsatzTV-backup
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ErsatzTV"
msg_info "Starting ErsatzTV"
systemctl start ersatzTV
msg_ok "Started ErsatzTV"
msg_info "Cleaning Up"
rm -f ${temp_file}
msg_ok "Cleaned"
msg_ok "Updated Successfully"
exit
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}
start
build_container
description

View File

@ -1,12 +1,11 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
# Author: tteck
# Co-Author: MickLesk (Canbiz)
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/ErsatzTV/ErsatzTV
# Source: https://ersatztv.org/
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
@ -15,22 +14,20 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
$STD apt-get install -y \
curl \
sudo \
mc
msg_ok "Installed Dependencies"
msg_info "Installing FFmpeg (Patience)"
wget -q https://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb
$STD dpkg -i deb-multimedia-keyring_2016.8.1_all.deb
cat <<EOF >/etc/apt/sources.list.d/backports.list
deb https://www.deb-multimedia.org bookworm main non-free
deb https://www.deb-multimedia.org bookworm-backports main
EOF
$STD apt update
DEBIAN_FRONTEND=noninteractive $STD apt-get install -t bookworm-backports ffmpeg -y
rm -rf /etc/apt/sources.list.d/backports.list deb-multimedia-keyring_2016.8.1_all.deb
$STD apt update
cd /usr/local/bin
wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
$STD tar -xvf ffmpeg-release-amd64-static.tar.xz
rm -f ffmpeg-*.tar.xz
cd ffmpeg-*
mv ffmpeg ffprobe /usr/local/bin/
rm -rf /usr/local/bin/ffmpeg-*
msg_ok "Installed FFmpeg"
msg_info "Setting Up Hardware Acceleration"
@ -44,10 +41,13 @@ if [[ "$CTTYPE" == "0" ]]; then
fi
msg_ok "Set Up Hardware Acceleration"
msg_info "Installing ErsatzTV"
msg_info "Installing ErsatzTV"
cd /opt
RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1)
wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt
mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV
wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" -O "$temp_file"
tar -xzf "$temp_file"
mv /opt/ErsatzTV-${RELEASE}-linux-x64 /opt/ErsatzTV
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed ErsatzTV"
msg_info "Creating Service"
@ -67,13 +67,14 @@ RestartSec=30
[Install]
WantedBy=multi-user.target
EOF
systemctl -q --now enable ersatzTV.service
systemctl enable -q --now ersatzTV
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -f ${temp_file}
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"