diff options
Diffstat (limited to 'src/usr/bin/myautomountd')
-rwxr-xr-x | src/usr/bin/myautomountd | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/usr/bin/myautomountd b/src/usr/bin/myautomountd index 0cbfb1f..e6a1466 100755 --- a/src/usr/bin/myautomountd +++ b/src/usr/bin/myautomountd @@ -9,6 +9,7 @@ # History: # 2020-09-23 originally translated by bgstack15 to shell from Go version (reference 1) # 2020-09-25 diverged from original architecture +# 2023-10-04 add fs_type to path to make autofs work with exact fs type # Usage: # Invoke this at X startup. This can be from the xdg autostart mechanism, or "exec myautomountd &" in ~/fluxbox.startup # This is the backend to myautomount-trayicon @@ -66,22 +67,25 @@ createEntry() { _device="${1}" _filepath="${2}" test -n "${STACKTRACE}" && echo "STUB createEntry \"${_device}\" \"${_filepath}\"" 1>&2 - _fs= - _model= - _vendor= - _label= - _atracks= + unset _fs _model _vendor _label _atracks _fs_version _use_fs + # _use_fs simplifies the mount types a little _bytes="$( udevadm info "/dev/${_device}" 2>/dev/null )" - _shortbytes="$( printf "%s\n" "${_bytes}" | sed -r -e 's/^E:\s*//;' | grep -E '^(ID_FS_TYPE|ID_MODEL|ID_VENDOR|ID_FS_LABEL|ID_CDROM_MEDIA_TRACK_COUNT_AUDIO)=' )" - unset ID_FS_TYPE ID_MODEL ID_VENDOR ID_FS_LABEL ID_CDROM_MEDIA_TRACK_COUNT_AUDIO + _shortbytes="$( printf "%s\n" "${_bytes}" | sed -r -e 's/^E:\s*//;' | grep -E '^(ID_FS_TYPE|ID_MODEL|ID_VENDOR|ID_FS_LABEL|ID_CDROM_MEDIA_TRACK_COUNT_AUDIO|ID_FS_VERSION)=' )" + unset ID_FS_TYPE ID_MODEL ID_VENDOR ID_FS_LABEL ID_CDROM_MEDIA_TRACK_COUNT_AUDIO ID_FS_VERSION eval "${_shortbytes}" _fs="${ID_FS_TYPE}" + _fs_version="${ID_FS_VERSION}" _model="${ID_MODEL}" _vendor="${ID_VENDOR}" _label="${ID_FS_LABEL}" _atracks="${ID_CDROM_MEDIA_TRACK_COUNT_AUDIO}" test -n "${DEBUG}" && echo "fs=${_fs} model=${_model} vendor=${_vendor} label=${_label} atracks=${_atracks}" 1>&2 test "${_fs}" = "" && test "${_atracks}" = "" && return # if the fs cannot be detected + test "${_fs}" = "vfat" && test "${_fs_version}" = "FAT32" && _use_fs="fat32" + case "${_fs}" in + ntfs|ext4) _use_fs="${_fs}" ;; + esac + _use_fs="$( echo "/${_use_fs%%/}/" | sed -r -e "s@\/\/@\/@g;" )" touch "${_filepath}" ; chmod 0755 "${_filepath}" { echo "[Desktop Entry]" @@ -95,8 +99,8 @@ createEntry() { echo "Exec=xdg-open cdda:///dev/${_device}" else echo "Type=Application" - echo "Exec=xdg-open ${AUTOMOUNT_BROWSEDIR}/${_device}" - echo "Path=${AUTOMOUNT_BROWSEDIR}/${_device}" + echo "Exec=xdg-open ${AUTOMOUNT_BROWSEDIR}${_use_fs}${_device}" + echo "Path=${AUTOMOUNT_BROWSEDIR}${_use_fs}${_device}" fi if test -z "${_label}" ; then echo "Name=${_vendor} ${_model}" |