mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Default hostapd configuration
This commit is contained in:
		| @@ -65,7 +65,7 @@ function enable_php_lighttpd() { | ||||
| function create_raspap_directories() { | ||||
|     install_log "Creating RaspAP directories" | ||||
|     if [ -d "$raspap_dir" ]; then | ||||
|         sudo mv $raspap_dir $raspap_dir.original || install_error "Unable to move old directory out of the way" | ||||
|         sudo mv $raspap_dir $raspap_dir.original || install_error "Unable to move old '$raspap_dir' out of the way" | ||||
|     fi | ||||
|     sudo mkdir -p "$raspap_dir" || install_error "Unable to create directory '$raspap_dir'" | ||||
|  | ||||
| @@ -74,12 +74,13 @@ function create_raspap_directories() { | ||||
|  | ||||
| # Fetches latest files from github to webroot | ||||
| function download_latest_files() { | ||||
|     if [ ! -d "$webroot_dir" ]; then | ||||
|         install_error "Web root directory doesn't exist" | ||||
|     if [ -d "$webroot_dir" ]; then | ||||
|         sudo mv $webroot_dir /tmp/old_webroot || install_error "Unable to remove old webroot directory" | ||||
|     fi | ||||
|  | ||||
|     install_log "Cloning latest files from github" | ||||
|     sudo git clone https://github.com/billz/raspap-webgui "$webroot_dir" || install_error "Unable to download files from github" | ||||
|     git clone https://github.com/billz/raspap-webgui /tmp/raspap-webgui || install_error "Unable to download files from github" | ||||
|     sudo mv /tmp/raspap-webgui $webroot_dir || install_error "Unable to move raspap-webgui to web root" | ||||
| } | ||||
|  | ||||
| # Sets files ownership in web root directory | ||||
| @@ -103,6 +104,16 @@ function move_config_file() { | ||||
|     sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || install_error "Unable to change file ownership for '$raspap_dir'" | ||||
| } | ||||
|  | ||||
| # Set up default configuration | ||||
| function default_configuration() { | ||||
|     install_log "Setting up hostapd" | ||||
|     if [ -f /etc/default/hostapd ]; then | ||||
|         sudo mv /etc/default/hostapd /tmp/default_hostapd.old || install_error "Unable to remove old /etc/default/hostapd file" | ||||
|     fi | ||||
|     sudo echo DAEMON_CONF=$raspap_dir/hostapd.conf > /etc/default/hostapd || install_error "Unable to write new /etc/default/hostapd file" | ||||
|     sudo mv $webroot_dir/config/hostapd.conf $raspap_dir/hostapd.conf || install_error "Unable to move hostapd configuration file" | ||||
| } | ||||
|  | ||||
| # 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)" \ | ||||
| @@ -121,10 +132,10 @@ function patch_system_files() { | ||||
|     sudo_add '/sbin/wpa_cli scan' | ||||
|     sudo_add '/sbin/wpa_cli reconfigure' | ||||
|     sudo_add '/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf' | ||||
|     sudo_add 'service hostapd start' | ||||
|     sudo_add 'service hostapd stop' | ||||
|     sudo_add 'service dnsmasq start' | ||||
|     sudo_add 'service dnsmasq stop' | ||||
|     sudo_add '/usr/sbin/service hostapd start' | ||||
|     sudo_add '/usr/sbin/service hostapd stop' | ||||
|     sudo_add '/usr/sbin/service dnsmasq start' | ||||
|     sudo_add '/usr/sbin/service dnsmasq stop' | ||||
|     sudo_add '/bin/cp /tmp/dhcpddata /etc/dnsmasq.conf' | ||||
|     sudo_add '/sbin/shutdown -h now' | ||||
|     sudo_add '/sbin/reboot' | ||||
| @@ -151,6 +162,7 @@ function install_raspap() { | ||||
|     download_latest_files | ||||
|     change_file_ownership | ||||
|     move_config_file | ||||
|     default_configuration | ||||
|     patch_system_files | ||||
|     install_complete | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user