diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-18 18:32:54 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-18 18:32:54 +0200 |
commit | ca93eb95d535e30207aba84982475fbd9749d933 (patch) | |
tree | a7f94bae285572a51cc34c1e5f838c64e1fefb21 /bin/common | |
parent | ac369f0c9d0e4362dc229eccbc2d4692538f5553 (diff) |
don't use sudo if root
Diffstat (limited to 'bin/common')
-rwxr-xr-x | bin/common/amount | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/common/amount b/bin/common/amount index 71fc6ae..9053b62 100755 --- a/bin/common/amount +++ b/bin/common/amount @@ -26,7 +26,9 @@ dev="$(grep "^$choice\." "$tmp" | cut -f 2- -d ' ')" if test -n "$dev" then die "mounting /dev/$dev on /media/$dev" - sudo mount --mkdir /dev/$dev /media/$dev > /dev/null 2>&1 && + test "$(id -u)" != "0" && sudo="sudo" + mkdir -p /media/$dev + $sudo mount /dev/$dev /media/$dev > /dev/null 2>&1 && die 'Mounted succesfully.' || die 'Failed to mount.' die 'Press [Enter] to continue.' |