mirror of
https://github.com/opnsense/core.git
synced 2026-06-08 16:34:24 -04:00
Services: Network Time: PPS - remove stale symlink when pps is disabled, closes https://github.com/opnsense/core/pull/9969
This commit is contained in:
parent
3069c25680
commit
770480715b
1 changed files with 7 additions and 11 deletions
|
|
@ -152,17 +152,17 @@ function ntpd_configure_gps($serialport)
|
|||
return true;
|
||||
}
|
||||
|
||||
function ntpd_configure_pps($serialport)
|
||||
function ntpd_configure_pps($port)
|
||||
{
|
||||
$pps_device = '/dev/pps0';
|
||||
$serialport = "/dev/{$serialport}";
|
||||
$serialport = "/dev/{$port}";
|
||||
|
||||
if (!file_exists($serialport)) {
|
||||
@unlink($pps_device);
|
||||
if (empty($port)) {
|
||||
return false
|
||||
} elseif (!file_exists($serialport)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create symlink that ntpd requires
|
||||
@unlink($pps_device);
|
||||
@symlink($serialport, $pps_device);
|
||||
|
||||
return true;
|
||||
|
|
@ -213,11 +213,7 @@ function ntpd_configure_do($verbose = false)
|
|||
$ntpcfg .= "\n";
|
||||
|
||||
/* Add PPS configuration */
|
||||
if (
|
||||
!empty($config['ntpd']['pps'])
|
||||
&& file_exists('/dev/' . $config['ntpd']['pps']['port'])
|
||||
&& ntpd_configure_pps($config['ntpd']['pps']['port'])
|
||||
) {
|
||||
if (!empty($config['ntpd']['pps']) && ntpd_configure_pps($config['ntpd']['pps']['port'])) {
|
||||
$ntpcfg .= "\n";
|
||||
$ntpcfg .= "# PPS Setup\n";
|
||||
$ntpcfg .= 'server 127.127.22.0';
|
||||
|
|
|
|||
Loading…
Reference in a new issue