Moving between Production and Development builds - DynamicDevices/meta-dynamicdevices GitHub Wiki

I have a couple of scripts here which are a work in progress but seem to move between production and development by re-registering

  • you need to have removed the device from the Foundries portal before you do this
  • you can end up in a situation where it won't enable the Wireguard VPN as it says there's no public key. Rebooting seems to sort this out

go-prod.sh

#!/bin/sh

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

cp /usr/bin/lmp-device-auto-register .

# Change over to prod group
sed -i 's/edge-ai-test/-t main-edge-ai-prod/g' lmp-device-auto-register 
sed -i 's/edge-ai-dev/edge-ai-prod/g' lmp-device-auto-register 
# Register in prod mode
sed -i 's/-g ${GROUP}/-p 1 -g ${GROUP}/g' lmp-device-auto-register 

# Stop aktualizr-lite
systemctl stop aktualizr-lite

# Reset credentials
rm -Rf /var/sota
mkdir /var/sota

# Kick off custom registration
./lmp-device-auto-register

# Reboot (seem to need this for VPN key)
reboot

go-dev.sh

#!/bin/sh

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

cp /usr/bin/lmp-device-auto-register .

# Change over to ext group
sed -i 's/TAG="edge-ai-prod"/TAG="-t main-edge-ai-ext"/g' lmp-device-auto-register 
sed -i 's/TAG="edge-ai-test"/TAG="-t main-edge-ai-ext"/g' lmp-device-auto-register 
sed -i 's/GROUP="edge-ai-test/GROUP="edge-ai-dev"/g' lmp-device-auto-register 
sed -i 's/GROUP="edge-ai-prod/GROUP="edge-ai-dev"/g' lmp-device-auto-register 
# Register in dev mode
sed -i 's/-p 1/-p 0/g' lmp-device-auto-register 

# Stop aktualizr-lite
systemctl stop aktualizr-lite

# Reset credentials
rm -Rf /var/sota
mkdir /var/sota

# Kick off custom registration
./lmp-device-auto-register