diff options
author | Tobias K <6317548+theCalcaholic@users.noreply.github.com> | 2022-04-19 02:32:18 +0300 |
---|---|---|
committer | Tobias K <6317548+theCalcaholic@users.noreply.github.com> | 2022-04-19 02:32:18 +0300 |
commit | b013c046eb60a1bef807ef1b04194ee8d2172032 (patch) | |
tree | 7bdc7bb2c227aeaca4e6b91f603ffae5916f31c1 | |
parent | fef94a2a9d0169a3938e8019c8ee0821708a27cd (diff) | |
parent | afbf651412147f92958ce8d3f128f0fda027e698 (diff) |
Merge branch 'devel'
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | bin/ncp/NETWORKING/dnsmasq.sh | 2 | ||||
-rw-r--r-- | bin/ncp/SYSTEM/metrics.sh | 29 |
3 files changed, 22 insertions, 11 deletions
@@ -13,7 +13,7 @@ This code also generates the NextCloudPi [docker image](https://hub.docker.com/r Find the full documentation at [docs.nextcloudpi.com](http://docs.nextcloudpi.com) -[![VM Integration Tests](https://github.com/nextcloud/nextcloudpi/actions/workflows/vm-tests.yml/badge.svg)](https://github.com/nextcloud/nextcloudpi/actions/workflows/vm-tests.yml) +[![VM Integration Tests](https://github.com/nextcloud/nextcloudpi/workflows/VM%20Integration%20Tests/badge.svg)](https://github.com/nextcloud/nextcloudpi/actions/workflows/vm-tests.yml) ## Features diff --git a/bin/ncp/NETWORKING/dnsmasq.sh b/bin/ncp/NETWORKING/dnsmasq.sh index 368403e9..79826976 100644 --- a/bin/ncp/NETWORKING/dnsmasq.sh +++ b/bin/ncp/NETWORKING/dnsmasq.sh @@ -15,7 +15,7 @@ install() apt-get install --no-install-recommends -y dnsmasq rc=0 service dnsmasq status > /dev/null 2>&1 || rc=$? - [[ $rc -eq 3 ]] && { + ! is_docker && [[ $rc -eq 3 ]] && { echo "Applying workaround for dnsmasq bug (compare issue #1446)" service systemd-resolved stop service dnsmasq start diff --git a/bin/ncp/SYSTEM/metrics.sh b/bin/ncp/SYSTEM/metrics.sh index 50e46afd..b55fd721 100644 --- a/bin/ncp/SYSTEM/metrics.sh +++ b/bin/ncp/SYSTEM/metrics.sh @@ -62,10 +62,14 @@ metrics_services() { exit 1 fi - if [[ "$DOCKERBUILD" == 1 ]] + if is_docker then - update-rc.d ncp-metrics "$cmd" - return $? + rc1=0 + rc2=0 + update-rc.d ncp-metrics-exporter "$cmd" || rc1=$? + update-rc.d prometheus-node-exporter "$cmd" || rc2=$? + [[ $rc1 > $rc2 ]] && return $rc1 + return $rc2 else systemctl "$cmd" prometheus-node-exporter ncp-metrics-exporter return $? @@ -92,7 +96,7 @@ EOF [[ "${arch}" =~ ^"arm" ]] && arch="armv7" mkdir -p /usr/local/lib/ncp-metrics - wget -O "/usr/local/lib/ncp-metrics/ncp-metrics-exporter" \ + wget -qO "/usr/local/lib/ncp-metrics/ncp-metrics-exporter" \ "https://github.com/theCalcaholic/ncp-metrics-exporter/releases/download/v1.1.0/ncp-metrics-exporter-${arch}" chmod +x /usr/local/lib/ncp-metrics/ncp-metrics-exporter @@ -105,12 +109,18 @@ EOF then # during installation of prometheus-node-exporter `useradd` is used to create a user. # However, `useradd` doesn't the symlink in /etc/shadow, so we need to temporarily move it back - trap "mv /etc/shadow /data/etc/shadow; ln -s /data/etc/shadow /etc/shadow" EXIT - rm /etc/shadow - cp /data/etc/shadow /etc/shadow + restore_shadow=true + [[ -L /etc/shadow ]] || restore_shadow=false + [[ "$restore_shadow" == "false" ]] || { + trap "mv /etc/shadow /data/etc/shadow; ln -s /data/etc/shadow /etc/shadow" EXIT + rm /etc/shadow + cp /data/etc/shadow /etc/shadow + } apt_install_with_recommends prometheus-node-exporter - mv /etc/shadow /data/etc/shadow - ln -s /data/etc/shadow /etc/shadow + [[ "$restore_shadow" == "false" ]] || { + mv /etc/shadow /data/etc/shadow + ln -s /data/etc/shadow /etc/shadow + } trap - EXIT else apt_install_with_recommends prometheus-node-exporter @@ -144,6 +154,7 @@ LOGFILE=/var/log/ncp-metrics.log START_ARGS="--background --make-pidfile" EOF chmod +x /etc/init.d/ncp-metrics-exporter + update-rc.d ncp-metrics-exporter defaults cat > /etc/services-available.d/101ncp-metrics <<EOF #!/bin/bash |