deconz-install.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. msg_ok "Installed Dependencies"
  18. msg_info "Setting Phoscon Repository"
  19. VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
  20. curl -fsSL http://phoscon.de/apt/deconz.pub.key >/etc/apt/trusted.gpg.d/deconz.pub.asc
  21. echo "deb [arch=amd64] http://phoscon.de/apt/deconz $VERSION main" >/etc/apt/sources.list.d/deconz.list
  22. msg_ok "Setup Phoscon Repository"
  23. msg_info "Installing deConz"
  24. wget -qL http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
  25. $STD dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
  26. $STD apt-get update
  27. $STD apt-get install -y deconz
  28. msg_ok "Installed deConz"
  29. msg_info "Creating Service"
  30. cat <<EOF >/lib/systemd/system/deconz.service
  31. [Unit]
  32. Description=deCONZ: ZigBee gateway -- REST API
  33. Wants=deconz-init.service deconz-update.service
  34. StartLimitIntervalSec=0
  35. [Service]
  36. User=root
  37. ExecStart=/usr/bin/deCONZ -platform minimal --http-port=80
  38. Restart=on-failure
  39. RestartSec=30
  40. AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME
  41. [Install]
  42. WantedBy=multi-user.target
  43. EOF
  44. systemctl enable -q --now deconz
  45. msg_ok "Created Service"
  46. motd_ssh
  47. customize
  48. msg_info "Cleaning up"
  49. rm -rf libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
  50. $STD apt-get autoremove
  51. $STD apt-get autoclean
  52. msg_ok "Cleaned"