Merge lp:~julian-edwards/maas/broken-dns-install-bug-1060549 into lp:~maas-maintainers/maas/packaging

Proposed by Julian Edwards on 2012-10-03
Status: Merged
Approved by: Julian Edwards on 2012-10-03
Approved revision: 115
Merged at revision: 114
Proposed branch: lp:~julian-edwards/maas/broken-dns-install-bug-1060549
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 104 lines (+46/-28)
2 files modified
debian/changelog (+3/-2)
debian/maas-dns.postinst (+43/-26)
To merge this branch: bzr merge lp:~julian-edwards/maas/broken-dns-install-bug-1060549
Reviewer Review Type Date Requested Status
Andres Rodriguez Approve on 2012-10-03
Launchpad code reviewers 2012-10-03 Pending
Review via email: mp+127621@code.launchpad.net

Commit Message

Ensure maas-dns postinst creates the maas user before trying to chown files

To post a comment you must log in.
115. By Julian Edwards on 2012-10-03

convert tabs to spaces in the maas-dns.postinst

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-10-02 18:42:28 +0000
3+++ debian/changelog 2012-10-03 01:48:20 +0000
4@@ -1,9 +1,10 @@
5-maas (0.1+bzr1134+dfsg-0ubuntu2) UNRELEASED; urgency=low
6+maas (0.1+bzr1137+dfsg-0ubuntu2) UNRELEASED; urgency=low
7
8 * New upstream release.
9
10 [ Julian Edwards ]
11 * Ensure isc-dhcp-server is disabled when installing maas-dhcp.
12+ * Ensure maas-dns creates the maas user before trying to chown files.
13
14 [ Raphaƫl Badin ]
15 * Split celery config into cluster and region configs.
16@@ -25,7 +26,7 @@
17 * debian/control: Depends on python-netifaces.
18 * debian/maas-region-controller: Install maas-import-squashfs
19
20- -- Andres Rodriguez <andreserl@ubuntu.com> Tue, 02 Oct 2012 13:39:47 -0400
21+ -- Julian Edwards <julian.edwards@canonical.com> Wed, 03 Oct 2012 11:26:05 +1000
22
23 maas (0.1+bzr1110+dfsg-0ubuntu1) quantal; urgency=low
24
25
26=== modified file 'debian/maas-dns.postinst'
27--- debian/maas-dns.postinst 2012-08-31 18:04:22 +0000
28+++ debian/maas-dns.postinst 2012-10-03 01:48:20 +0000
29@@ -1,32 +1,49 @@
30 #!/bin/sh -e
31
32+add_user_group(){
33+ local user="maas"
34+ local group="maas"
35+ if ! getent group "$group" >/dev/null; then
36+ addgroup --quiet --system "$group" || true
37+ fi
38+ if ! getent passwd "$user" > /dev/null 2>&1; then
39+ adduser --quiet \
40+ --system \
41+ --group \
42+ --no-create-home \
43+ "$user" || true
44+ fi
45+}
46+
47 if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
48- # If /etc/bind/maas is empty, set_up_dns.
49- if [ ! "$(ls -A /etc/bind/maas)" ]; then
50- maas set_up_dns
51- fi
52-
53- # fix permissions
54- if [ -d /etc/bind/maas ]; then
55- chown -R maas:root /etc/bind/maas
56- fi
57- if [ -f /etc/bind/maas/named.conf.maas ]; then
58- chmod 644 /etc/bind/maas/named.conf.maas
59- fi
60- if [ -f /etc/bind/maas/rndc.conf.maas ]; then
61- chmod 600 /etc/bind/maas/rndc.conf.maas
62- fi
63-
64- # add the required line to "/etc/bind/named.conf.local"
65- if ! grep -qs "^include.*\/etc\/bind\/maas\;$" /etc/bind/maas.conf.local; then
66- include_path=$(maas get_named_conf | grep "include\ [a-z\"\/\.]\+;")
67- sed -i "\$a $include_path" \
68- /etc/bind/named.conf.local
69- fi
70-
71- if [ -x /usr/sbin/invoke-rc.d ]; then
72- invoke-rc.d bind9 restart || true
73- fi
74+ add_user_group
75+
76+ # If /etc/bind/maas is empty, set_up_dns.
77+ if [ ! "$(ls -A /etc/bind/maas)" ]; then
78+ maas set_up_dns
79+ fi
80+
81+ # fix permissions
82+ if [ -d /etc/bind/maas ]; then
83+ chown -R maas:root /etc/bind/maas
84+ fi
85+ if [ -f /etc/bind/maas/named.conf.maas ]; then
86+ chmod 644 /etc/bind/maas/named.conf.maas
87+ fi
88+ if [ -f /etc/bind/maas/rndc.conf.maas ]; then
89+ chmod 600 /etc/bind/maas/rndc.conf.maas
90+ fi
91+
92+ # add the required line to "/etc/bind/named.conf.local"
93+ if ! grep -qs "^include.*\/etc\/bind\/maas\;$" /etc/bind/maas.conf.local; then
94+ include_path=$(maas get_named_conf | grep "include\ [a-z\"\/\.]\+;")
95+ sed -i "\$a $include_path" \
96+ /etc/bind/named.conf.local
97+ fi
98+
99+ if [ -x /usr/sbin/invoke-rc.d ]; then
100+ invoke-rc.d bind9 restart || true
101+ fi
102 fi
103
104 #DEBHELPER#

Subscribers

People subscribed via source and target branches