18 lines
951 B
Bash
18 lines
951 B
Bash
#!/bin/bash
|
|
while IFS="," read -r curhost curip
|
|
do
|
|
echo "Host ${curhost} and IP ${curip}"
|
|
cp data/homie/config.json data/homie/config.json.sample
|
|
sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
|
|
sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
|
|
sed -i "s/HOSTNAME/${curhost}/g" data/homie/config.json
|
|
sed -i "s/HOSTNAME/${curhost}/g" data/homie/config.json
|
|
# Build image with these parameters
|
|
platformio run --target buildfs --environment d1_mini
|
|
# Save this image
|
|
cp .pio/build/d1_mini/spiffs.bin .pio/build/d1_mini/spiffs_${curhost}.bin
|
|
# Upload this image
|
|
# curl --insecure --no-progress-meter --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$curip" --form spiffs=@.pio/build/d1_mini/spiffs.bin --no-buffer
|
|
# Revert config.json
|
|
cp data/homie/config.json.sample data/homie/config.json
|
|
done < <(cat lastknownhostips) |