From 886f1d4c109c3c5779b24bc106595674e03163fc Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 9 Sep 2020 15:10:57 -0500 Subject: Fix umountfs /media/card link and mounting flash with errors --- recipes-core/udev/udev-extraconf/mount.patch | 69 +++++++++++++++++++++++++--- recipes-core/udev/udev-extraconf_%.bbappend | 2 +- 2 files changed, 63 insertions(+), 8 deletions(-) (limited to 'recipes-core') diff --git a/recipes-core/udev/udev-extraconf/mount.patch b/recipes-core/udev/udev-extraconf/mount.patch index 1b475f3..4ed3bfd 100644 --- a/recipes-core/udev/udev-extraconf/mount.patch +++ b/recipes-core/udev/udev-extraconf/mount.patch @@ -19,10 +19,27 @@ diff -Naru orig/mount.blacklist new/mount.blacklist +[PARTLABEL=config2] +[PARTLABEL=user_data] diff -Naru orig/mount.sh new/mount.sh ---- orig/mount.sh 2019-10-24 17:09:11.344795931 -0500 -+++ new/mount.sh 2019-10-24 18:11:38.612684994 -0500 -@@ -25,9 +25,32 @@ +--- orig/mount.sh 2020-09-09 13:57:23.196157483 -0500 ++++ new/mount.sh 2020-09-09 14:59:40.344046845 -0500 +@@ -4,8 +4,8 @@ + # + # Attempt to mount any added block devices and umount any removed devices + +-BASE_INIT="`readlink -f "@base_sbindir@/init"`" +-INIT_SYSTEMD="@systemd_unitdir@/systemd" ++BASE_INIT="`readlink -f "/sbin/init"`" ++INIT_SYSTEMD="/lib/systemd/systemd" + + if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then + # systemd as init uses systemd-mount to mount block devices +@@ -23,11 +23,38 @@ + MOUNT="/bin/mount" + UMOUNT="/bin/umount" fi ++LSBLK=$(type -p lsblk) ++if ((${#LSBLK} == 0)) ; then ++ LSBLK=true ++fi PMOUNT="/usr/bin/pmount" - @@ -31,7 +48,7 @@ diff -Naru orig/mount.sh new/mount.sh do + if [[ $line =~ ^\[([^=]*)=([^\]]*)\] ]] ; then + fsspectype=${BASH_REMATCH[1]} -+ tmp="$(lsblk -o $fsspectype $DEVNAME | sed -e '1d')" ++ tmp="$(${LSBLK} -o $fsspectype $DEVNAME | sed -e '1d')" + case $fsspectype in + PARTLABEL) + if [[ ${BASH_REMATCH[2]} == $tmp ]] ; then @@ -56,18 +73,35 @@ diff -Naru orig/mount.sh new/mount.sh if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ]; then logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" -@@ -49,6 +72,10 @@ +@@ -41,7 +68,7 @@ + # 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')" ++ tmp="$($LSBLK -o $n $DEVNAME | sed -e '1d')" + test -z "$tmp" && continue + tmp="$n=$tmp" + grep "^[[:space:]]*$tmp" /etc/fstab && return +@@ -49,13 +76,17 @@ [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name" + if [ "$name" = mmcblk0p1 ] ; then + ln -sf /run/media/$name /run/media/card + fi -+ ++ MOUNT="$MOUNT -o silent" # If filesystemtype is vfat, change the ownership group to 'disk', and -@@ -78,7 +105,11 @@ + # grant it with w/r/x permissions. + case $ID_FS_TYPE in + vfat|fat) +- MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`" ++ MOUNT="$MOUNT -o errors=continue -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`" + ;; + # TODO + *) +@@ -78,7 +109,11 @@ if [ -x "$PMOUNT" ]; then $PMOUNT $DEVNAME 2> /dev/null elif [ -x $MOUNT ]; then @@ -79,3 +113,24 @@ diff -Naru orig/mount.sh new/mount.sh fi # If the device isn't mounted at this point, it isn't +@@ -86,6 +121,11 @@ + grep -q "^$DEVNAME " /proc/mounts && return + + ! test -d "/run/media/$name" && mkdir -p "/run/media/$name" ++ ++ if [ "$name" = mmcblk0p1 ] ; then ++ ln -sf /run/media/$name /run/media/card ++ fi ++ + # Silent util-linux's version of mounting auto + if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; + then +@@ -96,7 +136,7 @@ + # grant it with w/r/x permissions. + case $ID_FS_TYPE in + vfat|fat) +- MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`" ++ MOUNT="$MOUNT -o errors=continue -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`" + ;; + # TODO + *) diff --git a/recipes-core/udev/udev-extraconf_%.bbappend b/recipes-core/udev/udev-extraconf_%.bbappend index 708a07c..3a39025 100644 --- a/recipes-core/udev/udev-extraconf_%.bbappend +++ b/recipes-core/udev/udev-extraconf_%.bbappend @@ -1,5 +1,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -PR = "m1" +PR = "m2" SRC_URI += "file://mount.patch" -- cgit v1.2.3