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

Proposed by Julian Andres Klode on 2018-12-17
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 2018-12-17 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.
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 on 2018-12-17

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
1diff --git a/debian/extra/dhclient-enter-resolved-hook b/debian/extra/dhclient-enter-resolved-hook
2index b504f5b..c2d59e4 100755
3--- a/debian/extra/dhclient-enter-resolved-hook
4+++ b/debian/extra/dhclient-enter-resolved-hook
5@@ -28,6 +28,9 @@ if [ -x /lib/systemd/systemd-resolved ] ; then
6 fi
7 statedir="/run/systemd/resolved.conf.d"
8 mkdir -p $statedir
9+
10+ oldstate="$(mktemp)"
11+ md5sum $statedir/isc-dhcp-v4-$interface.conf $statedir/isc-dhcp-v6-$interface.conf &> $oldstate
12 if [ -n "$new_domain_name_servers" ] ; then
13 cat <<EOF >$statedir/isc-dhcp-v4-$interface.conf
14 [Resolve]
15@@ -50,7 +53,12 @@ Domains=$new_dhcp6_domain_search
16 EOF
17 fi
18 fi
19- systemctl try-reload-or-restart systemd-resolved.service
20+
21+ if ! cmp --quiet $oldstate <(md5sum $statedir/isc-dhcp-v4-$interface.conf $statedir/isc-dhcp-v6-$interface.conf 2>&1); then
22+ systemctl try-reload-or-restart systemd-resolved.service
23+ fi
24+
25+ rm $oldstate
26 }
27 ;;
28

Subscribers

People subscribed via source and target branches