mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Updating to help troubleshoot #132
Added the scripts to disable and enable logging for hostapd Updated sudoers to allow running scripts
This commit is contained in:
parent
7845c8908b
commit
604b28130f
@ -456,18 +456,22 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
||||
|
||||
// Check for Logging Checkbox
|
||||
$logEnable = 0;
|
||||
echo "SOMETHING ".$arrHostapdConf['LogEnable'];
|
||||
echo 'logenable set:'.$_POST['logEnable'];
|
||||
if($arrHostapdConf['LogEnable'] == 0) {
|
||||
if(isset($_POST['logEnable'])) {
|
||||
// Need code to enable logfile logging here
|
||||
$logEnable = 1;
|
||||
exec('sudo /bin/sed -i "\'"\'s|#DAEMON_OPTS=""|DAEMON_OPTS=" -f /tmp/hostapd.log"|\'"\'" /etc/default/hostapd');
|
||||
exec('sudo /etc/raspap/hostapd/enablelog.sh');
|
||||
} else {
|
||||
exec('sudo /etc/raspap/hostapd/disablelog.sh');
|
||||
}
|
||||
} else {
|
||||
if(isset($_POST['logEnable'])) {
|
||||
$logEnable = 1;
|
||||
exec('sudo /bin/sed -i "\'"\'s|#DAEMON_OPTS=""|DAEMON_OPTS=" -f /tmp/hostapd.log"|\'"\'" /etc/default/hostapd');
|
||||
exec('sudo /etc/raspap/hostapd/enablelog.sh');
|
||||
} else {
|
||||
exec('sudo /bin/sed -i "\'"\'s|DAEMON_OPTS=" -f /tmp/hostapd.log"|#DAEMON_OPTS=""|\'"\'" /etc/default/hostapd');
|
||||
exec('sudo /etc/raspap/hostapd/disablelog.sh');
|
||||
}
|
||||
}
|
||||
write_php_ini(["LogEnable" => $logEnable],'/etc/raspap/hostapd.ini');
|
||||
|
@ -105,6 +105,13 @@ function create_raspap_directories() {
|
||||
|
||||
}
|
||||
|
||||
# Generate logging enable/disable files for hostapd
|
||||
function create_logging_scripts() {
|
||||
sudo mkdir /etc/raspap/hostapd
|
||||
sudo mv /var/www/html/installers/*log.sh /etc/rasp/hostapd
|
||||
}
|
||||
|
||||
|
||||
# Fetches latest files from github to webroot
|
||||
function download_latest_files() {
|
||||
if [ -d "$webroot_dir" ]; then
|
||||
@ -194,6 +201,7 @@ function default_configuration() {
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Add a single entry to the sudoers file
|
||||
function sudo_add() {
|
||||
sudo bash -c "echo \"www-data ALL=(ALL) NOPASSWD:$1\" | (EDITOR=\"tee -a\" visudo)" \
|
||||
@ -223,6 +231,8 @@ function patch_system_files() {
|
||||
'/sbin/ip link set wlan0 up'
|
||||
'/sbin/ip -s a f label wlan0'
|
||||
'/bin/cp /etc/raspap/networking/dhcpcd.conf /etc/dhcpcd.conf'
|
||||
'/etc/raspap/hostapd/enablelog.sh'
|
||||
'/etc/raspap/hostapd/disablelog.sh'
|
||||
)
|
||||
|
||||
# Check if sudoers needs patchin
|
||||
@ -259,6 +269,7 @@ function install_raspap() {
|
||||
install_dependencies
|
||||
enable_php_lighttpd
|
||||
create_raspap_directories
|
||||
create_logging_scripts
|
||||
check_for_old_configs
|
||||
download_latest_files
|
||||
change_file_ownership
|
||||
|
3
installers/disablelog.sh
Executable file
3
installers/disablelog.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
/bin/sed -i 's|DAEMON_OPTS=" -f /tmp/hostapd.log"|#DAEMON_OPTS=""|' /etc/default/hostapd
|
||||
|
2
installers/enablelog.sh
Executable file
2
installers/enablelog.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/bin/sed -i 's|#DAEMON_OPTS=""|DAEMON_OPTS=" -f /tmp/hostapd.log"|' /etc/default/hostapd
|
Loading…
Reference in New Issue
Block a user