I think this is a good idea. Below are some patches that implement this. With these patches, any file system that has a label will have its mount point created at /mnt/labelname, and any filesystems that don't have a label will behave like they normally do. If your label has spaces in it, the spaces will be changed to underscores for the mount directory.
Brian
Patch for /usr/sbin/rebuildfstab:
--- rebuildfstab_orig
+++ rebuildfstab_updated
@@ -63,8 +63,15 @@
ext2|ext3) OPTIONS="${OPTIONS},relatime" ;;
swap) OPTIONS="defaults"; MOUNTPOINT="none" ;;
esac
+
+ LABEL="$(blkid $DEVROOT/$DEVNAME -o udev 2>/dev/null | grep ID_FS_LABEL= | cut -f2 -d= )"
+
+ if [ -n "$LABEL" ]; then
+ MOUNTPOINT="/mnt/$LABEL"
+ fi
+
if [ "$MOUNTPOINT" != "none" ]; then
- mkdir -p "/mnt/$DEVNAME" 2>/dev/null >/dev/null
+ mkdir -p "$MOUNTPOINT" 2>/dev/null >/dev/null
fi
printf "%-15s %-15s %-8s %-20s %-s\n" "$DEVROOT/$DEVNAME" "$MOUNTPOINT" "$FSTYPE" "$OPTIONS" "0 0 $ADDEDBY" >>"$TMP"
done
For mnttool to work, there are a couple of more changes needed.
/usr/bin/mountables.sh needs to be changed to:
#!/bin/sh
cat /etc/fstab | awk -F '/' '/\/mnt\// {print $5}' | awk '{print $1}' | awk '{ sub(/[ \t]+$/, ""); print }' | sort -r | awk 'a != $0; { a = $0 }' | sort > /tmp/mountables
mnttool.fl needs to be patched and recompiled with this patch:
--- mnttool.fl_orig
+++ mnttool.fl_updated
@@ -40,8 +40,8 @@
ifstream fin("/tmp/mountables");
string line;
-string commandHead = "grep /mnt/";
-string commandTail = " /etc/mtab >/dev/null";
+string commandHead = "grep '/mnt/";
+string commandTail = " ' /etc/mtab >/dev/null";
while ( getline(fin,line) )
{
@@ -89,7 +89,7 @@
int results;
if (mountState.at(selected) == 0) // mounted
{
- results = system(("sudo umount /dev/" + mountList.at(selected)).c_str());
+ results = system(("sudo umount /mnt/" + mountList.at(selected)).c_str());
if (results == 0)
{
btnState->color((Fl_Color)1);
@@ -99,7 +99,7 @@
}
else
{
- results = system(("sudo mount /dev/" + mountList.at(selected)).c_str());
+ results = system(("sudo mount /mnt/" + mountList.at(selected)).c_str());
if (results == 0)
{
btnState->color((Fl_Color)2);