1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-04-20 07:28:06 +00:00

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!" msg_error "No ${APP} Installation Found!"
exit exit
fi 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" msg_info "Stopping ErsatzTV"
systemctl stop ersatzTV systemctl stop ersatzTV
msg_ok "Stopped ErsatzTV" msg_ok "Stopped ErsatzTV"
msg_info "Updating 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 cp -R /opt/ErsatzTV/ ErsatzTV-backup
rm ErsatzTV-backup/ErsatzTV rm ErsatzTV-backup/ErsatzTV
rm -rf /opt/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 temp_file=$(mktemp)
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
cp -R ErsatzTV-backup/* /opt/ErsatzTV/ cp -R ErsatzTV-backup/* /opt/ErsatzTV/
rm -rf ErsatzTV-backup rm -rf ErsatzTV-backup
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ErsatzTV" msg_ok "Updated ErsatzTV"
msg_info "Starting ErsatzTV" msg_info "Starting ErsatzTV"
systemctl start ersatzTV systemctl start ersatzTV
msg_ok "Started ErsatzTV" msg_ok "Started ErsatzTV"
msg_info "Cleaning Up"
rm -f ${temp_file}
msg_ok "Cleaned"
msg_ok "Updated Successfully" msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit exit
} }
start start
build_container build_container
description description

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck # Copyright (c) 2021-2025 tteck
# Author: tteck # Author: MickLesk (Canbiz)
# Co-Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # 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 color
@ -15,22 +14,20 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y curl $STD apt-get install -y \
$STD apt-get install -y sudo curl \
$STD apt-get install -y mc sudo \
mc
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing FFmpeg (Patience)" 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 cd /usr/local/bin
$STD dpkg -i deb-multimedia-keyring_2016.8.1_all.deb wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
cat <<EOF >/etc/apt/sources.list.d/backports.list $STD tar -xvf ffmpeg-release-amd64-static.tar.xz
deb https://www.deb-multimedia.org bookworm main non-free rm -f ffmpeg-*.tar.xz
deb https://www.deb-multimedia.org bookworm-backports main cd ffmpeg-*
EOF mv ffmpeg ffprobe /usr/local/bin/
$STD apt update rm -rf /usr/local/bin/ffmpeg-*
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
msg_ok "Installed FFmpeg" msg_ok "Installed FFmpeg"
msg_info "Setting Up Hardware Acceleration" msg_info "Setting Up Hardware Acceleration"
@ -45,9 +42,12 @@ fi
msg_ok "Set Up Hardware Acceleration" 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) 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 wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" -O "$temp_file"
mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV tar -xzf "$temp_file"
mv /opt/ErsatzTV-${RELEASE}-linux-x64 /opt/ErsatzTV
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed ErsatzTV" msg_ok "Installed ErsatzTV"
msg_info "Creating Service" msg_info "Creating Service"
@ -67,13 +67,14 @@ RestartSec=30
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl -q --now enable ersatzTV.service systemctl enable -q --now ersatzTV
msg_ok "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -f ${temp_file}
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"