mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-04 01:45:55 +01:00
Compare commits
2 Commits
MickLesk-p
...
exit_code_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee74c8f158 | ||
|
|
7dbb0a75ef |
@@ -39,7 +39,7 @@ function update_script() {
|
|||||||
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
||||||
if [[ -z "$COMPOSE_FILE" ]]; then
|
if [[ -z "$COMPOSE_FILE" ]]; then
|
||||||
msg_error "No valid compose file found in /opt/komodo!"
|
msg_error "No valid compose file found in /opt/komodo!"
|
||||||
exit 1
|
exit 252
|
||||||
fi
|
fi
|
||||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env pull
|
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env pull
|
||||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function update_script() {
|
|||||||
|
|
||||||
if [[ ! -d /opt/endurain ]]; then
|
if [[ ! -d /opt/endurain ]]; then
|
||||||
msg_error "No ${APP} installation found!"
|
msg_error "No ${APP} installation found!"
|
||||||
exit 1
|
exit 233
|
||||||
fi
|
fi
|
||||||
if check_for_gh_release "endurain" "endurain-project/endurain"; then
|
if check_for_gh_release "endurain" "endurain-project/endurain"; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function update_script() {
|
|||||||
check_container_resources
|
check_container_resources
|
||||||
if ! command -v evcc >/dev/null 2>&1; then
|
if ! command -v evcc >/dev/null 2>&1; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit 1
|
exit 233
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f /etc/apt/sources.list.d/evcc-stable.list ]]; then
|
if [[ -f /etc/apt/sources.list.d/evcc-stable.list ]]; then
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function update_script() {
|
|||||||
|
|
||||||
if ! dpkg -s grafana >/dev/null 2>&1; then
|
if ! dpkg -s grafana >/dev/null 2>&1; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit 1
|
exit 233
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f /etc/apt/sources.list.d/grafana.list ]] || [[ ! -f /etc/apt/sources.list.d/grafana.sources ]]; then
|
if [[ -f /etc/apt/sources.list.d/grafana.list ]] || [[ ! -f /etc/apt/sources.list.d/grafana.sources ]]; then
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function update_script() {
|
|||||||
|
|
||||||
if [[ ! -f /etc/itsm-ng/config_db.php ]]; then
|
if [[ ! -f /etc/itsm-ng/config_db.php ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit 1
|
exit 233
|
||||||
fi
|
fi
|
||||||
setup_mariadb
|
setup_mariadb
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function update_script() {
|
|||||||
|
|
||||||
if [[ -z "$KASM_URL" ]] || [[ -z "$KASM_VERSION" ]]; then
|
if [[ -z "$KASM_URL" ]] || [[ -z "$KASM_VERSION" ]]; then
|
||||||
msg_error "Unable to detect latest Kasm release URL."
|
msg_error "Unable to detect latest Kasm release URL."
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
msg_info "Checked for new version"
|
msg_info "Checked for new version"
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ function update_script() {
|
|||||||
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
||||||
if [[ -z "$COMPOSE_FILE" ]]; then
|
if [[ -z "$COMPOSE_FILE" ]]; then
|
||||||
msg_error "No valid compose file found in /opt/komodo!"
|
msg_error "No valid compose file found in /opt/komodo!"
|
||||||
exit 1
|
exit 252
|
||||||
fi
|
fi
|
||||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env pull
|
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env pull
|
||||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function update_script() {
|
|||||||
|
|
||||||
if ! dpkg -s loki >/dev/null 2>&1; then
|
if ! dpkg -s loki >/dev/null 2>&1; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit 1
|
exit 233
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CHOICE=$(msg_menu "Loki Update Options" \
|
CHOICE=$(msg_menu "Loki Update Options" \
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function update_script() {
|
|||||||
echo -e "${TAB}${GATEWAY}${BGN}https://github.com/community-scripts/ProxmoxVE/discussions/9223${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}https://github.com/community-scripts/ProxmoxVE/discussions/9223${CL}"
|
||||||
echo -e ""
|
echo -e ""
|
||||||
msg_custom "⚠️" "Update aborted. Please migrate your data first."
|
msg_custom "⚠️" "Update aborted. Please migrate your data first."
|
||||||
exit 1
|
exit 253
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ function update_script() {
|
|||||||
msg_warn "This requires MANUAL config changes in /etc/vikunja/config.yml."
|
msg_warn "This requires MANUAL config changes in /etc/vikunja/config.yml."
|
||||||
msg_warn "See: https://vikunja.io/changelog/whats-new-in-vikunja-1.0.0/#config-changes"
|
msg_warn "See: https://vikunja.io/changelog/whats-new-in-vikunja-1.0.0/#config-changes"
|
||||||
|
|
||||||
read -rp "Continue with update? (y to proceed): " -t 30 CONFIRM1 || exit 1
|
read -rp "Continue with update? (y to proceed): " -t 30 CONFIRM1 || exit 254
|
||||||
[[ "$CONFIRM1" =~ ^[yY]$ ]] || exit 0
|
[[ "$CONFIRM1" =~ ^[yY]$ ]] || exit 0
|
||||||
|
|
||||||
echo
|
echo
|
||||||
msg_warn "Vikunja may not start after the update until you manually adjust the config."
|
msg_warn "Vikunja may not start after the update until you manually adjust the config."
|
||||||
msg_warn "Details: https://vikunja.io/changelog/whats-new-in-vikunja-1.0.0/#config-changes"
|
msg_warn "Details: https://vikunja.io/changelog/whats-new-in-vikunja-1.0.0/#config-changes"
|
||||||
|
|
||||||
read -rp "Acknowledge and continue? (y): " -t 30 CONFIRM2 || exit 1
|
read -rp "Acknowledge and continue? (y): " -t 30 CONFIRM2 || exit 254
|
||||||
[[ "$CONFIRM2" =~ ^[yY]$ ]] || exit 0
|
[[ "$CONFIRM2" =~ ^[yY]$ ]] || exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
read -r -p "${TAB3}Enter PostgreSQL version (15/16/17): " ver
|
read -r -p "${TAB3}Enter PostgreSQL version (15/16/17): " ver
|
||||||
[[ $ver =~ ^(15|16|17)$ ]] || { echo "Invalid version"; exit 1; }
|
[[ $ver =~ ^(15|16|17)$ ]] || { echo "Invalid version"; exit 64; }
|
||||||
|
|
||||||
msg_info "Installing PostgreSQL ${ver}"
|
msg_info "Installing PostgreSQL ${ver}"
|
||||||
$STD apk add --no-cache postgresql${ver} postgresql${ver}-contrib postgresql${ver}-openrc sudo
|
$STD apk add --no-cache postgresql${ver} postgresql${ver}-contrib postgresql${ver}-openrc sudo
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ case $version in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg_error "Invalid JDK version selected. Please enter 8, 11, 17 or 21."
|
msg_error "Invalid JDK version selected. Please enter 8, 11, 17 or 21."
|
||||||
exit 1
|
exit 64
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@@ -39,7 +39,7 @@ case $version in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg_error "Invalid JDK version selected. Please enter 11, 17 or 21."
|
msg_error "Invalid JDK version selected. Please enter 11, 17 or 21."
|
||||||
exit 1
|
exit 64
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@@ -53,13 +53,13 @@ case $version in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg_error "Invalid JDK version selected. Please enter 17 or 21."
|
msg_error "Invalid JDK version selected. Please enter 17 or 21."
|
||||||
exit 1
|
exit 64
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg_error "Invalid Tomcat version selected. Please enter 9, 10.1 or 11."
|
msg_error "Invalid Tomcat version selected. Please enter 9, 10.1 or 11."
|
||||||
exit 1
|
exit 64
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ mkdir -p /opt/booklore/dist
|
|||||||
JAR_PATH=$(find /opt/booklore/booklore-api/build/libs -maxdepth 1 -type f -name "booklore-api-*.jar" ! -name "*plain*" | head -n1)
|
JAR_PATH=$(find /opt/booklore/booklore-api/build/libs -maxdepth 1 -type f -name "booklore-api-*.jar" ! -name "*plain*" | head -n1)
|
||||||
if [[ -z "$JAR_PATH" ]]; then
|
if [[ -z "$JAR_PATH" ]]; then
|
||||||
msg_error "Backend JAR not found"
|
msg_error "Backend JAR not found"
|
||||||
exit 1
|
exit 153
|
||||||
fi
|
fi
|
||||||
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
||||||
msg_ok "Built Backend"
|
msg_ok "Built Backend"
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ EOF
|
|||||||
msg_ok "Docker TCP socket available on $socket"
|
msg_ok "Docker TCP socket available on $socket"
|
||||||
else
|
else
|
||||||
msg_error "Docker failed to restart. Check journalctl -xeu docker.service"
|
msg_error "Docker failed to restart. Check journalctl -xeu docker.service"
|
||||||
exit 1
|
exit 150
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ msg_info "Fetching latest EMQX Enterprise version"
|
|||||||
LATEST_VERSION=$(curl -fsSL https://www.emqx.com/en/downloads/enterprise | grep -oP '/en/downloads/enterprise/v\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1)
|
LATEST_VERSION=$(curl -fsSL https://www.emqx.com/en/downloads/enterprise | grep -oP '/en/downloads/enterprise/v\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1)
|
||||||
if [[ -z "$LATEST_VERSION" ]]; then
|
if [[ -z "$LATEST_VERSION" ]]; then
|
||||||
msg_error "Failed to determine latest EMQX version"
|
msg_error "Failed to determine latest EMQX version"
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
msg_ok "Latest version: v$LATEST_VERSION"
|
msg_ok "Latest version: v$LATEST_VERSION"
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ update_os
|
|||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
if [[ "$VERSION_ID" != "12" ]]; then
|
if [[ "$VERSION_ID" != "12" ]]; then
|
||||||
msg_error "Frigate requires Debian 12 (Bookworm) due to Python 3.11 dependencies"
|
msg_error "Frigate requires Debian 12 (Bookworm) due to Python 3.11 dependencies"
|
||||||
exit 1
|
exit 238
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Converting APT sources to DEB822 format"
|
msg_info "Converting APT sources to DEB822 format"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ fi
|
|||||||
|
|
||||||
if [[ -z "$KASM_URL" ]] || [[ -z "$KASM_VERSION" ]]; then
|
if [[ -z "$KASM_URL" ]] || [[ -z "$KASM_VERSION" ]]; then
|
||||||
msg_error "Unable to detect latest Kasm release URL."
|
msg_error "Unable to detect latest Kasm release URL."
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
msg_ok "Detected Kasm Workspaces version $KASM_VERSION"
|
msg_ok "Detected Kasm Workspaces version $KASM_VERSION"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ while true; do
|
|||||||
attempts=$((attempts + 1))
|
attempts=$((attempts + 1))
|
||||||
if [[ "$attempts" -ge 3 ]]; then
|
if [[ "$attempts" -ge 3 ]]; then
|
||||||
msg_error "Maximum attempts reached. Exiting."
|
msg_error "Maximum attempts reached. Exiting."
|
||||||
exit 1
|
exit 254
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -76,11 +76,11 @@ for i in {1..60}; do
|
|||||||
elif [[ "$STATUS" == "unhealthy" ]]; then
|
elif [[ "$STATUS" == "unhealthy" ]]; then
|
||||||
msg_error "NPMplus container is unhealthy! Check logs."
|
msg_error "NPMplus container is unhealthy! Check logs."
|
||||||
docker logs "$CONTAINER_ID"
|
docker logs "$CONTAINER_ID"
|
||||||
exit 1
|
exit 150
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sleep 2
|
sleep 2
|
||||||
[[ $i -eq 60 ]] && msg_error "NPMplus container did not become healthy within 120s." && docker logs "$CONTAINER_ID" && exit 1
|
[[ $i -eq 60 ]] && msg_error "NPMplus container did not become healthy within 120s." && docker logs "$CONTAINER_ID" && exit 150
|
||||||
done
|
done
|
||||||
msg_ok "Builded and started NPMplus"
|
msg_ok "Builded and started NPMplus"
|
||||||
|
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ if curl -fL# -C - -o "$TMP_TAR" "$OLLAMA_URL"; then
|
|||||||
msg_ok "Installed Ollama ${RELEASE}"
|
msg_ok "Installed Ollama ${RELEASE}"
|
||||||
else
|
else
|
||||||
msg_error "Extraction failed – archive corrupt or incomplete"
|
msg_error "Extraction failed – archive corrupt or incomplete"
|
||||||
exit 1
|
exit 251
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
msg_error "Download failed – $OLLAMA_URL not reachable"
|
msg_error "Download failed – $OLLAMA_URL not reachable"
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Creating ollama User and Group"
|
msg_info "Creating ollama User and Group"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ EOF
|
|||||||
else
|
else
|
||||||
msg_error "Failed to download or verify GPG key from $KEY_URL"
|
msg_error "Failed to download or verify GPG key from $KEY_URL"
|
||||||
[[ -f "$TMP_KEY_CONTENT" ]] && rm -f "$TMP_KEY_CONTENT"
|
[[ -f "$TMP_KEY_CONTENT" ]] && rm -f "$TMP_KEY_CONTENT"
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
rm -f "$TMP_KEY_CONTENT"
|
rm -f "$TMP_KEY_CONTENT"
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ for server in "${servers[@]}"; do
|
|||||||
done
|
done
|
||||||
if ((attempt >= MAX_ATTEMPTS)); then
|
if ((attempt >= MAX_ATTEMPTS)); then
|
||||||
msg_error "No more attempts - aborting script!"
|
msg_error "No more attempts - aborting script!"
|
||||||
exit 1
|
exit 254
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ update_os
|
|||||||
read -r -p "${TAB3}Enter PostgreSQL version (15/16/17/18): " ver
|
read -r -p "${TAB3}Enter PostgreSQL version (15/16/17/18): " ver
|
||||||
[[ $ver =~ ^(15|16|17|18)$ ]] || {
|
[[ $ver =~ ^(15|16|17|18)$ ]] || {
|
||||||
echo "Invalid version"
|
echo "Invalid version"
|
||||||
exit 1
|
exit 64
|
||||||
}
|
}
|
||||||
PG_VERSION=$ver setup_postgresql
|
PG_VERSION=$ver setup_postgresql
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ if useradd -r -m -d /opt/pulse-home -s /usr/sbin/nologin pulse; then
|
|||||||
msg_ok "Created User"
|
msg_ok "Created User"
|
||||||
else
|
else
|
||||||
msg_error "User creation failed"
|
msg_error "User creation failed"
|
||||||
exit 1
|
exit 71
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/pulse
|
mkdir -p /etc/pulse
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ while true; do
|
|||||||
[Nn]|[Nn][Oo]|"")
|
[Nn]|[Nn][Oo]|"")
|
||||||
msg_error "Terms not accepted. Installation cannot proceed."
|
msg_error "Terms not accepted. Installation cannot proceed."
|
||||||
msg_error "Please review the terms and run the script again if you wish to proceed."
|
msg_error "Please review the terms and run the script again if you wish to proceed."
|
||||||
exit 1
|
exit 254
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg_error "Invalid response. Please enter 'y' for yes or 'n' for no."
|
msg_error "Invalid response. Please enter 'y' for yes or 'n' for no."
|
||||||
@@ -47,7 +47,7 @@ DOWNLOAD_URL=$(curl -s "https://www.splunk.com/en_us/download/splunk-enterprise.
|
|||||||
RELEASE=$(echo "$DOWNLOAD_URL" | sed 's|.*/releases/\([^/]*\)/.*|\1|')
|
RELEASE=$(echo "$DOWNLOAD_URL" | sed 's|.*/releases/\([^/]*\)/.*|\1|')
|
||||||
$STD curl -fsSL -o "splunk-enterprise.tgz" "$DOWNLOAD_URL" || {
|
$STD curl -fsSL -o "splunk-enterprise.tgz" "$DOWNLOAD_URL" || {
|
||||||
msg_error "Failed to download Splunk Enterprise from the provided link."
|
msg_error "Failed to download Splunk Enterprise from the provided link."
|
||||||
exit 1
|
exit 250
|
||||||
}
|
}
|
||||||
$STD tar -xzf "splunk-enterprise.tgz" -C /opt
|
$STD tar -xzf "splunk-enterprise.tgz" -C /opt
|
||||||
rm -f "splunk-enterprise.tgz"
|
rm -f "splunk-enterprise.tgz"
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ update_os
|
|||||||
if [[ "${CTTYPE:-1}" != "0" ]]; then
|
if [[ "${CTTYPE:-1}" != "0" ]]; then
|
||||||
msg_error "UniFi OS Server requires a privileged LXC container."
|
msg_error "UniFi OS Server requires a privileged LXC container."
|
||||||
msg_error "Recreate the container with unprivileged=0."
|
msg_error "Recreate the container with unprivileged=0."
|
||||||
exit 1
|
exit 10
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e /dev/net/tun ]]; then
|
if [[ ! -e /dev/net/tun ]]; then
|
||||||
msg_error "Missing /dev/net/tun in container."
|
msg_error "Missing /dev/net/tun in container."
|
||||||
msg_error "Enable TUN/TAP (var_tun=yes) or add /dev/net/tun passthrough."
|
msg_error "Enable TUN/TAP (var_tun=yes) or add /dev/net/tun passthrough."
|
||||||
exit 1
|
exit 236
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Installing dependencies"
|
msg_info "Installing dependencies"
|
||||||
@@ -48,7 +48,7 @@ TEMP_JSON="$(mktemp)"
|
|||||||
if ! curl -fsSL "$API_URL" -o "$TEMP_JSON"; then
|
if ! curl -fsSL "$API_URL" -o "$TEMP_JSON"; then
|
||||||
rm -f "$TEMP_JSON"
|
rm -f "$TEMP_JSON"
|
||||||
msg_error "Failed to fetch data from Ubiquiti API"
|
msg_error "Failed to fetch data from Ubiquiti API"
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
LATEST=$(jq -r '
|
LATEST=$(jq -r '
|
||||||
._embedded.firmware
|
._embedded.firmware
|
||||||
@@ -62,7 +62,7 @@ UOS_URL=$(echo "$LATEST" | jq -r '._links.data.href')
|
|||||||
rm -f "$TEMP_JSON"
|
rm -f "$TEMP_JSON"
|
||||||
if [[ -z "$UOS_URL" || -z "$UOS_VERSION" || "$UOS_URL" == "null" ]]; then
|
if [[ -z "$UOS_URL" || -z "$UOS_VERSION" || "$UOS_URL" == "null" ]]; then
|
||||||
msg_error "Failed to parse UniFi OS Server version or download URL"
|
msg_error "Failed to parse UniFi OS Server version or download URL"
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
msg_ok "Found UniFi OS Server ${UOS_VERSION}"
|
msg_ok "Found UniFi OS Server ${UOS_VERSION}"
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ if gpg --verify /tmp/zerotier-install.sh >/dev/null 2>&1; then
|
|||||||
$STD bash /tmp/zerotier-install.sh
|
$STD bash /tmp/zerotier-install.sh
|
||||||
else
|
else
|
||||||
msg_warn "Could not verify signature of Zerotier-One install script. Exiting..."
|
msg_warn "Could not verify signature of Zerotier-One install script. Exiting..."
|
||||||
exit 1
|
exit 250
|
||||||
fi
|
fi
|
||||||
msg_ok "Setup Zerotier-One"
|
msg_ok "Setup Zerotier-One"
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ detect_repo_source
|
|||||||
# * Proxmox custom codes (200-231)
|
# * Proxmox custom codes (200-231)
|
||||||
# * Tools & Addon Scripts (232-238)
|
# * Tools & Addon Scripts (232-238)
|
||||||
# * Node.js/npm errors (239, 243, 245-249)
|
# * Node.js/npm errors (239, 243, 245-249)
|
||||||
|
# * Application Install/Update errors (250-254)
|
||||||
# - Returns description string for given exit code
|
# - Returns description string for given exit code
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
explain_exit_code() {
|
explain_exit_code() {
|
||||||
@@ -322,6 +323,13 @@ explain_exit_code() {
|
|||||||
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
||||||
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
||||||
|
|
||||||
|
# --- Application Install/Update Errors (250-254) ---
|
||||||
|
250) echo "App: Download failed or version not determined" ;;
|
||||||
|
251) echo "App: File extraction failed (corrupt or incomplete archive)" ;;
|
||||||
|
252) echo "App: Required file or resource not found" ;;
|
||||||
|
253) echo "App: Data migration required — update aborted" ;;
|
||||||
|
254) echo "App: User declined prompt or input timed out" ;;
|
||||||
|
|
||||||
# --- DPKG ---
|
# --- DPKG ---
|
||||||
255) echo "DPKG: Fatal internal error" ;;
|
255) echo "DPKG: Fatal internal error" ;;
|
||||||
|
|
||||||
@@ -385,6 +393,11 @@ get_error_text() {
|
|||||||
logfile="$BUILD_LOG"
|
logfile="$BUILD_LOG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Try SILENT_LOGFILE as last resort (captures $STD command output)
|
||||||
|
if [[ -z "$logfile" || ! -s "$logfile" ]] && [[ -n "${SILENT_LOGFILE:-}" && -s "${SILENT_LOGFILE}" ]]; then
|
||||||
|
logfile="$SILENT_LOGFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "$logfile" && -s "$logfile" ]]; then
|
if [[ -n "$logfile" && -s "$logfile" ]]; then
|
||||||
tail -n 20 "$logfile" 2>/dev/null | sed 's/\r$//' | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g'
|
tail -n 20 "$logfile" 2>/dev/null | sed 's/\r$//' | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g'
|
||||||
fi
|
fi
|
||||||
@@ -430,6 +443,13 @@ get_full_log() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fall back to SILENT_LOGFILE (captures $STD command output)
|
||||||
|
if [[ -z "$logfile" || ! -s "$logfile" ]]; then
|
||||||
|
if [[ -n "${SILENT_LOGFILE:-}" && -s "${SILENT_LOGFILE}" ]]; then
|
||||||
|
logfile="$SILENT_LOGFILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "$logfile" && -s "$logfile" ]]; then
|
if [[ -n "$logfile" && -s "$logfile" ]]; then
|
||||||
# Strip ANSI codes, carriage returns, and anonymize IP addresses (GDPR)
|
# Strip ANSI codes, carriage returns, and anonymize IP addresses (GDPR)
|
||||||
sed 's/\r$//' "$logfile" 2>/dev/null |
|
sed 's/\r$//' "$logfile" 2>/dev/null |
|
||||||
@@ -868,7 +888,7 @@ post_update_to_api() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# For failed/unknown status, resolve exit code and error description
|
# For failed/unknown status, resolve exit code and error description
|
||||||
local short_error=""
|
local short_error="" medium_error=""
|
||||||
if [[ "$pb_status" == "failed" ]] || [[ "$pb_status" == "unknown" ]]; then
|
if [[ "$pb_status" == "failed" ]] || [[ "$pb_status" == "unknown" ]]; then
|
||||||
if [[ "$raw_exit_code" =~ ^[0-9]+$ ]]; then
|
if [[ "$raw_exit_code" =~ ^[0-9]+$ ]]; then
|
||||||
exit_code="$raw_exit_code"
|
exit_code="$raw_exit_code"
|
||||||
@@ -888,6 +908,18 @@ post_update_to_api() {
|
|||||||
short_error=$(json_escape "$(explain_exit_code "$exit_code")")
|
short_error=$(json_escape "$(explain_exit_code "$exit_code")")
|
||||||
error_category=$(categorize_error "$exit_code")
|
error_category=$(categorize_error "$exit_code")
|
||||||
[[ -z "$error" ]] && error="Unknown error"
|
[[ -z "$error" ]] && error="Unknown error"
|
||||||
|
|
||||||
|
# Build medium error for attempt 2: explanation + last 100 log lines (≤16KB)
|
||||||
|
# This is the critical middle ground between full 120KB log and generic-only description
|
||||||
|
local medium_log=""
|
||||||
|
medium_log=$(get_full_log 16384) || true # 16KB max
|
||||||
|
if [[ -z "$medium_log" ]]; then
|
||||||
|
medium_log=$(get_error_text) || true
|
||||||
|
fi
|
||||||
|
local medium_full
|
||||||
|
medium_full=$(build_error_string "$exit_code" "$medium_log")
|
||||||
|
medium_error=$(json_escape "$medium_full")
|
||||||
|
[[ -z "$medium_error" ]] && medium_error="$short_error"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Calculate duration if timer was started
|
# Calculate duration if timer was started
|
||||||
@@ -946,7 +978,7 @@ EOF
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Attempt 2: Short error text (no full log) ──
|
# ── Attempt 2: Medium error text (truncated log ≤16KB instead of full 120KB) ──
|
||||||
sleep 1
|
sleep 1
|
||||||
local RETRY_PAYLOAD
|
local RETRY_PAYLOAD
|
||||||
RETRY_PAYLOAD=$(
|
RETRY_PAYLOAD=$(
|
||||||
@@ -966,7 +998,7 @@ EOF
|
|||||||
"pve_version": "${pve_version}",
|
"pve_version": "${pve_version}",
|
||||||
"method": "${METHOD:-default}",
|
"method": "${METHOD:-default}",
|
||||||
"exit_code": ${exit_code},
|
"exit_code": ${exit_code},
|
||||||
"error": "${short_error}",
|
"error": "${medium_error}",
|
||||||
"error_category": "${error_category}",
|
"error_category": "${error_category}",
|
||||||
"install_duration": ${duration},
|
"install_duration": ${duration},
|
||||||
"cpu_vendor": "${cpu_vendor}",
|
"cpu_vendor": "${cpu_vendor}",
|
||||||
@@ -989,7 +1021,7 @@ EOF
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Attempt 3: Minimal payload (bare minimum to set status) ──
|
# ── Attempt 3: Minimal payload with medium error (bare minimum to set status) ──
|
||||||
sleep 2
|
sleep 2
|
||||||
local MINIMAL_PAYLOAD
|
local MINIMAL_PAYLOAD
|
||||||
MINIMAL_PAYLOAD=$(
|
MINIMAL_PAYLOAD=$(
|
||||||
@@ -1001,7 +1033,7 @@ EOF
|
|||||||
"nsapp": "${NSAPP:-unknown}",
|
"nsapp": "${NSAPP:-unknown}",
|
||||||
"status": "${pb_status}",
|
"status": "${pb_status}",
|
||||||
"exit_code": ${exit_code},
|
"exit_code": ${exit_code},
|
||||||
"error": "${short_error}",
|
"error": "${medium_error}",
|
||||||
"error_category": "${error_category}",
|
"error_category": "${error_category}",
|
||||||
"install_duration": ${duration}
|
"install_duration": ${duration}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,6 +195,14 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
247) echo "Node.js: Fatal internal error" ;;
|
247) echo "Node.js: Fatal internal error" ;;
|
||||||
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
||||||
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
||||||
|
|
||||||
|
# --- Application Install/Update Errors (250-254) ---
|
||||||
|
250) echo "App: Download failed or version not determined" ;;
|
||||||
|
251) echo "App: File extraction failed (corrupt or incomplete archive)" ;;
|
||||||
|
252) echo "App: Required file or resource not found" ;;
|
||||||
|
253) echo "App: Data migration required — update aborted" ;;
|
||||||
|
254) echo "App: User declined prompt or input timed out" ;;
|
||||||
|
|
||||||
255) echo "DPKG: Fatal internal error" ;;
|
255) echo "DPKG: Fatal internal error" ;;
|
||||||
*) echo "Unknown error" ;;
|
*) echo "Unknown error" ;;
|
||||||
esac
|
esac
|
||||||
@@ -400,10 +408,29 @@ _send_abort_telemetry() {
|
|||||||
[[ "${DIAGNOSTICS:-no}" == "no" ]] && return 0
|
[[ "${DIAGNOSTICS:-no}" == "no" ]] && return 0
|
||||||
[[ -z "${RANDOM_UUID:-}" ]] && return 0
|
[[ -z "${RANDOM_UUID:-}" ]] && return 0
|
||||||
|
|
||||||
# Collect last 20 log lines for error diagnosis (best-effort)
|
# Collect last 200 log lines for error diagnosis (best-effort)
|
||||||
|
# Container context has no get_full_log(), so we gather as much as possible
|
||||||
local error_text=""
|
local error_text=""
|
||||||
|
local logfile=""
|
||||||
if [[ -n "${INSTALL_LOG:-}" && -s "${INSTALL_LOG}" ]]; then
|
if [[ -n "${INSTALL_LOG:-}" && -s "${INSTALL_LOG}" ]]; then
|
||||||
error_text=$(tail -n 20 "$INSTALL_LOG" 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\\/\\\\/g; s/"/\\"/g; s/\r//g' | tr '\n' '|' | sed 's/|$//' | tr -d '\000-\010\013\014\016-\037\177') || true
|
logfile="${INSTALL_LOG}"
|
||||||
|
elif [[ -n "${SILENT_LOGFILE:-}" && -s "${SILENT_LOGFILE}" ]]; then
|
||||||
|
logfile="${SILENT_LOGFILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$logfile" ]]; then
|
||||||
|
error_text=$(tail -n 200 "$logfile" 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\\/\\\\/g; s/"/\\"/g; s/\r//g' | tr '\n' '|' | sed 's/|$//' | head -c 16384 | tr -d '\000-\010\013\014\016-\037\177') || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepend exit code explanation header (like build_error_string does on host)
|
||||||
|
local explanation=""
|
||||||
|
if declare -f explain_exit_code &>/dev/null; then
|
||||||
|
explanation=$(explain_exit_code "$exit_code" 2>/dev/null) || true
|
||||||
|
fi
|
||||||
|
if [[ -n "$explanation" && -n "$error_text" ]]; then
|
||||||
|
error_text="exit_code=${exit_code} | ${explanation}|---|${error_text}"
|
||||||
|
elif [[ -n "$explanation" && -z "$error_text" ]]; then
|
||||||
|
error_text="exit_code=${exit_code} | ${explanation}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Calculate duration if start time is available
|
# Calculate duration if start time is available
|
||||||
@@ -412,10 +439,17 @@ _send_abort_telemetry() {
|
|||||||
duration=$(($(date +%s) - DIAGNOSTICS_START_TIME))
|
duration=$(($(date +%s) - DIAGNOSTICS_START_TIME))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Categorize error if function is available (may not be in minimal container context)
|
||||||
|
local error_category=""
|
||||||
|
if declare -f categorize_error &>/dev/null; then
|
||||||
|
error_category=$(categorize_error "$exit_code" 2>/dev/null) || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Build JSON payload with error context
|
# Build JSON payload with error context
|
||||||
local payload
|
local payload
|
||||||
payload="{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"${TELEMETRY_TYPE:-lxc}\",\"nsapp\":\"${NSAPP:-${app:-unknown}}\",\"status\":\"failed\",\"exit_code\":${exit_code}"
|
payload="{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"${TELEMETRY_TYPE:-lxc}\",\"nsapp\":\"${NSAPP:-${app:-unknown}}\",\"status\":\"failed\",\"exit_code\":${exit_code}"
|
||||||
[[ -n "$error_text" ]] && payload="${payload},\"error\":\"${error_text}\""
|
[[ -n "$error_text" ]] && payload="${payload},\"error\":\"${error_text}\""
|
||||||
|
[[ -n "$error_category" ]] && payload="${payload},\"error_category\":\"${error_category}\""
|
||||||
[[ -n "$duration" ]] && payload="${payload},\"duration\":${duration}"
|
[[ -n "$duration" ]] && payload="${payload},\"duration\":${duration}"
|
||||||
payload="${payload}}"
|
payload="${payload}}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user