Blame SOURCES/generate-rndc-key.sh

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