udisks-unmount-all 295 B

123456789101112131415161718
  1. #!/bin/sh
  2. if [ "$1" = "-h" ]; then
  3. cat <<EOF>&2
  4. Usage: ${0##*/}
  5. Automatically unmount external drives mounted with 'udisks'.
  6. EOF
  7. exit
  8. fi
  9. while IFS= read -r i; do
  10. udisksctl unmount -b "$(findmnt -n --output SOURCE "$i")"
  11. done <<EOF
  12. $(find /media/$USER -maxdepth 1 -mindepth 1 -type d)
  13. EOF