mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-03 17:35:55 +01:00
* fix(error-handler): prevent silent() from re-enabling error handling during recovery Root cause: silent() (core.func) unconditionally calls set -Eeuo pipefail and trap 'error_handler' ERR after every command. When build_container() intentionally disables error handling for its recovery section, any intermediate call through silent()/ re-enables it. This causes the grep/sed pipeline for missing_cmd extraction to trigger error_handler (grep returns exit code 1 on no match + pipefail = fatal). Fixes: 1. silent(): Save errexit state before disabling, only restore if it was active. Callers that intentionally disabled error handling (e.g. build_container recovery) are no longer silently re-enabled. 2. build.func: Add || true to missing_cmd grep pipeline as defense-in-depth against pipeline failure propagation. 3. build.func: Add explicit set +Eeuo pipefail / trap - ERR after post_update_to_api() call, before error classification grep/sed section. 4. build.func: Remove stale global combined_log variable from variables() that used a different path format (/tmp/install-SESSION-combined.log) than the actual local variable (/tmp/NSAPP-CTID-SESSION.log). The global was never written to and caused confusion when error_handler displayed it. * Update build.func * chore(install): add Github source links to all setup_nodejs scripts 52 install scripts had a project website in '# Source:' but no GitHub link. Merged the GitHub repo URL into the Source header as: # Source: https://website.com/ | Github: https://github.com/OWNER/REPO Repos sourced from fetch_and_deploy_gh_release calls, get_latest_github_release calls, or known project repos for npm/pip installed apps. Two scripts (fumadocs, pve-scripts-local) had no Source line at all — added one. Shinobi skipped (GitLab-only, no GitHub repo). * chore(install): add Github source links to all fetch_and_deploy scripts 77 additional install scripts had fetch_and_deploy_gh_release calls but no GitHub link in the Source header. Merged the primary app repo into the Source header as: # Source: https://website.com/ | Github: https://github.com/OWNER/REPO Where multiple fetch_and_deploy calls existed (app + dependency), the primary app repo was selected: - ersatztv: ErsatzTV/ErsatzTV (not ffmpeg) - firefly: firefly-iii/firefly-iii (not data-importer) - komga: gotson/komga (not kepubify dep) - sabnzbd: sabnzbd/sabnzbd (not par2cmdline-turbo dep) - signoz: SigNoz/signoz (not otel-collector) - tunarr: chrisbenincasa/tunarr (not ffmpeg dep) Also fixed cosmos-install.sh double https:// in Source URL. Skipped: autocaliweb (source already on codeberg, GitHub repos are deps only) * revert: restore misc/build.func and misc/core.func to main state These error-handler fixes belong to fix/error-handler-recovery, not to this sources-only branch. * chore(ct,tools): sync Source headers with install/ and add Github links to addon scripts
168 lines
4.3 KiB
Bash
168 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
|
|
|
|
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}..."
|
|
}
|
|
|
|
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/api.func) 2>/dev/null || true
|
|
declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pyenv" "addon"
|
|
|
|
if command -v pveversion >/dev/null 2>&1; then
|
|
msg_error "Can't Install on Proxmox "
|
|
exit
|
|
fi
|
|
msg_info "Installing pyenv"
|
|
apt-get 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 &>/dev/null
|
|
|
|
git clone https://github.com/pyenv/pyenv.git ~/.pyenv &>/dev/null
|
|
set +e
|
|
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"
|
|
. ~/.bashrc
|
|
set -e
|
|
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
|
|
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
|
|
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
|
|
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
|
|
python3 -m pip install wheel &>/dev/null
|
|
pip3 install --upgrade pip &>/dev/null
|
|
pip3 install --pre esphome &>/dev/null
|
|
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"
|
|
apt-get 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]
|
|
msg_ok "Installed Matter Server"
|
|
echo -e "Start server > python -m matter_server.server"
|
|
fi
|
|
msg_ok "\nFinished\n"
|
|
exec $SHELL
|