Skip to content

Commit d090dbf

Browse files
author
wyrie
committed
Installer: Gentoo update
- Added support for new default named.conf views layout.
1 parent 7f2c53d commit d090dbf

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

install/dist/lib/gentoo.lib.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,33 @@ public function configure_powerdns()
431431
}
432432
}
433433

434+
public function configure_bind() {
435+
global $conf;
436+
437+
//* Check if the zonefile directory has a slash at the end
438+
$content=$conf['bind']['bind_zonefiles_dir'];
439+
if(substr($content,-1,1) != '/') {
440+
$content .= '/';
441+
}
442+
443+
//* New default format of named.conf uses views. Check which version the system is using and include our zones file.
444+
$named_conf = rf($conf['bind']['named_conf_path']);
445+
if (stripos($named_conf, 'include "'.$conf['bind']['named_conf_local_path'].'";') === false)
446+
{
447+
preg_match_all("/(?<=\n)view \"(?:public|internal)\" in \{.*\n\};/Us", $named_conf, $views);
448+
if (count($views[0]) == 2) {
449+
foreach ($views[0] as $view) {
450+
$named_conf = str_replace($view, substr($view, 0, -2)."include \"{$conf['bind']['named_conf_local_path']}\";\n};", $named_conf);
451+
}
452+
453+
wf($conf['bind']['named_conf_path'], $named_conf);
454+
}
455+
else {
456+
af($conf['bind']['named_conf_path'], 'include "'.$conf['bind']['named_conf_local_path'].'";');
457+
}
458+
}
459+
}
460+
434461
public function configure_apache()
435462
{
436463
global $conf;

0 commit comments

Comments
 (0)