Ja, wobei es unerheblich ist, ob openHAB2 installiert ist, oder nicht. Es wird explizit getestet, ob openhab3 installiert ist. Ist das der Fall, wird openhab genommen, ist dies nicht der Fall, so wird openhab2 genommen. Der Codeschnipsel dazu:
Code: Alles auswählen
openhab3_is_installed() {
if [[ $(dpkg -s 'openhab' 2> /dev/null | grep Status | cut -d' ' -f2) == "install" ]]; then return 0; else return 1; fi
}
Wie erwähnt ist das gesourced. Im Einzelnen wird also zunächst dpkg -s 'openhab' ausgeführt, die Ausgabe wird umgeleitet und mittels grep Status wird die Zeile herausgesucht, in der Status vorkommt. Diese Zeile wird mit cut -d -f2 auf das 2. Wort eingekürzt. Und wenn dort install steht, gibt die Funktion 0 zurück, ansonsten 1. Es ist immer wieder beeindruckend, wie mächtig die Bash ist...
Da offensichtlich der Aufruf nicht korrekt ausgeführt wird, wäre jetzt tatsächlich ein Blick in die Datei ~/.bash_profile angesagt. So sieht die Datei bei mir aus:
Code: Alles auswählen
# ~/.bash_profile: executed by bash(1) for interactive shells.
source /opt/openhabian/functions/openhab.bash
if [ -f "/opt/openHABian-install-failed" ]; then
echo -e -n "\\n\e[31;01mAttention! \e[39;49;00m"
echo "The openHABian setup process seems to have failed on your system."
echo "Sorry, this shouldn't happen! Please restart the installation process. Chances"
echo -e "are high setup will succeed on the second try.\\n"
echo "In order to find the cause of the problem, have a look at the installation log:"
echo -e " \e[90;01msudo cat /boot/first-boot.log\e[39;49;00m\\n"
echo "In order to restart the installation run:"
echo -e " \e[90;01msudo rm -f /opt/openHABian*; sudo reboot\e[39;49;00m\\n"
echo "If the error persists, please read the debug guide at:"
echo -e "\e[94;04mhttps://github.com/openhab/openhabian/blob/master/docs/openhabian-DEBUG.md\e[39;49;00m\\n"
return 0
elif [ -f "/opt/openHABian-install-inprogress" ]; then
echo -e -n "\\n\e[36;01mAttention! \e[39;49;00m"
echo "The openHABian setup process has not finished yet."
if [ -f /boot/first-boot.log ]; then watch cat /boot/first-boot.log; echo -e "\\nProgress log:\\n"; cat /boot/first-boot.log; echo; fi
echo -e "\\nPlease wait for a few more minutes, all preparation steps will be finished shortly."
return 0
fi
if [ ! -f "/usr/bin/raspi-config" ]; then
alias raspi-config="echo 'raspi-config is not part of openHABian, please use openhabian-config instead.'"
fi
echo
FireMotD --theme digipolis
if openhab3_is_installed; then OHPKG="openhab"; else OHPKG="openhab2"; fi
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)"
echo -e "\\n$(sed -e 's|$OHVERSION|'"${OHVERSION}"'|g' -e 's|$OHBUILD|'"${OHBUILD}"'|g' -e 's|${HOSTNAME}|'"${HOSTNAME}"'|g' /opt/openhabian/includes/${OHPKG}logo)\\n"
if [[ -f $HOME/.profile ]]; then source $HOME/.profile; fi
# vim: filetype=sh
Es kann aber gut sein, dass die Datei bei Dir leicht anders aussieht, denn ich habe das nicht auf einem Raspberry laufen.
Der wichtigste Punkt ist die Zeile 3:
Wenn Du im Dateisystem den Pfad aufrufst, gibt es die Datei?
Findest Du in dieser Datei eine Zeile mit openhab3_is_installed? Das lässt sich so prüfen:
Code: Alles auswählen
cat /opt/openhabian/functions/openhab.bash | grep openhab3_is_installed
was bei mir drei Zeilen Code ausspuckt, unter anderem die Kommentarzeile für die Funktion und der Kopf der Definition selbst.
openHAB4.3.5 stable in einem Debian-Container (bookworm) (Proxmox 8.4.1, LXC), mit openHABian eingerichtet