From 7d5610d21d97a292d3fa8868bbe57e8acda140cd Mon Sep 17 00:00:00 2001 From: grabowski Date: Mon, 27 Oct 2025 15:19:07 +0700 Subject: [PATCH] Fix UUID extraction to handle commented fstab lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified grep logic to extract UUIDs even if the fstab lines are already commented out from a previous run. Uses sed to strip comment prefixes before extracting UUIDs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- setup_usb_final.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup_usb_final.sh b/setup_usb_final.sh index 5cfd988..9647592 100644 --- a/setup_usb_final.sh +++ b/setup_usb_final.sh @@ -50,10 +50,10 @@ umount /media/usb1 2>/dev/null || true echo -e "${GREEN}✓ Unmounted drives${NC}" echo "" -# Step 3: Extract UUIDs from fstab +# Step 3: Extract UUIDs from fstab (including commented lines) echo "Step 3: Reading UUIDs from /etc/fstab..." -USB0_UUID=$(grep "usb0" /etc/fstab 2>/dev/null | grep -v "^#" | grep -oP 'UUID=\K[^\s]+' || echo "") -USB1_UUID=$(grep "usb1" /etc/fstab 2>/dev/null | grep -v "^#" | grep -oP 'UUID=\K[^\s]+' || echo "") +USB0_UUID=$(grep "usb0" /etc/fstab 2>/dev/null | sed 's/^#[^ ]* //' | grep -oP 'UUID=\K[^\s]+' || echo "") +USB1_UUID=$(grep "usb1" /etc/fstab 2>/dev/null | sed 's/^#[^ ]* //' | grep -oP 'UUID=\K[^\s]+' || echo "") if [ -z "$USB0_UUID" ] && [ -z "$USB1_UUID" ]; then echo -e "${YELLOW}⚠ No UUIDs found in fstab${NC}"