Refactor & Bump to v2: Plex (#12179)

This commit is contained in:
CanbiZ (MickLesk)
2026-02-22 21:43:40 +01:00
committed by GitHub
parent d868b6d885
commit 287fe28741
2 changed files with 54 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 tteck # Copyright (c) 2021-2026 community-scripts ORG
# Author: tteck (tteckster) # Author: tteck (tteckster) | 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://www.plex.tv/ # Source: https://www.plex.tv/
@@ -24,28 +24,54 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] &&
[[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then if ! dpkg -l plexmediaserver &>/dev/null; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
UPD=$(msg_menu "Plex Update Options" \
"1" "Update LXC" \ # Migrate from old repository to new one if needed
"2" "Install plexupdate") if [[ -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then
if [ "$UPD" == "1" ]; then local current_uri
msg_info "Updating ${APP} LXC" current_uri=$(grep -oP '(?<=URIs: ).*' /etc/apt/sources.list.d/plexmediaserver.sources 2>/dev/null || true)
$STD apt update if [[ "$current_uri" == *"downloads.plex.tv/repo/deb"* ]]; then
$STD apt -y upgrade msg_info "Migrating to new Plex repository"
msg_ok "Updated ${APP} LXC" rm -f /etc/apt/sources.list.d/plexmediaserver.sources
msg_ok "Updated successfully!" rm -f /usr/share/keyrings/PlexSign.asc
exit setup_deb822_repo \
"plexmediaserver" \
"https://downloads.plex.tv/plex-keys/PlexSign.v2.key" \
"https://repo.plex.tv/deb/" \
"public" \
"main"
msg_ok "Migrated to new Plex repository"
fi
elif [[ -f /etc/apt/sources.list.d/plexmediaserver.list ]]; then
msg_info "Migrating to new Plex repository (deb822)"
rm -f /etc/apt/sources.list.d/plexmediaserver.list
rm -f /etc/apt/sources.list.d/plex*
rm -f /usr/share/keyrings/PlexSign.asc
setup_deb822_repo \
"plexmediaserver" \
"https://downloads.plex.tv/plex-keys/PlexSign.v2.key" \
"https://repo.plex.tv/deb/" \
"public" \
"main"
msg_ok "Migrated to new Plex repository (deb822)"
fi fi
if [ "$UPD" == "2" ]; then if [[ -f /usr/local/bin/plexupdate ]] || [[ -d /opt/plexupdate ]]; then
set +e msg_info "Removing legacy plexupdate"
bash -c "$(curl -fsSL https://raw.githubusercontent.com/mrworf/plexupdate/master/extras/installer.sh)" rm -rf /opt/plexupdate /usr/local/bin/plexupdate
msg_ok "Updated successfully!" crontab -l 2>/dev/null | grep -v plexupdate | crontab - 2>/dev/null || true
exit msg_ok "Removed legacy plexupdate"
fi fi
msg_info "Updating Plex Media Server"
$STD apt update
$STD apt install -y plexmediaserver
msg_ok "Updated Plex Media Server"
msg_ok "Updated successfully!"
exit
} }
start start

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck # Copyright (c) 2021-2026 community-scripts ORG
# Author: tteck (tteckster) # Author: tteck (tteckster) | 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://www.plex.tv/ # Source: https://www.plex.tv/
@@ -16,19 +16,16 @@ update_os
setup_hwaccel setup_hwaccel
msg_info "Setting Up Plex Media Server Repository" msg_info "Setting Up Plex Media Server Repository"
curl -fsSL https://downloads.plex.tv/plex-keys/PlexSign.key | tee /usr/share/keyrings/PlexSign.asc >/dev/null setup_deb822_repo \
cat <<EOF >/etc/apt/sources.list.d/plexmediaserver.sources "plexmediaserver" \
Types: deb "https://downloads.plex.tv/plex-keys/PlexSign.v2.key" \
URIs: https://downloads.plex.tv/repo/deb/ "https://repo.plex.tv/deb/" \
Suites: public "public" \
Components: main "main"
Signed-By: /usr/share/keyrings/PlexSign.asc
EOF
msg_ok "Set Up Plex Media Server Repository" msg_ok "Set Up Plex Media Server Repository"
msg_info "Installing Plex Media Server" msg_info "Installing Plex Media Server"
$STD apt update $STD apt install -y plexmediaserver
$STD apt -o Dpkg::Options::="--force-confold" install -y plexmediaserver
if [[ "$CTTYPE" == "0" ]]; then if [[ "$CTTYPE" == "0" ]]; then
sed -i -e 's/^ssl-cert:x:104:plex$/render:x:104:root,plex/' -e 's/^render:x:108:root$/ssl-cert:x:108:plex/' /etc/group sed -i -e 's/^ssl-cert:x:104:plex$/render:x:104:root,plex/' -e 's/^render:x:108:root$/ssl-cert:x:108:plex/' /etc/group
else else