Add status msg, update shell cmds

This commit is contained in:
billz 2021-04-30 08:37:41 +01:00
parent 79393c48d0
commit 8873735d7f
2 changed files with 5 additions and 3 deletions

View file

@ -20,6 +20,7 @@ function DisplayWPAConfig()
exec('sudo wpa_cli -i ' . $_SESSION['wifi_client_interface'] . ' select_network '.strval($_POST['connect']));
$status->addMessage('New network selected', 'success');
} elseif (isset($_POST['wpa_reinit'])) {
$status->addMessage('Re-initializing wpa_supplicant', 'info', false);
$force_remove=true;
$result = reinitializeWPA($force_remove);
$status->addMessage($result, 'info');

View file

@ -165,10 +165,11 @@ function getWifiInterface()
function reinitializeWPA($force)
{
if ($force == true) {
$cmd = escapeshellcmd("/bin/rm /var/run/wpa_supplicant/".$_SESSION['wifi_client_interface']);
$result = exec($cmd);
$cmd = escapeshellcmd("sudo /bin/rm /var/run/wpa_supplicant/".$_SESSION['wifi_client_interface']);
$result = exec($cmd);
}
$cmd = escapeshellcmd("sudo /sbin/wpa_supplicant -B -Dnl80211 -Dwext c/etc/wpa_supplicant/wpa_supplicant.conf -i". $_SESSION['wifi_client_interface']);
$cmd = escapeshellcmd("sudo /sbin/wpa_supplicant -B -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -i". $_SESSION['wifi_client_interface']);
$result = shell_exec($cmd);
return $result;
}