# Stop running client /opt/gd/gd-client.sh stop # Download image from artemis server CLIENT=cim cd /root rm -rf cp3-embedded-os-image.zip SERVICE_URL=`grep "ServiceUrl" /etc/general-devices/artemis/$CLIENT-client/settings.json | sed 's/.*\/\/\(.*\)".*/\1/'` API_KEY=`grep "ApiKey" /etc/general-devices/artemis/$CLIENT-client/settings.json | sed 's/.*:.*"\(.*\)".*/\1/'` wget --no-check-certificate --method GET --timeout=0 --header "X-Api-Key: $API_KEY" "https://$SERVICE_URL/api/updates/EmbeddedOsImage/cp3-embedded-os-image.zip" # Extract FILE="cp3-embedded-os-image" unzip -j -o /root/${FILE}.zip sdcard.img -d /root cp /root/${FILE}.zip /mnt/data/ cp /root/sdcard.img /mnt/data/ unzip -j -o /root/${FILE}.zip emmc-updater.run -d /mnt/data/ rm -rf /root/${FILE}.zip /etc/init.d/S94mount-sd-card stop /boot/flash_image_to_sd_card.sh /root/sdcard.img # Cleanup rm -rf /root/sdcard.img # Flash EMMC /etc/init.d/S94mount-sd-card start cp /mnt/data/emmc-updater.run /opt/update/run/ reboot