<commit_before>#!/usr/bin/env bash

whiptail_check() {
  if ! command -v whiptail &>/dev/null; then
    echo -n "$(timestamp) [openHABian] Installing whiptail... "
    cond_redirect apt update
    cond_redirect apt -y install whiptail
    if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi
  fi
}

system_upgrade() {
  echo -n "$(timestamp) [openHABian] Updating repositories and upgrading installed packages... "
  cond_redirect apt update
  cond_redirect apt --yes upgrade
  if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi
}

basic_packages() {
  echo -n "$(timestamp) [openHABian] Installing basic can't-be-wrong packages (screen, vim, ...)... "
  if is_pi; then
    #cond_redirect wget -O /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update
    #cond_redirect chmod +x /usr/bin/rpi-update
    cond_redirect rm -f /usr/bin/rpi-update
  fi
  cond_redirect apt update
  apt remove raspi-config &>/dev/null || true
  cond_redirect apt -y install screen vim nano mc vfu bash-completion htop curl wget multitail git bzip2 zip unzip \
                               xz-utils software-properties-common man-db whiptail acl usbutils dirmngr
  if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi
}

needed_packages() {
  # Install apt-transport-https - update packages through https repository
  # Install bc + sysstat - needed for FireMotD
  # Install avahi-daemon - hostname based discovery on local networks
  # Install python/python-pip - for python packages
  echo -n "$(timestamp) [openHABian] Installing additional needed packages... "
  #cond_redirect apt update
  cond_redirect apt -y install apt-transport-https bc sysstat avahi-daemon python python-pip
  if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi

  if is_pithree || is_pizerow; then
    echo -n "$(timestamp) [openHABian] Installing additional bluetooth packages... "
    cond_redirect apt -y install bluez python-bluez python-dev libbluetooth-dev raspberrypi-sys-mods pi-bluetooth<commit_msg>Add arping as basic package (#311)<commit_after>#!/usr/bin/env bash

whiptail_check() {
  if ! command -v whiptail &>/dev/null; then
    echo -n "$(timestamp) [openHABian] Installing whiptail... "
    cond_redirect apt update
    cond_redirect apt -y install whiptail
    if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi
  fi
}

system_upgrade() {
  echo -n "$(timestamp) [openHABian] Updating repositories and upgrading installed packages... "
  cond_redirect apt update
  cond_redirect apt --yes upgrade
  if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi
}

basic_packages() {
  echo -n "$(timestamp) [openHABian] Installing basic can't-be-wrong packages (screen, vim, ...)... "
  if is_pi; then
    #cond_redirect wget -O /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update
    #cond_redirect chmod +x /usr/bin/rpi-update
    cond_redirect rm -f /usr/bin/rpi-update
  fi
  cond_redirect apt update
  apt remove raspi-config &>/dev/null || true
  cond_redirect apt -y install screen vim nano mc vfu bash-completion htop curl wget multitail git bzip2 zip unzip \
                               xz-utils software-properties-common man-db whiptail acl usbutils dirmngr arping
  if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi
}

needed_packages() {
  # Install apt-transport-https - update packages through https repository
  # Install bc + sysstat - needed for FireMotD
  # Install avahi-daemon - hostname based discovery on local networks
  # Install python/python-pip - for python packages
  echo -n "$(timestamp) [openHABian] Installing additional needed packages... "
  #cond_redirect apt update
  cond_redirect apt -y install apt-transport-https bc sysstat avahi-daemon python python-pip
  if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; exit 1; fi

  if is_pithree || is_pizerow; then
    echo -n "$(timestamp) [openHABian] Installing additional bluetooth packages... "
    cond_redirect apt -y install bluez python-bluez python-dev libbluetooth-dev raspberrypi-sys-mods pi-bluetooth
{'fraction_non_alphanumeric': 0.10876937984496124, 'fraction_numerical': 0.005087209302325582, 'mean_word_length': 3.3878852284803402, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3262941', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1301, 'n_words': 447}