This commit is contained in:
Ryan Hughes
2025-10-13 01:06:56 -04:00
parent 9783b4b782
commit c6627f0e67

View File

@@ -4,17 +4,12 @@ MACBOOK_MODEL=$(cat /sys/class/dmi/id/product_name 2>/dev/null || true)
if [[ "$MACBOOK_MODEL" =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then if [[ "$MACBOOK_MODEL" =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
echo "Detected MacBook model: $MACBOOK_MODEL" echo "Detected MacBook model: $MACBOOK_MODEL"
echo "Applying NVMe suspend fix..."
# Check if the NVMe device exists at the expected PCI address
NVME_DEVICE="/sys/bus/pci/devices/0000:01:00.0/d3cold_allowed" NVME_DEVICE="/sys/bus/pci/devices/0000:01:00.0/d3cold_allowed"
if [[ -f "$NVME_DEVICE" ]]; then if [[ -f "$NVME_DEVICE" ]]; then
# Apply the fix immediately to prevent d3cold power state issues echo "Applying NVMe suspend fix..."
echo 0 | sudo tee "$NVME_DEVICE" >/dev/null || true
# Create systemd service to ensure fix persists across reboots
# The service runs after multi-user.target to ensure the device is available
cat <<EOF | sudo tee /etc/systemd/system/omarchy-nvme-suspend-fix.service >/dev/null cat <<EOF | sudo tee /etc/systemd/system/omarchy-nvme-suspend-fix.service >/dev/null
[Unit] [Unit]
Description=Omarchy NVMe Suspend Fix for MacBook Description=Omarchy NVMe Suspend Fix for MacBook
@@ -26,11 +21,8 @@ ExecStart=/bin/bash -c 'echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allo
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
# Enable the service to run on boot
sudo systemctl enable omarchy-nvme-suspend-fix.service sudo systemctl enable omarchy-nvme-suspend-fix.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
echo "NVMe suspend fix applied and systemd service enabled"
else else
echo "Warning: NVMe device not found at expected PCI address (0000:01:00.0)" echo "Warning: NVMe device not found at expected PCI address (0000:01:00.0)"
echo "This fix may not be needed for this MacBook model" echo "This fix may not be needed for this MacBook model"