Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/etc/rc.d PR/47024: Taylor R Campbell: handle "keys" director...
details: https://anonhg.NetBSD.org/src/rev/5ac2a398afa0
branches: trunk
changeset: 781800:5ac2a398afa0
user: christos <christos%NetBSD.org@localhost>
date: Mon Oct 01 18:46:43 2012 +0000
description:
PR/47024: Taylor R Campbell: handle "keys" directory and directory
permissions in general
diffstat:
etc/rc.d/named | 53 ++++++++++++++++++++++++++++++++---------------------
1 files changed, 32 insertions(+), 21 deletions(-)
diffs (110 lines):
diff -r c4928d755360 -r 5ac2a398afa0 etc/rc.d/named
--- a/etc/rc.d/named Mon Oct 01 18:19:18 2012 +0000
+++ b/etc/rc.d/named Mon Oct 01 18:46:43 2012 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: named,v 1.22 2009/08/03 17:45:48 perry Exp $
+# $NetBSD: named,v 1.23 2012/10/01 18:46:43 christos Exp $
#
# PROVIDE: named
@@ -20,38 +20,43 @@
named_migrate()
{
- local src=$1
- local dst=$2$1
+ local src="$1"
+ local dst="$2$1"
echo "Migrating $src to $dst"
(
diff=false
- cd $src
+ cd "$src"
+ mkdir -p "$dst"
for f in $(find . -type f)
do
- f=${f##./}
- case $f in
+ f="${f##./}"
+ case "$f" in
*/*)
- d=$dst/$(dirname $f)
+ ds="$(dirname "$f")"
+ dd="$dst/$ds"
+ mkdir -p "$dd"
+ chmod "$(stat -f "%p" "$ds" |
+ sed -e 's/.*\([0-7][0-7][0-7][0-7]\)$/\1/g')" "$dd"
+ chown "$(stat -f %u:%g "$ds")" "$dd"
;;
- *) d=$dst
+ *)
;;
esac
- mkdir -p $d
if [ -r "$dst/$f" ]
then
- if ! cmp $f $dst/$f; then
+ if ! cmp "$f" "$dst/$f"; then
diff=true
fi
else
- cp -p $f $dst/$f
+ cp -p "$f" "$dst/$f"
fi
done
if $diff; then
echo "Cannot complete migration because files are different"
echo "Run 'diff -r $src $dst' resolve the differences"
else
- rm -fr $src
- ln -s $dst $src
+ rm -fr "$src"
+ ln -s "$dst" "$src"
fi
)
}
@@ -59,6 +64,10 @@
named_precmd()
{
if [ -z "$named_chrootdir" ]; then
+ if [ ! -d "/etc/namedb/keys" ]; then
+ mkdir -m 775 "/etc/namedb/keys"
+ chown named:named "/etc/namedb/keys"
+ fi
return 0;
fi
@@ -87,8 +96,7 @@
;;
esac
- for i in null random
- do
+ for i in null random; do
if [ ! -c "${named_chrootdir}/dev/$i" ]; then
rm -f "${named_chrootdir}/dev/$i"
(cd /dev &&
@@ -99,12 +107,15 @@
if [ ! -h /etc/namedb ]; then
named_migrate /etc/namedb ${named_chrootdir}
fi
- if [ \( -r /etc/named.conf \) -a \( ! -h /etc/named.conf \) -a \
- \( ! -r ${named_chrootdir}/etc/named.conf \) ]
- then
- mv /etc/named.conf ${named_chrootdir}/etc/named.conf
- ln -s ${named_chrootdir}/etc/named.conf /etc/named.conf
- fi
+
+ for i in named.conf rndc.key; do
+ if [ \( -r "/etc/$i" \) -a \( ! -h "/etc/$i" \) -a \
+ \( ! -r "${named_chrootdir}/etc/$i" \) ]; then
+ mv "/etc/$i" "${named_chrootdir}/etc/$i"
+ ln -s "${named_chrootdir}/etc/$i" "/etc/$i"
+ fi
+ done
+
if [ \( ! -r ${named_chrootdir}/etc/named.conf \) -a \
\( -r ${named_chrootdir}/etc/namedb/named.conf \) ]; then
ln -s namedb/named.conf ${named_chrootdir}/etc
Home |
Main Index |
Thread Index |
Old Index