summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/services.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/inc/services.inc')
-rw-r--r--src/etc/inc/services.inc62
1 files changed, 28 insertions, 34 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index c254c35..333261d 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -391,7 +391,7 @@ function services_dhcpd_configure($family = "all", $blacklist = array()) {
global $config, $g;
/* configure DHCPD chroot once */
- $fd = fopen("{$g['tmp_path']}/dhcpd.sh", "w");
+ $fd = fopen("{$g['tmp_path']}/dhcpd.sh","w");
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}\n");
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/dev\n");
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/etc\n");
@@ -406,7 +406,7 @@ function services_dhcpd_configure($family = "all", $blacklist = array()) {
fwrite($fd, "/bin/cp -n /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n");
fwrite($fd, "/bin/chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n");
- $status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`;
+ $status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`;
if (!trim($status)) {
fwrite($fd, "/sbin/mount -t devfs devfs {$g['dhcpd_chroot_path']}/dev\n");
}
@@ -596,7 +596,7 @@ EOD;
$my_port = "519";
$peer_port = "520";
$type = "primary";
- $dhcpdconf_pri = "split 128;\n";
+ $dhcpdconf_pri = "split 128;\n";
$dhcpdconf_pri .= " mclt 600;\n";
}
@@ -709,16 +709,16 @@ EOPP;
$all_mac_strings[] = $dhcpifconf['mac_allow'];
$all_mac_strings[] = $dhcpifconf['mac_deny'];
if (!empty($all_mac_strings)) {
- $all_mac_list = array_unique(explode(',', implode(',', $all_mac_strings)));
- foreach ($all_mac_list as $mac) {
- if (empty($mac)) {
- continue;
- }
- $dhcpdconf .= 'class "' . str_replace(':', '', $mac) . '" {' . "\n";
- // Skip the first octet of the MAC address - for media type, typically Ethernet ("01") and match the rest.
- $dhcpdconf .= ' match if substring (hardware, 1, ' . (substr_count($mac, ':') + 1) . ') = ' . $mac . ';' . "\n";
- $dhcpdconf .= '}' . "\n";
+ $all_mac_list = array_unique(explode(',', implode(',', $all_mac_strings)));
+ foreach ($all_mac_list as $mac) {
+ if (empty($mac)) {
+ continue;
}
+ $dhcpdconf .= 'class "' . str_replace(':', '', $mac) . '" {' . "\n";
+ // Skip the first octet of the MAC address - for media type, typically Ethernet ("01") and match the rest.
+ $dhcpdconf .= ' match if substring (hardware, 1, ' . (substr_count($mac, ':') + 1) . ') = ' . $mac . ';' . "\n";
+ $dhcpdconf .= '}' . "\n";
+ }
}
$dhcpdconf .= "subnet {$subnet} netmask {$subnetmask} {\n";
@@ -1598,12 +1598,12 @@ function services_dhcrelay_configure() {
$dhcrelayifs[] = get_real_interface($dhcrelayif);
}
}
-
- $srvips = explode(",", $dhcrelaycfg['server']);
+
+ $srvips = explode(",", $dhcrelaycfg['server']);
if (!is_array($srvips)) {
log_error("No destination IP has been configured!");
return;
- }
+ }
$dhcrelayifs = array_unique($dhcrelayifs);
@@ -1613,10 +1613,10 @@ function services_dhcrelay_configure() {
return; /* XXX */
}
- $cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs);
+ $cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs);
if (isset($dhcrelaycfg['agentoption'])) {
- $cmd .= " -a -m replace";
+ $cmd .= " -a -m replace";
}
$cmd .= " " . implode(" ", $srvips);
@@ -1711,8 +1711,8 @@ function services_dyndns_configure_client($conf) {
$dnsPort = NULL,
$dnsUpdateURL = "{$conf['updateurl']}",
$forceUpdate = $conf['force'],
- $dnsZoneID = $conf['zoneid'],
- $dnsTTL = $conf['ttl'],
+ $dnsZoneID=$conf['zoneid'],
+ $dnsTTL=$conf['ttl'],
$dnsResultMatch = "{$conf['resultmatch']}",
$dnsRequestIf = "{$conf['requestif']}",
$dnsID = "{$conf['id']}",
@@ -1811,7 +1811,7 @@ function services_dnsmasq_configure() {
}
/* generate hosts file */
- if (system_hosts_generate() != 0) {
+ if (system_hosts_generate()!=0) {
$return = 1;
}
@@ -1967,7 +1967,7 @@ function services_dnsmasq_configure() {
}
if (!platform_booting()) {
- if (services_dhcpd_configure() != 0) {
+ if (services_dhcpd_configure()!=0) {
$return = 1;
}
}
@@ -1997,7 +1997,7 @@ function services_unbound_configure() {
}
/* generate hosts file */
- if (system_hosts_generate() != 0) {
+ if (system_hosts_generate()!=0) {
$return = 1;
}
@@ -2011,7 +2011,7 @@ function services_unbound_configure() {
}
if (!platform_booting()) {
- if (services_dhcpd_configure() != 0) {
+ if (services_dhcpd_configure()!=0) {
$return = 1;
}
}
@@ -2042,7 +2042,7 @@ function services_snmpd_configure() {
/* generate snmpd.conf */
$fd = fopen("{$g['varetc_path']}/snmpd.conf", "w");
if (!$fd) {
- printf(gettext("Error: cannot open snmpd.conf in services_snmpd_configure().%s"), "\n");
+ printf(gettext("Error: cannot open snmpd.conf in services_snmpd_configure().%s"),"\n");
return 1;
}
@@ -2483,11 +2483,10 @@ function upnp_start() {
}
}
-function install_cron_job($command, $active = false, $minute = "0", $hour = "*", $monthday = "*", $month = "*", $weekday = "*", $who = "root") {
+function install_cron_job($command, $active=false, $minute="0", $hour="*", $monthday="*", $month="*", $weekday="*", $who="root") {
global $config, $g;
$is_installed = false;
- $cron_changed = true;
if (!is_array($config['cron'])) {
$config['cron'] = array();
@@ -2496,7 +2495,7 @@ function install_cron_job($command, $active = false, $minute = "0", $hour = "*",
$config['cron']['item'] = array();
}
- $x = 0;
+ $x=0;
foreach ($config['cron']['item'] as $item) {
if (strstr($item['command'], $command)) {
$is_installed = true;
@@ -2518,13 +2517,8 @@ function install_cron_job($command, $active = false, $minute = "0", $hour = "*",
$config['cron']['item'][] = $cron_item;
write_config(sprintf(gettext("Installed cron job for %s"), $command));
} else {
- if ($config['cron']['item'][$x] == $cron_item) {
- $cron_changed = false;
- log_error(sprintf(gettext("Checked cron job for %s, no change needed"), $command));
- } else {
- $config['cron']['item'][$x] = $cron_item;
- write_config(sprintf(gettext("Updated cron job for %s"), $command));
- }
+ $config['cron']['item'][$x] = $cron_item;
+ write_config(sprintf(gettext("Updated cron job for %s"), $command));
}
} else {
if ($is_installed == true) {
OpenPOWER on IntegriCloud