Files
steamdeck-scripts/ncdu.sh
2022-11-18 23:59:12 -05:00

40 lines
1.0 KiB
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 -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
(
echo 0
echo '# setting / to read/write'
steamos-readonly disable
echo 15
echo '# setting up package manager keys'
pacman-key --init
pacman-key --populate archlinux
echo 50
echo '# installing ncdu'
pacman --quiet --noprogressbar --noconfirm --sync ncdu networkmanager-openvpn
echo 90
echo '# setting / back to read only'
steamos-readonly enable
echo 100
) | zenity --progress --no-cancel --width=400 2>/dev/null
#~deck/.local/share/steam
#/run/media/mmcblk0p1