Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinipsmaker/8795487 to your computer and use it in GitHub Desktop.
Save vinipsmaker/8795487 to your computer and use it in GitHub Desktop.
From ca22c8a63ea80f36044fdf76888041404e0a1974 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vin=C3=ADcius=20dos=20Santos=20Oliveira?=
<vini.ipsmaker@gmail.com>
Date: Mon, 3 Feb 2014 21:30:21 -0300
Subject: [PATCH] Fix mount options for vfat filesystems on automounting
Hot-plug device monitoring is done by udev. On OpenPandora, the file
/etc/udev/rules.d/local.rules guide udev to call the script
/etc/udev/scripts/mount.sh to handle aumounting. This is the script
changed in this commit.
The change makes the use of blkid (already used by the script) to
probe the device type prior to mounting. If a device type of vfat is
detected, then the utf8 argument is append to the list of mount
options. This option is important to provide proper Unicode support
for filenames. More about this argument can be found at the
following link:
https://www.kernel.org/doc/Documentation/filesystems/vfat.txt
The several tests were done using a real OpenPandora hardware.
---
recipes/udev/udev-151/omap3-pandora/mount.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/recipes/udev/udev-151/omap3-pandora/mount.sh b/recipes/udev/udev-151/omap3-pandora/mount.sh
index ad10a3e..f93ac1c 100755
--- a/recipes/udev/udev-151/omap3-pandora/mount.sh
+++ b/recipes/udev/udev-151/omap3-pandora/mount.sh
@@ -23,6 +23,12 @@ do
fi
done
+requiresutf8arg() {
+ fstype="`$blkid -p -s TYPE -o value "$1"`"
+ [ "$fstype" = vfat ]
+ return
+}
+
automount() {
if [ -n "$name2" ]
then
@@ -36,7 +42,13 @@ automount() {
! test -d "/media/$name" && mkdir -p "/media/$name"
- if ! $MOUNT -t auto -o dirsync,noatime,umask=0 $DEVNAME "/media/$name" && ! $MOUNT -t auto -o dirsync,noatime $DEVNAME "/media/$name"
+ extramountoptions=
+
+ if requiresutf8arg "$DEVNAME"; then
+ extramountoptions="$extramountoptions,utf8"
+ fi
+
+ if ! $MOUNT -t auto -o "dirsync,noatime,umask=0$extramountoptions" $DEVNAME "/media/$name" && ! $MOUNT -t auto -o "dirsync,noatime$extramountoptions" $DEVNAME "/media/$name"
then
#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
rm_dir "/media/$name"
--
1.8.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment