Merge ~juliank/ubuntu/+source/systemd:lp1805183 into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-disco

Proposed by Julian Andres Klode
Status: Needs review
Proposed branch: ~juliank/ubuntu/+source/systemd:lp1805183
Merge into: ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-disco
Diff against target: 27 lines (+9/-1)
1 file modified
debian/extra/dhclient-enter-resolved-hook (+9/-1)
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Review via email: mp+360990@code.launchpad.net

This proposal supersedes a proposal from 2018-12-17.

To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

The trick here with the md5sum and redirecting stderr to stdout means we easily handle newly created and absent files too, and don't have to worry about this, while keeping it short.

Unmerged commits

16d761d... by Julian Andres Klode

Only restart resolved on changes in dhclient enter hook

This prevents spurious restarts of resolved on rebounds when
the addresses did not change.

LP: #1805183

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/extra/dhclient-enter-resolved-hook b/debian/extra/dhclient-enter-resolved-hook
index b504f5b..c2d59e4 100755
--- a/debian/extra/dhclient-enter-resolved-hook
+++ b/debian/extra/dhclient-enter-resolved-hook
@@ -28,6 +28,9 @@ if [ -x /lib/systemd/systemd-resolved ] ; then
28 fi28 fi
29 statedir="/run/systemd/resolved.conf.d"29 statedir="/run/systemd/resolved.conf.d"
30 mkdir -p $statedir30 mkdir -p $statedir
31
32 oldstate="$(mktemp)"
33 md5sum $statedir/isc-dhcp-v4-$interface.conf $statedir/isc-dhcp-v6-$interface.conf &> $oldstate
31 if [ -n "$new_domain_name_servers" ] ; then34 if [ -n "$new_domain_name_servers" ] ; then
32 cat <<EOF >$statedir/isc-dhcp-v4-$interface.conf35 cat <<EOF >$statedir/isc-dhcp-v4-$interface.conf
33[Resolve]36[Resolve]
@@ -50,7 +53,12 @@ Domains=$new_dhcp6_domain_search
50EOF53EOF
51 fi54 fi
52 fi55 fi
53 systemctl try-reload-or-restart systemd-resolved.service56
57 if ! cmp --quiet $oldstate <(md5sum $statedir/isc-dhcp-v4-$interface.conf $statedir/isc-dhcp-v6-$interface.conf 2>&1); then
58 systemctl try-reload-or-restart systemd-resolved.service
59 fi
60
61 rm $oldstate
54 }62 }
55 ;;63 ;;
5664

Subscribers

People subscribed via source and target branches