diff --git a/assets/etc/hostapd/hostapd.template b/assets/etc/hostapd/hostapd.template new file mode 100644 index 0000000..d6d04b2 --- /dev/null +++ b/assets/etc/hostapd/hostapd.template @@ -0,0 +1,20 @@ +# Defaults for hostapd initscript +# +# See /usr/share/doc/hostapd/README.Debian for information about alternative +# methods of managing hostapd. +# +# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration +# file and hostapd will be started during system boot. An example configuration +# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz +# +DAEMON_CONF="/etc/hostapd/hostapd.conf" + +# Additional daemon options to be appended to hostapd command:- +# -d show more debug messages (-dd for even more) +# -K include key data in debug messages +# -t include timestamps in some debug messages +# +# Note that -B (daemon mode) and -P (pidfile) options are automatically +# configured by the init.d script and must not be added to DAEMON_OPTS. +# +#DAEMON_OPTS="" diff --git a/wifi_manager.js b/wifi_manager.js index 9052006..5604f03 100644 --- a/wifi_manager.js +++ b/wifi_manager.js @@ -158,8 +158,6 @@ module.exports = function() { function update_dhcpd(next_step) { var context = config.access_point; // We must enable this to turn on the access point - - write_template_to_file( "./assets/etc/dhcp/dhcpd.conf.template", "/etc/dhcp/dhcpd.conf", @@ -175,11 +173,34 @@ module.exports = function() { }, // Enable hostapd.conf file - function update_hostapd(next_step) { + function update_hostapd_conf(next_step) { write_template_to_file( "./assets/etc/hostapd/hostapd.conf.template", "/etc/hostapd/hostapd.conf", context, next_step); + }, + + function update_hostapd_default(next_step) { + write_template_to_file( + "./assets/etc/hostapd/hostapd.template", + "/etc/hostapd/hostapd", + context, next_step); + }, + + function restart_dhcp_service(next_step) { + exec("service isc-dhcp-server restart", function(error, stdout, stderr) { + console.log(stdout); + if (!error) console.log("dhcp server restarted!"); + next_step(error); + }); + }, + + function restart_hostapd_service(next_step) { + exec("service hostapd restart", function(error, stdout, stderr) { + console.log(stdout); + if (!error) console.log("hostapd restarted!"); + next_step(error); + }); } ], callback);