refactor locations
This commit is contained in:
parent
f826c56986
commit
6d88b971a3
@ -8,11 +8,11 @@
|
|||||||
"type": "addon",
|
"type": "addon",
|
||||||
"updateable": true,
|
"updateable": true,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": 9025,
|
"interface_port": 9205,
|
||||||
"documentation": "https://github.com/xperimental/nextcloud-exporter",
|
"documentation": "https://github.com/xperimental/nextcloud-exporter",
|
||||||
"website": "https://github.com/xperimental/nextcloud-exporter",
|
"website": "https://github.com/xperimental/nextcloud-exporter",
|
||||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/nextcloud.webp",
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/nextcloud.webp",
|
||||||
"config_path": "/opt/nextcloud-exporter.env",
|
"config_path": "/etc/nextcloud-exporter.env",
|
||||||
"description": "Prometheus exporter for Nextcloud servers. ",
|
"description": "Prometheus exporter for Nextcloud servers. ",
|
||||||
"install_methods": [
|
"install_methods": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,8 +20,8 @@ load_functions
|
|||||||
VERBOSE=${var_verbose:-no}
|
VERBOSE=${var_verbose:-no}
|
||||||
APP="nextcloud-exporter"
|
APP="nextcloud-exporter"
|
||||||
APP_TYPE="tools"
|
APP_TYPE="tools"
|
||||||
INSTALL_PATH="/opt/nextcloud-exporter"
|
BINARY_PATH="/usr/bin/nextcloud-exporter"
|
||||||
CONFIG_PATH="/opt/nextcloud-exporter.env"
|
CONFIG_PATH="/etc/nextcloud-exporter.env"
|
||||||
header_info
|
header_info
|
||||||
ensure_usr_local_bin_persist
|
ensure_usr_local_bin_persist
|
||||||
|
|
||||||
@ -52,7 +52,12 @@ function uninstall() {
|
|||||||
systemctl disable -q --now nextcloud-exporter
|
systemctl disable -q --now nextcloud-exporter
|
||||||
rm -f "$SERVICE_PATH"
|
rm -f "$SERVICE_PATH"
|
||||||
fi
|
fi
|
||||||
rm -rf "$INSTALL_PATH" "$CONFIG_PATH"
|
|
||||||
|
if dpkg -l | grep -q nextcloud-exporter; then
|
||||||
|
$STD apt-get remove -y nextcloud-exporter || $STD dpkg -r nextcloud-exporter
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$CONFIG_PATH"
|
||||||
rm -f "/usr/local/bin/update_nextcloud-exporter"
|
rm -f "/usr/local/bin/update_nextcloud-exporter"
|
||||||
rm -f "$HOME/.nextcloud-exporter"
|
rm -f "$HOME/.nextcloud-exporter"
|
||||||
msg_ok "Nextcloud-Exporter has been uninstalled"
|
msg_ok "Nextcloud-Exporter has been uninstalled"
|
||||||
@ -71,8 +76,7 @@ function update() {
|
|||||||
fi
|
fi
|
||||||
msg_ok "Stopped service"
|
msg_ok "Stopped service"
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "prebuild" "latest" "/opt/nextcloud-exporter" "nextcloud-exporter_*_amd64.deb"
|
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "binary" "latest"
|
||||||
setup_go
|
|
||||||
|
|
||||||
msg_info "Starting service"
|
msg_info "Starting service"
|
||||||
if [[ "$OS" == "Alpine" ]]; then
|
if [[ "$OS" == "Alpine" ]]; then
|
||||||
@ -115,8 +119,7 @@ function install() {
|
|||||||
NEXTCLOUD_TLS_SKIP_VERIFY="true"
|
NEXTCLOUD_TLS_SKIP_VERIFY="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "prebuild" "latest" "/opt/nextcloud-exporter" "nextcloud-exporter_*_amd64.deb"
|
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "binary" "latest"
|
||||||
setup_go
|
|
||||||
|
|
||||||
msg_info "Creating configuration"
|
msg_info "Creating configuration"
|
||||||
cat <<EOF >"$CONFIG_PATH"
|
cat <<EOF >"$CONFIG_PATH"
|
||||||
@ -141,9 +144,8 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/opt/nextcloud-exporter
|
|
||||||
EnvironmentFile=$CONFIG_PATH
|
EnvironmentFile=$CONFIG_PATH
|
||||||
ExecStart=/opt/nextcloud-exporter/nextcloud-exporter
|
ExecStart=$BINARY_PATH
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
@ -157,9 +159,8 @@ EOF
|
|||||||
|
|
||||||
name="nextcloud-exporter"
|
name="nextcloud-exporter"
|
||||||
description="Nextcloud Exporter for Prometheus"
|
description="Nextcloud Exporter for Prometheus"
|
||||||
command="${INSTALL_PATH}/nextcloud-exporter"
|
command="$BINARY_PATH"
|
||||||
command_background=true
|
command_background=true
|
||||||
directory="/opt/nextcloud-exporter"
|
|
||||||
pidfile="/run/\${RC_SVCNAME}.pid"
|
pidfile="/run/\${RC_SVCNAME}.pid"
|
||||||
output_log="/var/log/nextcloud-exporter.log"
|
output_log="/var/log/nextcloud-exporter.log"
|
||||||
error_log="/var/log/nextcloud-exporter.log"
|
error_log="/var/log/nextcloud-exporter.log"
|
||||||
@ -206,7 +207,7 @@ ensure_usr_local_bin_persist
|
|||||||
|
|
||||||
# Handle type=update (called from update script)
|
# Handle type=update (called from update script)
|
||||||
if [[ "${type:-}" == "update" ]]; then
|
if [[ "${type:-}" == "update" ]]; then
|
||||||
if [[ -d "$INSTALL_PATH" && -f "$INSTALL_PATH/nextcloud-exporter" ]]; then
|
if [[ -f "$BINARY_PATH" ]]; then
|
||||||
update
|
update
|
||||||
else
|
else
|
||||||
msg_error "Nextcloud-Exporter is not installed. Nothing to update."
|
msg_error "Nextcloud-Exporter is not installed. Nothing to update."
|
||||||
@ -216,7 +217,7 @@ if [[ "${type:-}" == "update" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if already installed
|
# Check if already installed
|
||||||
if [[ -d "$INSTALL_PATH" && -f "$INSTALL_PATH/nextcloud-exporter" ]]; then
|
if [[ -f "$BINARY_PATH" ]]; then
|
||||||
msg_warn "Nextcloud-Exporter is already installed."
|
msg_warn "Nextcloud-Exporter is already installed."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user