File 0006-Better-check-for-already-existing-etc-overlay.patch of Package read-only-root-fs.23306

From 870c0f1f906e820b6582781bdf8a529f23f42ec3 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Thu, 30 Jul 2020 16:17:55 +0200
Subject: [PATCH 6/7] Better check for already existing /etc overlay

The call to grep assumed that it's a single space, but transactional-update
reformats the fstab so it no longer matches. If setup-fstab-for-overlayfs
was called in an already set up system with a reformatted fstab, it would run
twice and duplicate its work.

Fixes boo#1174733.
---
 usr/sbin/setup-fstab-for-overlayfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/sbin/setup-fstab-for-overlayfs b/usr/sbin/setup-fstab-for-overlayfs
index 4cf1e51..9b81bdc 100755
--- a/usr/sbin/setup-fstab-for-overlayfs
+++ b/usr/sbin/setup-fstab-for-overlayfs
@@ -6,7 +6,7 @@
 #
 
 # Already there?
-if [ -e /etc/fstab ] && grep -qE "overlay /etc" /etc/fstab; then
+if [ -e /etc/fstab ] && grep -qE '^overlay[[:space:]]+/etc[[:space:]]' /etc/fstab; then
 	exit 0 # Do nothing
 fi
 
-- 
2.35.1

openSUSE Build Service is sponsored by