Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Kevin Hao <kexin.hao@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 3/3] udev-extraconf: Skip the entry in /etc/fstab when using the systemd-mount
Date: Mon, 22 Oct 2018 19:58:40 +0800	[thread overview]
Message-ID: <20181022115840.38029-4-kexin.hao@windriver.com> (raw)
In-Reply-To: <20181022115840.38029-1-kexin.hao@windriver.com>

When using systemd, the systemd-fstab-generator would parse the
/etc/fstab and create the corresponding unit dynamically. So we don't
need to handle the ADD action for the partitions in /etc/fstab.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index afb368dd6737..3ee67b13183a 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -38,6 +38,15 @@ done
 automount_systemd() {
     name="`basename "$DEVNAME"`"
 
+    # Skip the partition which are already in /etc/fstab
+    grep "^[[:space:]]*$DEVNAME" /etc/fstab && return
+    for n in LABEL PARTLABEL UUID PARTUUID; do
+        tmp="$(lsblk -o $n $DEVNAME | sed -e '1d')"
+        test -z "$tmp" && continue
+        tmp="$n=$tmp"
+        grep "^[[:space:]]*$tmp" /etc/fstab && return
+    done
+
     [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
 
     MOUNT="$MOUNT -o silent"
-- 
2.14.4



      parent reply	other threads:[~2018-10-22 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 11:58 [PATCH 0/3] udev-extraconf: Fix the automount malfunction when the systemd is used Kevin Hao
2018-10-22 11:58 ` [PATCH 1/3] udev-extraconf: Use the canonical file name of systemd Kevin Hao
2018-10-22 11:58 ` [PATCH 2/3] udev-extraconf: Fix the recursively dependency for the systemd-mount Kevin Hao
2018-10-22 11:58 ` Kevin Hao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181022115840.38029-4-kexin.hao@windriver.com \
    --to=kexin.hao@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox