From 65240a9bef9a809705d25eeb05d22b5ac8b3a57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Sat, 12 Oct 2024 23:07:25 +0200 Subject: [PATCH] dnsmasq.sh: Don't fix it if it ain't broken MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- bin/ncp/CONFIG/nc-datadir.sh | 2 +- bin/ncp/NETWORKING/dnsmasq.sh | 23 +++++++++++++++++------ install.sh | 5 ----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/bin/ncp/CONFIG/nc-datadir.sh b/bin/ncp/CONFIG/nc-datadir.sh index 4dfaea035..372c82034 100644 --- a/bin/ncp/CONFIG/nc-datadir.sh +++ b/bin/ncp/CONFIG/nc-datadir.sh @@ -103,7 +103,7 @@ configure() cd /var/www/nextcloud [[ "$BUILD_MODE" == 1 ]] || save_maintenance_mode - echo "moving data directory from ${SRCDIR} to ${BASEDIR}..." + echo "moving data directory from ${SRCDIR} to ${DATADIR}..." # use subvolumes, if BTRFS [[ "$(stat -fc%T "${BASEDIR}")" == "btrfs" ]] && ! is_docker && { diff --git a/bin/ncp/NETWORKING/dnsmasq.sh b/bin/ncp/NETWORKING/dnsmasq.sh index 4f93c89f8..9b57d74fa 100644 --- a/bin/ncp/NETWORKING/dnsmasq.sh +++ b/bin/ncp/NETWORKING/dnsmasq.sh @@ -14,30 +14,41 @@ install() set -x apt-get update apt-get install --no-install-recommends -y dnsmasq + sleep 10 rc=0 service dnsmasq status > /dev/null 2>&1 || rc=$? - [[ $rc -eq 3 ]] && ! [[ "$INIT_SYSTEM" =~ ^("chroot"|"unknown")$ ]] && command -v systemd-resolve > /dev/null || { + STOPPED_RESOLVER="" + if [[ $rc -eq 3 ]] && ! [[ "$INIT_SYSTEM" =~ ^("chroot"|"unknown")$ ]] + then echo "Applying workaround for dnsmasq bug (compare issue #1446)" mkdir -p /etc/systemd/resolved.conf.d if systemctl status systemd-resolved then - cat < /etc/systemd/resolved.conf.d/nostublistener.conf + cat < /etc/systemd/resolved.conf.d/nostublistener.conf [Resolve] DNSStubListener=no EOF [[ "$INIT_SYSTEM" != "systemd" ]] || systemctl restart systemd-resolved - else - systemctl stop resolvconf + elif systemctl status resolvconf + then + RESOLVER="resolvconf" + systemctl stop "${RESOLVER}" systemctl start dnsmasq systemctl status dnsmasq + else + echo "dnsmasq failed to start and no workaround could be found. This means, the installer failed." + false fi # service systemd-resolved stop || true systemctl start dnsmasq systemctl status dnsmasq - } + fi service dnsmasq stop - [[ "$INIT_SYSTEM" != "systemd" ]] || systemctl start systemd-resolved || systemctl start resolvconf + if [[ "$INIT_SYSTEM" == "systemd" ]] && systemctl list-unit-files resolvconf.service + then + systemctl start resolvconf + fi update-rc.d dnsmasq disable || rm /etc/systemd/system/multi-user.target.wants/dnsmasq.service return 0 diff --git a/install.sh b/install.sh index ceafe6597..e77104ab8 100644 --- a/install.sh +++ b/install.sh @@ -74,11 +74,6 @@ cp etc/ncp.cfg /usr/local/etc/ cp -r etc/ncp-templates /usr/local/etc/ install_app lamp.sh -if [[ -d "/run/systemd/system" ]] && is_lxc -then - DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y systemd-resolved - systemctl enable systemd-resolved -fi install_app bin/ncp/CONFIG/nc-nextcloud.sh run_app_unsafe bin/ncp/CONFIG/nc-nextcloud.sh rm /usr/local/etc/ncp-config.d/nc-nextcloud.cfg # armbian overlay is ro