Commit e09e0af7 authored by Franco Fichtner's avatar Franco Fichtner

dashboard: advertise LiveCD mode and SSH choices

(cherry picked from commit 5120905f)
(cherry picked from commit 3b54d298)
(cherry picked from commit 73f61f06)
parent e0b5fd6d
...@@ -5210,3 +5210,21 @@ function get_carp_interface_status($carpinterface) ...@@ -5210,3 +5210,21 @@ function get_carp_interface_status($carpinterface)
} }
return; 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,24 @@ function is_fqdn($fqdn) ...@@ -1559,3 +1559,24 @@ function is_fqdn($fqdn)
return $hostname; 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';
if (file_exists($file)) {
return false;
}
$fd = @fopen($file, 'w');
if ($fd) {
fclose($fd);
return false;
}
return true;
}
...@@ -29,39 +29,7 @@ ...@@ -29,39 +29,7 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
function is_install_media() /* looks weird, but means we started PHP successfully */
{
/*
* 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;
}
echo " done.\n"; echo " done.\n";
echo "Initializing..."; echo "Initializing...";
......
...@@ -78,8 +78,8 @@ echo "as a self-signed certificate is used by default." ...@@ -78,8 +78,8 @@ echo "as a self-signed certificate is used by default."
echo echo
echo -n "Rebooting in 5 seconds. CTRL-C to abort" echo -n "Rebooting in 5 seconds. CTRL-C to abort"
for n in 5 4 3 2 1; do for n in 5 4 3 2 1; do
sleep 1
echo -n "." echo -n "."
sleep 1
done done
echo echo
......
...@@ -269,6 +269,15 @@ function print_service_banner($service) ...@@ -269,6 +269,15 @@ function print_service_banner($service)
'</a>' '</a>'
)); ));
break; 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: default:
break; break;
} }
......
...@@ -310,6 +310,7 @@ include("fbegin.inc");?> ...@@ -310,6 +310,7 @@ include("fbegin.inc");?>
<div class="row"> <div class="row">
<div class="col-md-12 col-xs-12"> <div class="col-md-12 col-xs-12">
<?php <?php
print_service_banner('livecd');
$crash_report = get_crash_report(); $crash_report = get_crash_report();
if ($crash_report != '') { if ($crash_report != '') {
print_info_box($crash_report); print_info_box($crash_report);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment