PKGBUILDs/community/bind-geodns/bind.install
2009-10-09 21:15:33 -05:00

37 lines
1 KiB
Text

# arg 1: the new package version
post_install() {
getent group named >/dev/null || usr/sbin/groupadd -g 40 named
getent passwd named >/dev/null || usr/sbin/useradd -u 40 -c "BIND DNS Server" -g named -d /var/named -s /bin/false named
usr/bin/passwd -l named &>/dev/null
[ -f var/log/named.log ] || : >var/log/named.log
chown named.named var/log/named.log
# create an rndc.key if it doesn't already exist
if [ ! -s etc/rndc.key ]; then
usr/sbin/rndc-confgen -b 256 | head -n 5 >>etc/rndc.key
chown root.named etc/rndc.key
chmod 640 etc/rndc.key
fi
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
post_install $1
# old versions of this package didn't have a named user
chown -R named:named var/named
# old versions of this package didn't set permissions correct
chown root:named etc/named.conf
chmod 640 etc/named.conf
}
# arg 1: the old package version
pre_remove() {
usr/sbin/userdel named &>/dev/null
usr/sbin/groupdel named &>/dev/null
}
op=$1
shift
$op $*