From 612980a334f0d84d2385d2003c676d1e7aad46c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Thu, 28 Nov 2024 23:46:31 +0100 Subject: [PATCH] fix sudo --- functions.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index bf4df6f..7994715 100755 --- a/functions.sh +++ b/functions.sh @@ -1055,7 +1055,14 @@ get_crtime() { is_btrfs_subvolume() { - sudo btrfs subvolume show "$1" >/dev/null + local XSUDO + if [ $(id -u) -eq 0 ] + then + XSUDO= + else + XSUDO=sudo + fi + ${XSUDO:+sudo} btrfs subvolume show "$1" >/dev/null } convert_to_subvolume () {