From d8b541d06f979ca271785f191e19d8c3258a8224 Mon Sep 17 00:00:00 2001 From: Ethan Dye Date: Sat, 23 Nov 2024 20:20:10 -0700 Subject: [PATCH] Remove legacy openHAB2 support (#1926) * Remove legacy openHAB2 support * Remove migration support and update docs * Remove extra argument to openhab_setup Signed-off-by: Ethan Dye --- NEWS.md | 9 ++- docs/CHANGELOG.md | 6 +- docs/openhabian.md | 51 +++++++-------- functions/helpers.bash | 2 - functions/menu.bash | 30 ++++----- functions/openhab.bash | 19 ++---- functions/openhabian.bash | 119 ---------------------------------- includes/generic/bash_profile | 4 +- openhabian-setup.sh | 2 +- 9 files changed, 54 insertions(+), 188 deletions(-) diff --git a/NEWS.md b/NEWS.md index e702fd99e..c7e474350 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,10 @@ Hit tab to unselect buttons and scroll through the text using UP/DOWN or PGUP/PGDN. All announcements are stored in `/opt/openhabian/docs/CHANGELOG.md` for you to lookup. +## Legacy openHAB 2 support removed ## December XX, 2024 +We have removed legacy support for the openHAB 2 systems. Please upgrade to +the latest version of openHAB to receive further support. + ## openHABian 1.9 released based on Debian 12 bookworm ## March 13, 2024 We stepped up to latest Debian Linux release. The openHABian image for RPis uses Raspberry Pi OS (lite) and we finally managed to switch over to latest @@ -11,8 +15,3 @@ If you run a bullseye (Debian 11) or even older distribution, please read the docs how to reinstall. It's safer to reinstall (and import your old config, of course) than to attempt doing a dist-upgrade. See also the OH4 migration FAQ on the forum. - -## Raspberry Pi 5 support ## March 13, 2024 -Support for the new Raspberry Pi 5 is also included as part of the bookworm update. -Please note that while a RPi5 has new HW features such as PCI-E SSD, nothing has -changed about peripheral support in openHABian, unsupported parts may work or not. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9336ae67e..920bf08c5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,7 @@ +## Legacy openHAB 2 support removed ## December XX, 2024 +We have removed legacy support for the openHAB 2 systems. Please upgrade to +the latest version of openHAB to receive further support. + ## openHABian 1.9 released based on Debian 12 bookworm ## March 13, 2024 We stepped up to latest Debian Linux release. The openHABian image for RPis uses Raspberry Pi OS (lite) and we finally managed to switch over to latest RaspiOS @@ -51,7 +55,7 @@ image to an SD card. ## Zigbee2MQTT ## April 17, 2022 Zigbee2MQTT enables to connect a Zigbee-Network via MQTT. Zigbee2MQTT supports a huge number of devices, even many brands with non-standard zigbee- -implementations. It provides a web-based configuration interface and a +implementations. It provides a web-based configuration interface and a graphical view of the zigbee topology. ## Electric Vehicle Charge Controller ## April 6, 2022 diff --git a/docs/openhabian.md b/docs/openhabian.md index e376f60fa..fce6d46d9 100644 --- a/docs/openhabian.md +++ b/docs/openhabian.md @@ -29,7 +29,7 @@ It provides: The openHABian image provides lots of useful Linux tools out of the box: - Fully automated hassle-free setup without a need for a display or keyboard, connected via Ethernet or [Wi-Fi](#wi-fi-based-setup-notes) -- All versions of openHAB to select from, including the latest stable one as the default +- Most recent release of openHAB - [Comprehensive capabilities to ensure your system will keep working reliably 24/7](#availability-and-backup) including ZRAM, [SD card mirroring](openhabian.md#sd-mirroring) and [Amanda backup system](openhabian-amanda.md) - Web based openHAB Log Viewer (based on [frontail](https://github.com/mthenw/frontail)) - [Tailscale](https://tailscale.com/blog/how-tailscale-works/) VPN and [WireGuard](https://www.wireguard.com/) for remote VPN access @@ -59,14 +59,16 @@ Your setup is untested, and no-one but you knows about your changes. openHABian So if you choose to deviate from the standard openHABian installation (e.g. you change your box to run off SSD) and run into problems thereafter, please be fair: don't waste maintainer's or anyone's time by asking for help or information on your issues on the forum. Thank you ! -## On openHAB 4 and older +## Default installation openHABian will install **openHAB 4** and Java 17 by default. -The openHABian image will install openHAB 4 by default, to have it install openHAB 3 right from the beginning, set `clonebranch=openHAB3` in `openhabian.conf` before first boot. Use `clonebranch=legacy` to get openHAB 2. ## Hardware ### Hardware recommendation -Let's put this first: our current recommendation is to get a RPi model 4 or 5 with 2 or 4 GB of RAM, whatever you can get hold of for a good price, plus an "Endurance" SD card. If you want to be on the safe side, order the official 3A power supply, else any old mobile charger will usually do. +Let's put this first: our current recommendation is to get a RPi model 4 or 5 with 2 or 4 GB of RAM, whatever you can get hold of for a good price. +Older RPi models (or models with less RAM) can be sufficient to run a smallish openHAB setup, but they will not be enough to run a full-blown system with many bindings and memory consuming openHABian features/components such as zram or InfluxDB. +We also recommend an "Endurance" SD card. Cards labelled "Endurance" can handle more write cycles and will be more enduring under openHAB\'s use conditions. +If you want to be on the safe side, order the official 3A power supply, else any old mobile charger will usually do. Also prepare to make use of the [SD mirroring feature](openhabian.md#sd-mirroring), get a 2nd SD card right away, same model or at least the size of your internal one, plus a USB card reader. ### Hardware support @@ -75,15 +77,13 @@ openHABian can run on x86 based systems but on those you need to install the OS Anything else ARM based such as ODroids, OrangePis and the like may work or not. NAS servers such as QNAP and Synology boxes will not work. -We strongly recommend a Raspberry Pi 2 or newer that has 1 GB of RAM or more. -RPi 1 and 0/0W just have a single CPU core and only 512 MB of RAM. The RPi0W2 has 4 cores but only 512 MB as well. -512 MB can be sufficient to run a smallish openHAB setup, but it will not be enough to run a full-blown system with many bindings and memory consuming openHABian features/components such as zram or InfluxDB. -We do not actively prohibit installation on any hardware, including unsupported systems, but we might skip or deny to install specific extensions such as those memory hungry applications named above. +We do not actively prohibit installation on any hardware, including unsupported systems, but we might skip or deny to install/support specific features. Supporting hardware means testing every single patch and every release. There are simply too many combinations of SBCs, peripherals and OS flavors that maintainers do not have available, or, even if they did, the time to spend on the testing efforts that is required to make openHABian a reliable system. It means that to run on hardware other than RPi 2/3/4/5 or bare metal x86 Debian may work but is not a supported setup. -Please stay with a supported version. This will help you and those you will want to ask for help on the forum focus on a known set of issues and solutions. +Please stay with a supported version. +This will help you and those you will want to ask for help on the forum focus on a known set of issues and solutions. For ARM hardware that we don't support, you can try any of the [fake hardware parameters](openhabian.md#fake-hardware-mode) to 'simulate' RPi hardware and Raspberry Pi OS. @@ -100,18 +100,13 @@ Going beyond what the RPi image provides, as a manually installed set of scripts We provide code that is reported "as-is" to run on Ubuntu but we do not support Ubuntu so please don't open issues for this (PRs then again are welcome). Several optional components such as WireGuard or Homegear are known to expose problems on Ubuntu. -Note with openHAB 4 and Java 17, `buster` and older distros are no longer supported and there'll be issues when you attempt upgrading Java 11->17. -Should you still be running an older distribution, we recommend not to upgrade the distro but to re-install using the latest openHABian image and import your config instead. +Note as of openHAB 4 and Java 17, `buster` and older distros are no longer supported and there'll be issues if you attempt upgrading Java 11->17 from an older distro. +We do not recommend upgrading an older distro. +Please save yourself the pain and re-install using the latest openHABian image and import your config manually instead. ### 64 bit? -RPi 3 and newer have a 64 bit processor. There's openHABian images available in both, 32 and 64 bit. -Choose yours based on your hardware and primary use case. Please be aware that you cannot change once you decided in favor of either 32 or 64 bit. Should you need to revoke your choice, export/backup your config and install a fresh system, then import your config there. - -Use the 64 bit image versions but please be aware that 64 bit always has one major drawback: increased memory usage. That is not a good idea on heavily memory constrained platforms like Raspberries. If you want to go with 64 bit, ensure your RPi has a mimimum of 2 GB, 4 will put you on the safe side. -You can use the 32 bit version for older or non official addons that will not work on 64 bit yet. -Note there's a known issue on 32 bit, JS rules are reported to be annoyingly slow on first startup and in some Blockly use cases. - -On x86 hardware, it's all 64 bit but that in turn once more increases memory usage. A NUC to run on should have no less than 8 GB. +Any RPi 3 or newer supports 64 bit operation. +Unless you really know what you are doing and have a compelling reason to do so, stick with the 64 bit image. ### Networking You need to prepare your local network so you eventually need to configure your Internet router before an openHABian installation. @@ -302,7 +297,7 @@ That being said, openHABian has a number of built in software features we borrow WARNING: power failure will result in some data to get lost (albeit the system should continue to run) so we recommend to also get an UPS. Zram is enabled by default for swap, logs and persistence data. You can toggle use in \[menu option 38\]. - + 2. SD cards, SSDs and HDDs can break or crash just like any hardware. Mirror your SD card to have a ready-to-use alternative boot medium ready on site at any time ! Get an USB card writer and another SD card and set up SD mirroring using \[menu option 53\]. @@ -311,7 +306,7 @@ That being said, openHABian has a number of built in software features we borrow See [auto backup](#sd-mirroring) documentation. ::: tip remote replacement -Disasters love to happen when you're not at home. +Disasters love to happen when you're not at home. With an openHABian RPi mirror SD setup, you can instruct your partner, kid or your cottage neighbour to replace the SD card and/or computer from remote, by phone. No need for Internet or any sort of configuring to get your system back up running. ::: @@ -321,7 +316,7 @@ With an openHABian RPi mirror SD setup, you can instruct your partner, kid or yo HEADS UP: This is NOT meant to be a replacement for #1 or #3, it's a *complement* that will also enable you to restore your system to any point in time of the past. The specific [Amanda documentation is here](openhabian-amanda.md). Use \[menu option 52\] to set up. - + 5. For completeness, openHABian still provides the historic option to move the root filesystem to USB-attached devices. See \[menu option 37\]. We don't recommend or support doing so but if you're convinced this is beneficial to your situation, feel free to go for it. @@ -345,7 +340,7 @@ You can actually set a number of parameters _before_ you run an unattended insta This applies to the RPi image on an SD card as well as to a manual installation. You can also try with a different set of parameters if your initial attempt fails: -- Flash the system image to your micro SD card as described, do not remove the SD card yet +- Flash the system image to your micro SD card as described, do not remove the SD card yet - Use Windows file explorer to access the first SD card partition. Re-plug if needed to open in Windows file explorer, it's a vfat/FAT-32 (Windows) filesystem. - Open the file `openhabian.conf` in a text editor - Uncomment and complete the lines to contain the parameters you want to set @@ -512,13 +507,11 @@ If you are not able to access your system via the openHAB dashboard or SSH after Consult the [debug guide](openhabian-DEBUG.md) and move on from there. -#### Can I switch openHAB 2 and 3 via openHABian branches? +openHABian is designed to install and work with the latest version of openHAB (currently 4.x). +We do not support migrating older installation's persistence/configuration files to the latest version. +Users will need to migrate and fix any issues with their persistence/configuration files on their own. +Note: we will upgrade to a new major version of openHAB after warning and asking the user for confirmation, but will not do so automatically. -openHABian installs the latest release build of openHAB, 4.1.1 at the time of writing. -The standard openHABian `openHAB` and `main` branches will install the new openHAB version 4 and the old `openHAB3` and `legacy` branches will install the outdated openHAB version 3 or 2, respectively. -You can migrate between openHAB software versions by selecting the corresponding 4X menu option. (HEADS UP: Downgrading openHAB is not supported and will probably result in a broken system until you also restore an openHAB 3 configuration). -If you want to choose from release (stable), snapshot or milestone releases, please do so via `openhabian-config` tool (also menu 4X). -Switching to newer development releases might introduce changes and incompatibilities, so please be sure to make a full openHAB backup first. #### Where is the graphical user interface? diff --git a/functions/helpers.bash b/functions/helpers.bash index aaee15b9b..b7ef1dbd1 100644 --- a/functions/helpers.bash +++ b/functions/helpers.bash @@ -649,8 +649,6 @@ openhab2_is_installed() { ## openhab3_is_installed() ## openhab3_is_installed() { - #if [[ $(dpkg -s 'openhab' 2> /dev/null | grep Status | cut -d' ' -f2) =~ ^(install|hold)$ ]]; then return 0; else return 1; fi - #if [[ $(dpkg -s 'openhab' 2> /dev/null | grep Config-Version | cut -d ' ' -f2 | cut -d '.' -f1) = 3 ]]; then return 0; else return 1; fi if [[ $(dpkg -s 'openhab' 2> /dev/null | grep -E '^Version' | cut -d ' ' -f2 | cut -d '.' -f1) = 3 ]]; then return 0; else return 1; fi } ## Function to check if openHAB is installed on the current system. Returns diff --git a/functions/menu.bash b/functions/menu.bash index 5913bddb3..e1cd5085c 100644 --- a/functions/menu.bash +++ b/functions/menu.bash @@ -3,7 +3,7 @@ show_about() { local version - if openhab2_is_installed; then OHPKG="openhab2"; else OHPKG="openhab"; fi + OHPKG="openhab" version=$(sed -n 's/openhab-distro\s*: //p' /var/lib/${OHPKG}/etc/version.properties) whiptail --title "About openHABian and $(basename "$0")" --msgbox "openHABian Configuration Tool — $(get_git_revision) openHAB ${version} - $(sed -n 's/build-no\s*: //p' /var/lib/${OHPKG}/etc/version.properties) @@ -211,43 +211,41 @@ show_main_menu() { "41 | openHAB Release" "Install or switch to the latest openHAB Release" \ " | openHAB Milestone" "Install or switch to the latest openHAB Milestone Build" \ " | openHAB Snapshot" "Install or switch to the latest openHAB Snapshot Build" \ - "42 | Upgrade legacy openHABian env" "Upgrade openHAB 2 based OS environment to work with openHAB 3 or 4" \ - "43 | Remote Console" "Bind the openHAB SSH console to all external interfaces" \ - "44 | Clean cache" "Clean the cache for openHAB" \ - "45 | Nginx Proxy" "Setup reverse and forward web proxy" \ - "46 | OpenJDK 17" "Install and activate OpenJDK 17 as Java provider (now default)" \ + "42 | Remote Console" "Bind the openHAB SSH console to all external interfaces" \ + "43 | Clean cache" "Clean the cache for openHAB" \ + "44 | Nginx Proxy" "Setup reverse and forward web proxy" \ + "45 | OpenJDK 17" "Install and activate OpenJDK 17 as Java provider (now default)" \ " | OpenJDK 11" "Install and activate OpenJDK 11 as Java provider" \ " | Zulu 11 OpenJDK 32-bit" "Install Zulu 11 32-bit OpenJDK as Java provider" \ " | Zulu 11 OpenJDK 64-bit" "Install Zulu 11 64-bit OpenJDK as Java provider" \ " | Zulu 21 OpenJDK 64-bit" "Install Zulu 21 64-bit OpenJDK as Java provider" \ " | BellSoft Liberica JDK 21" "Install BellSoft Liberica JDK 21, supports 32bit RPi (EXPERIMENTAL)" \ - "47 | Install openhab-js" "JS Scripting: Upgrade to latest version of openHAB JavaScript library (advanced)" \ + "46 | Install openhab-js" "JS Scripting: Upgrade to latest version of openHAB JavaScript library (advanced)" \ " | Uninstall openhab-js" "JS Scripting: Switch back to included version of openHAB JavaScript library" \ - "48 | Install openhab_rules_tools" "JS Scripting: Manually install openhab_rules_tools (auto-installed)" \ + "47 | Install openhab_rules_tools" "JS Scripting: Manually install openhab_rules_tools (auto-installed)" \ " | Uninstall openhab_rules_tools" "JS Scripting: Uninstall openhab_rules_tools" \ 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ] || [ $RET -eq 255 ]; then return 0; fi wait_for_apt_to_finish_update - version="$(openhab4_is_installed && echo "openHAB" || (openhab3_is_installed && echo "openHAB3") || echo "openHAB2")" + version="$( (openhab4_is_installed && echo "openHAB") || (openhab3_is_installed && echo "openHAB3"))" # shellcheck disable=SC2154 case "$choice2" in 41\ *) openhab_setup "$version" "release";; *openHAB\ Milestone) openhab_setup "$version" "milestone";; *openHAB\ Snapshot) openhab_setup "$version" "snapshot";; - 42\ *) migrate_installation "openHAB" && openhabian_update "openHAB";; - 43\ *) openhab_shell_interfaces;; - 44\ *) openhab_clean_cache;; - 45\ *) nginx_setup;; - *OpenJDK\ 11) update_config_java "11" && java_install "11";; + 42\ *) openhab_shell_interfaces;; + 43\ *) openhab_clean_cache;; + 44\ *) nginx_setup;; *OpenJDK\ 17) update_config_java "17" && java_install "17";; + *OpenJDK\ 11) update_config_java "11" && java_install "11";; *Zulu\ 11\ OpenJDK\ 32-bit) update_config_java "Zulu11-32" && java_install_or_update "Zulu11-32";; *Zulu\ 11\ OpenJDK\ 64-bit) update_config_java "Zulu11-64" && java_install_or_update "Zulu11-64";; *Zulu\ 21\ OpenJDK\ 64-bit) update_config_java "Zulu21-64" && java_install_or_update "Zulu21-64";; *BellSoft\ Liberica\ JDK\ 21) update_config_java "BellSoft21" && java_install_or_update "BellSoft21";; - 47\ *) jsscripting_npm_install "openhab";; + 46\ *) jsscripting_npm_install "openhab";; *Uninstall\ openhab-js) jsscripting_npm_install "openhab" "uninstall";; - 48\ *) jsscripting_npm_install "openhab_rules_tools";; + 47\ *) jsscripting_npm_install "openhab_rules_tools";; *Uninstall\ openhab_rules_tools) jsscripting_npm_install "openhab_rules_tools" "uninstall";; "") return 0 ;; *) whiptail --msgbox "An unsupported option was selected (probably a programming error):\\n \"$choice2\"" 8 80 ;; diff --git a/functions/openhab.bash b/functions/openhab.bash index fcb5318ab..1dd4a2b28 100644 --- a/functions/openhab.bash +++ b/functions/openhab.bash @@ -40,8 +40,7 @@ delayed_rules() { } ## Function to install / upgrade / downgrade the installed openHAB version -## Valid argument 1: "openHAB" or "openHAB2" -## Valid argument 2: "release", "milestone" or "testing", or "snapshot" or "unstable" +## Valid argument 1: "release", "milestone" or "testing", or "snapshot" or "unstable" ## ## openhab_setup(String version, String release, String packageversion) ## @@ -52,24 +51,19 @@ openhab_setup() { local installVersion local repo local successText + local ohPkgName="openhab" - if [[ "$1" == "openHAB2" ]] || [[ "$1" == "legacy" ]]; then - ohPkgName="openhab2" - else - ohPkgName="openhab" - fi - - if [[ $2 == "snapshot" || $2 == "unstable" ]]; then + if [[ $1 == "snapshot" || $1 == "unstable" ]]; then introText="Proceed with caution!\\n\\nYou are about to switch over to the latest $ohPkgName unstable snapshot build. The daily snapshot builds contain the latest features and improvements but might also suffer from bugs or incompatibilities. Please be sure to take a full openHAB configuration backup first!\\n\\nBeware that downgrading will not be possible, you can only re-install old software and re-important the config backup you should have made before the upgrade." successText="The latest unstable snapshot build of $ohPkgName is now running on your system.\\n\\nPlease test the correct behavior of your setup. You might need to adapt your configuration, if available. If you made changes to the files in '/var/lib/${ohPkgName}' they were replaced, but you can restore them from backup files next to the originals.\\n\\nIf you find any problems or bugs, please report them and state the snapshot version you are on. To stay up-to-date with improvements and bug fixes you should upgrade your packages (using menu option 02) regularly." repo="deb [signed-by=/usr/share/keyrings/${keyName}.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg unstable main" echo -n "$(timestamp) [openHABian] Beginning install of latest $ohPkgName snapshot build (unstable repo)... " - elif [[ $2 == "release" || $2 == "stable" ]]; then + elif [[ $1 == "release" || $1 == "stable" ]]; then introText="You are about to install or change to the latest stable $ohPkgName release.\\n\\nPlease be aware that downgrading from a newer unstable snapshot build is not supported. Please consult with the documentation or community forum and be sure to take a full openHAB configuration backup first!" successText="The stable release of $ohPkgName is now installed on your system.\\n\\nPlease test the correct behavior of your setup. You might need to adapt your configuration, if available. If you made changes to the files in '/var/lib/${ohPkgName}' they were replaced, but you can restore them from backup files next to the originals.\\n\\nCheck the \"openHAB Release Notes\" and the official announcements to learn about additons, fixes and changes." repo="deb [signed-by=/usr/share/keyrings/${keyName}.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main" echo -n "$(timestamp) [openHABian] Beginning install of latest $ohPkgName release (stable repo)... " - elif [[ $2 == "milestone" || $2 == "testing" ]]; then + elif [[ $1 == "milestone" || $1 == "testing" ]]; then introText="You are about to install or change to the latest milestone $ohPkgName build. Note this is openHAB 4!\\n\\nMilestones contain the latest features and is supposed to run stable, but if you experience bugs or incompatibilities, please help with enhancing openHAB by posting them on the community forum or by raising a GitHub issue in the proper place.\\n\\nPlease be aware that downgrading from a newer build is not supported!\\n\\nPlease consult with the documentation or community forum and be sure to take a full openHAB configuration backup first!" successText="The testing release of $ohPkgName is now installed on your system.\\n\\nPlease test the correct behavior of your setup. You might need to adapt your configuration, if available. If you made changes to the files in '/var/lib/${ohPkgName}' they were replaced, but you can restore them from backup files next to the originals.\\n\\nCheck the \"openHAB Release Notes\" and the official announcements to learn about additons, fixes and changes." repo="deb [signed-by=/usr/share/keyrings/${keyName}.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg testing main" @@ -97,7 +91,7 @@ openhab_setup() { echo "$repo" > /etc/apt/sources.list.d/openhab.list dpkg --configure -a - echo -n "$(timestamp) [openHABian] Installing selected $1 version... " + echo -n "$(timestamp) [openHABian] Installing openHAB... " if ! apt-get clean --yes -o DPkg::Lock::Timeout="$APTTIMEOUT"; then echo "FAILED (apt cache clean)"; return 1; fi cond_redirect apt-get update -o DPkg::Lock::Timeout="$APTTIMEOUT" openhabVersion="${3:-$(apt-cache madison ${ohPkgName} | head -n 1 | cut -d'|' -f2 | xargs)}" @@ -113,7 +107,6 @@ openhab_setup() { echo -n "$(timestamp) [openHABian] Installing cached openHAB version... " if cond_redirect apt-get install --yes -o DPkg::Lock::Timeout="$APTTIMEOUT" --option Dpkg::Options::="--force-confnew" ${ohPkgName} ${ohPkgName}-addons; then echo "OK"; else echo "FAILED"; return 1; fi fi - rm -f /etc/apt/sources.list.d/openhab2.list # to avoid conflict with repo file from pkg # shellcheck disable=SC2154 gid="$(id -g "$username")" diff --git a/functions/openhabian.bash b/functions/openhabian.bash index dcc51cfe2..5cf5477b8 100644 --- a/functions/openhabian.bash +++ b/functions/openhabian.bash @@ -185,7 +185,6 @@ openhabian_update() { elif [[ -n $INTERACTIVE ]]; then radioOptions=("release" "most recommended version that supports openHAB 4 (openHAB branch)" "OFF") radioOptions+=("latest" "the latest of openHABian, not well tested (main branch)" "OFF") - radioOptions+=("legacy" "use for openHAB 2.x support (legacy branch)" "OFF") case "$current" in "openHAB") @@ -198,11 +197,6 @@ openhabian_update() { radioOptions[5]="ON" ;; - "openHAB2"|"legacy"|"stable") - branchLabel="the legacy version of openHABian" - radioOptions[8]="ON" - ;; - *) branchLabel="a custom version of openHABian. If you think this is an error, please report on Github (remember to provide a debug log - see debug guide)." radioOptions+=("$current" "some other version you fetched yourself" "ON") @@ -218,7 +212,6 @@ openhabian_update() { case $selection in release) selection="openHAB";; latest) selection="main";; - legacy) selection="openHAB2";; esac read -r -t 1 -n 1 key @@ -261,118 +254,6 @@ openhabian_update() { fi } -## Changes files on disk to match the new (changed) openhabian branch -## Valid arguments: "openHAB", "openHAB3" or "openHAB2" -## -## migrate_installation() -## -migrate_installation() { - local failText="is already installed on your system!\\n\\nCanceling migration, returning to menu." - local frontailService="/etc/systemd/system/frontail.service" - local homegearService="/etc/systemd/system/homegear.service" - local zramService="/etc/systemd/system/zram-config.service" - local frontailJSON="/usr/lib/node_modules/frontail/preset/openhab.json" - local amandaConfigs="/etc/amanda/openhab-*/disklist" - local ztab="/etc/ztab" - local serviceDir="/etc/systemd/system" - local services - # shellcheck disable=SC2206 - local mountUnits="${serviceDir}/srv-openhab*" - local from - local to - local distro="stable" - local javaVersion - - if [[ -z $INTERACTIVE ]]; then - echo "$(timestamp) [openHABian] Migration must be triggered in interactive mode... SKIPPED" - return 0 - fi - - echo -n "$(timestamp) [openHABian] Preparing openHAB installation... " - - if [[ "$1" == "openHAB" ]] || [[ "$1" == "openHAB3" ]]; then - if openhab4_is_installed || openhab3_is_installed; then - whiptail --title "openHAB version already installed" --msgbox "openHAB $failText" 10 80 - echo "FAILED (openHAB 3 or 4 already installed)" - return 1 - fi - from="openhab2" - to="openhab" - else - if openhab2_is_installed; then - whiptail --title "openHAB version already installed" --msgbox "openHAB 2 $failText" 10 80 - echo "FAILED (openHAB 2 already installed)" - return 1 - fi - from="openhab" - to="openhab2" - fi - services="srv-${from}\\x2daddons.mount srv-${from}\\x2dconf.mount srv-${from}\\x2duserdata.mount srv-${from}\\x2dsys.mount" - - javaVersion="$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed -e 's/_.*//g; s/^1\.//g; s/\..*//g; s/-.*//g;')" - # shellcheck disable=SC2154 - [[ "$zraminstall" != "disable" ]] && zram_is_installed && if cond_redirect systemctl stop zram-config.service; then echo "OK"; else echo "FAILED (stop zram)"; return 1; fi - backup_openhab_config - - if [[ -z "$javaVersion" ]] || [[ "${javaVersion}" -lt "11" ]]; then - echo -n "$(timestamp) [openHABian] WARNING: We were unable to detect Java 11 on your system so we will install the openHABian default (OpenJDK 11)." - java_install "11" - fi - echo -n "$(timestamp) [openHABian] Installing openHAB... " - if openhab_setup "$1" "${distro}"; then echo "OK"; else echo "FAILED (install openHAB)"; cond_redirect systemctl start zram-config.service; return 1; fi - - if [[ -d /var/lib/openhab/persistence/mapdb ]]; then - echo -n "$(timestamp) [openHABian] Deleting mapdb persistence files... " - rm -f /var/lib/${to}/persistence/mapdb/storage.mapdb - echo "OK" - fi - - echo -n "$(timestamp) [openHABian] Migrating Amanda config... " - for i in $amandaConfigs; do - if [[ -s "$i" ]]; then - sed -i "s|/${from}|/${to}|g" "$i" - fi - done - echo "OK" - - echo -n "$(timestamp) [openHABian] Migrating Samba and mount units... " - if ! cond_redirect systemctl stop smbd nmbd; then echo "FAILED (stop samba)"; return 1; fi - # shellcheck disable=SC2086 - if ! cond_redirect systemctl disable --now ${services}; then echo "FAILED (disable mount units)"; fi - for s in ${mountUnits}; do - if [[ "$to" == "openhab" ]] || ! grep -q "Description=$to" "$s"; then - newname=${s//${from}/${to}} - sed -e "s|${from}|${to}|g" "${s}" > "${newname}" - rm -f "$s" - fi - done - - services=${services//${from}/${to}} - sed -i "s|/${from}|/${to}|g" /etc/samba/smb.conf - - # shellcheck disable=SC2086 - if cond_redirect systemctl enable --now ${services}; then echo "OK"; else echo "FAILED (reenable mount units)"; return 1; fi - if cond_redirect systemctl start smbd nmbd; then echo "OK"; else echo "FAILED (reenable samba)"; return 1; fi - echo -n "$(timestamp) [openHABian] Migrating frontail... " - sed -i "s|${from}/|${to}/|g" $frontailService - sed -i "s|${from}/|${to}/|g" $frontailJSON - if ! cond_redirect systemctl -q daemon-reload; then echo "FAILED (daemon-reload)"; return 1; fi - if cond_redirect systemctl restart frontail.service; then echo "OK"; else echo "FAILED (restart frontail)"; return 1; fi - - echo -n "$(timestamp) [openHABian] Migrating homegear... " - sed -i "s|${from}/|${to}/|g" $homegearService - echo "OK" - - if zram_is_installed; then - echo -n "$(timestamp) [openHABian] Migrating zram config... " - sed -i "s|/${from}|/${to}|g" "$ztab" - sed -i "s|${from}|${to}|g" "$zramService" - fi - - # shellcheck disable=SC2154 - [[ "$zraminstall" != "disable" ]] && if cond_redirect systemctl restart zram-config.service; then echo "OK"; else echo "FAILED (restart zram)"; return 1; fi -} - ## Check for default system password and if found issue a warning and suggest ## changing the password. ## diff --git a/includes/generic/bash_profile b/includes/generic/bash_profile index 5238a92cd..a9f82c4dc 100644 --- a/includes/generic/bash_profile +++ b/includes/generic/bash_profile @@ -31,8 +31,8 @@ if [ -f ~/.firemotd-cache ]; then cat ~/.firemotd-cache fi (FireMotD --theme Gray > ~/.firemotd-cache &) &>/dev/null # does not use cache; might get removed in the near future - -if openhab2_is_installed; then OHPKG="openhab2"; else OHPKG="openhab"; fi +fi +OHPKG="openhab" OHVERSION="$(sed -n 's/openhab-distro\s*: //p' /var/lib/${OHPKG}/etc/version.properties)" OHBUILD="$(sed -n 's/build-no\s*: //p' /var/lib/${OHPKG}/etc/version.properties)" diff --git a/openhabian-setup.sh b/openhabian-setup.sh index 36f8b4dc3..3ba493026 100755 --- a/openhabian-setup.sh +++ b/openhabian-setup.sh @@ -108,7 +108,7 @@ if [[ -n "$UNATTENDED" ]]; then add_admin_ssh_key firemotd_setup java_install "${java_opt:-17}" - openhab_setup "${clonebranch:-openHAB}" "release" + openhab_setup "release" import_openhab_config openhab_shell_interfaces && setup_tailscale vim_openhab_syntax