34 lines
782 B
Bash
Executable file
34 lines
782 B
Bash
Executable file
#!/bin/bash
|
|
tmpdir=`mktemp -d`
|
|
dnsgit='https://infrastructure.fedoraproject.org/infra/dns.git'
|
|
destdir='/var/named/chroot/master/'
|
|
|
|
cd $tmpdir
|
|
|
|
# clone the dnsgit repo
|
|
git clone $dnsgit >> /dev/null
|
|
if [ $? != 0 ]; then
|
|
echo "Error cloning dns git repo"
|
|
exit 1
|
|
fi
|
|
|
|
cd dns
|
|
# diff the two dirs - if they are the same - do nothing
|
|
diff -qurN built/ $destdir >>/dev/null
|
|
if [ $? != 0 ]; then
|
|
# rsync our new files overtop of the destdir files
|
|
rsync -a -q --delete-after built/ $destdir
|
|
if [ $? != 0 ]; then
|
|
echo "Error rsyncing files overtop from git repo:: $tmpdir/dns/built"
|
|
exit 1
|
|
fi
|
|
|
|
# change context so the chroot can cope
|
|
chown -R named.named $destdir
|
|
chcon -u system_u $destdir/* $destdir/*/*
|
|
# reload named
|
|
/sbin/service named reload
|
|
fi
|
|
|
|
|
|
rm -rf $tmpdir
|