diff options
author | B. Stack <bgstack15@gmail.com> | 2023-10-14 15:33:40 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2023-10-14 15:33:40 -0400 |
commit | 021a4b5a438960b25ea644984895ce672a9756f4 (patch) | |
tree | 2840b448f01b84fd3c416e91a1a128596c6c4be7 /src | |
parent | add _service to scm (diff) | |
download | myautomount-021a4b5a438960b25ea644984895ce672a9756f4.tar.gz myautomount-021a4b5a438960b25ea644984895ce672a9756f4.tar.bz2 myautomount-021a4b5a438960b25ea644984895ce672a9756f4.zip |
v0.0.4 add floppy icon, reenable /browse/sdc1 format
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 2 | ||||
-rwxr-xr-x | src/usr/bin/myautomountd | 27 | ||||
-rw-r--r-- | src/usr/libexec/myautomount/myautomount-initialize.sh | 8 |
3 files changed, 25 insertions, 12 deletions
diff --git a/src/Makefile b/src/Makefile index 14e83af..0192a23 100644 --- a/src/Makefile +++ b/src/Makefile @@ -14,7 +14,7 @@ # build-devuan: txt2man, bgscripts-core APPNAME = myautomount -APPVERSION = 0.0.3 +APPVERSION = 0.0.4 SRCDIR = $(CURDIR) prefix = /usr SYSCONFDIR = $(DESTDIR)/etc 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 } |