From 021a4b5a438960b25ea644984895ce672a9756f4 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 14 Oct 2023 15:33:40 -0400 Subject: v0.0.4 add floppy icon, reenable /browse/sdc1 format --- src/usr/bin/myautomountd | 27 ++++++++++++++-------- .../libexec/myautomount/myautomount-initialize.sh | 8 ++++++- 2 files changed, 24 insertions(+), 11 deletions(-) (limited to 'src/usr') 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}" } diff --git a/src/usr/libexec/myautomount/myautomount-initialize.sh b/src/usr/libexec/myautomount/myautomount-initialize.sh index 1194ed5..1798c65 100644 --- a/src/usr/libexec/myautomount/myautomount-initialize.sh +++ b/src/usr/libexec/myautomount/myautomount-initialize.sh @@ -26,13 +26,19 @@ setupSystem() { } > "${MYA_PREFIX}${AUTOMOUNT_FILE}.ext4" || fail "Could not setup autofs rules! Check if this is being run as root?" _needrestart=1 } + ! grep -q -e "fstype=auto,noatime" "${MYA_PREFIX}${AUTOMOUNT_FILE}" 2>/dev/null && { + { + echo "# for CDs" + echo "* -fstype=auto,noatime,rw,nosuid :/dev/& " + } > "${MYA_PREFIX}${AUTOMOUNT_FILE}" || fail "Could not setup autofs rules! Check if this is being run as root?" + _needrestart=1 ! grep -q -e "${AUTOMOUNT_BROWSEDIR}" "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" 2>/dev/null && { { touch "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" echo "${AUTOMOUNT_BROWSEDIR}/ext4 ${AUTOMOUNT_FILE}.ext4 --timeout=5 " echo "${AUTOMOUNT_BROWSEDIR}/fat32 ${AUTOMOUNT_FILE}.fat32 --timeout=5 " echo "${AUTOMOUNT_BROWSEDIR}/ntfs ${AUTOMOUNT_FILE}.fat32 --timeout=5 " - echo "#${AUTOMOUNT_BROWSEDIR} ${AUTOMOUNT_FILE} --timeout=5 " + echo "${AUTOMOUNT_BROWSEDIR} ${AUTOMOUNT_FILE} --timeout=5 " } > "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" || fail "Could not setup autofs rules! Check if this is being run as root?" _needrestart=1 } -- cgit