As I shared also here for gvfs mount: viewtopic.php?p=126123#p126123 , it works in KLV too, from what I tested (but this is NOT a proposal to include by default in KLV !).
It's a hack, I know For who (like me) don't really like the devices display in Thunar and the mount options by the default gvfs/udisks2 configuration, this code will do it completely different, e.g. mountpoints wiil be in /mnt/, mount options are e.g. dev,suid,exec and the display in Thunar is like <LABEL>_<DEVICE> (or just <DEVICE> if label not present).
It works by adding entries to /etc/fstab, and it does NOT (auto) mount anything.
Usage: give the script some name, make it executable, and add it in /root/Startup (requires admin privileges (cannot run as e.g. user spot as it needs to write to /etc/fstab) and reboot or re-login.
Code: Select all
#!/bin/bash
# set mount options (except for vfat and ntfs, it's specified below)
MOPT="noatime,nodiratime,suid,dev,exec,async,x-gvfs-show,noauto"
# Setup fstab function
fstab () {
rm -f /tmp/devices 2>/dev/null
#rm -f /etc/fstab 2>/dev/null
blkid | egrep -v '/dev/sr|/dev/loop|/dev/mapper' >>/tmp/devices
dev=`egrep -v 'TYPE="sw|TYPE="LVM|TYPE=".*_raid_member"' /tmp/devices 2>/dev/null | cut -d: -f1 | cut -d/ -f3 | sort | uniq`
cat > /etc/fstab << EOF
# Device partitions:
EOF
for x in $dev; do
if [ ! -d /mnt/$x ]; then
mkdir /mnt/$x
fi
uuid=`grep -w /dev/$x /tmp/devices | egrep -o ' UUID=[^ ]+' | cut -d'"' -f2`
fs=`grep -w /dev/$x /tmp/devices | egrep -o ' TYPE=[^ ]+' | cut -d'"' -f2`
lbl=`grep -w /dev/$x /tmp/devices | egrep -o ' LABEL=[^ ]+' | cut -d'"' -f2`
[ -z "$lbl" ] && LBL=$x || LBL="${lbl}_${x}"
if [ $fs = vfat ]; then
echo "/dev/disk/by-uuid/$uuid /mnt/$x vfat noatime,nodiratime,suid,dev,exec,async,umask=0,check=s,utf8,x-gvfs-show,noauto,x-gvfs-name=$LBL 0 0" >>/etc/fstab
elif [ $fs = ntfs ]; then
echo "/dev/disk/by-uuid/$uuid /mnt/$x ntfs rw,noatime,user_id=0,group_id=0,allow_other,blksize=4096,x-gvfs-show,noauto,x-gvfs-name=$LBL 0 0" >>/etc/fstab
else
echo "/dev/disk/by-uuid/$uuid /mnt/$x $fs $MOPT,x-gvfs-name=$LBL 0 0" >>/etc/fstab
fi
done
sleep 1 # wait a sec before renewing fstab
echo '' >> /etc/fstab # renew, will be re-read by gvfs-mount, all partitions listed then
}
fstab
MON=$(ls /dev/disk/by-uuid)
while true; do
NEWMON=$(ls /dev/disk/by-uuid)
if [ "$NEWMON" != "$MON" ]; then
MON=$NEWMON
echo "content of /dev/disk/by-uuid changed, running fstab"
fstab
continue
fi
sleep 1
done