diff --git a/.gitignore b/.gitignore index 2325683..b172f3d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ docs/.sass-cache/ .remote-sync.json .history .vscode +*.bak diff --git a/core/class/zwavejs.class.php b/core/class/zwavejs.class.php index 228f148..72fa460 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 2014084..03fe4e2 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 7e7ffff..dbf47cc 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 73a3845..cf1aaac 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 [ -n "${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" -