Important
This is now in a better place, amongst the trash code pile. I don't have the time nor the effort to clean this up right now. Maybe some day.
I wrote this because I was tired of the process of updating my custom firmware and homebrew packages. Going through the process of getting everything together, unpacking, and making the changes that are tailor-made to my specific needs felt kind of meh to me, so I was looking for an AIO solution, but even then they were never quite what I was looking for. The general idea of this is to add the cfw/homebrew to your sources list, and then define a set of "cleanup" tasks to be done to the files before packaging them.
The files are downloaded to /downloads/input
, and then extracted/moved to /downloads/output
, the cleanup tasks (which you can define in the tasks tab following the instructions below) are basically four simple commands to manipulate the files within the output folder.
The commands are move
, rename
, copy
, delete
.
You can run the program without a GitHub token, but I highly suggest you get one using the instructions here. This is to prevent running into any rate limit issues.
- Download Management: Initiate the download of files from configured GitHub sources.
- Cleanup Management: Perform post-download tasks on the files.
- Packaging: Package the downloaded files into a single zip archive.
- Scheduler: Automatically check for updates since the source was added.
- Python 3.11
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/HenryBaby/switchblend.git cd switchblend
-
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # on Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Set up environment variables:
Create a
.env
file in the root directory and add your GitHub token:GITHUB_TOKEN=your_github_token
-
Run the Flask application:
python app.py
-
Access the application at
http://localhost:5000
.
-
Clone the repository:
git clone https://github.com/HenryBaby/switchblend.git cd switchblend
-
Create a
.env
file in the root directory and add your environment variables:TZ=your_timezone (i.e Europe/Stockholm) GITHUB_TOKEN=your_github_token UPDATE_INTERVAL=interval_in_minutes
-
Build and run the Docker container using Docker Compose:
docker compose up -d
-
Access the application at
http://docker_host_ip:5000
.
Create a file named docker-compose.yml
and another file named .env
with the following content:
-
docker-compose.yml:
volumes: switchblend_arch: name: switchblend_arch # Optional switchblend_conf: name: switchblend_conf # Optional services: switchblend: image: henrybaby/switchblend container_name: switchblend environment: - TZ=${TZ} - GITHUB_TOKEN=${GITHUB_TOKEN} - UPDATE_INTERVAL=${UPDATE_INTERVAL} ports: - 5000:5000 volumes: - switchblend_arch:/app/downloads:rw # Optional - switchblend_conf:/app/config:rw # Optional restart: unless-stopped
-
.env:
TZ=your_timezone (i.e Europe/Stockholm) GITHUB_TOKEN=your_github_token UPDATE_INTERVAL=interval_in_minutes
Manage sources by adding or removing GitHub URLs. This can be done through the Sources page in the web interface.
- Navigate to the Sources page.
- Add a new source by providing the project name and GitHub API URL, it should be specified like so:
https://api.github.com/repos/USER_NAME/REPO_NAME/releases?per_page=1&sort=created&order=desc
- Delete a source by clicking the delete button next to the source entry.
Manage tasks for file operations such as delete, move, copy, and rename.
- Navigate to the Tasks page.
- Add a new task by selecting the command and specifying the source and destination paths. The source path
/downloads/input
is already hardcoded into the program. - Delete a task by clicking the delete button next to the task entry.
Each task consists of a command and source and destination paths. The following commands are available:
-
delete
: Deletes the specified file or directory.delete file_or_directory
-
move
: Moves the specified file or directory to a new location.move file_or_directory /path/to/destination
-
copy
: Copies the specified file or directory to a new location.copy file_or_directory /path/to/destination
-
rename
: Renames the specified file or directory.rename file_or_directory /path/to/new_name
The web gui displays the list of added sources, their last updated times, and indicates if any updates are available.
Trigger the download process manually by clicking the Download button in the navigation bar. This will download files from the configured sources and reset the update status.
Trigger the cleanup process manually by clicking the Cleanup button in the navigation bar. You can also choose to clear the input directory by checking the corresponding checkbox before running the cleanup.
Trigger the packaging process manually by clicking the Package button in the navigation bar. This will package the contents of the downloads/output/
directory into a zip archive.
Planned feature, in no particular order.
- Support for uploading directly to switch.
- Support for other sources than just GitHub API
(currently does support .zip file downloads directly but it's a bit wonky, so stay away from it until a proper release). - Profile-based management (switch specific sources/tasks.json for people with multiple switch units).
- Add indicators to show the download/cleanup progress.
- Extend some of the functionality to env parameters, like the update scanner interval.
- Multi-arch docker image: (Currently only supports
linux/arm64
).