community-scripts / ProxmoxVE

Proxmox VE Helper-Scripts (Community Edition)
https://Helper-Scripts.com
MIT License
5.75k stars 349 forks source link

Zwave JS UI - Syntax error when running Update #583

Open WorldOfGZ opened 2 days ago

WorldOfGZ commented 2 days ago

Please verify that you have read and understood the guidelines.

yes

A clear and concise description of the issue.

Hello,

Just tried to update my zwave LXC using bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/zwave-js-ui.sh)"

The script Show the ascii zwave JS UI and I have this error : Loading... bash: -c: line 83: syntax error near unexpected token}'`

What settings are you currently utilizing?

Which Linux distribution are you employing?

Debian 11

If relevant, including screenshots or a code block can be helpful in clarifying the issue.

image

Please provide detailed steps to reproduce the issue.

No response

MickLesk commented 2 days ago

There is no wrong syntax i think.

Can you try it manually?


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) }')
systemctl stop zwave-js-ui
rm -rf /opt/zwave-js-ui/*
cd /opt/zwave-js-ui
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
systemctl start zwave-js-ui
rm -rf /opt/zwave-js-ui/zwave-js-ui-${RELEASE}-linux.zip
rm -rf /opt/zwave-js-ui/store
WorldOfGZ commented 2 days ago

@MickLesk These lines code process an update without error in console. I see this is updated in UI, but no devices appeare. probably something else wrong, maybe from my side

WorldOfGZ commented 2 days ago

I tried also 2 things now :

MickLesk commented 2 days ago

i check it in a few minutes

WorldOfGZ commented 2 days ago

No emergency. Restore helps a lot in this case :)

WorldOfGZ commented 2 days ago

About my remarks "I see this is updated in UI, but no devices appear" Could it be linked to rm -rf /opt/zwave-js-ui/store ? It seems there are all the settings of my nodes and server here

MickLesk commented 2 days ago

Can you try again?

clear console first / or exit console (cache)

WorldOfGZ commented 2 days ago

The update working, image

But the update erase all the configuration (previous message). UI is like first configuration. image And for example /opt/zwave-js-ui/store/nodes.json is now empty

WorldOfGZ commented 2 days ago

Regarding previous message.

On Tteck script, it remove : rm -rf zwave-js-ui-${RELEASE}-linux.zip zwave-js-ui-linux store The folder store is coming from the extraction of the zip file.

I don't know the reason, but on the current script this is like that :

rm -rf /opt/zwave-js-ui/zwave-js-ui-${RELEASE}-linux.zip
rm -rf /opt/zwave-js-ui/store

This is clearly not the same store which is deleted, and finally all the config is deleted after update

MickLesk commented 2 days ago

ah thats a breaking change. You have the old files now. Its migrated to .env file with new store paths.

You can do following:

  1. Do an Backup of your installation:

    cp /opt/zwave-js-ui /opt/zwave-js-ui_bak
  2. Remove Old Folder & Create new folder

    rm -rf /opt/zwave-js-ui
    mkdir -p /opt/zwave-js-ui
    mkdir -p /opt/zwave_store
  3. Move your old storage files to this path

    cp /opt/zwave-js-ui/store/*  /opt/zwave_store
  4. Enter Main Folder:

    cd /opt/zwave-js-ui
  5. Update Package:

    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) }')
    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
  6. Create .env File:

    cat <<EOF >/opt/.env
    ZWAVEJS_EXTERNAL_CONFIG=/opt/zwave_store/.config-db
    STORE_DIR=/opt/zwave_store
    EOF
  7. Update Service

    nano /etc/systemd/system/zwave-js-ui.service

Check [Service] and add or change missing:

User=root
WorkingDirectory=/opt/zwave-js-ui
ExecStart=/opt/zwave-js-ui/zwave-js-ui-linux
EnvironmentFile=/opt/.env

Check if this works. Then i write an documentation about this

WorldOfGZ commented 2 days ago

Thanks for your help, it seems to be OK now.

Just some additionnal information, if you made a documentation : Point 1, it seems I need arg -r

cp -r /opt/zwave-js-ui /opt/zwave-js-ui_bak

Point 3, I think we need to start from bak directory :

cp -r /opt/zwave-js-ui_bak/store/*  /opt/zwave_store

Just to be sure, I made after an update with the script, and I have no error, and all my config image

MickLesk commented 2 days ago

Fine, then i write tomorrow an documentation for the Migration process. Thx for Feedback 👍