#!/bin/sh

args=${@}
volname=${args##*/}
cleaned_volname=${volname//,/_}

@@PREFIX@@/sbin/ntfs-3g -o auto_xattr,local,volname="$cleaned_volname" "$@"

# wait at most 15 seconds for the mount to happen
# this prevents the system to use the mount point before the volume is mounted

# get the mount point (last argument)
for mount_point; do true; done

count=0;
while [ -z "$(mount | grep "$mount_point")" ] && [ "$count" -le "15" ]; do count=$(($count+1)); sleep 1; done
