Skip to content

Commit

Permalink
fix: Disable systemd-resolved stub mode on systemd versions less than…
Browse files Browse the repository at this point in the history
… 248 (#5366)

Signed-off-by: Nicola Timeus <[email protected]>
  • Loading branch information
nicolatimeus authored Sep 23, 2024
1 parent f91c17e commit 3835604
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions kura/distrib/src/main/resources/generic-aarch64/kura_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ EOF
fi
}

should_disable_systemd_resolved_stub() {

SYSTEMD_VERSION=$(systemd --version | (IFS=" " read -r _ignore SYSTEMD_VERSION _ignore; echo "${SYSTEMD_VERSION}") || true)

[ "${SYSTEMD_VERSION}" -lt 248 ] &&
[ -L /etc/resolv.conf ] &&
grep "^nameserver[ ]\+127.0.0.53" < /etc/resolv.conf > /dev/null 2>&1 &&
[ -e /run/systemd/resolve/resolv.conf ]
}

INSTALL_DIR=/opt/eclipse

# create known kura install location
Expand Down Expand Up @@ -105,6 +115,10 @@ fi

disable_netplan

if should_disable_systemd_resolved_stub; then
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
fi

if [ -d /usr/lib/NetworkManager/conf.d/ ]; then
TO_REMOVE=$( find /usr/lib/NetworkManager/conf.d/ -type f -name "*-globally-managed-devices.conf" | awk 'NR==1{print $1}' )

Expand Down
14 changes: 14 additions & 0 deletions kura/distrib/src/main/resources/generic-arm32/kura_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ EOF
fi
}

should_disable_systemd_resolved_stub() {

SYSTEMD_VERSION=$(systemd --version | (IFS=" " read -r _ignore SYSTEMD_VERSION _ignore; echo "${SYSTEMD_VERSION}") || true)

[ "${SYSTEMD_VERSION}" -lt 248 ] &&
[ -L /etc/resolv.conf ] &&
grep "^nameserver[ ]\+127.0.0.53" < /etc/resolv.conf > /dev/null 2>&1 &&
[ -e /run/systemd/resolve/resolv.conf ]
}

INSTALL_DIR=/opt/eclipse

# create known kura install location
Expand Down Expand Up @@ -105,6 +115,10 @@ fi

disable_netplan

if should_disable_systemd_resolved_stub; then
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
fi

if [ -d /usr/lib/NetworkManager/conf.d/ ]; then
TO_REMOVE=$( find /usr/lib/NetworkManager/conf.d/ -type f -name "*-globally-managed-devices.conf" | awk 'NR==1{print $1}' )

Expand Down
14 changes: 14 additions & 0 deletions kura/distrib/src/main/resources/generic-x86_64/kura_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ EOF
fi
}

should_disable_systemd_resolved_stub() {

SYSTEMD_VERSION=$(systemd --version | (IFS=" " read -r _ignore SYSTEMD_VERSION _ignore; echo "${SYSTEMD_VERSION}") || true)

[ "${SYSTEMD_VERSION}" -lt 248 ] &&
[ -L /etc/resolv.conf ] &&
grep "^nameserver[ ]\+127.0.0.53" < /etc/resolv.conf > /dev/null 2>&1 &&
[ -e /run/systemd/resolve/resolv.conf ]
}

INSTALL_DIR=/opt/eclipse

# create known kura install location
Expand Down Expand Up @@ -105,6 +115,10 @@ fi

disable_netplan

if should_disable_systemd_resolved_stub; then
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
fi

if [ -d /usr/lib/NetworkManager/conf.d/ ]; then
TO_REMOVE=$( find /usr/lib/NetworkManager/conf.d/ -type f -name "*-globally-managed-devices.conf" | awk 'NR==1{print $1}' )

Expand Down

0 comments on commit 3835604

Please sign in to comment.