aboutsummaryrefslogtreecommitdiff
path: root/src/usr/bin
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-10-14 15:33:40 -0400
committerB. Stack <bgstack15@gmail.com>2023-10-14 15:33:40 -0400
commit021a4b5a438960b25ea644984895ce672a9756f4 (patch)
tree2840b448f01b84fd3c416e91a1a128596c6c4be7 /src/usr/bin
parentadd _service to scm (diff)
downloadmyautomount-021a4b5a438960b25ea644984895ce672a9756f4.tar.gz
myautomount-021a4b5a438960b25ea644984895ce672a9756f4.tar.bz2
myautomount-021a4b5a438960b25ea644984895ce672a9756f4.zip
v0.0.4 add floppy icon, reenable /browse/sdc1 format
Diffstat (limited to 'src/usr/bin')
-rwxr-xr-xsrc/usr/bin/myautomountd27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/usr/bin/myautomountd b/src/usr/bin/myautomountd
index e6a1466..df2dc97 100755
--- a/src/usr/bin/myautomountd
+++ b/src/usr/bin/myautomountd
@@ -10,6 +10,7 @@
# 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
+# 2023-10-14 add floppy disk support
# 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
@@ -67,11 +68,11 @@ createEntry() {
_device="${1}"
_filepath="${2}"
test -n "${STACKTRACE}" && echo "STUB createEntry \"${_device}\" \"${_filepath}\"" 1>&2
- unset _fs _model _vendor _label _atracks _fs_version _use_fs
+ unset _fs _model _vendor _label _atracks _fs_version _use_fs _type
# _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|ID_FS_VERSION)=' )"
- unset ID_FS_TYPE ID_MODEL ID_VENDOR ID_FS_LABEL ID_CDROM_MEDIA_TRACK_COUNT_AUDIO ID_FS_VERSION
+ _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|ID_TYPE)=' )"
+ unset ID_FS_TYPE ID_MODEL ID_VENDOR ID_FS_LABEL ID_CDROM_MEDIA_TRACK_COUNT_AUDIO ID_FS_VERSION ID_TYPE
eval "${_shortbytes}"
_fs="${ID_FS_TYPE}"
_fs_version="${ID_FS_VERSION}"
@@ -79,7 +80,8 @@ createEntry() {
_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
+ _type="${ID_TYPE}"
+ test -n "${DEBUG}" && echo "fs=${_fs} model=${_model} vendor=${_vendor} label=${_label} atracks=${_atracks} _type=${_type}" 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
@@ -109,12 +111,17 @@ createEntry() {
echo "GenericName=${_vendor} ${_model}"
fi
echo "Comment=${_device} (${_fs})"
- case "${_fs}" in
- "cd9600") echo "Icon=media-optical" ;;
- "udf") echo "Icon=media-optical-dvd" ;;
- "") echo "Icon=media-optical-audio" ;;
- *) echo "Icon=media-removable" ;;
- esac
+ if test "${_type}" = "floppy" ;
+ then
+ echo "Icon=system-floppy"
+ else
+ case "${_fs}" in
+ "cd9600") echo "Icon=media-optical" ;;
+ "udf") echo "Icon=media-optical-dvd" ;;
+ "") echo "Icon=media-optical-audio" ;;
+ *) echo "Icon=media-removable" ;;
+ esac
+ fi
} > "${_filepath}"
}
bgstack15