[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCHES] live-initramfs: fix for root directory permissions and grep line possbly returning more than one line



Hello,

pls find attached a couple of diffs, fixing relaxed permissions of /
in the live filesystem and possible invalid results from
function where_is_mounted.

Best regards

Luigi Capriotti


diff --git a/scripts/live b/scripts/live
index 683afa2..a966070 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1286,6 +1312,9 @@ setup_unionfs ()
                        ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
        fi

+       # Correct the permissions of /:
+       chmod 755 "${rootmnt}"
+
        # tmpfs file systems
        touch /etc/fstab
        mkdir -p "${rootmnt}/live"
diff --git a/scripts/live-helpers b/scripts/live-helpers
index 79b158c..1d808bd 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -104,7 +104,7 @@ where_is_mounted ()
        if grep -q "^${device} " /proc/mounts
        then
                # return the first found
-               grep "^${device} " /proc/mounts | cut -f2 -d ' '
+               grep -m 1 "^${device} " /proc/mounts | cut -f2 -d ' '
        fi
 }



Reply to: