[PC-BSD Commits] r2911 - in pcbsd: branches/7.0/system-overlay/sbin trunk/system-overlay/sbin
svn at pcbsd.org
svn at pcbsd.org
Wed Oct 15 17:59:49 PDT 2008
Author: kris
Date: 2008-10-15 17:59:48 -0700 (Wed, 15 Oct 2008)
New Revision: 2911
Modified:
pcbsd/branches/7.0/system-overlay/sbin/mount_ntfs
pcbsd/trunk/system-overlay/sbin/mount_ntfs
Log:
Updated the mount_ntfs wrapper to fix a bug mounting when a -u flag is used, and also fix an issue where /media/.hal-mtab doesn't get preserved.
Modified: pcbsd/branches/7.0/system-overlay/sbin/mount_ntfs
===================================================================
--- pcbsd/branches/7.0/system-overlay/sbin/mount_ntfs 2008-10-15 20:28:29 UTC (rev 2910)
+++ pcbsd/branches/7.0/system-overlay/sbin/mount_ntfs 2008-10-16 00:59:48 UTC (rev 2911)
@@ -7,6 +7,7 @@
MNTSTRING=""
OPTIONS=""
FOUNDOPT="0"
+FOUNDU="0"
HWDEV=""
FOUNDDEV="0"
@@ -15,6 +16,9 @@
if [ "$FOUNDOPT" = "1" ]
then
OPTIONS="${OPTIONS} -o ${i}"
+ elif [ "${FOUNDU}" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o uid=${i}"
else
if [ "${FOUNDDEV}" = "1" ]
@@ -62,19 +66,28 @@
fi
# Add the value to our mount string
- if [ "$i" != "-o" ]
+ if [ "$i" != "-o" -a ${i} != "-u" ]
then
MNTSTRING="${MNTSTRING} ${i}"
fi
fi
+ # Check if we have been given a -o flag
if [ "${i}" = "-o" ]
then
FOUNDOPT="1"
else
FOUNDOPT="0"
fi
+
+ # Check if we have been given a -u flag
+ if [ "${i}" = "-u" ]
+ then
+ FOUNDU="1"
+ else
+ FOUNDU="0"
+ fi
done
# Save our final string which ntfs-3g will use
@@ -89,7 +102,7 @@
fi
# Run the ntfs-3g command now, with the options in the right order
-ntfs-3g ${FINALSTRING}
+ntfs-3g ${FINALSTRING}
# If we have an OLDFUSE variable, lets clear it from the list
if [ ! -z "${OLDFUSE}" ]
@@ -110,15 +123,15 @@
# Make sure to set /media/.hal-mtab with the new device so we can umount
echo '#!/bin/sh
-rm /media/.hal-mtab-lock
if [ -e "/media/.hal-mtab~" ]
then
cp "/media/.hal-mtab~" /tmp/orig-hal
else
cp /media/.hal-mtab /tmp/orig-hal
fi
+rm /media/.hal-mtab-lock
ID=`cat /tmp/orig-hal | tr "\t" " " | tr -s " " | grep "${1} " | cut -d " " -f 2`
-cat /orig-hal | grep -v "${1}" > /tmp/.hal-mtab
+cat /tmp/orig-hal | grep -v "${1}" > /tmp/.hal-mtab
echo "${2} ${ID} 0 ntfs nosuid ${3}" >> /tmp/.hal-mtab
cp /tmp/.hal-mtab /media/.hal-mtab
cp /tmp/.hal-mtab "/media/.hal-mtab~"
Modified: pcbsd/trunk/system-overlay/sbin/mount_ntfs
===================================================================
--- pcbsd/trunk/system-overlay/sbin/mount_ntfs 2008-10-15 20:28:29 UTC (rev 2910)
+++ pcbsd/trunk/system-overlay/sbin/mount_ntfs 2008-10-16 00:59:48 UTC (rev 2911)
@@ -7,6 +7,7 @@
MNTSTRING=""
OPTIONS=""
FOUNDOPT="0"
+FOUNDU="0"
HWDEV=""
FOUNDDEV="0"
@@ -15,6 +16,9 @@
if [ "$FOUNDOPT" = "1" ]
then
OPTIONS="${OPTIONS} -o ${i}"
+ elif [ "${FOUNDU}" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o uid=${i}"
else
if [ "${FOUNDDEV}" = "1" ]
@@ -62,19 +66,28 @@
fi
# Add the value to our mount string
- if [ "$i" != "-o" ]
+ if [ "$i" != "-o" -a ${i} != "-u" ]
then
MNTSTRING="${MNTSTRING} ${i}"
fi
fi
+ # Check if we have been given a -o flag
if [ "${i}" = "-o" ]
then
FOUNDOPT="1"
else
FOUNDOPT="0"
fi
+
+ # Check if we have been given a -u flag
+ if [ "${i}" = "-u" ]
+ then
+ FOUNDU="1"
+ else
+ FOUNDU="0"
+ fi
done
# Save our final string which ntfs-3g will use
@@ -89,7 +102,7 @@
fi
# Run the ntfs-3g command now, with the options in the right order
-ntfs-3g ${FINALSTRING}
+ntfs-3g ${FINALSTRING}
# If we have an OLDFUSE variable, lets clear it from the list
if [ ! -z "${OLDFUSE}" ]
@@ -110,15 +123,15 @@
# Make sure to set /media/.hal-mtab with the new device so we can umount
echo '#!/bin/sh
-rm /media/.hal-mtab-lock
if [ -e "/media/.hal-mtab~" ]
then
cp "/media/.hal-mtab~" /tmp/orig-hal
else
cp /media/.hal-mtab /tmp/orig-hal
fi
+rm /media/.hal-mtab-lock
ID=`cat /tmp/orig-hal | tr "\t" " " | tr -s " " | grep "${1} " | cut -d " " -f 2`
-cat /orig-hal | grep -v "${1}" > /tmp/.hal-mtab
+cat /tmp/orig-hal | grep -v "${1}" > /tmp/.hal-mtab
echo "${2} ${ID} 0 ntfs nosuid ${3}" >> /tmp/.hal-mtab
cp /tmp/.hal-mtab /media/.hal-mtab
cp /tmp/.hal-mtab "/media/.hal-mtab~"
More information about the Commits
mailing list