Adam Tkac 0f7d49
#!/bin/bash
Adam Tkac 0f7d49
23458b
if [ -r /etc/rc.d/init.d/functions ]; then
23458b
	. /etc/rc.d/init.d/functions
23458b
else
23458b
success() {
23458b
	echo $" OK "
23458b
}
23458b
23458b
failure() {
23458b
	echo -n " "
23458b
	echo $"FAILED"
23458b
}
23458b
fi
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:"
8ad137
  if /usr/sbin/rndc-confgen -a -A hmac-sha256 > /dev/null 2>&1
f5cbbc
  then
Adam Tkac 0f7d49
    chmod 640 /etc/rndc.key
f5cbbc
    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
23458b
    rc=$?
Adam Tkac 0f7d49
    failure $"/etc/rndc.key generation"
Adam Tkac 0f7d49
    echo
23458b
    exit $rc
Adam Tkac 0f7d49
  fi
Adam Tkac 0f7d49
fi