summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2023-01-07 19:04:34 +0100
committerRobert Günzler <r@gnzler.io>2023-01-07 19:04:34 +0100
commit200f1292e72ae2f0b1a027b383db7b82c72230d9 (patch)
treee88cd5f6dab10a06e8d1b08a47fb4d2b0a56283f
parentc3c3645ab8452a21ac757dd6b5d9c28701edb014 (diff)
bin: make mounts user accessible with mnts
Signed-off-by: Robert Günzler <r@gnzler.io>
-rwxr-xr-xbin/mnts12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/mnts b/bin/mnts
index 57eca9f..fe940c1 100755
--- a/bin/mnts
+++ b/bin/mnts
@@ -20,10 +20,10 @@ exec=
 while getopts hx: o; do
 	case "$o" in
 	x) exec="$OPTARG" ;;
-	h|?) exit 2 ;;
+	h | ?) exit 2 ;;
 	esac
 done
-shift $((OPTIND-1))
+shift $((OPTIND - 1))
 
 # mount <1:mode> <2:device> <3:label> <4:path>
 mount() {
@@ -32,17 +32,17 @@ mount() {
 	local icon=/usr/share/icons/mdi/scalable/harddisk.svg
 	trap '{ rm -f "$logfile"; }' EXIT
 
-	# udisksctl "${1}" -b "${2}" >"${logfile}" 2>&1; then
 	case "$1" in
 	mount)
 		local path
 
 		icon=/usr/share/icons/mdi/scalable/harddisk-plus.svg
-		local path="/media/$(tr '[:upper:]' '[:lower:]' <<<"$3")"
+		path="/media/$(tr '[:upper:]' '[:lower:]' <<<"$3")"
 		[ ! -d "$path" ] && mkdir -p "$path"
-		doas -n mount -v "$2" "$path" >"$logfile" 2>&1
+		doas -n mount -v -o "uid=$(id -u),gid=$(id -g)" "$2" "$path" >"$logfile" 2>&1
 		if [ -n "${exec}" ]; then
-			sh -c "$exec $path" & disown
+			sh -c "$exec $path" &
+			disown
 		fi
 		;;
 	unmount)