remove alpine

This commit is contained in:
Tobias 2025-12-25 01:09:39 +01:00
parent 39b0aa1612
commit a7d97b15e7
2 changed files with 9 additions and 75 deletions

View File

@ -25,17 +25,6 @@
"os": null, "os": null,
"version": null "version": null
} }
},
{
"type": "alpine",
"script": "tools/addon/nextcloud-exporter.sh",
"resources": {
"cpu": null,
"ram": null,
"hdd": null,
"os": null,
"version": null
}
} }
], ],
"default_credentials": { "default_credentials": {

View File

@ -22,34 +22,15 @@ APP="nextcloud-exporter"
APP_TYPE="tools" APP_TYPE="tools"
BINARY_PATH="/usr/bin/nextcloud-exporter" BINARY_PATH="/usr/bin/nextcloud-exporter"
CONFIG_PATH="/etc/nextcloud-exporter.env" CONFIG_PATH="/etc/nextcloud-exporter.env"
# ==============================================================================
# OS DETECTION
# ==============================================================================
if [[ -f "/etc/alpine-release" ]]; then
OS="Alpine"
SERVICE_PATH="/etc/init.d/nextcloud-exporter"
elif grep -qE 'ID=debian|ID=ubuntu' /etc/os-release; then
OS="Debian"
SERVICE_PATH="/etc/systemd/system/nextcloud-exporter.service" SERVICE_PATH="/etc/systemd/system/nextcloud-exporter.service"
else
echo -e "${CROSS} Unsupported OS detected. Exiting."
exit 1
fi
# ============================================================================== # ==============================================================================
# UNINSTALL # UNINSTALL
# ============================================================================== # ==============================================================================
function uninstall() { function uninstall() {
msg_info "Uninstalling Nextcloud-Exporter" msg_info "Uninstalling Nextcloud-Exporter"
if [[ "$OS" == "Alpine" ]]; then
rc-service nextcloud-exporter stop &>/dev/null
rc-update del nextcloud-exporter &>/dev/null
rm -f "$SERVICE_PATH"
else
systemctl disable -q --now nextcloud-exporter systemctl disable -q --now nextcloud-exporter
rm -f "$SERVICE_PATH" rm -f "$SERVICE_PATH"
fi
if dpkg -l | grep -q nextcloud-exporter; then if dpkg -l | grep -q nextcloud-exporter; then
$STD apt-get remove -y nextcloud-exporter || $STD dpkg -r nextcloud-exporter $STD apt-get remove -y nextcloud-exporter || $STD dpkg -r nextcloud-exporter
@ -67,21 +48,13 @@ function uninstall() {
function update() { function update() {
if check_for_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter"; then if check_for_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter"; then
msg_info "Stopping service" msg_info "Stopping service"
if [[ "$OS" == "Alpine" ]]; then
rc-service nextcloud-exporter stop &>/dev/null
else
systemctl stop nextcloud-exporter systemctl stop nextcloud-exporter
fi
msg_ok "Stopped service" msg_ok "Stopped service"
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "binary" "latest" fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "binary" "latest"
msg_info "Starting service" msg_info "Starting service"
if [[ "$OS" == "Alpine" ]]; then
rc-service nextcloud-exporter start &>/dev/null
else
systemctl start nextcloud-exporter systemctl start nextcloud-exporter
fi
msg_ok "Started service" msg_ok "Started service"
msg_ok "Updated successfully" msg_ok "Updated successfully"
exit exit
@ -134,7 +107,6 @@ EOF
msg_ok "Created configuration" msg_ok "Created configuration"
msg_info "Creating service" msg_info "Creating service"
if [[ "$OS" == "Debian" ]]; then
cat <<EOF >"$SERVICE_PATH" cat <<EOF >"$SERVICE_PATH"
[Unit] [Unit]
Description=nextcloud-exporter Description=nextcloud-exporter
@ -151,33 +123,6 @@ WantedBy=multi-user.target
EOF EOF
systemctl daemon-reload systemctl daemon-reload
systemctl enable -q --now nextcloud-exporter systemctl enable -q --now nextcloud-exporter
else
cat <<EOF >"$SERVICE_PATH"
#!/sbin/openrc-run
name="nextcloud-exporter"
description="Nextcloud Exporter for Prometheus"
command="$BINARY_PATH"
command_background=true
pidfile="/run/\${RC_SVCNAME}.pid"
output_log="/var/log/nextcloud-exporter.log"
error_log="/var/log/nextcloud-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 nextcloud-exporter default
$STD rc-service nextcloud-exporter start
fi
msg_ok "Created and started service" msg_ok "Created and started service"
# Create update script # Create update script
@ -243,7 +188,7 @@ msg_warn "Nextcloud-Exporter is not installed."
echo "" echo ""
echo -e "${TAB}${INFO} This will install:" echo -e "${TAB}${INFO} This will install:"
echo -e "${TAB} - Nextcloud Exporter (Go binary)" echo -e "${TAB} - Nextcloud Exporter (Go binary)"
echo -e "${TAB} - Systemd/OpenRC service" echo -e "${TAB} - Systemd service"
echo "" echo ""
echo -n "${TAB}Install Nextcloud-Exporter? (y/N): " echo -n "${TAB}Install Nextcloud-Exporter? (y/N): "