mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-12-22 15:06:25 +01:00
Compare commits
12 Commits
2025-12-20
...
update_uni
| Author | SHA1 | Date | |
|---|---|---|---|
| 93815cbe33 | |||
| 9258fa684a | |||
| 6dab7728df | |||
| abfe97a9c9 | |||
| 174721bc14 | |||
| 8c1f42f6c1 | |||
| 245578a2a3 | |||
| 4c9baeb755 | |||
| b9640c4211 | |||
| b7ef0f8f01 | |||
| 8f3fa0c88a | |||
| 867f3347c7 |
14
CHANGELOG.md
14
CHANGELOG.md
@ -12,6 +12,20 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
## 2025-12-21
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- Typo fix in Heimdall install script [@Turcid-uwu](https://github.com/Turcid-uwu) ([#10187](https://github.com/community-scripts/ProxmoxVE/pull/10187))
|
||||
|
||||
- #### 🔧 Refactor
|
||||
|
||||
- Refactor: Backrest [@tremor021](https://github.com/tremor021) ([#10193](https://github.com/community-scripts/ProxmoxVE/pull/10193))
|
||||
|
||||
### 🧰 Tools
|
||||
|
||||
- pihole-exporter ([#10091](https://github.com/community-scripts/ProxmoxVE/pull/10091))
|
||||
|
||||
## 2025-12-20
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
@ -27,28 +27,18 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/garethgeorge/backrest/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
|
||||
if check_for_gh_release "backrest" "garethgeorge/backrest"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop backrest
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
temp_file=$(mktemp)
|
||||
rm -f /opt/backrest/bin/backrest
|
||||
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "$temp_file"
|
||||
tar xzf $temp_file -C /opt/backrest/bin
|
||||
chmod +x /opt/backrest/bin/backrest
|
||||
rm -f "$temp_file"
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||
fetch_and_deploy_gh_release "backrest" "garethgeorge/backrest" "prebuild" "latest" "/opt/backrest/bin" "backrest_Linux_x86_64.tar.gz"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start backrest
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
|
||||
JAVA_VERSION="21" setup_java
|
||||
|
||||
msg_info "Updating ${APP}"
|
||||
$STD apt update --allow-releaseinfo-change
|
||||
$STD apt install -y unifi
|
||||
|
||||
46
frontend/public/json/pihole-exporter.json
Normal file
46
frontend/public/json/pihole-exporter.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "Pi-Hole Exporter",
|
||||
"slug": "pihole-exporter",
|
||||
"categories": [
|
||||
9
|
||||
],
|
||||
"date_created": "2025-12-21",
|
||||
"type": "addon",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 9617,
|
||||
"documentation": "https://github.com/eko/pihole-exporter",
|
||||
"website": "https://github.com/eko/pihole-exporter",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/pi-hole.webp",
|
||||
"config_path": "/opt/pihole-exporter.env",
|
||||
"description": "A Prometheus exporter for PI-Hole's Raspberry PI ad blocker",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "tools/addon/pihole-exporter.sh",
|
||||
"resources": {
|
||||
"cpu": null,
|
||||
"ram": null,
|
||||
"hdd": null,
|
||||
"os": null,
|
||||
"version": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "alpine",
|
||||
"script": "tools/addon/pihole-exporter.sh",
|
||||
"resources": {
|
||||
"cpu": null,
|
||||
"ram": null,
|
||||
"hdd": null,
|
||||
"os": null,
|
||||
"version": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
@ -1,8 +1,58 @@
|
||||
[
|
||||
{
|
||||
"name": "msgbyte/tianji",
|
||||
"version": "v1.30.24",
|
||||
"date": "2025-12-21T10:26:35Z"
|
||||
},
|
||||
{
|
||||
"name": "hyperion-project/hyperion.ng",
|
||||
"version": "2.1.1",
|
||||
"date": "2025-06-14T17:45:06Z"
|
||||
},
|
||||
{
|
||||
"name": "pocketbase/pocketbase",
|
||||
"version": "v0.35.0",
|
||||
"date": "2025-12-21T07:44:15Z"
|
||||
},
|
||||
{
|
||||
"name": "morpheus65535/bazarr",
|
||||
"version": "v1.5.3",
|
||||
"date": "2025-09-20T12:12:33Z"
|
||||
},
|
||||
{
|
||||
"name": "Jackett/Jackett",
|
||||
"version": "v0.24.498",
|
||||
"date": "2025-12-21T05:55:52Z"
|
||||
},
|
||||
{
|
||||
"name": "scanopy/scanopy",
|
||||
"version": "v0.12.5",
|
||||
"date": "2025-12-20T22:40:12Z"
|
||||
"date": "2025-12-21T05:36:12Z"
|
||||
},
|
||||
{
|
||||
"name": "fuma-nama/fumadocs",
|
||||
"version": "fumadocs-ui@16.3.2",
|
||||
"date": "2025-12-21T05:23:55Z"
|
||||
},
|
||||
{
|
||||
"name": "dedicatedcode/reitti",
|
||||
"version": "v3.0.1",
|
||||
"date": "2025-12-21T04:35:21Z"
|
||||
},
|
||||
{
|
||||
"name": "intri-in/manage-my-damn-life-nextjs",
|
||||
"version": "v0.8.2",
|
||||
"date": "2025-12-21T03:53:53Z"
|
||||
},
|
||||
{
|
||||
"name": "steveiliop56/tinyauth",
|
||||
"version": "v4.1.0",
|
||||
"date": "2025-11-23T12:13:34Z"
|
||||
},
|
||||
{
|
||||
"name": "jeedom/core",
|
||||
"version": "4.5.1",
|
||||
"date": "2025-12-21T00:27:04Z"
|
||||
},
|
||||
{
|
||||
"name": "Luligu/matterbridge",
|
||||
@ -39,11 +89,6 @@
|
||||
"version": "v14.3.0",
|
||||
"date": "2025-12-20T13:16:37Z"
|
||||
},
|
||||
{
|
||||
"name": "fuma-nama/fumadocs",
|
||||
"version": "create-fumadocs-app@16.0.30",
|
||||
"date": "2025-12-20T10:47:00Z"
|
||||
},
|
||||
{
|
||||
"name": "zwave-js/zwave-js-ui",
|
||||
"version": "v11.9.1",
|
||||
@ -59,31 +104,11 @@
|
||||
"version": "v6.4.14",
|
||||
"date": "2025-12-16T05:42:34Z"
|
||||
},
|
||||
{
|
||||
"name": "Jackett/Jackett",
|
||||
"version": "v0.24.488",
|
||||
"date": "2025-12-20T05:55:23Z"
|
||||
},
|
||||
{
|
||||
"name": "louislam/uptime-kuma",
|
||||
"version": "2.0.2",
|
||||
"date": "2025-10-22T17:03:54Z"
|
||||
},
|
||||
{
|
||||
"name": "hyperion-project/hyperion.ng",
|
||||
"version": "2.1.1",
|
||||
"date": "2025-06-14T17:45:06Z"
|
||||
},
|
||||
{
|
||||
"name": "jeedom/core",
|
||||
"version": "4.5.1",
|
||||
"date": "2025-12-20T00:27:06Z"
|
||||
},
|
||||
{
|
||||
"name": "steveiliop56/tinyauth",
|
||||
"version": "v4.1.0",
|
||||
"date": "2025-11-23T12:13:34Z"
|
||||
},
|
||||
{
|
||||
"name": "Dispatcharr/Dispatcharr",
|
||||
"version": "v0.15.0",
|
||||
@ -174,11 +199,6 @@
|
||||
"version": "v25.4",
|
||||
"date": "2025-10-09T10:27:01Z"
|
||||
},
|
||||
{
|
||||
"name": "dedicatedcode/reitti",
|
||||
"version": "v3.0.0",
|
||||
"date": "2025-12-19T13:47:44Z"
|
||||
},
|
||||
{
|
||||
"name": "raydak-labs/configarr",
|
||||
"version": "v1.19.0",
|
||||
@ -224,11 +244,6 @@
|
||||
"version": "v11.1.2",
|
||||
"date": "2025-12-17T09:26:24Z"
|
||||
},
|
||||
{
|
||||
"name": "morpheus65535/bazarr",
|
||||
"version": "v1.5.3",
|
||||
"date": "2025-09-20T12:12:33Z"
|
||||
},
|
||||
{
|
||||
"name": "jhuckaby/Cronicle",
|
||||
"version": "v0.9.102",
|
||||
@ -242,7 +257,7 @@
|
||||
{
|
||||
"name": "mealie-recipes/mealie",
|
||||
"version": "v3.8.0",
|
||||
"date": "2025-12-19T01:37:16Z"
|
||||
"date": "2025-12-19T01:37:04Z"
|
||||
},
|
||||
{
|
||||
"name": "moghtech/komodo",
|
||||
@ -284,11 +299,6 @@
|
||||
"version": "2025.11.2",
|
||||
"date": "2025-12-18T17:08:34Z"
|
||||
},
|
||||
{
|
||||
"name": "msgbyte/tianji",
|
||||
"version": "v1.30.23",
|
||||
"date": "2025-12-18T16:55:01Z"
|
||||
},
|
||||
{
|
||||
"name": "ollama/ollama",
|
||||
"version": "v0.13.5",
|
||||
@ -844,11 +854,6 @@
|
||||
"version": "v1.7.4",
|
||||
"date": "2025-12-04T13:56:39Z"
|
||||
},
|
||||
{
|
||||
"name": "pocketbase/pocketbase",
|
||||
"version": "v0.34.2",
|
||||
"date": "2025-12-04T13:08:18Z"
|
||||
},
|
||||
{
|
||||
"name": "glpi-project/glpi",
|
||||
"version": "11.0.4",
|
||||
@ -1404,11 +1409,6 @@
|
||||
"version": "v2.7.6",
|
||||
"date": "2025-09-15T15:50:44Z"
|
||||
},
|
||||
{
|
||||
"name": "intri-in/manage-my-damn-life-nextjs",
|
||||
"version": "v0.8.1",
|
||||
"date": "2025-09-14T06:45:23Z"
|
||||
},
|
||||
{
|
||||
"name": "ThePhaseless/Byparr",
|
||||
"version": "v2.0.1",
|
||||
|
||||
@ -13,16 +13,7 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Backrest"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/garethgeorge/backrest/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
temp_file=$(mktemp)
|
||||
mkdir -p /opt/backrest/{bin,config,data}
|
||||
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "$temp_file"
|
||||
tar xzf $temp_file -C /opt/backrest/bin
|
||||
chmod +x /opt/backrest/bin/backrest
|
||||
rm -f "$temp_file"
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Backrest"
|
||||
fetch_and_deploy_gh_release "backrest" "garethgeorge/backrest" "prebuild" "latest" "/opt/backrest/bin" "backrest_Linux_x86_64.tar.gz"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/backrest.service
|
||||
@ -32,7 +23,6 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=/opt/backrest/bin/backrest
|
||||
Environment="BACKREST_PORT=9898"
|
||||
Environment="BACKREST_CONFIG=/opt/backrest/config/config.json"
|
||||
@ -48,4 +38,3 @@ msg_ok "Created Service"
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ ExecStart=/usr/bin/php artisan serve --port 7990 --host 0.0.0.0
|
||||
TimeoutStopSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now heimdall
|
||||
cd /opt/Heimdall
|
||||
|
||||
@ -17,7 +17,6 @@ msg_info "Installing Dependencies"
|
||||
$STD apt install -y apt-transport-https
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
JAVA_VERION="17" setup_java
|
||||
setup_deb822_repo \
|
||||
"unifi" \
|
||||
"https://dl.ui.com/unifi/unifi-repo.gpg" \
|
||||
@ -26,17 +25,22 @@ setup_deb822_repo \
|
||||
"ubiquiti" \
|
||||
"amd64"
|
||||
|
||||
if ! grep -q -m1 'avx[^ ]*' /proc/cpuinfo; then
|
||||
msg_warn "No AVX Support Detected. MongoDB v4.4 will be installed"
|
||||
if ! dpkg -l | grep -q "libssl1.1"; then
|
||||
curl -fsSL "https://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1w-0+deb11u4_amd64.deb" -o "libssl1.1_1.1.1w-0+deb11u4_amd64.deb"
|
||||
$STD dpkg -i libssl1.1_1.1.1w-0+deb11u4_amd64.deb
|
||||
fi
|
||||
MONGO_VERSION="4.4" setup_mongodb
|
||||
JAVA_VERSION="21" setup_java
|
||||
|
||||
if lscpu | grep -q 'avx'; then
|
||||
MONGO_VERSION="8.0" setup_mongodb
|
||||
else
|
||||
MONGO_VERSION="7.0" setup_mongodb
|
||||
msg_error "No AVX detected (CPU-Flag)! We have discontinued support for this. You are welcome to try it manually with a Debian LXC, but due to the many issues with Unifi, we currently only support AVX CPUs."
|
||||
exit 10
|
||||
fi
|
||||
|
||||
if ! dpkg -l | grep -q 'libssl1.1'; then
|
||||
msg_info "Installing libssl (if needed)"
|
||||
curl -fsSL "https://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1w-0+deb11u4_amd64.deb" -o "/tmp/libssl.deb"
|
||||
$STD dpkg -i /tmp/libssl.deb
|
||||
rm -f /tmp/libssl.deb
|
||||
msg_ok "Installed libssl1.1"
|
||||
fi
|
||||
msg_ok "Installed MongoDB"
|
||||
|
||||
msg_info "Installing UniFi Network Server"
|
||||
$STD apt install -y unifi
|
||||
|
||||
249
tools/addon/pihole-exporter.sh
Normal file
249
tools/addon/pihole-exporter.sh
Normal file
@ -0,0 +1,249 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: CrazyWolf13
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/eko/pihole-exporter/
|
||||
|
||||
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)
|
||||
|
||||
# Enable error handling
|
||||
set -Eeuo pipefail
|
||||
trap 'error_handler' ERR
|
||||
|
||||
load_functions
|
||||
# ==============================================================================
|
||||
# CONFIGURATION
|
||||
# ==============================================================================
|
||||
VERBOSE=${var_verbose:-no}
|
||||
APP="pihole-exporter"
|
||||
APP_TYPE="tools"
|
||||
INSTALL_PATH="/opt/pihole-exporter"
|
||||
CONFIG_PATH="/opt/pihole-exporter.env"
|
||||
header_info
|
||||
ensure_usr_local_bin_persist
|
||||
get_current_ip &>/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# OS DETECTION
|
||||
# ==============================================================================
|
||||
if [[ -f "/etc/alpine-release" ]]; then
|
||||
OS="Alpine"
|
||||
SERVICE_PATH="/etc/init.d/pihole-exporter"
|
||||
elif grep -qE 'ID=debian|ID=ubuntu' /etc/os-release; then
|
||||
OS="Debian"
|
||||
SERVICE_PATH="/etc/systemd/system/pihole-exporter.service"
|
||||
else
|
||||
echo -e "${CROSS} Unsupported OS detected. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# UNINSTALL
|
||||
# ==============================================================================
|
||||
function uninstall() {
|
||||
msg_info "Uninstalling Pihole-Exporter"
|
||||
if [[ "$OS" == "Alpine" ]]; then
|
||||
rc-service pihole-exporter stop &>/dev/null
|
||||
rc-update del pihole-exporter &>/dev/null
|
||||
rm -f "$SERVICE_PATH"
|
||||
else
|
||||
systemctl disable -q --now pihole-exporter
|
||||
rm -f "$SERVICE_PATH"
|
||||
fi
|
||||
rm -rf "$INSTALL_PATH" "$CONFIG_PATH"
|
||||
rm -f "/usr/local/bin/update_pihole-exporter"
|
||||
rm -f "$HOME/.pihole-exporter"
|
||||
msg_ok "Pihole-Exporter has been uninstalled"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# UPDATE
|
||||
# ==============================================================================
|
||||
function update() {
|
||||
if check_for_gh_release "pihole-exporter" "eko/pihole-exporter"; then
|
||||
msg_info "Stopping service"
|
||||
if [[ "$OS" == "Alpine" ]]; then
|
||||
rc-service pihole-exporter stop &>/dev/null
|
||||
else
|
||||
systemctl stop pihole-exporter
|
||||
fi
|
||||
msg_ok "Stopped service"
|
||||
|
||||
fetch_and_deploy_gh_release "pihole-exporter" "eko/pihole-exporter" "tarball" "latest"
|
||||
setup_go
|
||||
|
||||
msg_info "Building Pihole-Exporter"
|
||||
cd /opt/pihole-exporter/
|
||||
$STD /usr/local/bin/go build -o ./pihole-exporter
|
||||
msg_ok "Built Pihole-Exporter"
|
||||
|
||||
msg_info "Starting service"
|
||||
if [[ "$OS" == "Alpine" ]]; then
|
||||
rc-service pihole-exporter start &>/dev/null
|
||||
else
|
||||
systemctl start pihole-exporter
|
||||
fi
|
||||
msg_ok "Started service"
|
||||
msg_ok "Updated successfully"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# INSTALL
|
||||
# ==============================================================================
|
||||
function install() {
|
||||
read -erp "Enter the protocol to use (http/https), default https: " pihole_PROTOCOL
|
||||
read -erp "Enter the hostname of Pihole, example: (127.0.0.1): " pihole_HOSTNAME
|
||||
read -erp "Enter the port of Pihole, default 443: " pihole_PORT
|
||||
read -rsp "Enter Pihole password: " pihole_PASSWORD
|
||||
printf "\n"
|
||||
read -erp "Do you want to skip TLS-Verification (if using a self-signed Certificate on Pi-Hole) [y/N]: " SKIP_TLS
|
||||
if [[ "${SKIP_TLS,,}" =~ ^(y|yes)$ ]]; then
|
||||
pihole_SKIP_TLS="true"
|
||||
fi
|
||||
|
||||
fetch_and_deploy_gh_release "pihole-exporter" "eko/pihole-exporter" "tarball" "latest"
|
||||
setup_go
|
||||
msg_info "Building Pihole-Exporter on ${OS}"
|
||||
cd /opt/pihole-exporter/
|
||||
$STD /usr/local/bin/go build -o ./pihole-exporter
|
||||
msg_ok "Built Pihole-Exporter"
|
||||
|
||||
msg_info "Creating configuration"
|
||||
cat <<EOF >"$CONFIG_PATH"
|
||||
# https://github.com/eko/pihole-exporter/?tab=readme-ov-file#available-cli-options
|
||||
PIHOLE_PASSWORD="${pihole_PASSWORD}"
|
||||
PIHOLE_HOSTNAME="${pihole_HOSTNAME:-127.0.0.1}"
|
||||
PIHOLE_PORT="${pihole_PORT:-443}"
|
||||
SKIP_TLS_VERIFICATION="${pihole_SKIP_TLS:-false}"
|
||||
PIHOLE_PROTOCOL="${pihole_PROTOCOL:-https}"
|
||||
EOF
|
||||
msg_ok "Created configuration"
|
||||
|
||||
msg_info "Creating service"
|
||||
if [[ "$OS" == "Debian" ]]; then
|
||||
cat <<EOF >"$SERVICE_PATH"
|
||||
[Unit]
|
||||
Description=pihole-exporter
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
WorkingDirectory=/opt/pihole-exporter
|
||||
EnvironmentFile=$CONFIG_PATH
|
||||
ExecStart=/opt/pihole-exporter/pihole-exporter
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q --now pihole-exporter
|
||||
else
|
||||
cat <<EOF >"$SERVICE_PATH"
|
||||
#!/sbin/openrc-run
|
||||
|
||||
name="pihole-exporter"
|
||||
description="Pi-hole Exporter for Prometheus"
|
||||
command="${INSTALL_PATH}/pihole-exporter"
|
||||
command_background=true
|
||||
directory="/opt/pihole-exporter"
|
||||
pidfile="/run/\${RC_SVCNAME}.pid"
|
||||
output_log="/var/log/pihole-exporter.log"
|
||||
error_log="/var/log/pihole-exporter.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after firewall
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ -f "$CONFIG_PATH" ]; then
|
||||
export \$(grep -v '^#' $CONFIG_PATH | xargs)
|
||||
fi
|
||||
}
|
||||
EOF
|
||||
chmod +x "$SERVICE_PATH"
|
||||
$STD rc-update add pihole-exporter default
|
||||
$STD rc-service pihole-exporter start
|
||||
fi
|
||||
msg_ok "Created and started service"
|
||||
|
||||
# Create update script
|
||||
msg_info "Creating update script"
|
||||
ensure_usr_local_bin_persist
|
||||
cat <<'UPDATEEOF' >/usr/local/bin/update_pihole-exporter
|
||||
#!/usr/bin/env bash
|
||||
# pihole-exporter Update Script
|
||||
type=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/pihole-exporter.sh)"
|
||||
UPDATEEOF
|
||||
chmod +x /usr/local/bin/update_pihole-exporter
|
||||
msg_ok "Created update script (/usr/local/bin/update_pihole-exporter)"
|
||||
|
||||
echo ""
|
||||
msg_ok "Pihole-Exporter installed successfully"
|
||||
msg_ok "Metrics: ${BL}http://${CURRENT_IP}:9617/metrics${CL}"
|
||||
msg_ok "Config: ${BL}${CONFIG_PATH}${CL}"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# MAIN
|
||||
# ==============================================================================
|
||||
header_info
|
||||
ensure_usr_local_bin_persist
|
||||
get_current_ip &>/dev/null
|
||||
|
||||
# Handle type=update (called from update script)
|
||||
if [[ "${type:-}" == "update" ]]; then
|
||||
if [[ -d "$INSTALL_PATH" && -f "$INSTALL_PATH/pihole-exporter" ]]; then
|
||||
update
|
||||
else
|
||||
msg_error "Pihole-Exporter is not installed. Nothing to update."
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if already installed
|
||||
if [[ -d "$INSTALL_PATH" && -f "$INSTALL_PATH/pihole-exporter" ]]; then
|
||||
msg_warn "Pihole-Exporter is already installed."
|
||||
echo ""
|
||||
|
||||
echo -n "${TAB}Uninstall Pihole-Exporter? (y/N): "
|
||||
read -r uninstall_prompt
|
||||
if [[ "${uninstall_prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
uninstall
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "${TAB}Update Pihole-Exporter? (y/N): "
|
||||
read -r update_prompt
|
||||
if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
update
|
||||
exit 0
|
||||
fi
|
||||
|
||||
msg_warn "No action selected. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Fresh installation
|
||||
msg_warn "Pihole-Exporter is not installed."
|
||||
echo ""
|
||||
echo -e "${TAB}${INFO} This will install:"
|
||||
echo -e "${TAB} - Pi-hole Exporter (Go binary)"
|
||||
echo -e "${TAB} - Systemd/OpenRC service"
|
||||
echo ""
|
||||
|
||||
echo -n "${TAB}Install Pihole-Exporter? (y/N): "
|
||||
read -r install_prompt
|
||||
if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
install
|
||||
else
|
||||
msg_warn "Installation cancelled. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
6
tools/headers/pihole-exporter
Normal file
6
tools/headers/pihole-exporter
Normal file
@ -0,0 +1,6 @@
|
||||
_ __ __ __
|
||||
____ (_) /_ ____ / /__ ___ _ ______ ____ _____/ /____ _____
|
||||
/ __ \/ / __ \/ __ \/ / _ \______/ _ \| |/_/ __ \/ __ \/ ___/ __/ _ \/ ___/
|
||||
/ /_/ / / / / / /_/ / / __/_____/ __/> </ /_/ / /_/ / / / /_/ __/ /
|
||||
/ .___/_/_/ /_/\____/_/\___/ \___/_/|_/ .___/\____/_/ \__/\___/_/
|
||||
/_/ /_/
|
||||
Reference in New Issue
Block a user