2023-03-23 00:48:20 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2025-01-01 12:37:29 +00:00
|
|
|
# Copyright (c) 2021-2025 tteck
|
2023-03-23 00:48:20 +00:00
|
|
|
# Author: tteck (tteckster)
|
|
|
|
# License: MIT
|
2024-11-02 07:48:05 +00:00
|
|
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
2023-03-23 00:48:20 +00:00
|
|
|
|
|
|
|
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
|
|
|
color
|
|
|
|
verb_ip6
|
|
|
|
catch_errors
|
|
|
|
setting_up_container
|
|
|
|
network_check
|
|
|
|
update_os
|
|
|
|
|
|
|
|
msg_info "Installing Dependencies"
|
2024-11-28 04:48:58 +00:00
|
|
|
$STD apt-get install -y \
|
|
|
|
curl \
|
|
|
|
sudo \
|
|
|
|
mc
|
2023-03-23 00:48:20 +00:00
|
|
|
msg_ok "Installed Dependencies"
|
|
|
|
|
|
|
|
msg_info "Installing Z-Wave JS UI"
|
2024-11-28 04:48:58 +00:00
|
|
|
mkdir -p /opt/zwave-js-ui
|
|
|
|
mkdir -p /opt/zwave_store
|
2023-03-23 00:48:20 +00:00
|
|
|
cd /opt/zwave-js-ui
|
|
|
|
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) }')
|
2024-11-28 04:48:58 +00:00
|
|
|
wget -q https://github.com/zwave-js/zwave-js-ui/releases/download/${RELEASE}/zwave-js-ui-${RELEASE}-linux.zip
|
|
|
|
unzip -q zwave-js-ui-${RELEASE}-linux.zip
|
|
|
|
cat <<EOF >/opt/.env
|
|
|
|
ZWAVEJS_EXTERNAL_CONFIG=/opt/zwave_store/.config-db
|
|
|
|
STORE_DIR=/opt/zwave_store
|
|
|
|
EOF
|
|
|
|
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
2023-03-23 00:48:20 +00:00
|
|
|
msg_ok "Installed Z-Wave JS UI"
|
|
|
|
|
|
|
|
msg_info "Creating Service"
|
2024-11-28 04:48:58 +00:00
|
|
|
cat <<EOF > /etc/systemd/system/zwave-js-ui.service
|
|
|
|
[Unit]
|
2023-03-23 00:48:20 +00:00
|
|
|
Description=zwave-js-ui
|
|
|
|
Wants=network-online.target
|
|
|
|
After=network-online.target
|
2024-11-28 04:48:58 +00:00
|
|
|
|
2023-03-23 00:48:20 +00:00
|
|
|
[Service]
|
|
|
|
User=root
|
|
|
|
WorkingDirectory=/opt/zwave-js-ui
|
2023-12-02 00:03:26 +00:00
|
|
|
ExecStart=/opt/zwave-js-ui/zwave-js-ui-linux
|
2024-11-28 04:48:58 +00:00
|
|
|
EnvironmentFile=/opt/.env
|
|
|
|
|
2023-03-23 00:48:20 +00:00
|
|
|
[Install]
|
2024-11-28 04:48:58 +00:00
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
|
|
|
systemctl enable -q --now zwave-js-ui
|
2023-03-23 00:48:20 +00:00
|
|
|
msg_ok "Created Service"
|
|
|
|
|
|
|
|
motd_ssh
|
2023-05-15 11:39:30 +00:00
|
|
|
customize
|
2023-03-23 00:48:20 +00:00
|
|
|
|
|
|
|
msg_info "Cleaning up"
|
|
|
|
rm zwave-js-ui-${RELEASE}-linux.zip
|
2024-06-02 12:00:22 +00:00
|
|
|
$STD apt-get -y autoremove
|
|
|
|
$STD apt-get -y autoclean
|
2023-03-23 00:48:20 +00:00
|
|
|
msg_ok "Cleaned"
|