Seite 3 von 3

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 22. Okt 2021 00:40
von peter-pan
...ist doch klar :lol: :lol: . Ich habe den gleichen Fehler bekommen:

Code: Alles auswählen

hab3@hostHAB3:~ $ source /opt/openhabian/funtions/openhab.bash
-bash: /opt/openhabian/funtions/openhab.bash: Datei oder Verzeichnis nicht gefunden
hab3@hostHAB3:~ $ ls -alF /opt/openhabian/funtions/
ls: Zugriff auf '/opt/openhabian/funtions/' nicht möglich: Datei oder Verzeichnis nicht gefunden
hab3@hostHAB3:~ $
...der sitzt aber diesmal vor der Tastatur (nicht böse sein). Aber

Code: Alles auswählen

/opt/openhabian/funtions/openhab.bash
und

Code: Alles auswählen

/opt/openhabian/functions/openhab.bash
sind 2 Paar Stiefel (auch wenn es nur ein klitzekleines "c" ist ;) ) Damit sieht das Ganze dann so aus:

Code: Alles auswählen

hab3@hostHAB3:~ $ source /opt/openhabian/functions/openhab.bash
hab3@hostHAB3:~ $ ls -alF /opt/openhabian/functions/
insgesamt 360
drwxrwxr-x 2 root root  4096  6. Sep 13:09 ./
drwxrwxr-x 9 root root  4096  6. Sep 13:09 ../
-rw-r--r-- 1 root root  7023 30. Jul 17:39 auth.bash
-rw-r--r-- 1 root root 31557  6. Sep 13:09 backup.bash
-rw-r--r-- 1 root root  3261 30. Jul 17:39 config.bash
-rw-r--r-- 1 root root  6696 26. Feb 2021  ext-storage.bash
-rw-r--r-- 1 root root 20126  6. Sep 13:09 find.bash
-rw-r--r-- 1 root root  3421 30. Jul 17:39 habapp.bash
-rw-r--r-- 1 root root  1942 30. Jul 17:39 habapp.bats
-rw-r--r-- 1 root root 16481  6. Sep 13:09 helpers.bash
-rw-r--r-- 1 root root   868 28. Dez 2020  helpers.bats
-rw-r--r-- 1 root root 23796  6. Sep 13:09 influxdb+grafana.bash
-rw-r--r-- 1 root root  3905 16. Mär 2021  influxdb+grafana.bats
-rw-r--r-- 1 root root 17805  6. Sep 13:09 java-jre.bash
-rw-r--r-- 1 root root  1842 26. Feb 2021  java-jre.bats
-rw-r--r-- 1 root root 14037 30. Jul 17:39 menu.bash
-rw-r--r-- 1 root root  9896  6. Sep 13:09 nodejs-apps.bash
-rw-r--r-- 1 root root  1069 26. Feb 2021  nodejs-apps.bats
-rw-r--r-- 1 root root 16950  6. Sep 13:09 openhab.bash
-rw-r--r-- 1 root root 21095 30. Jul 17:39 openhabian.bash
-rw-r--r-- 1 root root 39943  6. Sep 13:09 packages.bash
-rw-r--r-- 1 root root  2782 30. Jul 17:39 packages.bats
-rw-r--r-- 1 root root   373 28. Dez 2020  README.md
-rw-r--r-- 1 root root 31723  6. Sep 13:09 system.bash
-rw-r--r-- 1 root root 14092  6. Sep 13:09 vpn.bash
-rw-r--r-- 1 root root  2026 26. Feb 2021  vpn.bats
-rw-r--r-- 1 root root  8068  7. Mai 11:49 wifi.bash
-rw-r--r-- 1 root root  7581 30. Jul 17:39 zram.bash
-rw-r--r-- 1 root root  3427 26. Feb 2021  zram.bats

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 22. Okt 2021 09:55
von domi1705
Ouuhh...
...der sitzt aber diesmal vor der Tastatur
wohl Wahr...

Also das Kommando vom Udo sagt schon mal was gutes.

Code: Alles auswählen

 cat /opt/openhabian/functions/openhab.bash | grep openhab3_is_installed
##    openhab3_is_installed()
openhab3_is_installed() {
  if openhab2_is_installed || openhab3_is_installed; then return 0; else return 1; fi

Code: Alles auswählen

ls -alF /opt/openhabian/functions/
total 360
drwxrwxr-x 2 root root  4096 Oct 16 16:25 ./
drwxrwxr-x 9 root root  4096 Oct 16 16:25 ../
-rw-r--r-- 1 root root  7023 Oct 16 16:25 auth.bash
-rw-r--r-- 1 root root 31557 Oct 16 16:25 backup.bash
-rw-r--r-- 1 root root  3261 Oct 16 16:25 config.bash
-rw-r--r-- 1 root root  6696 Oct 16 16:25 ext-storage.bash
-rw-r--r-- 1 root root 20126 Oct 16 16:25 find.bash
-rw-r--r-- 1 root root  3421 Oct 16 16:25 habapp.bash
-rw-r--r-- 1 root root  1942 Oct 16 16:25 habapp.bats
-rw-r--r-- 1 root root 16481 Oct 16 16:25 helpers.bash
-rw-r--r-- 1 root root   868 Aug 12  2020 helpers.bats
-rw-r--r-- 1 root root 23796 Oct 16 16:25 influxdb+grafana.bash
-rw-r--r-- 1 root root  3905 Oct 16 16:25 influxdb+grafana.bats
-rw-r--r-- 1 root root 17805 Oct 16 16:25 java-jre.bash
-rw-r--r-- 1 root root  1842 Oct 16 16:25 java-jre.bats
-rw-r--r-- 1 root root 14037 Oct 16 16:25 menu.bash
-rw-r--r-- 1 root root  9896 Oct 16 16:25 nodejs-apps.bash
-rw-r--r-- 1 root root  1069 Oct 16 16:25 nodejs-apps.bats
-rw-r--r-- 1 root root 16950 Oct 16 16:25 openhab.bash
-rw-r--r-- 1 root root 21095 Oct 16 16:25 openhabian.bash
-rw-r--r-- 1 root root 39943 Oct 16 16:25 packages.bash
-rw-r--r-- 1 root root  2782 Oct 16 16:25 packages.bats
-rw-r--r-- 1 root root   373 Aug 12  2020 README.md
-rw-r--r-- 1 root root 31723 Oct 16 16:25 system.bash
-rw-r--r-- 1 root root 14092 Oct 16 16:25 vpn.bash
-rw-r--r-- 1 root root  2026 Oct 16 16:25 vpn.bats
-rw-r--r-- 1 root root  8068 Oct 16 16:25 wifi.bash
-rw-r--r-- 1 root root  7581 Oct 16 16:25 zram.bash
-rw-r--r-- 1 root root  3427 Oct 16 16:25 zram.bats

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 22. Okt 2021 10:51
von peter-pan
domi1705 hat geschrieben: 22. Okt 2021 09:55 Also das Kommando vom Udo sagt schon mal was gutes.
Na das ist ja eine erfreuliche Nachricht. Kannst du mal deine ".bash_profile"-Datei posten ? Die liegt in deinem Home-Verzeichnis. Das geht mit dem Kommando:

Code: Alles auswählen

cat $HOME/.bash_profile
Das Ergebnis sieht dann in etwa so aus:

Code: Alles auswählen

hab3@hostHAB3:/ $ cat $HOME/.bash_profile
# ~/.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 Gray

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
und evtl. auch noch(mal) "/opt/openhabian/functions/openhab.bash" mit

Code: Alles auswählen

cat /opt/openhabian/functions/openhab.bash

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 22. Okt 2021 11:33
von domi1705

Code: Alles auswählen

cat $HOME/.bash_profile
# ~/.bash_profile: executed by bash(1) for interactive shells.

if [ -f "/opt/openHABian-install-failed" ]; then
  echo ""
  echo -e -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 "are high setup will succeed on the second try."
  echo ""
  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"
  echo ""
  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"
  echo ""
  return 0
elif [ -f "/opt/openHABian-install-inprogress" ]; then
  echo ""
  echo -e -n "\e[36;01mAttention! \e[39;49;00m"
  echo "The openHABian setup process is 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 -e "\n"; 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 Gray

OHVERSION=$(dpkg-query --showformat='${Version}' --show openhab2)
OHBUILD=$(sed -n 's/build-no\s*: //p' /var/lib/openhab2/etc/version.properties)
if [ "$OHBUILD" == "- release build -" ]; then OHBUILD="Release Build"; fi

cat << 'EOF'

              Welcome to            __  _____    ____  _
            ____  ____  ___  ____  / / / /   |  / __ )(_)___ _____
           / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  / / __ `/ __ \
          / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ / / /_/ / / / /
          \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/_/\__,_/_/ /_/
              /_/
EOF
echo "                  openHAB $OHVERSION ($OHBUILD)"
echo ""
echo ""
echo "Looking for a place to get started? Check out 'sudo openhabian-config' and the"
echo "documentation at https://www.openhab.org/docs/installation/openhabian.html"
echo "The openHAB dashboard can be reached at http://$(hostname):8080"
echo "To interact with openHAB on the command line, execute: 'openhab-cli --help'"
echo ""

# vim: filetype=sh

Code: Alles auswählen

cat /opt/openhabian/functions/openhab.bash
#!/usr/bin/env bash

# shellcheck disable=SC2154

## Generate systemd dependencies for zram, Frontail and others to start together with OH
## This is done using /etc/systemd/system/openhab.service.d/override.conf
##
##    create_systemd_dependencies()
##
create_systemd_dependencies() {
  local targetDir="/etc/systemd/system/openhab.service.d"

  echo -n "$(timestamp) [openHABian] Creating dependencies to jointly start services that depend on each other... "
  if ! cond_redirect mkdir -p $targetDir; then echo "FAILED (prepare directory)"; return 1; fi
  if ! cond_redirect rm -f "${targetDir}"/override.conf; then echo "FAILED (clean directory)"; return 1; fi
  if cond_redirect cp "${BASEDIR:-/opt/openhabian}"/includes/openhab-override.conf "${targetDir}"/override.conf; then echo "OK"; else echo "FAILED (copy configuration)"; return 1; fi
  if ! cond_redirect systemctl -q daemon-reload &> /dev/null; then echo "FAILED (reload configuration)"; return 1; fi
}

## Function to quickly rename openHAB rules back and forth after two minutes to
## speed up startup of openHAB.
## This is done using /etc/systemd/system/openhab.service.d/override.conf
## Valid arguments: "yes" or "no"
##
##    delayed_rules()
##
delayed_rules() {
  if ! openhab_is_installed; then return 0; fi

  local targetDir="/etc/systemd/system/openhab.service.d"

  if [[ $1 == "yes" ]]; then
    echo -n "$(timestamp) [openHABian] Adding delay on loading openHAB rules... "
    if (cat "${BASEDIR:-/opt/openhabian}"/includes/delayed-rules.conf >> "${targetDir}"/override.conf); then echo "OK"; else echo "FAILED (copy configuration)"; return 1; fi
  elif [[ $1 == "no" ]]; then
    echo "$(timestamp) [openHABian] Removing delay on loading openHAB rules... OK"
    rm -rf ${targetDir}/override.conf
  fi
  if ! cond_redirect systemctl -q daemon-reload &> /dev/null; then return 1; fi
}

## Function to install / upgrade / downgrade the installed openHAB version
## Valid arguments: "openHAB3" or "openHAB2"
## Valid arguments: "unstable", "stable", or "testing"
##
##    openhab_setup(String version, String release)
##
openhab_setup() {
  local introText
  local keyName="openhab"
  local openhabVersion
  local repo
  local successText

  if [[ "$1" == "openHAB3" ]]; then
     ohPkgName="openhab"
  else
     ohPkgName="openhab2"
  fi

  if [[ $2 == "unstable" ]]; then
    introText="Proceed with caution!\\n\\nYou are about to switch over to the latest $1 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!"
    successText="The latest unstable snapshot build of $1 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"
  elif [[ $2 == "stable" ]]; then
    introText="You are about to install or change to the latest stable $1 release.\\n\\nPlease be aware that downgrading from a newer unstable snapshot build is not officially 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 $1 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"
  elif [[ $2 == "testing" ]]; then
    introText="You are about to install or change to the latest milestone (testing) $1 build. It contains 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.\\n\\nPlease be aware that downgrading from a newer build is not officially 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 $1 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"
  fi

  if [[ $2 == "unstable" ]]; then
    echo -n "$(timestamp) [openHABian] Beginning install of latest $1 snapshot build (unstable)... "
  elif [[ $2 == "stable" ]]; then
    echo -n "$(timestamp) [openHABian] Beginning install of latest $1 release (stable)... "
  elif [[ $2 == "testing" ]]; then
    echo -n "$(timestamp) [openHABian] Beginning install of latest $1 milestone build (testing)... "
  fi

  if [[ -n $INTERACTIVE ]]; then
    if (whiptail --title "openHAB software change" --yes-button "Continue" --no-button "Cancel" --yesno "$introText" 15 80); then echo "OK"; else echo "CANCELED"; return 1; fi
    export DEBIAN_FRONTEND=noninteractive
  else
    echo "OK"
  fi

  if running_in_docker || [[ -z $OFFLINE ]]; then
    if ! add_keys "https://openhab.jfrog.io/artifactory/api/gpg/key/public" "$keyName"; then return 1; fi

    rm -f /etc/apt/sources.list.d/${ohPkgName}*.list
    echo "$repo" > /etc/apt/sources.list.d/${ohPkgName}.list

    echo -n "$(timestamp) [openHABian] Installing selected $1 version... "
    if ! cond_redirect apt-get update; then echo "FAILED (update apt lists)"; return 1; fi
    openhabVersion="$(apt-cache madison ${ohPkgName} | head -n 1 | cut -d'|' -f2 | xargs)"
    if cond_redirect apt-get install --allow-downgrades --yes --option Dpkg::Options::="--force-confnew" "${ohPkgName}=${openhabVersion}" "${ohPkgName}-addons=${openhabVersion}"; then echo "OK"; else echo "FAILED"; return 1; fi
  else
    echo -n "$(timestamp) [openHABian] Installing cached openHAB version... "
    if cond_redirect apt-get install --yes --option Dpkg::Options::="--force-confnew" ${ohPkgName} ${ohPkgName}-addons; then echo "OK"; else echo "FAILED"; return 1; fi
  fi

  # shellcheck disable=SC2154
  gid="$(id -g "$username")"
  cond_redirect usermod -g "openhab" "$username" &> /dev/null
  cond_redirect usermod -aG "$gid" "$username" &> /dev/null

  echo -n "$(timestamp) [openHABian] Setting up openHAB service... "
  if ! zram_dependency install ${ohPkgName}; then return 1; fi
  if ! cond_redirect systemctl -q daemon-reload &> /dev/null; then echo "FAILED (daemon-reload)"; return 1; fi
  if cond_redirect systemctl enable ${ohPkgName}.service; then echo "OK"; else echo "FAILED (enable service)"; return 1; fi

  openhab_misc
  create_systemd_dependencies
  if ! [[ $ohPkgName == "openhab" ]]; then
    delayed_rules "yes"
  fi
  dashboard_add_tile "openhabiandocs"

  # see https://github.com/openhab/openhab-core/issues/1937
  echo -n "$(timestamp) [openHABian] Restarting openHAB service to play it safe... "
  if cond_redirect systemctl restart ${ohPkgName}.service; then echo "OK"; else echo "FAILED (restart service)"; return 1; fi

  if [[ -n $INTERACTIVE ]]; then
    unset DEBIAN_FRONTEND
    whiptail --title "Operation successful!" --msgbox "$successText" 15 80
  fi
}

## Function that binds openHAB console to interfaces making it available over the network
##
##    openhab_shell_interfaces()
##
openhab_shell_interfaces() {
  local introText
  local sshPass
  local sshPass1="habopen"
  local sshPass2
  local successText

  introText="\\nThe openHAB remote console is a powerful tool for every openHAB user. For details see https://www.openhab.org/docs/administration/console.html\\n\\nThis menu option will make the console available on all interfaces of your system. Please provide a secure password for this connection. Blank input will get you the default password \"habopen\"."
  successText="The openHAB remote console was successfully activated on all interfaces and openHAB has been restarted. You can reach the console using\\n\\nssh openhab@$hostname -p 8101\\n\\nBe aware that the first connection attempt may take a few minutes or may result in a timeout due to key generation.\\nThe default password is \"habopen\"."
  echo -n "$(timestamp) [openHABian] Activating the openHAB console on all interfaces... "

  if [[ -n $INTERACTIVE ]]; then
    while [[ -z $sshPass ]]; do
      if ! sshPass1="$(whiptail --title "Authentication setup" --passwordbox "$introText" 15 80 "$sshPass1" 3>&1 1>&2 2>&3)"; then echo "CANCELED"; return 0; fi
      if ! sshPass2="$(whiptail --title "Authentication setup" --passwordbox "\\nPlease confirm the password:" 9 80 3>&1 1>&2 2>&3)"; then echo "CANCELED"; return 0; fi
      if [[ $sshPass1 == "$sshPass2" ]] && [[ ${#sshPass1} -ge 7 ]] && [[ ${#sshPass2} -ge 7 ]]; then
        sshPass="$sshPass1"
      else
        whiptail --title "Authentication setup" --msgbox "Password mismatched, or less than 7 characters... Please try again!" 7 80
      fi
    done
  else
    sshPass="habopen"
  fi

  if ! cond_redirect sed -i -e 's|^#.*sshHost = 0.0.0.0.*$|org.apache.karaf.shell:sshHost = 0.0.0.0|g' /etc/openhab/services/runtime.cfg; then echo "FAILED (sshHost)"; return 1; fi
  if cond_redirect sed -i -e 's|openhab = .*,|openhab = '"${sshPass}"',|g' /var/lib/openhab/etc/users.properties; then echo "OK"; else echo "FAILED (sshPass)"; return 1; fi

  if [[ -n $INTERACTIVE ]]; then
    whiptail --title "Operation successful!" --msgbox "$successText" 15 80
  fi
}

## Function to download and install special vim syntax for openHAB files.
##
##    vim_openhab_syntax()
##
vim_openhab_syntax() {
  echo -n "$(timestamp) [openHABian] Adding openHAB syntax to vim editor... "
  if ! cond_redirect mkdir -p /home/"${username:-openhabian}"/.vim/{ftdetect,syntax}; then echo "FAILED (prepare dirs)"; return 1; fi
  if ! cond_redirect wget -O "/home/${username:-openhabian}/.vim/syntax/openhab.vim" https://github.com/cyberkov/openhab-vim/raw/master/syntax/openhab.vim; then echo "FAILED (syntax)"; return 1; fi
  if ! cond_redirect wget -O "/home/${username:-openhabian}/.vim/ftdetect/openhab.vim" https://github.com/cyberkov/openhab-vim/raw/master/ftdetect/openhab.vim; then echo "FAILED (ftdetect)"; return 1; fi
  if chown -R "${username:-openhabian}:${username:-openhabian}" /home/"${username:-openhabian}"/.vim; then echo "OK"; else echo "FAILED (permissions)"; return 1; fi
}

## Function to download and install special nano syntax for openHAB files.
##
##    nano_openhab_syntax()
##
nano_openhab_syntax() {
  echo -n "$(timestamp) [openHABian] Adding openHAB syntax to nano editor... "
  if ! cond_redirect wget -O /usr/share/nano/openhab.nanorc https://github.com/airix1/openhabnano/raw/master/openhab.nanorc; then echo "FAILED (download)"; return 1; fi
  if echo -e "\\n## openHAB syntax\\ninclude \"/usr/share/nano/openhab.nanorc\"" >> /etc/nanorc; then echo "OK"; else echo "FAILED (nanorc)"; return 1; fi
}

## Function to install a special multitail theme for openHAB logs.
##
##    multitail_openhab_scheme()
##
multitail_openhab_scheme() {
  echo -n "$(timestamp) [openHABian] Adding openHAB scheme to multitail... "
  if ! cp "${BASEDIR:-/opt/openhabian}"/includes/multitail.openhab.conf /etc/multitail.openhab.conf; then echo "FAILED (copy)"; return 1; fi
  if ! cond_redirect sed -i -e '/^.*multitail.*openhab.*$/d' /etc/multitail.conf; then echo "FAILED (remove default configuration)"; return 1; fi
  if cond_redirect sed -i -e 's|^# misc.*$|# openHAB logs\\ninclude:/etc/multitail.openhab.conf\\n#\\n# misc|g' /etc/multitail.conf; then echo "OK"; else echo "FAILED (include)"; return 1; fi
}

## Function to check if openHAB 2 is installed on the current system. Returns
## 0 / true if openHAB is installed and 1 / false if not.
##
##    openhab2_is_installed()
##
openhab2_is_installed() {
  if [[ $(dpkg -s 'openhab2' 2> /dev/null | grep Status | cut -d' ' -f2) == "install" ]]; then return 0; else return 1; fi
}
## Function to check if openHAB 3 is installed on the current system. Returns
## 0 / true if openHAB is installed and 1 / false if not.
##
##    openhab3_is_installed()
##
openhab3_is_installed() {
  if [[ $(dpkg -s 'openhab' 2> /dev/null | grep Status | cut -d' ' -f2) == "install" ]]; then return 0; else return 1; fi
}
## Function to check if openHAB is installed on the current system. Returns
## 0 / true if openHAB is installed and 1 / false if not.
##
##    openhab_is_installed()
##
openhab_is_installed() {
  if openhab2_is_installed || openhab3_is_installed; then return 0; else return 1; fi
}

## Function to check if openHAB is running on the current system. Returns
## 0 / true if openHAB is running and 1 / false if not.
##
##    openhab_is_running()
##
openhab_is_running() {
  if openhab_is_installed && [[ $(systemctl is-active openhab) == "active" ]]; then return 0; else return 1; fi
}

## Optimize openHAB Java for low memory SBC's and set HTTP/HTTPS ports
##
##    openhab_misc()
##
openhab_misc() {
  if ! is_arm; then return 0; fi

  echo -n "$(timestamp) [openHABian] Optimizing openHAB to run on low memory single board computers... "
  if has_lowmem; then
    if cond_redirect sed -i -e 's|^EXTRA_JAVA_OPTS=.*$|EXTRA_JAVA_OPTS="-Xms16m -Xmx256m"|g' /etc/default/openhab; then echo "OK"; else echo "FAILED"; return 1; fi
  else
    if cond_redirect sed -i -e 's|^EXTRA_JAVA_OPTS=.*$|EXTRA_JAVA_OPTS="-Xms192m -Xmx320m"|g' /etc/default/openhab; then echo "OK"; else echo "FAILED"; return 1; fi
  fi

  echo -n "$(timestamp) [openHABian] Setting openHAB HTTP/HTTPS ports... "
  if ! cond_redirect sed -i -e 's|^#*.*OPENHAB_HTTP_PORT=.*$|OPENHAB_HTTP_PORT=8080|g' /etc/default/openhab; then echo "FAILED"; return 1; fi
  if cond_redirect sed -i -e 's|^#*.*OPENHAB_HTTPS_PORT=.*$|OPENHAB_HTTPS_PORT=8443|g' /etc/default/openhab; then echo "OK"; else echo "FAILED"; return 1; fi
}

## Create a openHAB dashboard title and image for the input application.
## Valid arguments: "grafana", "frontail", "nodered", "find", or "openhabiandocs"
##
##    dashboard_add_tile(String application)
##
dashboard_add_tile() {
  local application
  local dashboardConfig
  local ipAddress
  local openhabConfig
  local tileDesc
  local tileImg
  local tileURL

  application="$1"
  openhabConfig="/etc/openhab"
  dashboardConfig="${openhabConfig}/services/runtime.cfg"
  ipAddress="$(ip route get 8.8.8.8 | awk '{print $7}' | xargs)"
  tileDesc="$(grep "^[[:space:]]*tile_desc_${application}" "${BASEDIR:-/opt/openhabian}"/includes/dashboard-imagedata | sed 's|tile_desc_'"${application}"'=||g; s|"||g')"
  tileImg="$(grep "^[[:space:]]*tile_imagedata_${application}" "${BASEDIR:-/opt/openhabian}"/includes/dashboard-imagedata | sed 's|tile_imagedata_'"${application}"'=||g; s|"||g')"
  tileURL="$(grep "^[[:space:]]*tile_url_${application}" "${BASEDIR:-/opt/openhabian}"/includes/dashboard-imagedata | sed 's|tile_url_'"${application}"'=||g; s|"||g; s|{HOSTNAME}|'"${ipAddress}"'|g')"

  echo -n "$(timestamp) [openHABian] Adding an openHAB dashboard tile for '${application}'... "

  case $application in
    grafana|frontail|nodered|find3|openhabiandocs)
      true ;;
    *)
      echo "FAILED (tile name not valid)"; return 1 ;;
  esac
  if ! openhab_is_installed || ! [[ -d "${openhabConfig}/services" ]]; then
    echo "FAILED (openHAB or config folder missing)"
    return 1
  fi

  touch "$dashboardConfig"
  if grep -qs "${application}-link" "$dashboardConfig"; then
    echo -n "Replacing... "
    cond_redirect sed -i -e "/^${application}-link-*$/d" "$dashboardConfig"
  fi

  if [[ -z $tileDesc ]] || [[ -z $tileURL ]] || [[ -z $tileImg ]]; then
    echo "FAILED (data missing)"
    return 1
  fi

  if echo -e "\\norg.openhab.core.ui.tiles:${application}-link-name=${tileDesc}\\norg.openhab.core.ui.tiles:${application}-link-url=${tileURL}\\norg.openhab.core.ui.tiles:${application}-link-imageurl=${tileImg}" >> "$dashboardConfig"; then echo "OK"; else echo "FAILED"; return 1; fi
}

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 22. Okt 2021 12:14
von peter-pan
Ich hab das jetzt nicht bis ins kleinste Detail verglichen, aber deine ".bash_profile" sieht ab Zeile 33 anders aus als meine (und vermutlich auch wie Udo's).

Es ist klar, dass da Fehlermeldungen hochkommen, wenn versucht wird auf einen bestimmten (nicht mehr vorhandenen) Ordner zuzugreifen.

Code: Alles auswählen

OHBUILD=$(sed -n 's/build-no\s*: //p' /var/lib/openhab2/etc/version.properties)
und ausserdem fehlt die Zeile

Code: Alles auswählen

source /opt/openhabian/functions/openhab.bash
ganz.

Warum deine Profil-Datei noch alt ist, kann ich jetzt nicht sagen. Das ist auf jeden Fall der Grund für die (fehlerhaften) Start-Meldungen.

Ich könnte mir vorstellen, dass man die alte Profil-Datei umbenennt (oder löscht- vielleicht später) und evtl. eine Kopie meiner Datei in dein Home-Verzeichnis als "neue" .bash_profile einspielt, das sollte eigentlich die gleiche sein.

Nach einem "reboot", vielleicht reicht auch ein neues Login mit Putty, sollten dann die richtigen Daten angezeigt werden. Das ist aber alles ohne Gewähr. (evtl. wäre vorher eine System-Sicherung angebracht).

Vielleicht kann @udo1toni, das nochmal prüfen und evtl. Änderungen anmerken.

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 22. Okt 2021 23:39
von udo1toni
So sehe ich das auch.

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 23. Okt 2021 18:34
von domi1705
Also ich hab getan was ihr gesagt habt, und sieh mal da!
Die richtige Version wird jetzt angezeigt!

Männer ihr habt's echt drauf! Danke

Re: Putty Falsche Version / Verzeichnisse

Verfasst: 24. Okt 2021 13:09
von udo1toni
:)