Update build.func
This commit is contained in:
parent
bcddaaba41
commit
721ba24191
144
misc/build.func
144
misc/build.func
@ -2163,16 +2163,20 @@ build_container() {
|
|||||||
VAAPI_DEVICES=()
|
VAAPI_DEVICES=()
|
||||||
NVIDIA_DEVICES=()
|
NVIDIA_DEVICES=()
|
||||||
|
|
||||||
for device in $(compgen -G "/dev/dri/renderD*" || true); do
|
# VAAPI / Intel / AMD
|
||||||
VAAPI_DEVICES+=("$device")
|
for device in /dev/dri/renderD* /dev/dri/card*; do
|
||||||
done
|
[[ -e "$device" ]] || continue
|
||||||
for device in $(compgen -G "/dev/dri/card*" || true); do
|
|
||||||
VAAPI_DEVICES+=("$device")
|
VAAPI_DEVICES+=("$device")
|
||||||
done
|
done
|
||||||
|
|
||||||
for device in $(compgen -G "/dev/nvidia*" || true); do
|
# NVIDIA
|
||||||
|
for device in /dev/nvidia*; do
|
||||||
|
[[ -e "$device" ]] || continue
|
||||||
NVIDIA_DEVICES+=("$device")
|
NVIDIA_DEVICES+=("$device")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
msg_debug "Detected VAAPI devices: ${VAAPI_DEVICES[*]:-(none)}"
|
||||||
|
msg_debug "Detected NVIDIA devices: ${NVIDIA_DEVICES[*]:-(none)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configure USB passthrough for privileged containers
|
# Configure USB passthrough for privileged containers
|
||||||
@ -2401,77 +2405,77 @@ EOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install GPU userland packages
|
# # Install GPU userland packages
|
||||||
install_gpu_userland() {
|
# install_gpu_userland() {
|
||||||
local gpu_type="$1"
|
# local gpu_type="$1"
|
||||||
|
|
||||||
if [ "$var_os" == "alpine" ]; then
|
# if [ "$var_os" == "alpine" ]; then
|
||||||
case "$gpu_type" in
|
# case "$gpu_type" in
|
||||||
VAAPI)
|
# VAAPI)
|
||||||
msg_info "Installing VAAPI packages in Alpine container"
|
# msg_info "Installing VAAPI packages in Alpine container"
|
||||||
pct exec "$CTID" -- ash -c '
|
# pct exec "$CTID" -- ash -c '
|
||||||
apk add --no-cache \
|
# apk add --no-cache \
|
||||||
mesa-dri-gallium \
|
# mesa-dri-gallium \
|
||||||
mesa-va-gallium \
|
# mesa-va-gallium \
|
||||||
intel-media-driver \
|
# intel-media-driver \
|
||||||
libva-utils >/dev/null 2>&1
|
# libva-utils >/dev/null 2>&1
|
||||||
' || msg_warn "Some VAAPI packages may not be available in Alpine"
|
# ' || msg_warn "Some VAAPI packages may not be available in Alpine"
|
||||||
;;
|
# ;;
|
||||||
NVIDIA)
|
# NVIDIA)
|
||||||
msg_warn "NVIDIA drivers are not readily available in Alpine Linux"
|
# msg_warn "NVIDIA drivers are not readily available in Alpine Linux"
|
||||||
;;
|
# ;;
|
||||||
esac
|
# esac
|
||||||
else
|
# else
|
||||||
case "$gpu_type" in
|
# case "$gpu_type" in
|
||||||
VAAPI)
|
# VAAPI)
|
||||||
msg_info "Installing VAAPI userland packages"
|
# msg_info "Installing VAAPI userland packages"
|
||||||
pct exec "$CTID" -- bash -c '
|
# pct exec "$CTID" -- bash -c '
|
||||||
. /etc/os-release || true
|
# . /etc/os-release || true
|
||||||
if [[ "${VERSION_CODENAME:-}" == "trixie" ]]; then
|
# if [[ "${VERSION_CODENAME:-}" == "trixie" ]]; then
|
||||||
cat >/etc/apt/sources.list.d/non-free.sources <<EOF
|
# cat >/etc/apt/sources.list.d/non-free.sources <<EOF
|
||||||
Types: deb deb-src
|
# Types: deb deb-src
|
||||||
URIs: http://deb.debian.org/debian
|
# URIs: http://deb.debian.org/debian
|
||||||
Suites: trixie trixie-updates trixie-security
|
# Suites: trixie trixie-updates trixie-security
|
||||||
Components: non-free non-free-firmware
|
# Components: non-free non-free-firmware
|
||||||
EOF
|
# EOF
|
||||||
fi
|
# fi
|
||||||
apt-get update >/dev/null 2>&1
|
# apt-get update >/dev/null 2>&1
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
# DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
intel-media-va-driver-non-free \
|
# intel-media-va-driver-non-free \
|
||||||
mesa-va-drivers \
|
# mesa-va-drivers \
|
||||||
libvpl2 \
|
# libvpl2 \
|
||||||
vainfo \
|
# vainfo \
|
||||||
ocl-icd-libopencl1 \
|
# ocl-icd-libopencl1 \
|
||||||
mesa-opencl-icd \
|
# mesa-opencl-icd \
|
||||||
intel-gpu-tools >/dev/null 2>&1
|
# intel-gpu-tools >/dev/null 2>&1
|
||||||
' && msg_ok "VAAPI userland installed" || msg_warn "Some VAAPI packages failed to install"
|
# ' && msg_ok "VAAPI userland installed" || msg_warn "Some VAAPI packages failed to install"
|
||||||
;;
|
# ;;
|
||||||
NVIDIA)
|
# NVIDIA)
|
||||||
msg_info "Installing NVIDIA userland packages"
|
# msg_info "Installing NVIDIA userland packages"
|
||||||
pct exec "$CTID" -- bash -c '
|
# pct exec "$CTID" -- bash -c '
|
||||||
apt-get update >/dev/null 2>&1
|
# apt-get update >/dev/null 2>&1
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
# DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
nvidia-driver \
|
# nvidia-driver \
|
||||||
nvidia-utils \
|
# nvidia-utils \
|
||||||
libnvidia-encode1 \
|
# libnvidia-encode1 \
|
||||||
libcuda1 >/dev/null 2>&1
|
# libcuda1 >/dev/null 2>&1
|
||||||
' && msg_ok "NVIDIA userland installed" || msg_warn "Some NVIDIA packages failed to install"
|
# ' && msg_ok "NVIDIA userland installed" || msg_warn "Some NVIDIA packages failed to install"
|
||||||
;;
|
# ;;
|
||||||
esac
|
# esac
|
||||||
fi
|
# fi
|
||||||
}
|
# }
|
||||||
|
|
||||||
# Customize container
|
# Customize container
|
||||||
msg_info "Customizing LXC Container"
|
msg_info "Customizing LXC Container"
|
||||||
|
|
||||||
# Install GPU userland if configured
|
# # Install GPU userland if configured
|
||||||
if [[ "${ENABLE_VAAPI:-0}" == "1" ]]; then
|
# if [[ "${ENABLE_VAAPI:-0}" == "1" ]]; then
|
||||||
install_gpu_userland "VAAPI"
|
# install_gpu_userland "VAAPI"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if [[ "${ENABLE_NVIDIA:-0}" == "1" ]]; then
|
# if [[ "${ENABLE_NVIDIA:-0}" == "1" ]]; then
|
||||||
install_gpu_userland "NVIDIA"
|
# install_gpu_userland "NVIDIA"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Continue with standard container setup
|
# Continue with standard container setup
|
||||||
if [ "$var_os" == "alpine" ]; then
|
if [ "$var_os" == "alpine" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user