diff options
| -rw-r--r-- | .github/workflows/build.yml | 4 | ||||
| -rw-r--r-- | backend/browser.py | 6 | ||||
| -rwxr-xr-x | dist/install_prerelease.sh | 42 |
3 files changed, 48 insertions, 4 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24310a2b..fb45ecf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,11 +43,11 @@ jobs: - name: 🛠️ Build run: | - pyinstaller --noconfirm --onefile --name "Decky" --add-data ./backend/static:/static --add-data ./backend/legacy:/legacy ./backend/*.py + pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data ./backend/static:/static --add-data ./backend/legacy:/legacy ./backend/*.py - name: ⬆️ Upload package uses: actions/upload-artifact@v2 with: name: Plugin Loader path: | - ./dist/* + ./dist/PluginLoader diff --git a/backend/browser.py b/backend/browser.py index 6e6963dd..c491f17a 100644 --- a/backend/browser.py +++ b/backend/browser.py @@ -37,7 +37,6 @@ class PluginBrowser: return False zip_file = ZipFile(zip) zip_file.extractall(self.plugin_path) - rename(path.join(self.plugin_path, zip_file.namelist()[0]), path.join(self.plugin_path, name)) Popen(["chown", "-R", "deck:deck", self.plugin_path]) Popen(["chmod", "-R", "555", self.plugin_path]) return True @@ -66,7 +65,10 @@ class PluginBrowser: return web.Response(text="Requested plugin uninstall") async def _install(self, artifact, name, version, hash): - self.uninstall_plugin(name) + try: + await self.uninstall_plugin(name) + except: + self.log.error(f"Plugin {name} not installed, skipping uninstallation") self.log.info(f"Installing {name} (Version: {version})") async with ClientSession() as client: self.log.debug(f"Fetching {artifact}") diff --git a/dist/install_prerelease.sh b/dist/install_prerelease.sh new file mode 100755 index 00000000..5b83c691 --- /dev/null +++ b/dist/install_prerelease.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +[ "$UID" -eq 0 ] || exec sudo "$0" "$@" + +echo "Installing Steam Deck Plugin Loader release..." + +HOMEBREW_FOLDER=/home/deck/homebrew + +# # Create folder structure +rm -rf ${HOMEBREW_FOLDER}/services +sudo -u deck mkdir -p ${HOMEBREW_FOLDER}/services +sudo -u deck mkdir -p ${HOMEBREW_FOLDER}/plugins + +# Download latest release and install it +DOWNLOADURL="$(curl -s 'https://api.github.com/repos/SteamDeckHomebrew/PluginLoader/releases' | jq -r "first(.[] | select(.prerelease == "true"))" | jq -r ".assets[].browser_download_url")" +# printf "DOWNLOADURL=$DOWNLOADURL\n" +curl -L $DOWNLOADURL --output ${HOMEBREW_FOLDER}/services/PluginLoader +chmod +x ${HOMEBREW_FOLDER}/services/PluginLoader + +systemctl --user stop plugin_loader 2> /dev/null +systemctl --user disable plugin_loader 2> /dev/null + +systemctl stop plugin_loader 2> /dev/null +systemctl disable plugin_loader 2> /dev/null +rm -f /etc/systemd/system/plugin_loader.service +cat > /etc/systemd/system/plugin_loader.service <<- EOM +[Unit] +Description=SteamDeck Plugin Loader +[Service] +Type=simple +User=root +Restart=always +ExecStart=/home/deck/homebrew/services/PluginLoader +WorkingDirectory=/home/deck/homebrew/services +Environment=PLUGIN_PATH=/home/deck/homebrew/plugins +Environment=LOG_LEVEL=DEBUG +[Install] +WantedBy=multi-user.target +EOM +systemctl daemon-reload +systemctl start plugin_loader +systemctl enable plugin_loader |
