Adam Tkac 0f7d49
#!/bin/bash
Adam Tkac 0f7d49
Adam Tkac 0f7d49
. /etc/rc.d/init.d/functions
Adam Tkac 0f7d49
Tomas Hozza 5154ca
# This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf
Adam Tkac 0f7d49
Tomas Hozza 5154ca
if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then
Adam Tkac 0f7d49
  echo -n $"Generating /etc/rndc.key:"
Adam Tkac 0f7d49
  if /usr/sbin/rndc-confgen -a > /dev/null 2>&1; then
Adam Tkac 0f7d49
    chmod 640 /etc/rndc.key
Adam Tkac 0f7d49
    chown root.named /etc/rndc.key
Adam Tkac 0f7d49
    [ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.key
Adam Tkac 0f7d49
    success $"/etc/rndc.key generation"
Adam Tkac 0f7d49
    echo
Adam Tkac 0f7d49
  else
Adam Tkac 0f7d49
    failure $"/etc/rndc.key generation"
Adam Tkac 0f7d49
    echo
Adam Tkac 0f7d49
  fi
Adam Tkac 0f7d49
fi