mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-08-02 11:03:03 +02:00
158 lines
4.3 KiB
Bash
158 lines
4.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 tteck
|
|
# Author: tteck (tteckster)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://pyenv.run/ | Github: https://github.com/pyenv/pyenv
|
|
|
|
APP="pyenv"
|
|
APP_TYPE="addon"
|
|
|
|
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 1
|
|
fi
|
|
msg_info "Installing ${APP}"
|
|
$STD apt update
|
|
$STD apt install -y \
|
|
make \
|
|
build-essential \
|
|
libjpeg-dev \
|
|
libpcap-dev \
|
|
libssl-dev \
|
|
zlib1g-dev \
|
|
libbz2-dev \
|
|
libreadline-dev \
|
|
libsqlite3-dev \
|
|
autoconf \
|
|
git \
|
|
curl \
|
|
sudo \
|
|
llvm \
|
|
libncursesw5-dev \
|
|
xz-utils \
|
|
tk-dev \
|
|
libxml2-dev \
|
|
libxmlsec1-dev \
|
|
libffi-dev \
|
|
libopenjp2-7 \
|
|
libtiff5 \
|
|
libturbojpeg0-dev \
|
|
liblzma-dev
|
|
|
|
$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 ${APP}"
|
|
. ~/.bashrc
|
|
set -Eeuo pipefail
|
|
msg_info "Installing Python 3.11.1"
|
|
$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
|
|
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
|
msg_info "Installing Home Assistant Beta"
|
|
cat <<EOF >/etc/systemd/system/homeassistant.service
|
|
[Unit]
|
|
Description=Home Assistant
|
|
After=network-online.target
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=/root/.homeassistant
|
|
ExecStart=/srv/homeassistant/bin/hass -c "/root/.homeassistant"
|
|
RestartForceExitStatus=100
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
mkdir /srv/homeassistant
|
|
cd /srv/homeassistant
|
|
python3 -m venv .
|
|
source bin/activate
|
|
$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"
|
|
hass
|
|
fi
|
|
|
|
read -r -p "Would you like to install ESPHome Beta? <y/N> " prompt
|
|
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
|
msg_info "Installing ESPHome Beta"
|
|
mkdir /srv/esphome
|
|
cd /srv/esphome
|
|
python3 -m venv .
|
|
source bin/activate
|
|
$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
|
|
|
|
# Copyright (c) 2021-2026 tteck
|
|
# Author: tteck (tteckster)
|
|
# License: MIT
|
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
source /srv/esphome/bin/activate
|
|
esphome dashboard /srv/esphome/
|
|
EOF
|
|
chmod +x start.sh
|
|
cat <<EOF >/etc/systemd/system/esphomedashboard.service
|
|
[Unit]
|
|
Description=ESPHome Dashboard Service
|
|
After=network.target
|
|
[Service]
|
|
Type=simple
|
|
User=root
|
|
WorkingDirectory=/srv/esphome
|
|
ExecStart=/srv/esphome/start.sh
|
|
RestartSec=30
|
|
Restart=on-failure
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable --now esphomedashboard &>/dev/null
|
|
msg_ok "Installed ESPHome Beta"
|
|
echo -e " Go to $(hostname -I | awk '{print $1}'):6052"
|
|
exec $SHELL
|
|
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"
|
|
$STD apt install -y \
|
|
libcairo2-dev \
|
|
libjpeg62-turbo-dev \
|
|
libgirepository1.0-dev \
|
|
libpango1.0-dev \
|
|
libgif-dev \
|
|
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
|
|
|