refactor: harmonize architecture detection and improve installation scripts for addons

This commit is contained in:
MickLesk
2026-08-01 22:54:09 +02:00
parent 0fb07d03e7
commit 308ef17283
7 changed files with 123 additions and 186 deletions
+35 -45
View File
@@ -5,40 +5,29 @@
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://pyenv.run/ | Github: https://github.com/pyenv/pyenv
set -e
YW=$(echo "\033[33m")
RD=$(echo "\033[01;31m")
BL=$(echo "\033[36m")
GN=$(echo "\033[1;92m")
CL=$(echo "\033[m")
CM="${GN}${CL}"
CROSS="${RD}${CL}"
BFR="\\r\\033[K"
HOLD="-"
function msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
APP="pyenv"
APP_TYPE="addon"
function msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
function msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
# Telemetry
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true
declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pyenv" "addon"
# Enable error handling
set -Eeuo pipefail
trap 'error_handler' ERR
# Initialize all core functions (colors, formatting, icons, STD mode)
load_functions
if command -v pveversion >/dev/null 2>&1; then
msg_error "Can't Install on Proxmox "
exit
exit 1
fi
msg_info "Installing pyenv"
apt-get install -y \
msg_info "Installing ${APP}"
$STD apt update
$STD apt install -y \
make \
build-essential \
libjpeg-dev \
@@ -62,18 +51,18 @@ apt-get install -y \
libopenjp2-7 \
libtiff5 \
libturbojpeg0-dev \
liblzma-dev &>/dev/null
liblzma-dev
git clone https://github.com/pyenv/pyenv.git ~/.pyenv &>/dev/null
set +e
$STD git clone https://github.com/pyenv/pyenv.git ~/.pyenv
set +Eeuo pipefail
echo 'export PYENV_ROOT="$HOME/.pyenv"' >>~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >>~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\nfi' >>~/.bashrc
msg_ok "Installed pyenv"
msg_ok "Installed ${APP}"
. ~/.bashrc
set -e
set -Eeuo pipefail
msg_info "Installing Python 3.11.1"
pyenv install 3.11.1 &>/dev/null
$STD pyenv install 3.11.1
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
@@ -95,10 +84,10 @@ EOF
cd /srv/homeassistant
python3 -m venv .
source bin/activate
python3 -m pip install wheel &>/dev/null
pip3 install --upgrade pip &>/dev/null
pip3 install psycopg2-binary &>/dev/null
pip3 install --pre homeassistant &>/dev/null
$STD python3 -m pip install wheel
$STD pip3 install --upgrade pip
$STD pip3 install psycopg2-binary
$STD pip3 install --pre homeassistant
systemctl enable homeassistant &>/dev/null
msg_ok "Installed Home Assistant Beta"
echo -e " Go to $(hostname -I | awk '{print $1}'):8123"
@@ -112,9 +101,9 @@ if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
cd /srv/esphome
python3 -m venv .
source bin/activate
python3 -m pip install wheel &>/dev/null
pip3 install --upgrade pip &>/dev/null
pip3 install --pre esphome &>/dev/null
$STD python3 -m pip install wheel
$STD pip3 install --upgrade pip
$STD pip3 install --pre esphome
cat <<EOF >/srv/esphome/start.sh
#!/usr/bin/env bash
@@ -150,18 +139,19 @@ fi
read -r -p "Would you like to install Matter-Server (Beta)? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Installing Matter Server"
apt-get install -y \
$STD apt install -y \
libcairo2-dev \
libjpeg62-turbo-dev \
libgirepository1.0-dev \
libpango1.0-dev \
libgif-dev \
g++ &>/dev/null
python3 -m pip install wheel
pip3 install --upgrade pip
pip install python-matter-server[server]
g++
$STD python3 -m pip install wheel
$STD pip3 install --upgrade pip
$STD pip install python-matter-server[server]
msg_ok "Installed Matter Server"
echo -e "Start server > python -m matter_server.server"
fi
msg_ok "\nFinished\n"
exec $SHELL