diff options
| author | Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> | 2023-03-20 21:59:23 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-20 21:59:23 +0000 |
| commit | 0ecd667f7e086208d08570612c9e97a21fa69512 (patch) | |
| tree | b52c38d9b15dbff66ccb45314ebe0112c722c96d | |
| parent | a93adc06d9eb208e7dc2e5ceac04b71674e52584 (diff) | |
| download | decky-installer-0ecd667f7e086208d08570612c9e97a21fa69512.tar.gz decky-installer-0ecd667f7e086208d08570612c9e97a21fa69512.zip | |
The first thing I tried worked, there was just a typo
| -rw-r--r-- | gui/user_install_script.sh | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/gui/user_install_script.sh b/gui/user_install_script.sh index f89c26e..acc3c5d 100644 --- a/gui/user_install_script.sh +++ b/gui/user_install_script.sh @@ -5,6 +5,10 @@ temp_pass_cleanup() { echo $PASS | sudo -S -k passwd -d deck } +# removes unhelpful GTK warnings +zen_nospam() { + zenity 2> >(grep -v 'Gtk' >&2) "$@" +} # check if JQ is installed if ! command -v jq &> /dev/null @@ -22,7 +26,7 @@ if (( $EUID != 0 )); then fi if [ "${PASS_STATUS:5:2}" = "NP" ]; then # if no password is set - if ( zenity --title="Decky Installer" --width=300 --height=200 --question --text="You appear to have not set an admin password.\nDecky can still install by temporarily setting your password to 'Decky!' and continuing, then removing it when the installer finishes\nAre you okay with that?" 2> >(grep -v GtkDialog >&2)); then + if ( zen_nospam --title="Decky Installer" --width=300 --height=200 --question --text="You appear to have not set an admin password.\nDecky can still install by temporarily setting your password to 'Decky!' and continuing, then removing it when the installer finishes\nAre you okay with that?" ); then yes "Decky!" | passwd deck trap temp_pass_cleanup EXIT # make sure password is removed when application closes PASS="Decky!" @@ -31,20 +35,20 @@ if (( $EUID != 0 )); then # get password FINISHED="false" while [ "$FINISHED" != "true" ]; do - PASS=$(zenity --title="Decky Installer" --width=300 --height=100 --entry --hide-text --text="Enter your sudo/admin password" 2> >(grep -v GtkDialog >&2)) + PASS=$(zen_nospam --title="Decky Installer" --width=300 --height=100 --entry --hide-text --text="Enter your sudo/admin password") if [[ $? -eq 1 ]] || [[ $? -eq 5 ]]; then exit 1 fi if ( echo "$PASS" | sudo -S -k true ); then FINISHED="true" else - zenity --title="Decky Installer" --width=150 --height=40 --info --text "Incorrect Password" 2> >(grep -v GtkDialog >&2) + zen_nospam --title="Decky Installer" --width=150 --height=40 --info --text "Incorrect Password" fi done fi if ! [ $USER = "deck" ]; then - zenity --title="Decky Installer" --width=300 --height=100 --warning --text "You appear to not be on a deck.\nDecky should still mostly work, but you may not get full functionality." 2> >(grep -v GtkDialog >&2) + zen_nospam --title="Decky Installer" --width=300 --height=100 --warning --text "You appear to not be on a deck.\nDecky should still mostly work, but you may not get full functionality." fi # get user dir before rerunning as root, otherwise it'll just be 'home/root' @@ -59,9 +63,9 @@ HOMEBREW_FOLDER="${USER_DIR}/homebrew" # if decky is already installed, then also add an 'uninstall' prompt if [[ -f "${USER_DIR}/homebrew/services/PluginLoader" ]] ; then - BRANCH=$(zenity --title="Decky Installer" --width=360 --height=170 --list --radiolist --text "Select Option:" --hide-header --column "Buttons" --column "Choice" --column "Info" TRUE "release" "(Recommended option)" FALSE "prerelease" "(May be unstable)" FALSE "uninstall decky loader" "" 2> >(grep -v GtkDialog >&2)) + BRANCH=$(zen_nospam --title="Decky Installer" --width=360 --height=170 --list --radiolist --text "Select Option:" --hide-header --column "Buttons" --column "Choice" --column "Info" TRUE "release" "(Recommended option)" FALSE "prerelease" "(May be unstable)" FALSE "uninstall decky loader" "") else - BRANCH=$(zenity --title="Decky Installer" --width=300 --height=100 --list --radiolist --text "Select Branch:" --hide-header --column "Buttons" --column "Choice" --column "Info" TRUE "release" "(Recommended option)" FALSE "prerelease" "(May be unstable)" 2> >(grep -v GtkDialog >&2)) + BRANCH=$(zen_nospam --title="Decky Installer" --width=300 --height=100 --list --radiolist --text "Select Branch:" --hide-header --column "Buttons" --column "Choice" --column "Info" TRUE "release" "(Recommended option)" FALSE "prerelease" "(May be unstable)" ) fi if [[ $? -eq 1 ]] || [[ $? -eq 5 ]]; then exit 1 @@ -87,12 +91,12 @@ if [ "$BRANCH" == "uninstall decky loader" ] ; then echo "100" ; echo "# Uninstall finished, installer can now be closed"; ) | - zenity --progress \ + zen_nospam --progress \ --title="Decky Installer" \ --width=300 --height=100 \ --text="Uninstalling..." \ --percentage=0 \ - --no-cancel 2> >(grep -v GtkDialog >&2) + --no-cancel exit 1 fi @@ -114,7 +118,7 @@ VERSION=$(jq -r '.tag_name' <<< ${RELEASE} ) DOWNLOADURL=$(jq -r '.assets[].browser_download_url | select(endswith("PluginLoader"))' <<< ${RELEASE}) echo "45" ; echo "# Installing version $VERSION" ; -curl -L $DOWNLOADURL -o ${HOMEBREW_FOLDER}/services/PluginLoader 2>&1 | stdbuf -oL tr '\r' '\n' | sed -u 's/^ *\([0-9][0-9]*\).*\( [0-9].*$\)/\1\n#Download Speed\:\2/' | zenity --progress --title "Downloading Decky" --text="Download Speed: 0" --width=300 --height=100 --auto-close --no-cancel 2> >(grep -v GtkDialog >&2) +curl -L $DOWNLOADURL -o ${HOMEBREW_FOLDER}/services/PluginLoader 2>&1 | stdbuf -oL tr '\r' '\n' | sed -u 's/^ *\([0-9][0-9]*\).*\( [0-9].*$\)/\1\n#Download Speed\:\2/' | zen_nospam --progress --title "Downloading Decky" --text="Download Speed: 0" --width=300 --height=100 --auto-close --no-cancel chmod +x ${HOMEBREW_FOLDER}/services/PluginLoader echo $VERSION > ${HOMEBREW_FOLDER}/services/.loader.version @@ -173,14 +177,13 @@ fi echo "100" ; echo "# Install finished, installer can now be closed"; ) | -zenity --progress \ +zen_nospam --progress \ --title="Decky Installer" \ --width=300 --height=100 \ --text="Installing..." \ --percentage=0 \ - --no-cancel \ # not actually sure how to make the cancel work properly, so it's just not there unless someone else can figure it out - 2> >(grep -v GtkDialog >&2) + --no-cancel # not actually sure how to make the cancel work properly, so it's just not there unless someone else can figure it out if [ "$?" = -1 ] ; then - zenity --title="Decky Installer" --width=150 --height=70 --error --text="Download interrupted." 2> >(grep -v GtkDialog >&2) + zen_nospam --title="Decky Installer" --width=150 --height=70 --error --text="Download interrupted." fi |
