Files
steamdeck-scripts/ncdu-install.sh
2022-11-15 00:22:07 -05:00

34 lines
879 B
Bash
Executable File

#!/bin/bash
# vim: ts=4:sw=4:et
if which ncdu &>/dev/null; then
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 --hold -e "$0" "$@"
exit $?
elif [[ $UID -ne 0 ]]; then
# script run in konsole, but without sudo
echo "switching to root"
sudo /bin/bash "$0" "$@"
exit $?
fi
# SteamOS's wrapper for: btrfs property set -ts / ro false
steamos-readonly disable
pacman-key --init
pacman-key --populate archlinux
pacman -S ncdu
# SteamOS's wrapper for: btrfs property set -ts / ro true
steamos-readonly enable
echo 'This window is now safe to close.'
# zenity --info --title='Result' --no-wrap --text='Done'