#!/bin/sh # # Script for auto-detect fs of removable media and mount it the right way. # # For FAT fs we want the right user to own the files if test ! $SUDO_USER ; then if test ! $USER ; then MOUNT_USER=`id -u` else MOUNT_USER=$USER fi else MOUNT_USER=$SUDO_USER fi /sbin/mount_msdos -u $MOUNT_USER $* 2> /dev/null RETURNVAL=$? # Probably not an msdos file system? if test $RETURNVAL -ne 0; then # Try ext2fs mount (general mount will fail with ext2fs) /sbin/mount_ext2fs $* 2> /dev/null RETURNVAL=$? if test $RETURNVAL -ne 0; then # Try general auto-detect mount command /sbin/mount_general $* RETURNVAL=$? # Still errors? if test $RETURNVAL -ne 0; then exit $RETURNVAL fi fi exit 0 fi