diff --git a/ct/plex.sh b/ct/plex.sh new file mode 100644 index 000000000..be50ac0aa --- /dev/null +++ b/ct/plex.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2025 tteck +# Author: tteck (tteckster) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.plex.tv/ + +APP="Plex" +var_tags="${var_tags:-media}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-ubuntu}" +var_version="${var_version:-24.04}" +var_unprivileged="${var_unprivileged:-1}" +var_gpu="${var_gpu:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] && + [[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select \nplexupdate info >> https://github.com/mrworf/plexupdate" 10 59 2 \ + "1" "Update LXC" ON \ + "2" "Install plexupdate" OFF \ + 3>&1 1>&2 2>&3) + if [ "$UPD" == "1" ]; then + msg_info "Updating ${APP} LXC" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated ${APP} LXC" + msg_ok "Updated successfully!" + exit + fi + if [ "$UPD" == "2" ]; then + set +e + bash -c "$(curl -fsSL https://raw.githubusercontent.com/mrworf/plexupdate/master/extras/installer.sh)" + msg_ok "Updated successfully!" + exit + fi +} + +start +build_container +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}:32400/web${CL}" diff --git a/install/frigate-install.sh b/install/frigate-install.sh index e243d2e2a..fb6d16404 100644 --- a/install/frigate-install.sh +++ b/install/frigate-install.sh @@ -44,15 +44,19 @@ msg_info "Installing hardware acceleration drivers" $STD apt-get install -y va-driver-all ocl-icd-libopencl1 vainfo intel-gpu-tools msg_ok "Hardware acceleration drivers installed" +if [[ -d /dev/dri ]]; then + msg_info "Configuring GPU access" + chgrp video /dev/dri 2>/dev/null || true + chmod 755 /dev/dri 2>/dev/null || true + chmod 660 /dev/dri/* 2>/dev/null || true +fi + if [[ "$CTTYPE" == "0" ]]; then - msg_info "Configuring GPU access for privileged container" - chgrp video /dev/dri - chmod 755 /dev/dri - chmod 660 /dev/dri/* + msg_info "Configuring render group for privileged container" sed -i -e 's/^kvm:x:104:$/render:x:104:root,frigate/' -e 's/^render:x:105:root$/kvm:x:105:/' /etc/group msg_ok "Privileged container GPU access configured" else - msg_info "Configuring GPU access for unprivileged container" + msg_info "Configuring render group for unprivileged container" sed -i -e 's/^kvm:x:104:$/render:x:104:frigate/' -e 's/^render:x:105:$/kvm:x:105:/' /etc/group msg_ok "Unprivileged container GPU access configured" fi diff --git a/install/plex-install.sh b/install/plex-install.sh new file mode 100644 index 000000000..641bed6e2 --- /dev/null +++ b/install/plex-install.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 tteck +# Author: tteck (tteckster) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.plex.tv/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Setting Up Hardware Acceleration" +$STD apt -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ -d /dev/dri ]]; then + chgrp video /dev/dri 2>/dev/null || true + chmod 755 /dev/dri 2>/dev/null || true + chmod 660 /dev/dri/* 2>/dev/null || true + $STD adduser "$(id -u -n)" video + $STD adduser "$(id -u -n)" render +fi +msg_ok "Set Up Hardware Acceleration" + +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 +cat </etc/apt/sources.list.d/plexmediaserver.sources +Types: deb +URIs: https://downloads.plex.tv/repo/deb/ +Suites: public +Components: main +Signed-By: /usr/share/keyrings/PlexSign.asc +EOF +msg_ok "Set Up Plex Media Server Repository" + +msg_info "Installing Plex Media Server" +$STD apt update +$STD apt -o Dpkg::Options::="--force-confold" install -y plexmediaserver +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 +else + sed -i -e 's/^ssl-cert:x:104:plex$/render:x:104:plex/' -e 's/^render:x:108:$/ssl-cert:x:108:/' /etc/group +fi +msg_ok "Installed Plex Media Server" + +motd_ssh +customize +cleanup_lxc diff --git a/misc/tools.func b/misc/tools.func index 4f1d6a4de..716a74d8a 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -2629,7 +2629,7 @@ function setup_hwaccel() { ;; esac - if [[ "$in_ct" == "0" ]]; then + if [[ -d /dev/dri ]]; then chgrp video /dev/dri 2>/dev/null || true chmod 755 /dev/dri 2>/dev/null || true chmod 660 /dev/dri/* 2>/dev/null || true