summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/bind
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2014-03-27 02:34:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-05-29 13:42:19 +0100
commit5f4a75f904b6e62788976bb557569a01bdc5ab5d (patch)
treead7cd6a9eaf5af2f7d83ef623c4591c592b536c7 /meta/recipes-connectivity/bind
parentb4e7ebe227f25d7f2149f42cf226781ee3f4c93d (diff)
downloadpoky-5f4a75f904b6e62788976bb557569a01bdc5ab5d.tar.gz
bind: add support for read-only rootfs
This patch adds support for read-only rootfs to the bind service. Basically it just bind mounts several directories so that the bind service could start correctly without reporting any error. (From OE-Core rev: 99cc96eaee28bfde89096689b1296d28937ead88) (From OE-Core rev: 5e62ed2e5684e4791199604d75e6ab3caae5875a) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/bind')
-rw-r--r--meta/recipes-connectivity/bind/bind/init.d-add-support-for-read-only-rootfs.patch65
-rw-r--r--meta/recipes-connectivity/bind/bind_9.9.5.bb2
2 files changed, 67 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bind/bind/init.d-add-support-for-read-only-rootfs.patch b/meta/recipes-connectivity/bind/bind/init.d-add-support-for-read-only-rootfs.patch
new file mode 100644
index 0000000000..11db95ede1
--- /dev/null
+++ b/meta/recipes-connectivity/bind/bind/init.d-add-support-for-read-only-rootfs.patch
@@ -0,0 +1,65 @@
1Subject: init.d: add support for read-only rootfs
2
3Upstream-Status: Inappropriate [oe specific]
4
5Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
6---
7 init.d | 40 ++++++++++++++++++++++++++++++++++++++++
8 1 file changed, 40 insertions(+)
9
10diff --git a/init.d b/init.d
11index 0111ed4..24677c8 100644
12--- a/init.d
13+++ b/init.d
14@@ -6,8 +6,48 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
15 # Don't modify this line, change or create /etc/default/bind9.
16 OPTIONS=""
17
18+test -f /etc/default/rcS && . /etc/default/rcS
19 test -f /etc/default/bind9 && . /etc/default/bind9
20
21+# This function is here because it's possible that /var and / are on different partitions.
22+is_on_read_only_partition () {
23+ DIRECTORY=$1
24+ dir=`readlink -f $DIRECTORY`
25+ while true; do
26+ if [ ! -d "$dir" ]; then
27+ echo "ERROR: $dir is not a directory"
28+ exit 1
29+ else
30+ for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \
31+ END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
32+ [ "$flag" = "FOUND" ] && partition="read-write"
33+ [ "$flag" = "ro" ] && { partition="read-only"; break; }
34+ done
35+ if [ "$dir" = "/" -o -n "$partition" ]; then
36+ break
37+ else
38+ dir=`dirname $dir`
39+ fi
40+ fi
41+ done
42+ [ "$partition" = "read-only" ] && echo "yes" || echo "no"
43+}
44+
45+bind_mount () {
46+ olddir=$1
47+ newdir=$2
48+ mkdir -p $olddir
49+ cp -a $newdir/* $olddir
50+ mount --bind $olddir $newdir
51+}
52+
53+# Deal with read-only rootfs
54+if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
55+ [ "$VERBOSE" != "no" ] && echo "WARN: start bind service in read-only rootfs"
56+ [ `is_on_read_only_partition /etc/bind` = "yes" ] && bind_mount /var/volatile/bind/etc /etc/bind
57+ [ `is_on_read_only_partition /var/named` = "yes" ] && bind_mount /var/volatile/bind/named /var/named
58+fi
59+
60 test -x /usr/sbin/rndc || exit 0
61
62 case "$1" in
63--
641.7.9.5
65
diff --git a/meta/recipes-connectivity/bind/bind_9.9.5.bb b/meta/recipes-connectivity/bind/bind_9.9.5.bb
index 604deb6236..a190956cff 100644
--- a/meta/recipes-connectivity/bind/bind_9.9.5.bb
+++ b/meta/recipes-connectivity/bind/bind_9.9.5.bb
@@ -13,6 +13,7 @@ SRC_URI = "ftp://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \
13 file://make-etc-initd-bind-stop-work.patch \ 13 file://make-etc-initd-bind-stop-work.patch \
14 file://mips1-not-support-opcode.diff \ 14 file://mips1-not-support-opcode.diff \
15 file://dont-test-on-host.patch \ 15 file://dont-test-on-host.patch \
16 file://init.d-add-support-for-read-only-rootfs.patch \
16 " 17 "
17 18
18SRC_URI[md5sum] = "e676c65cad5234617ee22f48e328c24e" 19SRC_URI[md5sum] = "e676c65cad5234617ee22f48e328c24e"
@@ -45,6 +46,7 @@ do_install_append() {
45 rm "${D}${mandir}/man1/nslookup.1" 46 rm "${D}${mandir}/man1/nslookup.1"
46 rmdir "${D}${localstatedir}/run" 47 rmdir "${D}${localstatedir}/run"
47 rmdir --ignore-fail-on-non-empty "${D}${localstatedir}" 48 rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
49 install -d "${D}${localstatedir}/cache/bind"
48 install -d "${D}${sysconfdir}/bind" 50 install -d "${D}${sysconfdir}/bind"
49 install -d "${D}${sysconfdir}/init.d" 51 install -d "${D}${sysconfdir}/init.d"
50 install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/" 52 install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/"