install 658 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. set -e
  3. if [ -f "${SNAP_DATA}/settings.conf" ]; then
  4. logger "Already copied ${SNAP}/settings.conf to ${SNAP_DATA}/settings.conf"
  5. exit 0
  6. fi
  7. logger "Copying ${SNAP}/settings.conf to ${SNAP_DATA}/settings.conf"
  8. cp "${SNAP}/settings.conf" "${SNAP_DATA}/settings.conf"
  9. if [ $? -ne 0 ]; then
  10. logger "Failed moving settings.conf!"
  11. exit 1
  12. else
  13. logger "Moved settings.conf successfully!"
  14. fi
  15. logger "Read initial settings to snap"
  16. $SNAP/bin/update-settings "${SNAP_DATA}/settings.conf" "install" | while read LINE; do
  17. logger "${LINE}"
  18. snapctl set "${LINE}"
  19. done
  20. logger "Settings set. See 'snap get ${SNAP_NAME} -l'"