From 15311867a4fc07abf62080f7569d833e6abbbcfc Mon Sep 17 00:00:00 2001 From: Aegis940 <76250825+Aegis940@users.noreply.github.com> Date: Fri, 27 Dec 2024 12:54:41 +0100 Subject: [PATCH 1/3] Add the choice of Zwave-js version --- core/class/zwavejs.class.php | 11 +++++++++++ plugin_info/configuration.php | 11 +++++++++++ resources/post_install.sh | 2 +- resources/pre_install.sh | 9 ++++++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/core/class/zwavejs.class.php b/core/class/zwavejs.class.php index dcd8804d..09460b93 100644 --- a/core/class/zwavejs.class.php +++ b/core/class/zwavejs.class.php @@ -228,6 +228,17 @@ public static function configureSettings($_path) { file_put_contents($file, json_encode($settings, JSON_FORCE_OBJECT)); } + public static function postConfig_wanted_zwavejs_version($_value = null) { + if($_value == null || trim($_value) == null){ + if(file_exists(__DIR__.'/../../data/wanted_zwavejs_version')){ + unlink(__DIR__.'/../../data/wanted_zwavejs_version'); + } + } else{ + $_value = preg_replace('/v*(\d+\.\d+\.\d+)/', "$1", $_value, 1); + file_put_contents(__DIR__.'/../../data/wanted_zwavejs_version', $_value); + } + } + public static function addFileEvent($_file, $_data) { $status_path = dirname(__FILE__) . '/../../data/status'; if (!is_dir($status_path)) { diff --git a/plugin_info/configuration.php b/plugin_info/configuration.php index 8780452e..67a6ae04 100644 --- a/plugin_info/configuration.php +++ b/plugin_info/configuration.php @@ -108,6 +108,17 @@
+ +
+ +
+
+ {{Liste des versions}} +
+
+
diff --git a/resources/post_install.sh b/resources/post_install.sh index 7e7ffffd..dbf47cca 100644 --- a/resources/post_install.sh +++ b/resources/post_install.sh @@ -36,4 +36,4 @@ then echo "And reboot your Raspberry Pi" fi fi -echo "Everything is successfully installed!" \ No newline at end of file +echo "Everything is successfully installed!" diff --git a/resources/pre_install.sh b/resources/pre_install.sh index 73a38457..c9b01c10 100644 --- a/resources/pre_install.sh +++ b/resources/pre_install.sh @@ -7,8 +7,15 @@ BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) cd $BASEDIR source ../core/config/zwavejs.config.ini &> /dev/null + +if [ -f "${BASEDIR}/../data/wanted_zwavejs_version" ]; then + wanted_zwavejs_version=$(cat "${BASEDIR}/../data/wanted_zwavejs_version") + if [ ! -z "${wanted_zwavejs_version}" ];then + $wantedVersion = $wanted_zwavejs_version + fi +fi + echo "Wanted Version: $wantedVersion" rm -R zwave-js-ui git clone --branch v$wantedVersion --depth 1 https://github.com/zwave-js/zwave-js-ui echo "Pre install finished" - From f627f6873de5e85c6eac5d6f60a72b0a71de54de Mon Sep 17 00:00:00 2001 From: Aegis940 <76250825+Aegis940@users.noreply.github.com> Date: Sat, 20 Sep 2025 20:37:43 +0200 Subject: [PATCH 2/3] Update pre_install.sh --- resources/pre_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/pre_install.sh b/resources/pre_install.sh index c9b01c10..cf1aaac3 100644 --- a/resources/pre_install.sh +++ b/resources/pre_install.sh @@ -10,8 +10,8 @@ source ../core/config/zwavejs.config.ini &> /dev/null if [ -f "${BASEDIR}/../data/wanted_zwavejs_version" ]; then wanted_zwavejs_version=$(cat "${BASEDIR}/../data/wanted_zwavejs_version") - if [ ! -z "${wanted_zwavejs_version}" ];then - $wantedVersion = $wanted_zwavejs_version + if [ -n "${wanted_zwavejs_version}" ];then + wantedVersion=$wanted_zwavejs_version fi fi From b5d6f76391f4801b44e8d451d1032b89cacdbccf Mon Sep 17 00:00:00 2001 From: Aegis940 <76250825+Aegis940@users.noreply.github.com> Date: Sat, 20 Sep 2025 20:38:06 +0200 Subject: [PATCH 3/3] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 23256835..b172f3dc 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ docs/.sass-cache/ .remote-sync.json .history .vscode +*.bak