From 7305fa4f0ace2d1ba487d29c587ae48ec15112ab Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Wed, 8 Mar 2023 15:37:32 -0500
Subject: [PATCH] code refactoring

---
 install/influxdb-v5-install.sh   |  6 ------
 install/k0s-v5-install.sh        |  6 ------
 install/mariadb-v5-install.sh    |  6 ------
 install/postgresql-v5-install.sh |  6 ------
 install/scrypted-v5-install.sh   |  6 ------
 misc/pyenv.sh                    | 17 ++++-------------
 6 files changed, 4 insertions(+), 43 deletions(-)

diff --git a/install/influxdb-v5-install.sh b/install/influxdb-v5-install.sh
index 5e1a28c95..31fe8eced 100644
--- a/install/influxdb-v5-install.sh
+++ b/install/influxdb-v5-install.sh
@@ -120,12 +120,6 @@ msg_ok "Installed InfluxDB"
 
 read -r -p "Would you like to add Telegraf? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  TELEGRAF="Y"
-else
-  TELEGRAF="N"
-fi
-
-if [[ $TELEGRAF == "Y" ]]; then
   msg_info "Installing Telegraf"
   $STD apt-get install -y telegraf
   msg_ok "Installed Telegraf"
diff --git a/install/k0s-v5-install.sh b/install/k0s-v5-install.sh
index b7c7db8da..c5bb38f5e 100644
--- a/install/k0s-v5-install.sh
+++ b/install/k0s-v5-install.sh
@@ -102,12 +102,6 @@ msg_ok "Installed k0s Kubernetes"
 
 read -r -p "Would you like to add Helm Package Manager? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  HELM="Y"
-else
-  HELM="N"
-fi
-
-if [[ $HELM == "Y" ]]; then
 msg_info "Installing Helm"
 $STD bash <(curl -sSLf https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3)
 msg_ok "Installed Helm"
diff --git a/install/mariadb-v5-install.sh b/install/mariadb-v5-install.sh
index 84ae6eca9..63b2899e7 100644
--- a/install/mariadb-v5-install.sh
+++ b/install/mariadb-v5-install.sh
@@ -100,12 +100,6 @@ msg_ok "Installed MariaDB"
 
 read -r -p "Would you like to add Adminer? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  ADMINER="Y"
-else
-  ADMINER="N"
-fi
-
-if [[ $ADMINER == "Y" ]]; then
   msg_info "Installing Adminer"
   $STD apt install -y adminer
   $STD a2enconf adminer
diff --git a/install/postgresql-v5-install.sh b/install/postgresql-v5-install.sh
index ceaee9eae..6c589a4f5 100644
--- a/install/postgresql-v5-install.sh
+++ b/install/postgresql-v5-install.sh
@@ -207,12 +207,6 @@ msg_ok "Installed PostgreSQL"
 
 read -r -p "Would you like to add Adminer? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  ADMINER="Y"
-else
-  ADMINER="N"
-fi
-
-if [[ $ADMINER == "Y" ]]; then
   msg_info "Installing Adminer"
   $STD apt install -y adminer
   $STD sudo a2enconf adminer
diff --git a/install/scrypted-v5-install.sh b/install/scrypted-v5-install.sh
index 0ee2a5170..60b1e6e9e 100644
--- a/install/scrypted-v5-install.sh
+++ b/install/scrypted-v5-install.sh
@@ -149,12 +149,6 @@ msg_ok "Installed Python3"
 
 read -r -p "Would you like to add Coral Edge TPU support? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  CORAL="Y"
-else
-  CORAL="N"
-fi
-
-if [[ $CORAL == "Y" ]]; then
 msg_info "Adding Coral Edge TPU Support"
 $STD apt-key add <(curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg)
 sh -c 'echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list'
diff --git a/misc/pyenv.sh b/misc/pyenv.sh
index ca43a5fd8..675a03446 100644
--- a/misc/pyenv.sh
+++ b/misc/pyenv.sh
@@ -64,15 +64,12 @@ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)
 msg_ok "Installed pyenv"
 . ~/.bashrc
 set -e
-msg_info "Installing Python 3.10.8"
-pyenv install 3.10.8 &>/dev/null
-pyenv global 3.10.8
-msg_ok "Installed Python 3.10.8"
+msg_info "Installing Python 3.11.1"
+pyenv install 3.11.1 &>/dev/null
+pyenv global 3.11.1
+msg_ok "Installed Python 3.11.1"
 read -r -p "Would you like to install Home Assistant Beta? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  HA="Y"
-fi
-if [[ $HA == "Y" ]]; then
 msg_info "Installing Home Assistant Beta"
 cat <<EOF >/etc/systemd/system/homeassistant.service
 [Unit]
@@ -102,9 +99,6 @@ fi
 
 read -r -p "Would you like to install ESPHome Beta? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  ESP="Y"
-fi
-if [[ $ESP == "Y" ]]; then
 msg_info "Installing ESPHome Beta"
 mkdir /srv/esphome
 cd /srv/esphome
@@ -147,9 +141,6 @@ fi
 
 read -r -p "Would you like to install Matter-Server (Beta)? <y/N> " prompt
 if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
-  MTR="Y"
-fi
-if [[ $MTR == "Y" ]]; then
 msg_info "Installing Matter Server"
 apt-get install -y \
 libcairo2-dev \