Blinky/configurefs.sh

18 lines
951 B
Bash
Raw Normal View History

2022-08-30 18:47:29 +00:00
#!/bin/bash
2022-08-30 18:53:16 +00:00
while IFS="," read -r curhost curip
2022-08-30 18:47:29 +00:00
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
2022-08-30 19:04:57 +00:00
# Save this image
cp .pio/build/d1_mini/spiffs.bin .pio/build/d1_mini/spiffs_${curhost}.bin
2022-08-30 18:47:29 +00:00
# Upload this image
2022-08-30 19:04:57 +00:00
# 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
2022-08-30 18:47:29 +00:00
# Revert config.json
cp data/homie/config.json.sample data/homie/config.json
done < <(cat lastknownhostips)