@%@UCRWARNING=# @%@

@!@
dns_backend = configRegistry.get('dns/backend', 'ldap').lower()
if dns_backend == 'samba4':
    print('''
[Unit]
Description=BIND Domain Name Server with samba4 backend
After=samba-ad-dc.service
Wants=samba-ad-dc.service

[Service]
Type=simple
Group=bind
ExecStart=
ExecStart=/usr/lib/univention-bind/samba4 start
ExecReload=
ExecReload=/usr/lib/univention-bind/samba4 reload
ExecStop=
ExecStop=/usr/lib/univention-bind/samba4 stop
ExecStartPost=/usr/lib/univention-bind/samba4 wait-for-startup
''')
elif dns_backend == 'ldap':
    print('''
[Unit]
Description=BIND Domain Name Server proxy for LDAP backend
After=network.target univention-bind-ldap.service
Wants=univention-bind-ldap.service
PropagatesReloadTo=univention-bind-ldap.service

[Service]
Type=simple
ExecStart=
ExecStart=/usr/lib/univention-bind/proxy start
ExecReload=
ExecReload=/usr/lib/univention-bind/proxy reload
ExecStop=
ExecStop=/usr/lib/univention-bind/proxy stop
ExecStartPost=/usr/lib/univention-bind/proxy wait-for-startup
''')
else:
    print('''
[Unit]
Description=Unknown backend configured for BIND Domain Name Server

[Service]
Type=oneshot
ExecStartPre=/usr/bin/echo "Unknown backend configured for BIND Domain Name Server. See 'ucr get dns/backend'"
ExecStart=
ExecStart=/bin/false
ExecReload=
ExecStop=
Restart=no
''')
@!@
