dcavalca / rpms / initscripts

Forked from rpms/initscripts 4 years ago
Clone
Blob Blame History Raw
From bdfa5a5d4e959937fe9f525d8ce39cec410dbe08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Wed, 16 Apr 2014 13:47:53 +0200
Subject: [PATCH] fedora-readonly: fix prefix detection (#1059749)

---
 systemd/rhel-readonly | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/systemd/rhel-readonly b/systemd/rhel-readonly
index 190de26..f33eef4 100755
--- a/systemd/rhel-readonly
+++ b/systemd/rhel-readonly
@@ -42,7 +42,8 @@ MOUNTS=()
 if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
 
         add_mount() {
-                MOUNTS=("${MOUNTS[@]}" "$1")
+                mnt=${1%/}
+                MOUNTS=("${MOUNTS[@]}" "$mnt")
         }
 
         cp_empty() {
@@ -109,7 +110,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
                 prefix=0
                 for mount_point in "${MOUNTS[@]}"; do
                         [[ $m = $mount_point ]] && continue
-                        if [[ $m =~ ^$mount_point.* ]] ; then
+                        if [[ $m =~ ^$mount_point/.* ]] ; then
                                 prefix=1
                                 break
                         fi
-- 
1.8.3.1