|  | @@ -7132,6 +7132,15 @@ function enable_wifi_hotspot {
 | 
	
		
			
			| 7132 | 7132 |    fi
 | 
	
		
			
			| 7133 | 7133 |    apt-get -y install hostapd dnsmasq
 | 
	
		
			
			| 7134 | 7134 |  
 | 
	
		
			
			|  | 7135 | +  if [ ! -f /etc/default/hostapd ]; then
 | 
	
		
			
			|  | 7136 | +	  echo 'Unable to find /etc/default/hostapd. hostapd may not have installed correctly'
 | 
	
		
			
			|  | 7137 | +	  exit 490
 | 
	
		
			
			|  | 7138 | +  fi
 | 
	
		
			
			|  | 7139 | +  if [ ! -f /etc/dnsmasq.conf ]; then
 | 
	
		
			
			|  | 7140 | +	  echo 'Unable to find /etc/dnsmasq.conf. dnsmasq may not have installed correctly'
 | 
	
		
			
			|  | 7141 | +	  exit 492
 | 
	
		
			
			|  | 7142 | +  fi
 | 
	
		
			
			|  | 7143 | +
 | 
	
		
			
			| 7135 | 7144 |    get_wifi_essid
 | 
	
		
			
			| 7136 | 7145 |    get_wifi_password
 | 
	
		
			
			| 7137 | 7146 |  
 | 
	
	
		
			
			|  | @@ -7188,11 +7197,19 @@ function enable_wifi_hotspot {
 | 
	
		
			
			| 7188 | 7197 |    echo 'eapol_key_index_workaround=0' >> /etc/hostapd/hostapd.conf
 | 
	
		
			
			| 7189 | 7198 |  
 | 
	
		
			
			| 7190 | 7199 |    service hostapd restart
 | 
	
		
			
			|  | 7200 | +  if [ ! "$?" = "0" ]; then
 | 
	
		
			
			|  | 7201 | +	  echo 'Unable to restart hostapd'
 | 
	
		
			
			|  | 7202 | +	  exit 854
 | 
	
		
			
			|  | 7203 | +  fi
 | 
	
		
			
			| 7191 | 7204 |  
 | 
	
		
			
			| 7192 | 7205 |    sed -i "s/#interface=/interface=$WIFI_INTERFACE/" /etc/dnsmasq.conf
 | 
	
		
			
			| 7193 | 7206 |    sed -i 's/#dhcp-range=192.168.0.50,192.168.0.150,12h/dhcp-range=192.168.1.1,192.168.1.50,12h/g' /etc/dnsmasq.conf
 | 
	
		
			
			| 7194 | 7207 |  
 | 
	
		
			
			| 7195 | 7208 |    service dnsmasq restart
 | 
	
		
			
			|  | 7209 | +  if [ ! "$?" = "0" ]; then
 | 
	
		
			
			|  | 7210 | +	  echo 'Unable to restart dnsmasq'
 | 
	
		
			
			|  | 7211 | +	  exit 856
 | 
	
		
			
			|  | 7212 | +  fi
 | 
	
		
			
			| 7196 | 7213 |  
 | 
	
		
			
			| 7197 | 7214 |    # Add details to the README file
 | 
	
		
			
			| 7198 | 7215 |    if ! grep -q "Wifi Hotspot" /home/$MY_USERNAME/README; then
 | 
	
	
		
			
			|  | @@ -7205,8 +7222,6 @@ function enable_wifi_hotspot {
 | 
	
		
			
			| 7205 | 7222 |        chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
 | 
	
		
			
			| 7206 | 7223 |    fi
 | 
	
		
			
			| 7207 | 7224 |  
 | 
	
		
			
			| 7208 |  | -  service networking restart
 | 
	
		
			
			| 7209 |  | -
 | 
	
		
			
			| 7210 | 7225 |    echo 'enable_wifi_hotspot' >> $COMPLETION_FILE
 | 
	
		
			
			| 7211 | 7226 |  }
 | 
	
		
			
			| 7212 | 7227 |  
 | 
	
	
		
			
			|  | @@ -7242,6 +7257,10 @@ function enable_wifi {
 | 
	
		
			
			| 7242 | 7257 |    fi
 | 
	
		
			
			| 7243 | 7258 |  
 | 
	
		
			
			| 7244 | 7259 |    service networking restart
 | 
	
		
			
			|  | 7260 | +  if [ ! "$?" = "0" ]; then
 | 
	
		
			
			|  | 7261 | +	  echo 'Unable to restart networking'
 | 
	
		
			
			|  | 7262 | +	  exit 855
 | 
	
		
			
			|  | 7263 | +  fi
 | 
	
		
			
			| 7245 | 7264 |  
 | 
	
		
			
			| 7246 | 7265 |    # Add details to the README file
 | 
	
		
			
			| 7247 | 7266 |    if [[ ENABLE_WIFI_HOTSPOT != "yes" ]]; then
 |