Update install_coral_lxc.sh

This commit is contained in:
MacRimi 2025-01-31 20:20:54 +01:00 committed by GitHub
parent f018313eb7
commit c2325242b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,6 +75,7 @@ select_container() {
} }
# Validate that the selected container is valid
validate_container_id() { validate_container_id() {
if [ -z "$CONTAINER_ID" ]; then if [ -z "$CONTAINER_ID" ]; then
msg_error "$(translate 'Container ID not defined. Make sure to select a container first.')" msg_error "$(translate 'Container ID not defined. Make sure to select a container first.')"
@ -87,10 +88,6 @@ validate_container_id() {
pct stop "$CONTAINER_ID" pct stop "$CONTAINER_ID"
msg_ok "$(translate 'Container stopped.')" msg_ok "$(translate 'Container stopped.')"
fi fi
if [ -z "$CONTAINER_ID" ]; then
msg_error "$(translate 'Container ID not defined. Make sure to select a container first.')"
exit 1
fi
} }
@ -116,19 +113,6 @@ configure_lxc_hardware() {
msg_ok "$(translate 'The container is already privileged.')" msg_ok "$(translate 'The container is already privileged.')"
fi fi
# Configure Coral TPU (USB and M.2)
if ! grep -Pq "^lxc.cgroup2.devices.allow: c 189:\* rwm # Coral USB$" "$CONFIG_FILE"; then
echo "lxc.cgroup2.devices.allow: c 189:* rwm # Coral USB" >> "$CONFIG_FILE"
fi
if ! grep -Pq "^lxc.mount.entry: /dev/bus/usb dev/bus/usb none bind,optional,create=dir$" "$CONFIG_FILE"; then
echo "lxc.mount.entry: /dev/bus/usb dev/bus/usb none bind,optional,create=dir" >> "$CONFIG_FILE"
fi
if ! grep -Pq "^lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file$" "$CONFIG_FILE"; then
echo "lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file" >> "$CONFIG_FILE"
fi
# Configure iGPU # Configure iGPU
if ! grep -q "features: nesting=1" "$CONFIG_FILE"; then if ! grep -q "features: nesting=1" "$CONFIG_FILE"; then
echo "features: nesting=1" >> "$CONFIG_FILE" echo "features: nesting=1" >> "$CONFIG_FILE"
@ -149,6 +133,19 @@ configure_lxc_hardware() {
echo "lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file" >> "$CONFIG_FILE" echo "lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file" >> "$CONFIG_FILE"
fi fi
# Configure Coral TPU (USB and M.2)
if ! grep -Pq "^lxc.cgroup2.devices.allow: c 189:\* rwm # Coral USB$" "$CONFIG_FILE"; then
echo "lxc.cgroup2.devices.allow: c 189:* rwm # Coral USB" >> "$CONFIG_FILE"
fi
if ! grep -Pq "^lxc.mount.entry: /dev/bus/usb dev/bus/usb none bind,optional,create=dir$" "$CONFIG_FILE"; then
echo "lxc.mount.entry: /dev/bus/usb dev/bus/usb none bind,optional,create=dir" >> "$CONFIG_FILE"
fi
if ! grep -Pq "^lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file$" "$CONFIG_FILE"; then
echo "lxc.mount.entry: /dev/apex_0 dev/apex_0 none bind,optional,create=file" >> "$CONFIG_FILE"
fi
msg_ok "$(translate 'Coral TPU and iGPU configuration added to container') $CONTAINER_ID." msg_ok "$(translate 'Coral TPU and iGPU configuration added to container') $CONTAINER_ID."
} }