From 19ab3c22edb1bd75549bcd37d7e07494bd7f8120 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Sun, 13 Sep 2020 13:31:43 +0200 Subject: [PATCH] README.md: update and make more user friendly --- README.md | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6ebbb52..2452880 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ HTML/CSS/JavaScript. Checkout the [Demo](https://mwarning.github.io/yet-another- ![image](misc/screenshot.png) -## Run +## Quick Run * Download the sources and change the working directory * Start webserver (e.g. `python3 -m http.server`) @@ -18,24 +18,33 @@ Configure with [config.js](www/config.js). This firmware selector can speak to a [ASU server](https://github.com/aparcar/asu) to build custom images. To enable the feature, the `asu_url` option in the config.js needs to be set. -## Update Database +## Installation -The `overview.json` files are based on JSON files created by OpenWrt -(master): `Global build settings ---> [*] Create JSON info files per build -image`. +Place the `www/` folder somewhere web accessible. Then use the `collect.py` script to update the `config.json` file: -A [Python script](misc/collect.py) is included to merge the JSON files into a single overview.json: ``` -./collect.py merge bin/ --download-url 'https://downloads.openwrt.org/releases/{version}/targets/{target}' > overview.json +./misc/collect.py scan "https://firmware.example.com/{version}/targets/{target}" ~/openwrt/bin/ www/ ``` -If you want to scrape the OpenWrt download website and update the config.js: +This should do it. + +The https link is used to access image files. `{version}` will be replaced by the name of the release, e.g. `19.07.4`. `{taget}` will be replaced by the main- and sub target, e.g. `ath79/generic`. + +The `collect.py` script searches the `~/openwrt/bin/` directory for `profile.json` files. These are merged into `overview.json` files (one per release). The `overview.json` files are then placed into `www/data/` and `www/config.js` is updated. + +To let OpenWrt create `profile.json` files, enable the build setting (`make menuconfig`): +`Global build settings ---> [*] Create JSON info files per build image`. + +If the option is not available (OpenWrt 18.06 or 19.07.3), apply commit [openwrt/openwrt@881ed09](https://github.com/openwrt/openwrt/commit/881ed09ee6e23f6c224184bb7493253c4624fb9f). + +### Scrape + +If you want to scrape the OpenWrt download website and update the `config.js`: + ``` -./collect.py scrape https://downloads.openwrt.org /var/www/firmware_selector +./collect.py --download-url "https://firmware.example.com/{version}/targets/{target}" scrape https://downloads.openwrt.org /var/www/firmware_selector ``` -For the OpenWrt 18.06 and 19.07 releases, you need to patch OpenWrt to output JSON files for collect.py (commit [openwrt/openwrt@881ed09](https://github.com/openwrt/openwrt/commit/881ed09ee6e23f6c224184bb7493253c4624fb9f)). - ## Similar Projects - [Gluon Firmware Selector](https://github.com/freifunk-darmstadt/gluon-firmware-selector): Original source of this project for images generated by [Gluon](https://github.com/freifunk-gluon/), now with pictures. -- 2.30.2