#! /bin/bash# SPDX-License-Identifier: LGPL-2.1-or-laterset -euxdev=$1need_unmount=""maybe_unmount () {if [ -n "$need_unmount" ]; thenumount "$need_unmount"rmdir "$need_unmount"fi}trap maybe_unmount EXIT INT QUITmp=$(findmnt -no TARGET "$dev" | cat)if [ -z "$mp" ]; thenmp=$(mktemp -d)need_unmount=$mpmount "$dev" "$mp" -o rofi# A filesystem is empty if it only has directories in it.first=$(find "$mp" -not -type d | head -1)info=$(stat -f -c '{ "unit": %S, "free": %f, "total": %b }' "$mp")if [ -z "$first" ]; thenecho yeselseecho "$info"fi