Commit e34cce34 authored by Franco Fichtner's avatar Franco Fichtner

rc: yes/no prompt unification

parent a8fa1a6c
...@@ -53,7 +53,7 @@ function set_networking_interfaces_ports($probe = false) ...@@ -53,7 +53,7 @@ function set_networking_interfaces_ports($probe = false)
global $config; global $config;
$fp = fopen('php://stdin', 'r'); $fp = fopen('php://stdin', 'r');
$yes_no_prompt = '[y|n]? '; $yes_no_prompt = '[y/N]: ';
$interactive = true; $interactive = true;
$key = null; $key = null;
...@@ -95,7 +95,7 @@ EOD; ...@@ -95,7 +95,7 @@ EOD;
You now have the opportunity to configure VLANs. If you don't require VLANs You now have the opportunity to configure VLANs. If you don't require VLANs
for initial connectivity, say no here and use the GUI to configure VLANs later. for initial connectivity, say no here and use the GUI to configure VLANs later.
Do you want to set up VLANs now ${yes_no_prompt} Do you want to set up VLANs now? ${yes_no_prompt}
EOD; EOD;
if ($interactive) { if ($interactive) {
$key = chop(fgets($fp)); $key = chop(fgets($fp));
...@@ -277,7 +277,7 @@ EOD; ...@@ -277,7 +277,7 @@ EOD;
echo <<<EOD echo <<<EOD
Do you want to proceed ${yes_no_prompt} Do you want to proceed? ${yes_no_prompt}
EOD; EOD;
if ($interactive) { if ($interactive) {
$key = chop(fgets($fp)); $key = chop(fgets($fp));
...@@ -454,7 +454,7 @@ function vlan_setup($iflist, $fp) ...@@ -454,7 +454,7 @@ function vlan_setup($iflist, $fp)
{ {
global $config; global $config;
$yes_no_prompt = '[y|n]? '; $yes_no_prompt = '[y/N]: ';
if (isset($config['vlans']['vlan'])) { if (isset($config['vlans']['vlan'])) {
...@@ -462,7 +462,7 @@ function vlan_setup($iflist, $fp) ...@@ -462,7 +462,7 @@ function vlan_setup($iflist, $fp)
WARNING: all existing VLANs will be cleared if you proceed! WARNING: all existing VLANs will be cleared if you proceed!
Do you want to proceed ${yes_no_prompt} Do you want to proceed? ${yes_no_prompt}
EOD; EOD;
if (strcasecmp(chop(fgets($fp)), "y") != 0) { if (strcasecmp(chop(fgets($fp)), "y") != 0) {
......
...@@ -27,9 +27,9 @@ set -e ...@@ -27,9 +27,9 @@ set -e
echo echo
echo " 0) Logout 7) Ping host" echo " 0) Logout 7) Ping host"
echo " 1) Assign Interfaces 8) Shell" echo " 1) Assign interfaces 8) Shell"
echo " 2) Set interface(s) IP address 9) pfTop" echo " 2) Set interface IP address 9) pfTop"
echo " 3) Reset the root password 10) Filter Logs" echo " 3) Reset the root password 10) Firewall log"
echo " 4) Reset to factory defaults 11) Reload all services" echo " 4) Reset to factory defaults 11) Reload all services"
echo " 5) Power off system 12) Upgrade from console" echo " 5) Power off system 12) Upgrade from console"
echo " 6) Reboot system 13) Restore a configuration" echo " 6) Reboot system 13) Restore a configuration"
......
...@@ -32,13 +32,13 @@ require_once("config.inc"); ...@@ -32,13 +32,13 @@ require_once("config.inc");
require_once("system.inc"); require_once("system.inc");
$fp = fopen('php://stdin', 'r'); $fp = fopen('php://stdin', 'r');
$yes_no_prompt = '[y|n]? '; $yes_no_prompt = '[y/N]: ';
echo <<<EOD echo <<<EOD
You are about to reset the firewall to factory defaults. You are about to reset the firewall to factory defaults.
The firewall will reboot after resetting the configuration. The firewall will reboot after resetting the configuration.
Do you want to proceed {$yes_no_prompt} Do you want to proceed? {$yes_no_prompt}
EOD; EOD;
if (strcasecmp(chop(fgets($fp)), 'y') == 0) { if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
......
...@@ -34,7 +34,7 @@ require_once("system.inc"); ...@@ -34,7 +34,7 @@ require_once("system.inc");
$fp = fopen('php://stdin', 'r'); $fp = fopen('php://stdin', 'r');
echo "The system will halt and power off. Do you want to proceed [y|n]? "; echo 'The system will halt and power off. Do you want to proceed? [y/N]: ';
if (strcasecmp(chop(fgets($fp)), 'y') == 0) { if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
system_halt(true); system_halt(true);
......
...@@ -33,7 +33,7 @@ require_once("system.inc"); ...@@ -33,7 +33,7 @@ require_once("system.inc");
$fp = fopen('php://stdin', 'r'); $fp = fopen('php://stdin', 'r');
echo "The system will reboot. Do you want to proceed [y|n]? "; echo 'The system will reboot. Do you want to proceed? [y/N]: ';
if (strcasecmp(chop(fgets($fp)), 'y') == 0) { if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
system_reboot(true); system_reboot(true);
......
...@@ -69,7 +69,7 @@ function restore_history_backup($number) ...@@ -69,7 +69,7 @@ function restore_history_backup($number)
list_backups($number); list_backups($number);
$filename = array_keys($confvers)[$number-1]; $filename = array_keys($confvers)[$number-1];
$thisbackup = $confvers[$filename]; $thisbackup = $confvers[$filename];
echo 'Y/N? : '; echo '[y/N]: ';
$confirm = strtoupper(chop(fgets($fp))); $confirm = strtoupper(chop(fgets($fp)));
if ($confirm == 'Y') { if ($confirm == 'Y') {
$cnf = OPNsense\Core\Config::getInstance(); $cnf = OPNsense\Core\Config::getInstance();
......
...@@ -39,9 +39,6 @@ require_once("interfaces.inc"); ...@@ -39,9 +39,6 @@ require_once("interfaces.inc");
system_console_mute(); system_console_mute();
if (set_networking_interfaces_ports()) { if (set_networking_interfaces_ports()) {
global $config;
$config = parse_config(true);
/* need to stop local dhcp servers to avoid wrong leases */ /* need to stop local dhcp servers to avoid wrong leases */
killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true); killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true);
killbypid('/var/dhcpd/var/run/dhcpdv6.pid', 'TERM', true); killbypid('/var/dhcpd/var/run/dhcpdv6.pid', 'TERM', true);
......
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