From cc7a4602bbf2d9d8189ead0bbcd977d522c11e12 Mon Sep 17 00:00:00 2001 From: hschang Date: Thu, 22 Feb 2018 14:19:57 +0900 Subject: [PATCH] [udev] fix automount. --- .../recipes-core/udev/udev-182/automount.py | 25 ++++++++++++++++++++-- .../udev/udev-182/vuzero4k/automount.py | 25 ++++++++++++++++++++-- .../recipes-core/udev/udev_182.bbappend | 2 +- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/meta-openvuplus/recipes-core/udev/udev-182/automount.py b/meta-openvuplus/recipes-core/udev/udev-182/automount.py index 05848d2..69f5a68 100755 --- a/meta-openvuplus/recipes-core/udev/udev-182/automount.py +++ b/meta-openvuplus/recipes-core/udev/udev-182/automount.py @@ -39,12 +39,25 @@ def isMountedByDevName(devName): return ismounted def isUsbDevice(dev_base): - phyPath = os.path.realpath('/sys/block/' + dev_base) + phyPath = os.path.realpath('/sys/block/' + dev_base + '/device') for x in glob.glob("/sys/bus/usb/devices/usb*"): if phyPath.find(os.path.realpath(x)) != -1: return True return False +def checkFilesystem(device): + p = os.popen("blkid %s" % device) + data = p.read() + p.close() + + fs = None + for x in data.split(): + if x.startswith('TYPE') and x.find('=') != -1: + fs = x.split('=')[1].strip('"') + break + + return fs + def automount(): kernel = sys.argv[1] dev_kernel = os.path.join("/dev/", kernel) @@ -84,7 +97,15 @@ def automount(): if not os.access(mountPoint, os.F_OK): return - if os.system("mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint)): + fs = checkFilesystem(dev_kernel) + if fs == "ntfs": + cmd = "mount.ntfs-3g %s %s" % (dev_kernel, mountPoint) + else: + cmd = "mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint) + + ret = os.system(cmd) + + if ret: os.rmdir(mountPoint) else: if mountPoint == "/media/hdd": diff --git a/meta-openvuplus/recipes-core/udev/udev-182/vuzero4k/automount.py b/meta-openvuplus/recipes-core/udev/udev-182/vuzero4k/automount.py index c70d38e..ed34b2a 100755 --- a/meta-openvuplus/recipes-core/udev/udev-182/vuzero4k/automount.py +++ b/meta-openvuplus/recipes-core/udev/udev-182/vuzero4k/automount.py @@ -39,12 +39,25 @@ def isMountedByDevName(devName): return ismounted def isUsbDevice(dev_base): - phyPath = os.path.realpath('/sys/block/' + dev_base) + phyPath = os.path.realpath('/sys/block/' + dev_base + '/device') for x in glob.glob("/sys/bus/usb/devices/usb*"): if phyPath.find(os.path.realpath(x)) != -1: return True return False +def checkFilesystem(device): + p = os.popen("blkid %s" % device) + data = p.read() + p.close() + + fs = None + for x in data.split(): + if x.startswith('TYPE') and x.find('=') != -1: + fs = x.split('=')[1].strip('"') + break + + return fs + def automount(): kernel = sys.argv[1] dev_kernel = os.path.join("/dev/", kernel) @@ -83,7 +96,15 @@ def automount(): if not os.access(mountPoint, os.F_OK): return - if os.system("mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint)): + fs = checkFilesystem(dev_kernel) + if fs == "ntfs": + cmd = "mount.ntfs-3g %s %s" % (dev_kernel, mountPoint) + else: + cmd = "mount -t auto -o noatime %s %s" % (dev_kernel, mountPoint) + + ret = os.system(cmd) + + if ret: os.rmdir(mountPoint) else: if mountPoint == "/media/hdd": diff --git a/meta-openvuplus/recipes-core/udev/udev_182.bbappend b/meta-openvuplus/recipes-core/udev/udev_182.bbappend index a5599d6..06620a1 100644 --- a/meta-openvuplus/recipes-core/udev/udev_182.bbappend +++ b/meta-openvuplus/recipes-core/udev/udev_182.bbappend @@ -1,4 +1,4 @@ -PR .= "-vuplus6" +PR .= "-vuplus7" SRC_URI += " \ file://99_vuplus.rules \ -- 2.7.4