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() ...@@ -1026,7 +1026,7 @@ function openvpn_resync_csc()
} }
} }
function openvpn_prepare_all() function openvpn_prepare_all($verbose = false)
{ {
global $config; global $config;
...@@ -1034,7 +1034,10 @@ function openvpn_prepare_all() ...@@ -1034,7 +1034,10 @@ function openvpn_prepare_all()
return; return;
} }
log_error('Creating OpenVPN instances.'); if ($verbose) {
echo 'Creating OpenVPN instances...';
flush();
}
foreach (array('server', 'client') as $mode) { foreach (array('server', 'client') as $mode) {
if (isset($config['openvpn']["openvpn-{$mode}"])) { if (isset($config['openvpn']["openvpn-{$mode}"])) {
...@@ -1043,6 +1046,10 @@ function openvpn_prepare_all() ...@@ -1043,6 +1046,10 @@ function openvpn_prepare_all()
} }
} }
} }
if ($verbose) {
echo "done.\n";
}
} }
function openvpn_resync($mode, $settings) function openvpn_resync($mode, $settings)
...@@ -1051,7 +1058,7 @@ function openvpn_resync($mode, $settings) ...@@ -1051,7 +1058,7 @@ function openvpn_resync($mode, $settings)
openvpn_restart($mode, $settings); openvpn_restart($mode, $settings);
} }
function openvpn_resync_all($interface = null) function openvpn_resync_all($interface = null, $verbose = false)
{ {
global $config; global $config;
...@@ -1061,6 +1068,11 @@ function openvpn_resync_all($interface = null) ...@@ -1061,6 +1068,11 @@ function openvpn_resync_all($interface = null)
return; return;
} }
if ($verbose) {
echo 'Syncing OpenVPN settings...';
flush();
}
if (!empty($interface)) { if (!empty($interface)) {
log_error(sprintf( log_error(sprintf(
'Resyncing OpenVPN instances for interface %s.', 'Resyncing OpenVPN instances for interface %s.',
...@@ -1081,6 +1093,10 @@ function openvpn_resync_all($interface = null) ...@@ -1081,6 +1093,10 @@ function openvpn_resync_all($interface = null)
} }
openvpn_resync_csc(); openvpn_resync_csc();
if ($verbose) {
echo "done.\n";
}
} }
function openvpn_get_active_servers($type = 'multipoint') function openvpn_get_active_servers($type = 'multipoint')
......
...@@ -104,16 +104,11 @@ system_hosts_generate(true); ...@@ -104,16 +104,11 @@ system_hosts_generate(true);
interfaces_loopback_configure(true); interfaces_loopback_configure(true);
system_syslogd_start(true); system_syslogd_start(true);
/* set up interfaces */ system_console_mute(); /* XXX move this further up */
system_console_mute(); openvpn_prepare_all(true);
openvpn_prepare_all(); interfaces_configure(); /* XXX needs $verbose conversion */
interfaces_configure(); openvpn_resync_all(null, true);
system_console_unmute(); system_console_unmute(); /* XXX move this further down */
/* start OpenVPN server & clients */
echo "Syncing OpenVPN settings...";
openvpn_resync_all();
echo "done.\n";
system_resolvconf_generate(true); system_resolvconf_generate(true);
filter_configure_sync(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