This commit is contained in:
Jan Wachsmuth 2024-01-05 18:22:47 +01:00 committed by GitHub
parent efa78eaefa
commit 667f0ca516
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 112 additions and 7 deletions

View file

@ -34,4 +34,7 @@ The first version on my devices was 4.2.8020 from 2020/02/20 (20th of Feb 2020).
When the device reboots, any changes in ramfs are lost, however there is a way to install a script or command so that it survives a reboot. [Install Persistant Hook](/persistant-hook.md) When the device reboots, any changes in ramfs are lost, however there is a way to install a script or command so that it survives a reboot. [Install Persistant Hook](/persistant-hook.md)
## Download and Prepare Firmware on your own web server ## Download and Prepare Firmware on your own web server
If you have some Linkplay devices I have compiled a list / script with useful commands (mainly curl) to download XML files, images and more for two different versions. It contains a lot of devices with Linkplay A31 module, but may also be a starting point for other Linkplay modules. The script may help you to download and prepare the firmware on your own web server. [Download and prepare Firmware](/download-firmware.md) If you have some Linkplay devices I have compiled a list / script with useful commands (mainly curl) to download XML files, images and more for two different versions. It contains a lot of devices with Linkplay A31 module, but may also be a starting point for other Linkplay modules. The script may help you to download and prepare the firmware on your own web server. [Download and prepare Firmware](/download-firmware.md)
## Allow own shell scripts in cgi-bin
By default the cgi-bin directory is read-only, but there is a way to make it writable to be able to install own shell scripts on the device. See [Allow own shell scripts in cgi-bin](/cgi-bin.md)

View file

@ -438,6 +438,11 @@ ApCliChannel=6
# a similar output will provide # a similar output will provide
ralink_init show 2860 ralink_init show 2860
``` ```
It's even possible to get such an output from remote via build-in shell script (script is located in /etc_ro/web/cgi-bin):
```
curl 'http://10.1.1.52/cgi-bin/ExportSettings.sh'
```
To read a specific variable from NVRAM or modify its value use these commands: To read a specific variable from NVRAM or modify its value use these commands:
``` ```
nvram_get 2860 HostName nvram_get 2860 HostName

52
cgi-bin.md Normal file
View file

@ -0,0 +1,52 @@
# Allow own shell scripts in cgi-bin
By default the cgi-bin directory is read-only, but there is a way to make it writable to be able to install own shell scripts on the device.
Initially I was looking for a way to add a notification message during play of music. There is a binary called ***"smplayer"*** preinstalled on the device that is exactly doing what I was looking for, even with nice fading of the music.
Here's a shell script called ***notice.sh*** that is calling that program:
```
#!/bin/sh
# notice.sh
# play announcement (any music/speech, e.g. mp3)
echo "Content-type: text/html"
echo
echo "Playing ... $WIIMU_play"
export LD_LIBRARY_PATH='/tmp/lib:/system/workdir/lib:'
/system/workdir/bin/smplayer "$WIIMU_play" >/dev/nul
```
The only problem was a way to run it from remote. The build-in webserver ***GoAhead*** does not accept any command line options and is using ***/etc_ro/web/cgi-bin*** by default. There is a way to get around that problem by creating a ***cgi-bin*** subdirectory in ***/etc*** and mount it on ***/etc_ro/web***. Here are the commands to accomplish this:
```
# allow custom shell scripts to be executed from remote via GoAhead webserver.
# make /etc_ro/web/cgi-bin directory writeable by pointing to /etc/web/cgi-bin
# umount just in case this script is executed twice
umount /etc_ro/web/cgi-bin/
# create directory for CGI apps
mkdir /etc/web
mkdir /etc/web/cgi-bin
# download shell script to play notice
# note: you may store the script in flash to avoid any download (e.g. in /vendor/user)
wget -O /etc/web/cgi-bin/notice.sh -T 5 http://10.1.1.22/linkplay/scripts/notice.sh -q
# make shell script executable
chmod 755 /etc/web/cgi-bin/notice.sh
# copy existing files from existing (read-only) CGI directory
cp /etc_ro/web/cgi-bin/upload.cgi /etc/web/cgi-bin/upload.cgi
# mount new (read-write) CGI directory to existing CGI path
mount /etc/web/cgi-bin/ /etc_ro/web/cgi-bin/ -o bind
# add proper library path
export LD_LIBRARY_PATH='/tmp/lib:/system/workdir/lib:'
# optional: play message with new shell script
export WIIMU_play='http://10.1.1.22/linkplay/scripts/Modification_installed.mp3'
/etc_ro/web/cgi-bin/notice.sh
unset WIIMU_play
```
You may add these commands to a persistant hook, see [Install Persistant Hook](/persistant-hook.md) for details.
Now you can play a notice message on the device by calling your script:
```
curl 'http://10.1.1.52/cgi-bin/notice.sh?play=http://10.1.1.22/mp3/SaunaIstAufgeheizt.mp3'
# if you have downloaded any messages to the Linkplay device itself, you play a message from local storage
curl 'http://10.1.1.52/cgi-bin/notice.sh?play=/tmp/SaunaIstAufgeheizt.mp3'
```
> **Note:**
> Meanwhile Arylic has added an API call to play a notification message: ***/httpapi.asp?command=playPromptUrl:<url>***, see https://developer.arylic.com/httpapi/#play-notification-sound for details, but there might be other use cases.

View file

@ -5,12 +5,12 @@ After I had downloaded some firmware files my web server became quite messy, so
/Library/WebServer/Documents/linkplay /Library/WebServer/Documents/linkplay
|-- products-original-2024-01-03.xml # downloaded products.xml file renamed by current date for future use |-- products-original-2024-01-03.xml # downloaded products.xml file renamed by current date for future use
|-- products.xml # crafted file that contains the products I own and the URLs are pointing to this local web server |-- products.xml # crafted file that contains the products I own and the URLs are pointing to this local web server
|-- product.xmls-2024-01-03 # directory for product.xml files with date when the download was done |-- product.xmls-2024-01-03 # directory for specific product.xml files with date when the download was done
| |-- all-products.xml # combined xml files from all products for easier modification | |-- all-products.xml # combined XML file from all product.xml files for easier modification
| |-- product-XXXXX.xml # specific product.xlm files renamed with their product IDs | |-- product-XXXXX.xml # specific product.xlm files renamed with their product IDs
| |-- ... | |-- ...
|-- a31 # subdirectory with all images, binaries and other files for devices with Linkplay A31 module |-- a31 # subdirectories for images, binaries and other files for devices with Linkplay A31 module
| |-- common # common directory for images and other files that are the same for many products | |-- a31rakoit # common directory for images and other files that are the same for many products
| | |-- 20200220 # subdirectory with images and other files named with release date of that version | | |-- 20200220 # subdirectory with images and other files named with release date of that version
| | | |-- a31rakoit_new_uImage_20200220 # kernel image as an example | | | |-- a31rakoit_new_uImage_20200220 # kernel image as an example
| | | +-- ... | | | +-- ...
@ -25,6 +25,7 @@ After I had downloaded some firmware files my web server became quite messy, so
| | |-- product-RP0011_WB60-20220427.xml # modified product.xml file that points to files on this server | | |-- product-RP0011_WB60-20220427.xml # modified product.xml file that points to files on this server
| +-- ... | +-- ...
+-- mp3 # notification messages in mp3 format +-- mp3 # notification messages in mp3 format
+-- scripts # shell scripts for linkplay devices
... ...
``` ```
@ -33,11 +34,55 @@ I've provided shell script that can be used to download products.xml, the specif
- 20220427 - actual version for my Linkplay devices (today is 2024/01/05). - 20220427 - actual version for my Linkplay devices (today is 2024/01/05).
You may only want to download the files that are interesting for you. The shell script contains a lot of commands that should be skipped, but it is easier to start with and it contains the URLs for the OLDER versions of many products. Unfortunately only the latest products.xml and product.xml files are available on the Internet. You may only want to download the files that are interesting for you. The shell script contains a lot of commands that should be skipped, but it is easier to start with and it contains the URLs for the OLDER versions of many products. Unfortunately only the latest products.xml and product.xml files are available on the Internet.
- http://silenceota.linkplay.com/wifi_audio_imageproducts.xml (entry link with list of products with URLs and more) - http://silenceota.linkplay.com/wifi_audio_image/products.xml (entry link with list of products with URLs and more)
- http://ota.rakoit.com/release/RP0011_WB60_S/product.xml (example for one of the product IDs) - http://ota.rakoit.com/release/RP0011_WB60_S/product.xml (example for one of the product IDs)
See shell script for more information [Shell script to download](/download-firmware.sh) See shell script for more information [Shell script to download](/download-firmware.sh)
## Preparation
Create a base directory on your web server, e.g. 'linkplay'. On my Mac mini the base directory for the apache web server is ***/Library/WebServer/Documents***, so I've created
```
mkdir /Library/WebServer/Documents/linkplay
cd /Library/WebServer/Documents/linkplay
```
## 1. Download latest products.xml file
The XML file products.xml contains a list of all products for which downloads are available. The following list contains devices with (mainly) A31 module.
```
curl http://silenceota.linkplay.com/wifi_audio_image/products.xml -o products-original-`date '+%Y-%m-%d'`.xml
```
> NOTE:
> There is a different products list available for devices with (mainly) A28 module (not covered here)
```
curl http://silenceota.linkplay.com/wifi_audio_image/products_v2.xml -o products_v2-original-`date '+%Y-%m-%d'`.xml
```
## 2. Download latest specific product.xml files
You should download the product.xml files for your product (and maybe a few more), because the URLs may alway point to the latest version only. Therefore it may be hard to guess the name for older versions or it's even impossible to download them if the URL stays the same. I recommend to put them into a directory with the (assumed) release date included in the directory name.
It's easy to see that the download URLs are the same for products with the same ***<UUID>***
specific p
for all used products (the following short list contains all products from Rakoit/Arylic only!)
mkdir product.xmls-`date '+%Y-%m-%d'`
cd product.xmls-`date '+%Y-%m-%d'`
You may convert the XML file into 'curl' commands for download by using 'search & replace' with regular expressions in your editor
- Search for: `.*<product>.*\n.*<productid>(.*)</productid>.*\n.*\n.*<UUID>(.*)</UUID>.*\n.*<major-url>(.*)</major-url>.*\n.*`
- Replace with: `curl --create-dirs '$3' -o 'product-$2-$1-20220427.xml'`. (see example 1)
and
- Search for: `.*<product>.*\n.*<productid>(.*)</productid>.*\n.*\n.*<major-url>(.*)</major-url>.*\n.*<UUID>(.*)</UUID>.*\n.*`
- Replace with: `curl --create-dirs '$2' -o 'product-$3-$1-20220427.xml''`.
```
# example 1
curl --create-dirs 'http://ota.rakoit.com/release/UP2STREAM_PRO_V3/product.xml' -o 'product-FF31F09E-UP2STREAM_PRO_V3-20220427.xml'
```
It might be better to to put all ***product.xml*** files into a single directory to be able to combine them or extract the products you need. You may replace the "/" with "-" to
```
curl --create-dirs $3 -o $2/$1/product-$1-original.xml
> NOTE: Don't forget to add read and execute (enter directory) rights for the whole linkplay subdirectories and files at the final end!! > NOTE: Don't forget to add read and execute (enter directory) rights for the whole linkplay subdirectories and files at the final end!!
``` ```
chmod -v -R u=rwx,g=rx,o=rx * chmod -v -R u=rwx,g=rx,o=rx *

View file

@ -6,7 +6,7 @@
mkdir /Library/WebServer/Documents/linkplay mkdir /Library/WebServer/Documents/linkplay
cd /Library/WebServer/Documents/linkplay cd /Library/WebServer/Documents/linkplay
# #
# NOTE: don't forget to add read rights for the whole linkplay subdirectories and files and the final end!! # NOTE: don't forget to add read rights for the whole linkplay subdirectories and files at the final end!!
chmod -v -R u=rwx,g=rx,o=rx * chmod -v -R u=rwx,g=rx,o=rx *
# 1. download products.xml with current date. The list contains devices with (mainly) A31 module # 1. download products.xml with current date. The list contains devices with (mainly) A31 module
curl http://silenceota.linkplay.com/wifi_audio_image/products.xml -o products-original-`date '+%Y-%m-%d'`.xml curl http://silenceota.linkplay.com/wifi_audio_image/products.xml -o products-original-`date '+%Y-%m-%d'`.xml