From 59aac1588963567c3e907085ff651138b2743020 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 21 Nov 2015 20:56:47 +0100 Subject: Do not restart asterisk on boot --- config/asterisk/asterisk.inc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/config/asterisk/asterisk.inc b/config/asterisk/asterisk.inc index ed835b25..899fc370 100644 --- a/config/asterisk/asterisk.inc +++ b/config/asterisk/asterisk.inc @@ -28,6 +28,10 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +require_once("config.inc"); +require_once("service-utils.inc"); +require_once("util.inc"); + define('ASTERISK_CONF_DIR', '/conf/asterisk'); $pf_version=substr(trim(file_get_contents("/etc/version")), 0, 3); if ($pf_version == "2.1" || $pf_version == "2.2") { @@ -43,6 +47,7 @@ function asterisk_install() { } function sync_package_asterisk() { + global $g; conf_mount_rw(); // For NanoBSD compatibility, move the /etc/asterisk configuration directory to /conf, and symlink it back @@ -401,13 +406,26 @@ EOF; 'start' => $start, 'stop' => $stop )); - restart_service("asterisk"); - // Prepare backup for factory defaults restoring feature if (!file_exists("/conf.default/asterisk_factory_defaults_config.tgz")) { system("cd /conf/asterisk/ && /usr/bin/tar czf /conf.default/asterisk_factory_defaults_config.tgz *"); } + /* Do not (re)start the service on boot */ + if (function_exists("platform_booting")) { + if (platform_booting()) { + return; + } + } elseif ($g['booting']) { + return; + } else { + if (is_service_running("asterisk")) { + restart_service("asterisk"); + } else { + start_service("asterisk"); + } + } + conf_mount_ro(); } -- cgit v1.2.3