EmuDeck/functions/ToolScripts/emuDeckPlugins.sh
Simon Lalonde 38fcd2738b
Handle special chars when echoing password for sudo req funcs? (#901)
* adds updating the roms path in usersettings to the migration

* Fix migration with saves

* Hotfix dolphin config

Remove WirelessMac

* SRM:

update saturn parser to include saturnjp

* freeze PCSX2

# Conflicts:
#	functions/EmuScripts/emuDeckPCSX2QT.sh

* Update emuDeckPCSX2QT.sh

* Add GitHub Issue Templates

* Create pull_request_template.md

* Update README.md

* Update README.md

* helpers: Fix FlatPak installed check (#875)

The previous way of checking whether a package was installed or not was
incorrect in its assumption, that a package ID will only occur once in
the flatpak installed list.

I noticed this while trying to install PPSSPP, as FlatPak installs a
`org.ppsspp.PPSSPP` and `org.ppsspp.PPSSPP.Locale` package. The package
was installed correctly, but EmuDeck would register it as non-installed.

Signed-off-by: Sophie 'Tyalie' Friedrich <dev@flowerpot.me>

* SDL Driver

* hotfix Vita3k releaseURL

hotfix Vita3k releaseURL

* Update Vita3K's default config path (#890)

* better linux support

* Chimera

* chimera

* chimera

* chimeraaa

* chimeraPath

* chimeraos FIX

* chimera fixes

* fixed readme

# Conflicts:
#	README.md

# Conflicts:
#	README.md

* Handle special chars when echoing password for sudo req funcs

* store zenity/cli prompt passwd as str

---------

Signed-off-by: Sophie 'Tyalie' Friedrich <dev@flowerpot.me>
Co-authored-by: Livedeht <godsbane@gmail.com>
Co-authored-by: Rodrigo <rodrigosedano@me.com>
Co-authored-by: 108900299+rawdatafeel@users.noreply.github.com <108900299+rawdatafeel@users.noreply.github.com>
Co-authored-by: Sophie Tyalie <dev@flowerpot.me>
Co-authored-by: Pedro Montes Alcalde <pedro.montes.alcalde@gmail.com>
2023-12-29 16:58:03 +01:00

135 lines
5.5 KiB
Bash

#!/bin/bash
Plugins_install_cleanup() {
local password=$1
#We restart Decky
#systemctl daemon-reload
#systemctl restart plugin_loader
#Deleting temp password
if [ "$password" = "Decky!" ]; then
echo "$password" | sudo -S -k passwd -d $(whoami)
fi
}
Plugins_checkPassword(){
local password=$1
if [ "$password" = "Decky!" ]; then
#We create the password
yes "$password" | passwd $(whoami)
elif [ "$system" == "chimeraos" ]; then
password="gamer"
else
if ( echo "$PASS" | sudo -S -k true ); then
echo "true"
else
read -r PASS <<< $(zenity --title="Decky Installer" --width=300 --height=100 --entry --hide-text --text="Enter your sudo/admin password so we can install Decky with the best plugins for emulation")
if [[ $? -eq 1 ]] || [[ $? -eq 5 ]]; then
exit 1
fi
if ( echo "$PASS" | sudo -S -k true ); then
password=$PASS
else
zenity --title="Decky Installer" --width=150 --height=40 --info --text "Incorrect Password"
fi
fi
fi
return $password
}
Plugins_installPluginLoader(){
local password=$1
local PluginLoader_releaseURL="https://github.com/SteamDeckHomebrew/decky-installer/releases/latest/download/install_release.sh"
if [ ! -f $HOME/.steam/steam/.cef-enable-remote-debugging ]; then
mkdir -p "$HOME/homebrew"
Plugins_checkPassword $password && echo $password | sudo -S chown -R $USER:$USER "$HOME/homebrew"
curl -L $PluginLoader_releaseURL | sh
touch "$HOME/.steam/steam/.cef-enable-remote-debugging"
echo $password | sudo -S chown $USER:$USER ~/.steam/steam/.cef-enable-remote-debugging
Plugins_install_cleanup $password
fi
}
Plugins_installPowerTools(){
local password=$1
local ptHash
Plugins_checkPassword $password
local url="https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/$ptHash.zip"
ptHash=$(curl https://beta.deckbrew.xyz/plugins | jq -r '.[] | select(.name=="PowerTools").versions[0].hash')
if [ -d "$HOME/homebrew/plugins/" ]; then
echo $password | sudo -S rm -rf "$HOME/homebrew/plugins/PowerTools"
curl -l "$url" --output "$HOME/homebrew/PowerTools.zip.temp" && mv "$HOME/homebrew/PowerTools.zip.temp" "$HOME/homebrew/PowerTools.zip"
echo $password | sudo -S unzip "$HOME/homebrew/PowerTools.zip" -d "$HOME/homebrew/plugins/" && rm "$HOME/homebrew/PowerTools.zip"
Plugins_install_cleanup $password
else
rm -rf "$HOME/homebrew/plugins/PowerTools"
curl -l "$url" --output "$HOME/homebrew/PowerTools.zip.temp" && mv "$HOME/homebrew/PowerTools.zip.temp" "$HOME/homebrew/PowerTools.zip"
unzip "$HOME/homebrew/PowerTools.zip" -d "$HOME/homebrew/plugins/" && rm "$HOME/homebrew/PowerTools.zip"
fi
}
Plugins_installPowerControl(){
local password=$1
local destinationFolder="$HOME/homebrew/plugins/EmuDecky"
local PowerControl_releaseURL="$(getLatestReleaseURLGH "mengmeet/PowerControl" ".tar.gz")"
if [ -d "$HOME/homebrew/plugins/" ]; then
Plugins_checkPassword $password
echo $password | sudo -S rm -rf $destinationFolder
echo $password | sudo -S curl -L "$PowerControl_releaseURL" -o "$HOME/homebrew/plugins/PowerControl.tar.gz"
echo $password | sudo -S unzip "$HOME/homebrew/plugins/PowerControl.tar.gz" -d "$HOME/homebrew/plugins/" && echo $password | sudo -S rm "$HOME/homebrew/plugins/PowerControl.tar.gz"
echo $password | sudo -S chown $USER:$USER -R $HOME/homebrew/plugins/PowerControl
chmod 555 -R $HOME/homebrew/plugins/PowerControl
Plugins_install_cleanup $password
else
rm -rf $destinationFolder
curl -L "$PowerControl_releaseURL" -o "$HOME/homebrew/plugins/PowerControl.tar.gz"
unzip "$HOME/homebrew/plugins/PowerControl.tar.gz" -d "$HOME/homebrew/plugins/" && rm "$HOME/homebrew/plugins/PowerControl.tar.gz"
chown $USER:$USER -R $HOME/homebrew/plugins/PowerControl
fi
}
Plugins_installDeckyControls(){
local password=$1
Plugins_installEmuDecky $password
}
Plugins_installEmuDecky(){
local password=$1
local destinationFolder="$HOME/homebrew/plugins/EmuDecky"
local DeckyControls_releaseURL="$(getLatestReleaseURLGH "EmuDeck/EmuDecky" ".zip")"
if [ -d "$HOME/homebrew/plugins/" ]; then
Plugins_checkPassword $password
echo $password | sudo -S rm -rf $destinationFolder
echo $password | sudo -S curl -L "$DeckyControls_releaseURL" -o "$HOME/homebrew/plugins/EmuDecky.zip"
echo $password | sudo -S unzip "$HOME/homebrew/plugins/EmuDecky.zip" -d "$HOME/homebrew/plugins/" && echo $password | sudo -S rm "$HOME/homebrew/plugins/EmuDecky.zip"
echo $password | sudo -S chown $USER:$USER -R $HOME/homebrew/plugins/EmuDecky
chmod 555 -R $HOME/homebrew/plugins/EmuDecky
Plugins_install_cleanup $password
else
rm -rf $destinationFolder
curl -L "$DeckyControls_releaseURL" -o "$HOME/homebrew/plugins/EmuDecky.zip"
unzip "$HOME/homebrew/plugins/EmuDecky.zip" -d "$HOME/homebrew/plugins/" && rm "$HOME/homebrew/plugins/EmuDecky.zip"
chown $USER:$USER -R $HOME/homebrew/plugins/EmuDecky
fi
}
Plugins_installSteamDeckGyroDSU(){
local password=$1
Plugins_checkPassword $password
echo $password | sudo -S pwd
local SDGyro_releaseURL="https://github.com/kmicki/SteamDeckGyroDSU/raw/master/pkg/update.sh"
curl -L $SDGyro_releaseURL --output /tmp/sdgyro.sh && chmod +x /tmp/sdgyro.sh && /tmp/sdgyro.sh && rm /tmp/sdgyro.sh
Plugins_install_cleanup $password
}
Plugins_install(){
Plugins_installEmuDecky
Plugins_installSteamDeckGyroDSU
Plugins_installPluginLoader
}