Fix exFAT mount rights. Use USER option in config file. Make MTP detection and mount better.
This commit is contained in:
parent
6ad9b18041
commit
72eeeff0f1
31
automount
31
automount
|
|
@ -144,7 +144,7 @@ if [ "${1}" = '--version' -o \
|
||||||
"${1}" = 'version' -o \
|
"${1}" = 'version' -o \
|
||||||
"${1}" = '-v' ]
|
"${1}" = '-v' ]
|
||||||
then
|
then
|
||||||
echo "automount 1.7.0 2019/08/28"
|
echo "automount 1.7.1 2019/12/03"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ fi
|
||||||
: ${LOG_FILE='/var/log/automount.log'} # log file
|
: ${LOG_FILE='/var/log/automount.log'} # log file
|
||||||
: ${LOG_DATEFMT='%Y-%m-%d %H:%M:%S'} # 2012-02-20 07:49:09
|
: ${LOG_DATEFMT='%Y-%m-%d %H:%M:%S'} # 2012-02-20 07:49:09
|
||||||
: ${STATE="/var/run/automount.state"} # current state file
|
: ${STATE="/var/run/automount.state"} # current state file
|
||||||
: ${USER="0"} # which user to use for popup
|
: ${USER="root"} # which user to use for popup
|
||||||
|
|
||||||
# init of main variables
|
# init of main variables
|
||||||
DEV="/dev/${1}"
|
DEV="/dev/${1}"
|
||||||
|
|
@ -217,7 +217,7 @@ readonly FS_TYPE_EXFAT=33
|
||||||
readonly FS_TYPE_NTFS=34
|
readonly FS_TYPE_NTFS=34
|
||||||
readonly FS_TYPE_MTP=128
|
readonly FS_TYPE_MTP=128
|
||||||
|
|
||||||
# FUNCTION: guess filesystemy type from the device
|
# FUNCTION: guess filesystem type from device
|
||||||
__guess_fs_type() { # 1=DEV
|
__guess_fs_type() { # 1=DEV
|
||||||
# first time guess with file(1) tool
|
# first time guess with file(1) tool
|
||||||
unset FS_TYPE
|
unset FS_TYPE
|
||||||
|
|
@ -365,7 +365,7 @@ __wait_for_device() { # 1=DEV
|
||||||
esac
|
esac
|
||||||
# try to read from device to ensure that it alive
|
# try to read from device to ensure that it alive
|
||||||
local COUNT=0
|
local COUNT=0
|
||||||
while ! dd if="${1}" of=/dev/null conv=sync count=1 bs=256k 1> /dev/null 2>&1
|
while ! dd if="${1}" of=/dev/null conv=sync count=1 bs=8k 1> /dev/null 2>&1
|
||||||
do
|
do
|
||||||
if [ ! -e "${1}" ]
|
if [ ! -e "${1}" ]
|
||||||
then
|
then
|
||||||
|
|
@ -387,6 +387,7 @@ __check_block_device() { # 1=DEV
|
||||||
# first check if its block device
|
# first check if its block device
|
||||||
if ! fstyp ${1} 1> /dev/null 2>&1
|
if ! fstyp ${1} 1> /dev/null 2>&1
|
||||||
then
|
then
|
||||||
|
__log "ASD"
|
||||||
__log "${DEV}: not a block device"
|
__log "${DEV}: not a block device"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -424,10 +425,13 @@ case ${2} in
|
||||||
FS_TYPE=${FS_TYPE_ISO9660}
|
FS_TYPE=${FS_TYPE_ISO9660}
|
||||||
;;
|
;;
|
||||||
(ugen*)
|
(ugen*)
|
||||||
__check_block_device "${DEV}"
|
|
||||||
FS_TYPE=${FS_TYPE_MTP}
|
FS_TYPE=${FS_TYPE_MTP}
|
||||||
;;
|
;;
|
||||||
(cd*|da*|mmcsd*)
|
(cd*)
|
||||||
|
__guess_fs_type "${DEV}"
|
||||||
|
FS_TYPE=${?}
|
||||||
|
;;
|
||||||
|
(da*|mmcsd*)
|
||||||
__check_block_device "${DEV}"
|
__check_block_device "${DEV}"
|
||||||
__guess_fs_type "${DEV}"
|
__guess_fs_type "${DEV}"
|
||||||
FS_TYPE=${?}
|
FS_TYPE=${?}
|
||||||
|
|
@ -487,6 +491,7 @@ case ${2} in
|
||||||
(${FS_TYPE_FAT})
|
(${FS_TYPE_FAT})
|
||||||
# FreeBSD 12.x does not support '-o large' option
|
# FreeBSD 12.x does not support '-o large' option
|
||||||
case $( sysctl -n kern.osrelease ) in
|
case $( sysctl -n kern.osrelease ) in
|
||||||
|
(10*) LARGE="-o large" ;;
|
||||||
(11*) LARGE="-o large" ;;
|
(11*) LARGE="-o large" ;;
|
||||||
(*) LARGE="" ;;
|
(*) LARGE="" ;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -525,14 +530,19 @@ case ${2} in
|
||||||
__log "command '${FS_MOUNT_CMD}' not found"
|
__log "command '${FS_MOUNT_CMD}' not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PHONEDEV=$( simple-mtpfs --list-devices -d ${DEV} 2>&1 )
|
PHONEDEV=$( simple-mtpfs --list-devices -d ${DEV} 2> /dev/null )
|
||||||
if [ "${PHONEDEV}" = "No raw devices found." ]
|
if [ "${PHONEDEV}" = "No raw devices found." ]
|
||||||
then
|
then
|
||||||
__log "${DEV}: no raw devices found"
|
__log "${DEV}: no raw devices found"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
PHONEDEV=$( echo "${PHONEDEV}" | awk '{print $1}' | tr -d ':' )
|
PHONEDEV=$( echo "${PHONEDEV}" | awk '{print $1}' | tr -d ':' )
|
||||||
FS_MOUNT_ARGS="--device ${PHONEDEV} ${MNT} -o allow_other -o intr -o big_writes -o uid=${UID} -o gid=${GID}"
|
if [ ! ${PHONEDEV} ]
|
||||||
|
then
|
||||||
|
__log "${DEV}: no MTP devices found"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
FS_MOUNT_ARGS="--device ${PHONEDEV} ${MNT} -o allow_other -o uid=${UID} -o gid=${GID}"
|
||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
__log "${DEV}: filesystem not supported or no filesystem"
|
__log "${DEV}: filesystem not supported or no filesystem"
|
||||||
|
|
@ -541,7 +551,7 @@ case ${2} in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# create mount point
|
# create mount point
|
||||||
mkdir -m "${MNT_MODE}" -p "${MNT}"
|
mkdir -m "${MNT_MODE}" -p "${MNT}"
|
||||||
__log "${DEV}: create '${MNT}' dir"
|
__log "${DEV}: create '${MNT}' dir"
|
||||||
|
|
||||||
# check file system before mount
|
# check file system before mount
|
||||||
|
|
@ -559,6 +569,9 @@ case ${2} in
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check is device already mounted
|
||||||
|
__check_already_mounted "${DEV}" "${MNT}"
|
||||||
|
|
||||||
# try to mount
|
# try to mount
|
||||||
if ! /usr/bin/which -s "${FS_MOUNT_CMD}"
|
if ! /usr/bin/which -s "${FS_MOUNT_CMD}"
|
||||||
then
|
then
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,10 +1,3 @@
|
||||||
USERUMOUNT=YES
|
USERUMOUNT=YES
|
||||||
ATIME=NO
|
|
||||||
REMOVEDIRS=YES
|
|
||||||
FM="caja --no-desktop"
|
|
||||||
USER=vermaden
|
|
||||||
FAT_ENCODING=pl_PL.UTF-8
|
|
||||||
FAT_CODEPAGE=cp852
|
|
||||||
ISO9660_CODEPAGE=UTF-8
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue