Project

General

Profile

« Previous | Next » 

Revision 285ef132

Added by Ermal Luçi over 10 years ago

Rather than set the g['booting'] on globals provide a function to test for that doing the right checks

View differences:

etc/inc/services.inc
281 281
	/* write radvd.conf */
282 282
	if (!@file_put_contents("{$g['varetc_path']}/radvd.conf", $radvdconf)) {
283 283
		log_error("Error: cannot open radvd.conf in services_radvd_configure().\n");
284
		if ($g['booting'])
284
		if (platform_booting())
285 285
			printf("Error: cannot open radvd.conf in services_radvd_configure().\n");
286 286
	}
287 287
	unset($radvdconf);
......
367 367
				break;
368 368
			}
369 369

  
370
	if ($g['booting']) {
370
	if (platform_booting()) {
371 371
		/* restore the leases, if we have them */
372 372
		if (file_exists("{$g['cf_conf_path']}/dhcpleases.tgz")) {
373 373
			$dhcprestore = "";
......
400 400
		}
401 401
	}
402 402

  
403
	if ($g['booting'])
403
	if (platform_booting())
404 404
		echo gettext("Starting DHCP service...");
405 405
	else
406 406
		sleep(1);
......
913 913
			join(" ", $dhcpdifs));
914 914
	}
915 915

  
916
	if ($g['booting'])
916
	if (platform_booting())
917 917
		print "done.\n";
918 918

  
919 919
	return 0;
......
1003 1003
	if (!is_dhcpv6_server_enabled())
1004 1004
		return 0;
1005 1005

  
1006
	if ($g['booting']) {
1006
	if (platform_booting()) {
1007 1007
		if ($g['platform'] != "pfSense") {
1008 1008
			/* restore the leases, if we have them */
1009 1009
			if (file_exists("{$g['cf_conf_path']}/dhcp6leases.tgz")) {
......
1026 1026
	$Iflist = array_merge($Iflist, get_configured_pppoe_server_interfaces());
1027 1027

  
1028 1028

  
1029
	if ($g['booting'])
1029
	if (platform_booting())
1030 1030
		echo "Starting DHCPv6 service...";
1031 1031
	else
1032 1032
		sleep(1);
......
1303 1303
	/* write dhcpdv6.conf */
1304 1304
	if (!@file_put_contents("{$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf", $dhcpdv6conf)) {
1305 1305
		log_error("Error: cannot open {$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf in services_dhcpdv6_configure().\n");
1306
		if ($g['booting'])
1306
		if (platform_booting())
1307 1307
			printf("Error: cannot open {$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf in services_dhcpdv6_configure().\n");
1308 1308
		unset($dhcpdv6conf);
1309 1309
		return 1;
......
1324 1324
			join(" ", $dhcpdv6ifs));
1325 1325
		mwexec("/usr/local/sbin/dhcpleases6 -c \"/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh\" -l {$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases");
1326 1326
	}
1327
	if ($g['booting'])
1327
	if (platform_booting())
1328 1328
		print gettext("done.") . "\n";
1329 1329

  
1330 1330
	return 0;
......
1406 1406
	if (!isset($dhcrelaycfg['enable']))
1407 1407
		return 0;
1408 1408

  
1409
	if ($g['booting'])
1409
	if (platform_booting())
1410 1410
		echo gettext("Starting DHCP relay service...");
1411 1411
	else
1412 1412
		sleep(1);
......
1528 1528
	if (!isset($dhcrelaycfg['enable']))
1529 1529
		return 0;
1530 1530

  
1531
	if ($g['booting'])
1531
	if (platform_booting())
1532 1532
		echo gettext("Starting DHCPv6 relay service...");
1533 1533
	else
1534 1534
		sleep(1);
......
1669 1669
	$dyndnscfg = $config['dyndnses']['dyndns'];
1670 1670
	$gwgroups = return_gateway_groups_array();
1671 1671
	if (is_array($dyndnscfg)) {
1672
		if ($g['booting'])
1672
		if (platform_booting())
1673 1673
			echo gettext("Starting DynDNS clients...");
1674 1674

  
1675 1675
		foreach ($dyndnscfg as $dyndns) {
......
1682 1682
			}
1683 1683
		}
1684 1684

  
1685
		if ($g['booting'])
1685
		if (platform_booting())
1686 1686
			echo gettext("done.") . "\n";
1687 1687
	}
1688 1688

  
......
1738 1738

  
1739 1739
	if (isset($config['dnsmasq']['enable'])) {
1740 1740

  
1741
		if ($g['booting'])
1741
		if (platform_booting())
1742 1742
			echo gettext("Starting DNS forwarder...");
1743 1743
		else
1744 1744
			sleep(1);
......
1866 1866

  
1867 1867
        system_dhcpleases_configure();
1868 1868

  
1869
		if ($g['booting'])
1869
		if (platform_booting())
1870 1870
			echo gettext("done.") . "\n";
1871 1871
	}
1872 1872

  
1873
	if (!$g['booting']) {
1873
	if (!platform_booting()) {
1874 1874
		if(services_dhcpd_configure()!=0)
1875 1875
			$return = 1;
1876 1876
	}
......
1892 1892
		sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
1893 1893

  
1894 1894
	if (isset($config['unbound']['enable'])) {
1895
		if ($g['booting'])
1895
		if (platform_booting())
1896 1896
			echo gettext("Starting DNS Resolver...");
1897 1897
		else
1898 1898
			sleep(1);
......
1903 1903

  
1904 1904
		require_once('/etc/inc/unbound.inc');
1905 1905
		sync_unbound_service();
1906
		if ($g['booting'])
1906
		if (platform_booting())
1907 1907
			echo gettext("done.") . "\n";
1908 1908

  
1909 1909
        system_dhcpleases_configure();
1910 1910
	}
1911 1911

  
1912
	if (!$g['booting']) {
1912
	if (!platform_booting()) {
1913 1913
		if (services_dhcpd_configure()!=0)
1914 1914
			$return = 1;
1915 1915
	}
......
1932 1932

  
1933 1933
	if (isset($config['snmpd']['enable'])) {
1934 1934

  
1935
		if ($g['booting'])
1935
		if (platform_booting())
1936 1936
			echo gettext("Starting SNMP daemon... ");
1937 1937

  
1938 1938
		/* generate snmpd.conf */
......
2114 2114
		mwexec("/usr/sbin/bsnmpd -c {$g['varetc_path']}/snmpd.conf" .
2115 2115
			"{$bindlan} -p {$g['varrun_path']}/snmpd.pid");
2116 2116

  
2117
		if ($g['booting'])
2117
		if (platform_booting())
2118 2118
			echo gettext("done.") . "\n";
2119 2119
	}
2120 2120

  

Also available in: Unified diff