Skip to content

Commit

Permalink
Update hosts file if hostname is modified, but the user should run au…
Browse files Browse the repository at this point in the history
…to config and reboot the system afterwards
  • Loading branch information
sonertari committed May 22, 2018
1 parent 630628c commit 1a3857c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Installer/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ function ApplyConfig($auto)
}

$View->Model= 'system';
$host= "$lanip $myname ".explode(".", $myname)[0];
if (!$View->Controller($output, 'AddHost', $host)) {
wui_syslog(LOG_ERR, __FILE__, __FUNCTION__, __LINE__, "Failed setting hosts: $host");
}

if (!$View->Controller($output, 'SetManCgiHome', $lanip)) {
wui_syslog(LOG_ERR, __FILE__, __FUNCTION__, __LINE__, "Failed setting man.cgi home: $lanip");
}
Expand Down
2 changes: 2 additions & 0 deletions src/Model/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ function SetMyGate($mygate)
*/
function SetMyName($myname)
{
/// @attention Do not change the active hostname here by running /bin/hostname, otherwise UI login over SSH fails.
// The user should run auto config and then reboot the system to activate the new hostname.
return file_put_contents($this->confDir.'myname', $myname.PHP_EOL);
}

Expand Down

0 comments on commit 1a3857c

Please sign in to comment.