diff options
author | hschang <chang@dev3> | 2018-02-22 05:19:57 (GMT) |
---|---|---|
committer | hschang <chang@dev3> | 2018-02-22 05:19:57 (GMT) |
commit | cc7a4602bbf2d9d8189ead0bbcd977d522c11e12 (patch) | |
tree | 06fef95d957293e3b56cbc8ac06732645a15f258 /meta-openvuplus | |
parent | 9f696207c04309401e7fc3757d438f901d354035 (diff) |
[udev] fix automount.
Diffstat (limited to 'meta-openvuplus')
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 \ |