Blame SOURCES/generate-rndc-key.sh

b7523e
#!/bin/bash
b7523e
b7523e
if [ -r /etc/rc.d/init.d/functions ]; then
b7523e
	. /etc/rc.d/init.d/functions
b7523e
else
b7523e
success() {
b7523e
	echo $" OK "
b7523e
}
b7523e
b7523e
failure() {
b7523e
	echo -n " "
b7523e
	echo $"FAILED"
b7523e
}
b7523e
fi
b7523e
b7523e
# This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf
b7523e
b7523e
if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then
b7523e
  echo -n $"Generating /etc/rndc.key:"
b7523e
  if /usr/sbin/rndc-confgen -a -A hmac-sha256 > /dev/null 2>&1
b7523e
  then
b7523e
    chmod 640 /etc/rndc.key
b7523e
    chown root:named /etc/rndc.key
b7523e
    [ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.key
b7523e
    success $"/etc/rndc.key generation"
b7523e
    echo
b7523e
  else
b7523e
    rc=$?
b7523e
    failure $"/etc/rndc.key generation"
b7523e
    echo
b7523e
    exit $rc
b7523e
  fi
b7523e
fi