zwave-js-ui.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/usr/bin/env bash
  2. source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
  3. # Copyright (c) 2021-2023 tteck
  4. # Author: tteck (tteckster)
  5. # License: MIT
  6. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  7. function header_info {
  8. clear
  9. cat <<"EOF"
  10. _____ _______ __ ______
  11. /__ /_ ______ __ _____ / / ___/ / / / / _/
  12. / /| | /| / / __ `/ | / / _ \ __ / /\__ \ / / / // /
  13. / /_| |/ |/ / /_/ /| |/ / __/ / /_/ /___/ / / /_/ // /
  14. /____/__/|__/\__,_/ |___/\___/ \____//____/ \____/___/
  15. EOF
  16. }
  17. header_info
  18. echo -e "Loading..."
  19. APP="Zwave-JS-UI"
  20. var_disk="4"
  21. var_cpu="2"
  22. var_ram="1024"
  23. var_os="debian"
  24. var_version="12"
  25. variables
  26. color
  27. catch_errors
  28. function default_settings() {
  29. CT_TYPE="0"
  30. PW=""
  31. CT_ID=$NEXTID
  32. HN=$NSAPP
  33. DISK_SIZE="$var_disk"
  34. CORE_COUNT="$var_cpu"
  35. RAM_SIZE="$var_ram"
  36. BRG="vmbr0"
  37. NET="dhcp"
  38. GATE=""
  39. DISABLEIP6="no"
  40. MTU=""
  41. SD=""
  42. NS=""
  43. MAC=""
  44. VLAN=""
  45. SSH="no"
  46. VERB="no"
  47. echo_default
  48. }
  49. function update_script() {
  50. header_info
  51. if [[ ! -d /opt/zwave-js-ui ]]; then
  52. msg_error "No ${APP} Installation Found!"
  53. exit
  54. fi
  55. RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
  56. msg_info "Stopping Z-wave JS UI"
  57. systemctl stop zwave-js-ui.service
  58. msg_ok "Stopped Z-wave JS UI"
  59. msg_info "Updating Z-wave JS UI"
  60. wget https://github.com/zwave-js/zwave-js-ui/releases/download/${RELEASE}/zwave-js-ui-${RELEASE}-linux.zip &>/dev/null
  61. unzip zwave-js-ui-${RELEASE}-linux.zip &>/dev/null
  62. \cp -R zwave-js-ui /opt/zwave-js-ui
  63. service_path="/etc/systemd/system/zwave-js-ui.service"
  64. echo "[Unit]
  65. Description=zwave-js-ui
  66. Wants=network-online.target
  67. After=network-online.target
  68. [Service]
  69. User=root
  70. WorkingDirectory=/opt/zwave-js-ui
  71. ExecStart=/opt/zwave-js-ui/zwave-js-ui
  72. [Install]
  73. WantedBy=multi-user.target" >$service_path
  74. msg_ok "Updated Z-wave JS UI"
  75. msg_info "Starting Z-wave JS UI"
  76. systemctl enable --now zwave-js-ui.service
  77. msg_ok "Started Z-wave JS UI"
  78. msg_info "Cleanup"
  79. rm -rf zwave-js-ui-${RELEASE}-linux.zip zwave-js-ui-linux store
  80. msg_ok "Cleaned"
  81. msg_ok "Updated Successfully!\n"
  82. exit
  83. }
  84. start
  85. build_container
  86. description
  87. echo -e "${APP} should be reachable by going to the following URL.
  88. ${BL}http://${IP}:8091${CL} \n"