Skip to content

Commit d10a2bb

Browse files
committed
Detect and mount exfat filesystem
Tested with the following openbsd packages installed: - sysutils/exfat-fuse-1.2.8 - sysutils/e2fsprogs-1.46.2p0
1 parent ac56228 commit d10a2bb

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

toad.pl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,26 @@ sub mount_device {
330330
create_mount_point ($devnum);
331331
create_pkrule ($devname, $devnum, $part);
332332

333-
if (($part[1] eq 'ntfs') && (-x '/usr/local/bin/ntfs-3g')) {
333+
# DISCUSS: should we inform user about missing
334+
# mounting tools (i.e. blkid, ntfs-3g, mount.exfat-fuse)
335+
336+
# check if NTFS is actually exFAT
337+
if ($part[1] eq 'ntfs' && -x '/usr/local/sbin/blkid') {
338+
if (System ("/usr/local/sbin/blkid $device | grep -q 'TYPE=\"exfat\"'") == 0) {
339+
$part[1] = 'exfat';
340+
}
341+
}
342+
343+
if ($part[1] eq 'ntfs' && '/usr/local/bin/ntfs-3g') {
334344
$mount_cmd = "/usr/local/bin/ntfs-3g";
335345
$mountopts = "$mountopts,uid=$uid,gid=$gid,umask=077";
336346
}
337347

348+
if ($part[1] eq 'exfat' && -x '/usr/local/sbin/mount.exfat-fuse') {
349+
$mount_cmd = "/usr/local/sbin/mount.exfat-fuse";
350+
$mountopts = "uid=$uid,gid=$gid,umask=077,noatime";
351+
}
352+
338353
my $trymount = `$mount_cmd -o $mountopts $device $mountbase/$login/$devtype$devnum 2>&1`;
339354
if (length ($trymount) != 0) {
340355
system ("$trymount -o $mountopts,ro $device $mountbase/$login/$devtype$devnum");

0 commit comments

Comments
 (0)