Skip to content

Commit

Permalink
Use mount flag 'users' and don't depend on root to umount
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferk committed Nov 30, 2022
1 parent a00f157 commit 2b46708
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion media-automount
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#$1 = <dev>

# Default options to use for mounting
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,user'
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,users'
# Default type to use for mounting
AUTOMOUNT_TYPE='auto'

Expand Down
2 changes: 1 addition & 1 deletion media-automount.d/auto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- sh -*-

# Options to use for auto-mounting generic filesystems
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,user,sync'
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,users,sync'

# Type to use for auto-mounting generic filesystems
AUTOMOUNT_TYPE=auto
Expand Down
2 changes: 1 addition & 1 deletion media-automount.d/hfsplus
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- sh -*-

# Options to use for auto-mounting devices detected with an hfsplus filesystem
AUTOMOUNT_OPTS=ro,relatime
AUTOMOUNT_OPTS=ro,users,relatime

2 changes: 1 addition & 1 deletion media-automount.d/ntfs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- sh -*-

# Mount options to use for auto-mounting NTFS drives
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,user,flush'
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,users,flush'

# If NTFS-3G is installed, use it as the mount type
hash ntfs-3g && AUTOMOUNT_TYPE="ntfs-3g"
Expand Down
2 changes: 1 addition & 1 deletion media-automount.d/vfat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- sh -*-

# Options to use for auto-mounting devices detected with a vfat filesystem
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,user,flush,gid=100,dmask=000,fmask=111'
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,users,flush,gid=100,dmask=000,fmask=111'

9 changes: 3 additions & 6 deletions umount_dmenu
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ dmenu_notify() {
: | dmenu -p "$1 (press enter)"
}

if [ "$(id -u)" != 0 ]; then
dmenu_notify "Please run it as root"
exit 1
fi

dir="$(awk '$2 ~ /^\/media\// {print $2}' /etc/mtab | cut -d / -f 3 | dmenu -p "Select media device to remove")"
dir=$(printf $dir) # cleanup escaped chars
if [ -z "$dir" ] || ! [ -d "/media/$dir" ]; then
echo "invalid selection: '$dir'"
exit 1
fi

Expand All @@ -23,5 +20,5 @@ if result=$(umount "/media/$dir" 2>&1); then
else
echo "$result"
dmenu_notify "ERROR: $result"
exit 1
exit 32
fi

0 comments on commit 2b46708

Please sign in to comment.