Update configure_igpu_lxc.sh

This commit is contained in:
MacRimi 2025-08-16 17:34:34 +02:00 committed by GitHub
parent bda7834a4f
commit 2132ae79a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,8 +76,8 @@ validate_container_id() {
# Configure LXC for Coral TPU and iGPU # Configure LXC for iGPU
configure_lxc_for_igpu() { configure_lxc_for_igpu_() {
validate_container_id validate_container_id
CONFIG_FILE="/etc/pve/lxc/${CONTAINER_ID}.conf" CONFIG_FILE="/etc/pve/lxc/${CONTAINER_ID}.conf"
if [ ! -f "$CONFIG_FILE" ]; then if [ ! -f "$CONFIG_FILE" ]; then
@ -131,6 +131,32 @@ configure_lxc_for_igpu() {
configure_lxc_for_igpu() {
validate_container_id
CONFIG_FILE="/etc/pve/lxc/${CONTAINER_ID}.conf"
[[ -f "$CONFIG_FILE" ]] || { msg_error "$(translate 'Configuration file not found.')"; exit 1; }
if ! grep -q "^unprivileged:" "$CONFIG_FILE"; then
echo "unprivileged: 1" >> "$CONFIG_FILE"
fi
grep -q "^features: " "$CONFIG_FILE" || echo "features: nesting=1" >> "$CONFIG_FILE"
grep -q "^lxc.cgroup2.devices.allow: c 226:\* rwm" "$CONFIG_FILE" || \
echo "lxc.cgroup2.devices.allow: c 226:* rwm" >> "$CONFIG_FILE"
grep -q "^lxc.mount.entry: /dev/dri " "$CONFIG_FILE" || \
echo "lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir" >> "$CONFIG_FILE"
msg_ok "$(translate 'iGPU configuration added to container') $CONTAINER_ID."
}
# Install iGPU drivers in the container # Install iGPU drivers in the container
install_igpu_in_container() { install_igpu_in_container() {