From 991fe14dd7aef45e67ac4570a98e285000e1c1cf Mon Sep 17 00:00:00 2001 From: Terry Date: Tue, 15 Nov 2022 00:01:53 -0500 Subject: [PATCH] force konsole --- ncdu-install.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ncdu-install.sh b/ncdu-install.sh index 51b8c0d..b484a5d 100755 --- a/ncdu-install.sh +++ b/ncdu-install.sh @@ -1,11 +1,20 @@ #!/bin/bash +# vim: ts=4:sw=4:et if which ncdu &>/dev/null; then - echo 'ncdu is already installed' + zenity --info --title='Result' --no-wrap --text='ncdu is already installed' exit 0 fi +if ! tty -s; then + # script is running non-interactively, for ex by clicking "Execute" in dolphin + zenity --password --title="Enter password for `whoami`" --timeout=10 | sudo --stdin -- \ + konsole -e "$0" "$@" + exit $? +fi + if [[ $UID -ne 0 ]]; then + echo "switching to root" sudo /bin/bash "$0" "$@" exit $? fi @@ -20,3 +29,5 @@ pacman -S ncdu # SteamOS's wrapper for: btrfs property set -ts / ro true steamos-readonly enable + +zenity --info --title='Result' --no-wrap --text='Done'