Skip to content

Commit

Permalink
First commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
theypsilon committed Sep 14, 2021
0 parents commit 79a2e68
Show file tree
Hide file tree
Showing 71 changed files with 4,177 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
12 changes: 12 additions & 0 deletions .github/pack_launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Copyright (c) 2021 José Manuel Barroso Galindo <[email protected]>

set -euo pipefail

if ! gh release list | grep -q "latest" ; then
gh release create "latest" || true
sleep 15s
fi

zip "MiSTer_Downloader.zip" downloader.sh
gh release upload "latest" "MiSTer_Downloader.zip" --clobber
24 changes: 24 additions & 0 deletions .github/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Copyright (c) 2021 José Manuel Barroso Galindo <[email protected]>

set -euo pipefail

git add dont_download.sh
git commit -m "BOT: New dont_download.sh" > /dev/null 2>&1 || true
git fetch origin main

set +e
CHANGES="$(git diff main:dont_download.sh origin/main:dont_download.sh | sed '/^[+-]export COMMIT/d' | sed '/^+++/d' | sed '/^---/d' | grep '^[+-]' | wc -l)"
set -e

if [ ${CHANGES} -ge 1 ] ; then
echo "There are changes to push."
echo
git push origin main
echo
echo "New dont_download.sh can be used."
echo "::set-output name=NEW_RELEASE::yes"
else
echo "Nothing to be updated."
echo "::set-output name=NEW_RELEASE::no"
fi
31 changes: 31 additions & 0 deletions .github/workflows/all_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: All Tests

on:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-20.04

steps:
- name: Install sharutils
run: sudo apt-get install sharutils

- uses: actions/setup-python@v2
with:
python-version: '3.5'

- uses: actions/checkout@v2

- name: Unit Tests
run: cd src && python3 -m unittest discover -s test/unit

- name: Integration Tests
run: cd src && python3 -m unittest discover -s test/integration

- name: System Quick Tests
run: cd src && python3 -m unittest discover -s test/system/quick

- name: System Slow Tests
run: cd src && python3 -m unittest discover -s test/system/slow
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on: push

jobs:
build:
runs-on: ubuntu-20.04

steps:
- name: Install sharutils
run: sudo apt-get install sharutils

- uses: actions/setup-python@v2
with:
python-version: '3.5'

- uses: actions/checkout@v2

- name: Unit Tests
run: cd src && python3 -m unittest discover -s test/unit

- name: Integration Tests
run: cd src && python3 -m unittest discover -s test/integration

- name: System Quick Tests
run: cd src && python3 -m unittest discover -s test/system/quick

- name: Build
run: ./src/build.sh > dont_download.sh

- name: Release
id: release
run: |
git config --global user.email "[email protected]"
git config --global user.name "The CI/CD Bot"
./.github/release.sh
- name: System Slow Tests
if: steps.release.outputs.NEW_RELEASE == 'yes'
run: cd src && python3 -m unittest discover -s test/system/slow
20 changes: 20 additions & 0 deletions .github/workflows/pack_launcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pack Launcher

on:
push:
paths:
- 'downloader.sh'
workflow_dispatch:

jobs:
pack:
runs-on: ubuntu-20.04

steps:

- uses: actions/checkout@v2

- name: Pack Launcher
run: ./.github/pack_launcher.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
venv
__pycache__
mister.ip
dont_download.ini
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# MiSTer Downloader

This tool installs and **updates all the cores** and other extra files for your *MiSTer*. It also updates the menu core, the MiSTer firmware and the Linux system. The source for all downloads is the [MiSTer Distribution](https://github.com/MiSTer-devel/Distribution_MiSTer) repository.

The **MiSTer Downloader** is a substitute for the [MiSTer Updater](https://github.com/MiSTer-devel/Updater_script_MiSTer), and is meant to offer a more safe and robust experience, while being much faster.

As a drawback, the **Downloader** is not backwards compatible with the old INI files that were configured for the [MiSTer Updater](https://github.com/MiSTer-devel/Updater_script_MiSTer). In fact, as of today, this tool doesn't implement many fine-grained features that allow you to customize the updating process in depth. In case you value these features, consider to keep using the [MiSTer Updater](https://github.com/MiSTer-devel/Updater_script_MiSTer) as usual. Both tools will coexist in the near future.

### Setup and Usage

Download this [ZIP file](https://github.com/MiSTer-devel/Downloader_MiSTer/releases/download/latest/MiSTer_Downloader.zip) and extract `downloader.sh` to your `/Scripts` folder on your primary SD card (create that folder if it doesn't exist). You only need to perform this operation once, since this tool self-updates itself.

To use it, on your MiSTer main menu, go to the *Scripts* screen, and select `downloader`.

### Options

You may create a `downloader.ini` file to tweak some parameters.

Here you can see the default parameters and the options that you may change:

```ini
[MiSTer]
; base_path is where most files will be installed
; Useful for setups with USB storage, for example: '/media/usb0/'
base_path = '/media/fat/'

; base_system_path is where system files such as 'MiSTer' and 'menu.rbf' will be installed.
; Warning: It is recommended to NOT change this setting regardless of your setup.
base_system_path = '/media/fat/'

; allow_delete options:
; 0 -> Don't allow this tool to delete anything at all.
; 1 -> Allow this tool to delete any old file from previous updates.
; 2 -> Allow this tool to delete only old cores that receive a new version.
allow_delete = 1

; allow_reboot options:
; 0 -> Don't allow this tool to ever reboot automatically.
; 1 -> Allow this tool to reboot the system after any system file has been updated.
; 2 -> Allow this tool to reboot the system only after Linux has been updated.
allow_reboot = 1

; update_linux options:
; true -> Updates Linux when there is a new update (very recommended).
; false -> Doesn't update Linux.
update_linux = true

; parallel_update options:
; true -> Tries to more than one file simultaneously.
; false -> Will only download one file at a time.
parallel_update = true

; downloader_timeout: Can be tweaked to increase the timeout time in seconds
; It is useful to increase this value for users with slow connections.
downloader_timeout = 300

; downloader_retries: Can be tweaked to increase the retries per failed download
; It is useful to increase this value for users with very unstable connections.
downloader_retries = 3
```

### Roadmap

- [x] Initial Release
- [ ] [Cheats](https://gamehacking.org/mister/) fetching
- [ ] First-run optimisations
- [ ] Configurable custom download filters
- [ ] Handle duplicated `games` folders through symlinks (*GBA* <-> *GBA2P*, and *GAMEBOY* <-> *GAMEBOY2P*)
- [ ] Integration with *MiSTer* binary
Loading

0 comments on commit 79a2e68

Please sign in to comment.