mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
dashboard: advertise LiveCD mode and SSH choices
This commit is contained in:
parent
47988b58ef
commit
5120905f1c
@ -5208,3 +5208,21 @@ function get_carp_interface_status($carpinterface)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function is_interface_mismatch()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['interfaces'])) {
|
||||
foreach (legacy_config_get_interfaces(array("virtual" => false)) as $ifname => $ifcfg) {
|
||||
if (preg_match("/^enc|^cua|^tun|^tap|^l2tp|^pptp|^ppp|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
|
||||
/* Do not check these interfaces */
|
||||
continue;
|
||||
} elseif (does_interface_exist($ifcfg['if']) == false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1559,3 +1559,21 @@ function is_fqdn($fqdn)
|
||||
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
function is_install_media()
|
||||
{
|
||||
/*
|
||||
* Despite unionfs underneath, / is still not writeable,
|
||||
* making the following the perfect test for install media.
|
||||
*/
|
||||
|
||||
$file = '/.probe.for.install.media';
|
||||
$fd = @fopen($file, 'w');
|
||||
if ($fd) {
|
||||
fclose($fd);
|
||||
unlink($file);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -29,39 +29,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function is_install_media()
|
||||
{
|
||||
/*
|
||||
* Despite unionfs underneath, / is still not writeable,
|
||||
* making the following the perfect test for install media.
|
||||
*/
|
||||
|
||||
$file = '/.probe.for.install.media';
|
||||
$fd = @fopen($file, 'w');
|
||||
if ($fd) {
|
||||
fclose($fd);
|
||||
unlink($file);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function is_interface_mismatch()
|
||||
{
|
||||
global $config;
|
||||
if (isset($config['interfaces'])) {
|
||||
foreach (legacy_config_get_interfaces(array("virtual" => false)) as $ifname => $ifcfg) {
|
||||
if (preg_match("/^enc|^cua|^tun|^tap|^l2tp|^pptp|^ppp|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
|
||||
/* Do not check these interfaces */
|
||||
continue;
|
||||
} elseif (does_interface_exist($ifcfg['if']) == false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* looks weird, but means we started PHP successfully */
|
||||
echo " done.\n";
|
||||
|
||||
echo "Initializing...";
|
||||
|
||||
@ -269,6 +269,15 @@ function print_service_banner($service)
|
||||
'</a>'
|
||||
));
|
||||
break;
|
||||
case 'livecd':
|
||||
if (!is_install_media()) {
|
||||
break;
|
||||
}
|
||||
print_alert_box(
|
||||
gettext('You are currently running in LiveCD mode. A reboot will reset the configuration.') .' ' .
|
||||
(is_process_running('sshd') ? gettext('SSH remote login is enabled for the users "root" and ' .
|
||||
'"installer" using the same password.') : gettext('SSH remote login is disabled.'))
|
||||
);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -310,6 +310,7 @@ include("fbegin.inc");?>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xs-12">
|
||||
<?php
|
||||
print_service_banner('livecd');
|
||||
$crash_report = get_crash_report();
|
||||
if ($crash_report != '') {
|
||||
print_info_box($crash_report);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user