#!/bin/bash -x
#Purpose 
#http://pi-star:2222

#user: pi-star
#password: raspberry

#Make the root filesystem writable

sudo mount -o remount,rw / ;
	
cd ~
sudo rm -rf STM32F10X_Lib.zip;
sudo rm -rf STM32F10X_Lib;
curl -OL https://www.bi7jta.org/files/MMDVM_Firmware/duplex_M17/STM32F10X_Lib.zip;
curl -OL https://www.bi7jta.org/files/MMDVM_Firmware/duplex_M17/onekeyflash_fw_RPi_M17_Ver1.5.2.sh;
curl -OL https://www.bi7jta.org/files/MMDVM_Firmware/duplex_M17/mmdvm_duplex_f_M17.bin;

sudo unzip STM32F10X_Lib.zip
sudo chmod +x ./STM32F10X_Lib/utils/rpi32/stm32flash;
sudo chmod +x onekeyflash_fw_RPi_M17_Ver1.5.2.sh;
./onekeyflash_fw_RPi_M17_Ver1.5.2.sh;

echo ' If not 100% successful, run again ./onekeyflash_fw_RPi_M17_Ver1.5.2.sh '
