Commit 4346d549 authored by Franco Fichtner's avatar Franco Fichtner

rc: $verbose conversion for OpenVPN

parent c1bd0196
......@@ -1026,7 +1026,7 @@ function openvpn_resync_csc()
}
}
function openvpn_prepare_all()
function openvpn_prepare_all($verbose = false)
{
global $config;
......@@ -1034,7 +1034,10 @@ function openvpn_prepare_all()
return;
}
log_error('Creating OpenVPN instances.');
if ($verbose) {
echo 'Creating OpenVPN instances...';
flush();
}
foreach (array('server', 'client') as $mode) {
if (isset($config['openvpn']["openvpn-{$mode}"])) {
......@@ -1043,6 +1046,10 @@ function openvpn_prepare_all()
}
}
}
if ($verbose) {
echo "done.\n";
}
}
function openvpn_resync($mode, $settings)
......@@ -1051,7 +1058,7 @@ function openvpn_resync($mode, $settings)
openvpn_restart($mode, $settings);
}
function openvpn_resync_all($interface = null)
function openvpn_resync_all($interface = null, $verbose = false)
{
global $config;
......@@ -1061,6 +1068,11 @@ function openvpn_resync_all($interface = null)
return;
}
if ($verbose) {
echo 'Syncing OpenVPN settings...';
flush();
}
if (!empty($interface)) {
log_error(sprintf(
'Resyncing OpenVPN instances for interface %s.',
......@@ -1081,6 +1093,10 @@ function openvpn_resync_all($interface = null)
}
openvpn_resync_csc();
if ($verbose) {
echo "done.\n";
}
}
function openvpn_get_active_servers($type = 'multipoint')
......
......@@ -104,16 +104,11 @@ system_hosts_generate(true);
interfaces_loopback_configure(true);
system_syslogd_start(true);
/* set up interfaces */
system_console_mute();
openvpn_prepare_all();
interfaces_configure();
system_console_unmute();
/* start OpenVPN server & clients */
echo "Syncing OpenVPN settings...";
openvpn_resync_all();
echo "done.\n";
system_console_mute(); /* XXX move this further up */
openvpn_prepare_all(true);
interfaces_configure(); /* XXX needs $verbose conversion */
openvpn_resync_all(null, true);
system_console_unmute(); /* XXX move this further down */
system_resolvconf_generate(true);
filter_configure_sync(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment