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/sentai-test/-t main-jaguar-sentai-prod/g' lmp-device-auto-register 
sed -i 's/sentai-dev/sentai-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="sentai-prod"/TAG="-t main-jaguar-sentai-ext"/g' lmp-device-auto-register 
sed -i 's/TAG="sentai-test"/TAG="-t main-jaguar-sentai-ext"/g' lmp-device-auto-register 
sed -i 's/GROUP="sentai-test/GROUP="sentai-dev"/g' lmp-device-auto-register 
sed -i 's/GROUP="sentai-prod/GROUP="sentai-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