Skip to content

Commit

Permalink
dnsmasq.sh: Don't fix it if it ain't broken
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Knöppler <[email protected]>
  • Loading branch information
theCalcaholic committed Oct 12, 2024
1 parent eb835b9 commit 65240a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 && {
Expand Down
23 changes: 17 additions & 6 deletions bin/ncp/NETWORKING/dnsmasq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > /etc/systemd/resolved.conf.d/nostublistener.conf
cat <<EOF > /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
Expand Down
5 changes: 0 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65240a9

Please sign in to comment.