prepare-plug-zui-store 640 B

12345678910111213141516171819
  1. #!/usr/bin/env bash
  2. export DAEMONIZED=1
  3. source $SNAP/helper/functions
  4. RAND="$(cat /dev/urandom | LC_ALL=C tr -dc '0-9A-F' | fold -w 32 | head -n 1)"
  5. snapctl set transfer="${RAND}"
  6. snapctl set :zui-store z2mrand="${RAND}"
  7. lprint "Transfer random: ${RAND}"
  8. SNAP_CONFIG="$(snapctl get -d server mqtt session transfer)"
  9. snapctl set :zui-store z2mconfig="${SNAP_CONFIG}"
  10. lprint "Export snap config over plug connection: ${SNAP_CONFIG}"
  11. USING_SERIAL="$(snapctl is-connected serial-port && echo 1 || echo 0)"
  12. snapctl set :zui-store z2mserial="${USING_SERIAL}"
  13. lprint "Share serial-port plug be used (${USING_SERIAL}) over plug connection."