mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 19:11:58 +00:00
Remove argument parity between scripts, not sustainable solution
This commit is contained in:
@@ -45,11 +45,11 @@ Keep an eye on the [Wiki](https://deckbrew.xyz) for more information about Plugi
|
|||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
- For Plugin Loader contributors (in possession of a Steam Deck):
|
- For Plugin Loader contributors (in possession of a Steam Deck):
|
||||||
- `curl -L https://github.com/SteamDeckHomebrew/PluginLoader/raw/react-frontend-plugins/contrib/deck.sh | sh`
|
- `bash <(curl -s https://github.com/SteamDeckHomebrew/PluginLoader/raw/react-frontend-plugins/contrib/deck.sh)`
|
||||||
- For PluginLoader contributors (without a Steam Deck):
|
- For PluginLoader contributors (without a Steam Deck):
|
||||||
- `curl -L https://github.com/SteamDeckHomebrew/PluginLoader/raw/react-frontend-plugins/contrib/pc.sh | sh`
|
- `bash <(curl -s https://github.com/SteamDeckHomebrew/PluginLoader/raw/react-frontend-plugins/contrib/nodeck.sh)`
|
||||||
- [Here's how to get the Steam Deck UI on your enviroment of choice.](https://youtu.be/1IAbZte8e7E?t=112)
|
- [Here's how to get the Steam Deck UI on your enviroment of choice.](https://youtu.be/1IAbZte8e7E?t=112)
|
||||||
- (The video shows Windows usage but unless you're using WSL/cygwin this script is unsupported on Windows.)
|
- (The video shows Windows usage but unless you're using Arch WSL/cygwin this script is unsupported on Windows.)
|
||||||
|
|
||||||
To run your development version of Plugin Loader on Deck, run a command like this:
|
To run your development version of Plugin Loader on Deck, run a command like this:
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
+10
-6
@@ -172,6 +172,7 @@ pnpmtransbundle() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! [[ $count -gt 9 ]] ; then
|
||||||
printf "Installing Steam Deck Plugin Loader contributor/developer (for Steam Deck)...\n"
|
printf "Installing Steam Deck Plugin Loader contributor/developer (for Steam Deck)...\n"
|
||||||
|
|
||||||
printf "THIS SCRIPT ASSUMES YOU ARE RUNNING IT ON A PC, NOT THE DECK!
|
printf "THIS SCRIPT ASSUMES YOU ARE RUNNING IT ON A PC, NOT THE DECK!
|
||||||
@@ -180,11 +181,14 @@ If so, you should not be using this script.\n
|
|||||||
If you have a release/nightly installed this script will disable it.\n"
|
If you have a release/nightly installed this script will disable it.\n"
|
||||||
|
|
||||||
printf "This script requires you to have nodejs installed. (If nodejs doesn't bundle npm on your OS/distro, then npm is required as well).\n"
|
printf "This script requires you to have nodejs installed. (If nodejs doesn't bundle npm on your OS/distro, then npm is required as well).\n"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [[ $count -gt 0 ]] ; then
|
if ! [[ $count -gt 0 ]] ; then
|
||||||
read -p "Press any key to continue"
|
read -p "Press any key to continue"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
## User chooses preffered clone & install directories
|
## User chooses preffered clone & install directories
|
||||||
|
|
||||||
if [[ "$CLONEFOLDER" == "" ]]; then
|
if [[ "$CLONEFOLDER" == "" ]]; then
|
||||||
@@ -246,7 +250,7 @@ fi
|
|||||||
|
|
||||||
## Create folder structure
|
## Create folder structure
|
||||||
|
|
||||||
printf "\nCloning git repositories.\n"
|
printf "Cloning git repositories.\n"
|
||||||
|
|
||||||
mkdir -p ${CLONEDIR} &> '/dev/null'
|
mkdir -p ${CLONEDIR} &> '/dev/null'
|
||||||
|
|
||||||
@@ -271,6 +275,8 @@ ssh deck@${DECKIP} -p ${SSHPORT} ${IDENINVOC} "python -m ensurepip && python -m
|
|||||||
|
|
||||||
## Transpile and bundle typescript
|
## Transpile and bundle typescript
|
||||||
|
|
||||||
|
[ "$UID" -eq 0 ] || printf "Input password to proceed with install.\n"
|
||||||
|
|
||||||
sudo npm install -g pnpm &> '/dev/null'
|
sudo npm install -g pnpm &> '/dev/null'
|
||||||
|
|
||||||
type pnpm &> '/dev/null'
|
type pnpm &> '/dev/null'
|
||||||
@@ -282,8 +288,6 @@ if ! [[ "$PNPMLIVES" -eq 0 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$UID" -eq 0 ] || printf "Input password to install typscript compiler.\n"
|
|
||||||
|
|
||||||
printf "Transpiling and bundling typescript.\n"
|
printf "Transpiling and bundling typescript.\n"
|
||||||
|
|
||||||
pnpmtransbundle ${CLONEDIR}/pluginlibrary/ "library"
|
pnpmtransbundle ${CLONEDIR}/pluginlibrary/ "library"
|
||||||
@@ -303,6 +307,7 @@ rsync -avzp --rsh="ssh -p $SSHPORT $IDENINVOC" --exclude='.git/' --exclude='.git
|
|||||||
|
|
||||||
if ! [[ $? -eq 0 ]]; then
|
if ! [[ $? -eq 0 ]]; then
|
||||||
printf "Error occurred when copying $CLONEDIR/pluginloader/ to $INSTALLDIR/pluginloader/\n"
|
printf "Error occurred when copying $CLONEDIR/pluginloader/ to $INSTALLDIR/pluginloader/\n"
|
||||||
|
printf "Check that your Steam Deck is active, ssh is enabled and running and is accepting connections.\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -317,8 +322,7 @@ fi
|
|||||||
|
|
||||||
printf "Run these commands to deploy your local changes to the deck:\n"
|
printf "Run these commands to deploy your local changes to the deck:\n"
|
||||||
printf "'rsync -avzp --mkpath --rsh=""\"ssh -p $SSHPORT $IDENINVOC\""" --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='frontend/' --exclude='dist/' --exclude='contrib/' --exclude='*.log' --exclude='requirements.txt' --exclude='backend/__pycache__/' --exclude='.gitignore' --delete $CLONEDIR/pluginloader/* deck@$DECKIP:$INSTALLDIR/pluginloader/'\n"
|
printf "'rsync -avzp --mkpath --rsh=""\"ssh -p $SSHPORT $IDENINVOC\""" --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='frontend/' --exclude='dist/' --exclude='contrib/' --exclude='*.log' --exclude='requirements.txt' --exclude='backend/__pycache__/' --exclude='.gitignore' --delete $CLONEDIR/pluginloader/* deck@$DECKIP:$INSTALLDIR/pluginloader/'\n"
|
||||||
|
printf "'rsync -avzp --mkpath --rsh=""\"ssh -p $SSHPORT $IDENINVOC\""" --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='node_modules/' --exclude='src/' --exclude='*.log' --exclude='.gitignore' --exclude='package-lock.json' --delete $CLONEDIR/pluginname deck@$DECKIP:$INSTALLDIR/plugins'\n\n"
|
||||||
printf "'rsync -avzp --mkpath --rsh=""\"ssh -p $SSHPORT $IDENINVOC\""" --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='node_modules/' --exclude='src/' --exclude='*.log' --exclude='.gitignore' --exclude='package-lock.json' --delete $CLONEDIR/pluginname deck@$DECKIP:$INSTALLDIR/plugins'\n"
|
|
||||||
|
|
||||||
printf "Run in console or in a script this command to run your development version:\n'ssh deck@$DECKIP -p $SSHPORT $IDENINVOC 'export PLUGIN_PATH=$INSTALLDIR/plugins; export CHOWN_PLUGIN_PATH=0; echo 'steam' | sudo -SE python3 $INSTALLDIR/pluginloader/backend/main.py'\n"
|
printf "Run in console or in a script this command to run your development version:\n'ssh deck@$DECKIP -p $SSHPORT $IDENINVOC 'export PLUGIN_PATH=$INSTALLDIR/plugins; export CHOWN_PLUGIN_PATH=0; echo 'steam' | sudo -SE python3 $INSTALLDIR/pluginloader/backend/main.py'\n"
|
||||||
|
|
||||||
@@ -328,4 +332,4 @@ printf "Run in console or in a script this command to run your development versi
|
|||||||
printf "Connecting via ssh to disable any PluginLoader release versions.\n"
|
printf "Connecting via ssh to disable any PluginLoader release versions.\n"
|
||||||
printf "Script will exit after this. All done!\n"
|
printf "Script will exit after this. All done!\n"
|
||||||
|
|
||||||
ssh deck@${DECKIP} -p ${SSHPORT} ${IDENINVOC} "printf $PASSWORD | sudo -S systemctl disable --now plugin_loader; echo $?"
|
ssh deck@${DECKIP} -p ${SSHPORT} ${IDENINVOC} "printf $PASSWORD | sudo -S systemctl disable --now plugin_loader; echo $?" &> '/dev/null'
|
||||||
|
|||||||
+91
-54
@@ -2,67 +2,85 @@
|
|||||||
|
|
||||||
## Pre-parse arugments for ease of use
|
## Pre-parse arugments for ease of use
|
||||||
CLONEFOLDER=${1:-""}
|
CLONEFOLDER=${1:-""}
|
||||||
|
LOADERBRANCH=${2:-""}
|
||||||
|
LIBRARYBRANCH=${3:-""}
|
||||||
|
TEMPLATEBRANCH=${4:-""}
|
||||||
|
LATEST=${5:-""}
|
||||||
|
|
||||||
setfolder() {
|
## gather options into an array
|
||||||
if [[ "$2" == "clone" ]]; then
|
OPTIONSARRAY=("$CLONEFOLDER" "$LOADERBRANCH" "$LIBRARYBRANCH" "$TEMPLATEBRANCH" "$LATEST")
|
||||||
local ACTION="clone"
|
|
||||||
local DEFAULT="git"
|
|
||||||
elif [[ "$2" == "install" ]]; then
|
|
||||||
local ACTION="install"
|
|
||||||
local DEFAULT="loaderdev"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "Enter the directory in /home/user to ${ACTION} to.\n"
|
## iterate through options array to check their presence
|
||||||
printf "Example: if your home directory is /home/user you would type: ${DEFAULT}\n"
|
count=0
|
||||||
printf "The ${ACTION} directory would be: ${HOME}/${DEFAULT}\n"
|
for OPTION in ${OPTIONSARRAY[@]}; do
|
||||||
if [[ "$ACTION" == "clone" ]]; then
|
! [[ "$OPTION" == "" ]] && count=$(($count+1))
|
||||||
read -p "Enter your ${ACTION} directory: " CLONEFOLDER
|
# printf "OPTION=$OPTION\n"
|
||||||
if ! [[ "$CLONEFOLDER" =~ ^[[:alnum:]]+$ ]]; then
|
done
|
||||||
printf "Folder name not provided. Using default, '${DEFAULT}'.\n"
|
|
||||||
CLONEFOLDER="${DEFAULT}"
|
|
||||||
fi
|
|
||||||
elif [[ "$ACTION" == "install" ]]; then
|
|
||||||
read -p "Enter your ${ACTION} directory: " INSTALLFOLDER
|
|
||||||
if ! [[ "$INSTALLFOLDER" =~ ^[[:alnum:]]+$ ]]; then
|
|
||||||
printf "Folder name not provided. Using default, '${DEFAULT}'.\n"
|
|
||||||
INSTALLFOLDER="${DEFAULT}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "Folder type could not be determined, exiting\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
clonefromto() {
|
clonefromto() {
|
||||||
# printf "repo=$1\n"
|
# printf "repo=$1\n"
|
||||||
# printf "outdir=$2\n"
|
# printf "outdir=$2\n"
|
||||||
# printf "branch=$3\n"
|
# printf "branch=$3\n"
|
||||||
if [[ -z $3 ]]; then
|
printf "Repository: $1\n"
|
||||||
BRANCH=""
|
git clone $1 $2 &> '/dev/null'
|
||||||
else
|
|
||||||
BRANCH="-b $3"
|
|
||||||
fi
|
|
||||||
git clone $1 $2 $BRANCH &> '/dev/null'
|
|
||||||
CODE=$?
|
CODE=$?
|
||||||
|
# printf "CODE=${CODE}"
|
||||||
if [[ $CODE -eq 128 ]]; then
|
if [[ $CODE -eq 128 ]]; then
|
||||||
cd $2
|
cd $2
|
||||||
git fetch &> '/dev/null'
|
git fetch --all &> '/dev/null'
|
||||||
|
fi
|
||||||
|
if [[ -z $3 ]]; then
|
||||||
|
printf "Enter the desired branch for repository "$1" :\n"
|
||||||
|
local OUT="$(git branch -r | sed '/\/HEAD/d')"
|
||||||
|
# $OUT="$($OUT > )"
|
||||||
|
printf "$OUT\nbranch: "
|
||||||
|
read BRANCH
|
||||||
|
else
|
||||||
|
printf "on branch: $3\n"
|
||||||
|
BRANCH="$3"
|
||||||
|
fi
|
||||||
|
if ! [[ -z ${BRANCH} ]]; then
|
||||||
|
git checkout $BRANCH &> '/dev/null'
|
||||||
|
fi
|
||||||
|
if [[ ${LATEST} == "true" ]]; then
|
||||||
|
git pull --all
|
||||||
|
elif [[ ${LATEST} == "true" ]]; then
|
||||||
|
printf "Assuming user not pulling latest commits.\n"
|
||||||
|
else
|
||||||
|
printf "Pull latest commits? (y/N): "
|
||||||
|
read PULL
|
||||||
|
case ${PULL:0:1} in
|
||||||
|
y|Y )
|
||||||
|
printf "Pulling latest commits.\n"
|
||||||
|
git pull --all
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
printf "Not pulling latest commits.\n"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if ! [[ "$PULL" =~ ^[[:alnum:]]+$ ]]; then
|
||||||
|
printf "Assuming user not pulling latest commits.\n"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
npmtransbundle() {
|
pnpmtransbundle() {
|
||||||
cd $1
|
cd $1
|
||||||
if [[ "$2" == "library" ]]; then
|
if [[ "$2" == "library" ]]; then
|
||||||
npm install --quiet &> '/dev/null'
|
npm install --quiet &> '/dev/null'
|
||||||
npm run build --quiet &> '/dev/null'
|
npm run build --quiet &> '/dev/null'
|
||||||
sudo npm link --quiet &> '/dev/null'
|
sudo npm link --quiet &> '/dev/null'
|
||||||
elif [[ "$2" == "frontend" ]] || [[ "$2" == "template" ]]; then
|
elif [[ "$2" == "frontend" ]]; then
|
||||||
npm install --quiet &> '/dev/null'
|
pnpm i &> '/dev/null'
|
||||||
npm link decky-frontend-lib --quiet &> '/dev/null'
|
pnpm run build &> '/dev/null'
|
||||||
npm run build --quiet &> '/dev/null'
|
elif [[ "$2" == "template" ]]; then
|
||||||
|
pnpm i &> '/dev/null'
|
||||||
|
pnpm run build &> '/dev/null'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ! [[ $count -gt 4 ]] ; then
|
||||||
printf "Installing Steam Deck Plugin Loader contributor/developer (no Steam Deck)..."
|
printf "Installing Steam Deck Plugin Loader contributor/developer (no Steam Deck)..."
|
||||||
|
|
||||||
printf "\nTHIS SCRIPT ASSUMES YOU ARE RUNNING IT ON A PC, NOT THE DECK!
|
printf "\nTHIS SCRIPT ASSUMES YOU ARE RUNNING IT ON A PC, NOT THE DECK!
|
||||||
@@ -70,20 +88,29 @@ Not planning to contribute to or develop for PluginLoader?
|
|||||||
Then you should not be using this script.\n"
|
Then you should not be using this script.\n"
|
||||||
|
|
||||||
printf "\nThis script requires you to have nodejs installed. (If nodejs doesn't bundle npm on your OS/distro, then npm is required as well).\n"
|
printf "\nThis script requires you to have nodejs installed. (If nodejs doesn't bundle npm on your OS/distro, then npm is required as well).\n"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
if ! [[ $count -gt 0 ]] ; then
|
||||||
read -p "Press any key to continue"
|
read -p "Press any key to continue"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
if [[ "$CLONEFOLDER" == "" ]]; then
|
if [[ "$CLONEFOLDER" == "" ]]; then
|
||||||
setfolder "$CLONEFOLDER" "clone"
|
printf "Enter the directory in /home/user/ to clone to.\n"
|
||||||
|
printf "The clone directory would be: ${HOME}/git \n"
|
||||||
|
read -p "Enter your clone directory: " CLONEFOLDER
|
||||||
|
if ! [[ "$CLONEFOLDER" =~ ^[[:alnum:]]+$ ]]; then
|
||||||
|
printf "Folder name not provided. Using default, '${DEFAULT}'.\n"
|
||||||
|
CLONEFOLDER="${DEFAULT}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLONEDIR="$HOME/$CLONEFOLDER"
|
CLONEDIR="$HOME/$CLONEFOLDER"
|
||||||
|
|
||||||
## Create folder structure
|
## Create folder structure
|
||||||
|
|
||||||
printf "\nCloning git repositories.\n"
|
printf "Cloning git repositories.\n"
|
||||||
|
|
||||||
mkdir -p ${CLONEDIR} &> '/dev/null'
|
mkdir -p ${CLONEDIR} &> '/dev/null'
|
||||||
|
|
||||||
@@ -92,37 +119,47 @@ mkdir -p ${CLONEDIR} &> '/dev/null'
|
|||||||
# rm -r ${CLONEDIR}/pluginlibrary
|
# rm -r ${CLONEDIR}/pluginlibrary
|
||||||
# rm -r ${CLONEDIR}/plugintemplate
|
# rm -r ${CLONEDIR}/plugintemplate
|
||||||
|
|
||||||
clonefromto "https://github.com/SteamDeckHomebrew/PluginLoader" ${CLONEDIR}/pluginloader react-frontend-plugins
|
clonefromto "https://github.com/SteamDeckHomebrew/PluginLoader" ${CLONEDIR}/pluginloader "$LOADERBRANCH"
|
||||||
|
|
||||||
clonefromto "https://github.com/SteamDeckHomebrew/decky-frontend-lib" ${CLONEDIR}/pluginlibrary
|
clonefromto "https://github.com/SteamDeckHomebrew/decky-frontend-lib" ${CLONEDIR}/pluginlibrary "$LIBRARYBRANCH"
|
||||||
|
|
||||||
clonefromto "https://github.com/SteamDeckHomebrew/decky-plugin-template" ${CLONEDIR}/plugintemplate
|
clonefromto "https://github.com/SteamDeckHomebrew/decky-plugin-template" ${CLONEDIR}/plugintemplate "$TEMPLATEBRANCH"
|
||||||
|
|
||||||
## install python dependencies (maybe use venv?)
|
## install python dependencies (maybe use venv?)
|
||||||
|
|
||||||
python -m pip3 install -r ${CLONEDIR}/pluginloader/requirements.txt
|
python -m pip install -r ${CLONEDIR}/pluginloader/requirements.txt &> '/dev/null'
|
||||||
|
|
||||||
## Transpile and bundle typescript
|
## Transpile and bundle typescript
|
||||||
|
|
||||||
|
[ "$UID" -eq 0 ] || printf "Input password to proceed with install.\n"
|
||||||
|
|
||||||
type npm &> '/dev/null'
|
type npm &> '/dev/null'
|
||||||
|
|
||||||
NPMLIVES=$?
|
NPMLIVES=$?
|
||||||
|
|
||||||
if ! [[ "$NPMLIVES" -eq 0 ]]; then
|
if ! [[ "$PNPMLIVES" -eq 0 ]]; then
|
||||||
printf "npm needs to be installed, exiting.\n"
|
printf "npm does not appear to be installed, exiting.\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$UID" -eq 0 ] || printf "Input password to install typscript compiler.\n"
|
sudo npm install -g pnpm &> '/dev/null'
|
||||||
|
|
||||||
sudo npm install --quiet -g tsc &> '/dev/null'
|
type pnpm &> '/dev/null'
|
||||||
|
|
||||||
|
PNPMLIVES=$?
|
||||||
|
|
||||||
|
if ! [[ "$PNPMLIVES" -eq 0 ]]; then
|
||||||
|
printf "pnpm does not appear to be installed, exiting.\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
printf "Transpiling and bundling typescript.\n"
|
printf "Transpiling and bundling typescript.\n"
|
||||||
|
|
||||||
npmtransbundle ${CLONEDIR}/pluginlibrary/ "library"
|
pnpmtransbundle ${CLONEDIR}/pluginlibrary/ "library"
|
||||||
|
|
||||||
npmtransbundle ${CLONEDIR}/pluginloader/frontend "frontend"
|
pnpmtransbundle ${CLONEDIR}/pluginloader/frontend "frontend"
|
||||||
|
|
||||||
npmtransbundle ${CLONEDIR}/plugintemplate "template"
|
pnpmtransbundle ${CLONEDIR}/plugintemplate "template"
|
||||||
|
|
||||||
printf "Plugin Loader is located at '${CLONEDIR}/pluginloader/'.\n"
|
printf "Plugin Loader is located at '${CLONEDIR}/pluginloader/'.\n"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user