diff options
| -rw-r--r-- | meta/recipes-connectivity/bind/bind/init.d-add-support-for-read-only-rootfs.patch | 65 | ||||
| -rw-r--r-- | meta/recipes-connectivity/bind/bind_9.9.5.bb | 2 |
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 @@ | |||
| 1 | Subject: init.d: add support for read-only rootfs | ||
| 2 | |||
| 3 | Upstream-Status: Inappropriate [oe specific] | ||
| 4 | |||
| 5 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 6 | --- | ||
| 7 | init.d | 40 ++++++++++++++++++++++++++++++++++++++++ | ||
| 8 | 1 file changed, 40 insertions(+) | ||
| 9 | |||
| 10 | diff --git a/init.d b/init.d | ||
| 11 | index 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 | -- | ||
| 64 | 1.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 65ec2322fd..de10eb8029 100644 --- a/meta/recipes-connectivity/bind/bind_9.9.5.bb +++ b/meta/recipes-connectivity/bind/bind_9.9.5.bb | |||
| @@ -15,6 +15,7 @@ SRC_URI = "ftp://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \ | |||
| 15 | file://dont-test-on-host.patch \ | 15 | file://dont-test-on-host.patch \ |
| 16 | file://generate-rndc-key.sh \ | 16 | file://generate-rndc-key.sh \ |
| 17 | file://named.service \ | 17 | file://named.service \ |
| 18 | file://init.d-add-support-for-read-only-rootfs.patch \ | ||
| 18 | " | 19 | " |
| 19 | 20 | ||
| 20 | SRC_URI[md5sum] = "e676c65cad5234617ee22f48e328c24e" | 21 | SRC_URI[md5sum] = "e676c65cad5234617ee22f48e328c24e" |
| @@ -50,6 +51,7 @@ do_install_append() { | |||
| 50 | rm "${D}${mandir}/man1/nslookup.1" | 51 | rm "${D}${mandir}/man1/nslookup.1" |
| 51 | rmdir "${D}${localstatedir}/run" | 52 | rmdir "${D}${localstatedir}/run" |
| 52 | rmdir --ignore-fail-on-non-empty "${D}${localstatedir}" | 53 | rmdir --ignore-fail-on-non-empty "${D}${localstatedir}" |
| 54 | install -d "${D}${localstatedir}/cache/bind" | ||
| 53 | install -d "${D}${sysconfdir}/bind" | 55 | install -d "${D}${sysconfdir}/bind" |
| 54 | install -d "${D}${sysconfdir}/init.d" | 56 | install -d "${D}${sysconfdir}/init.d" |
| 55 | install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/" | 57 | install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/" |
