mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Add client handling to installer
This commit is contained in:
		| @@ -26,6 +26,7 @@ readonly raspap_adblock="/etc/dnsmasq.d/090_adblock.conf" | |||||||
| readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf" | readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf" | ||||||
| readonly raspap_network="$raspap_dir/networking/" | readonly raspap_network="$raspap_dir/networking/" | ||||||
| readonly rulesv4="/etc/iptables/rules.v4" | readonly rulesv4="/etc/iptables/rules.v4" | ||||||
|  | readonly raspap_client_scripts="/usr/local/sbin" | ||||||
| readonly notracking_url="https://raw.githubusercontent.com/notracking/hosts-blocklists/master/" | readonly notracking_url="https://raw.githubusercontent.com/notracking/hosts-blocklists/master/" | ||||||
| webroot_dir="/var/www/html" | webroot_dir="/var/www/html" | ||||||
| git_source_url="https://github.com/$repo"  # $repo from install.raspap.com | git_source_url="https://github.com/$repo"  # $repo from install.raspap.com | ||||||
| @@ -50,6 +51,7 @@ function _install_raspap() { | |||||||
|     _configure_networking |     _configure_networking | ||||||
|     _prompt_install_adblock |     _prompt_install_adblock | ||||||
|     _prompt_install_openvpn |     _prompt_install_openvpn | ||||||
|  |     _install_client_config | ||||||
|     _patch_system_files |     _patch_system_files | ||||||
|     _install_complete |     _install_complete | ||||||
| } | } | ||||||
| @@ -145,6 +147,7 @@ function _install_dependencies() { | |||||||
|     echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections |     echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections | ||||||
|     echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections |     echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections | ||||||
|     sudo apt-get install $apt_option lighttpd git hostapd dnsmasq iptables-persistent $php_package $dhcpcd_package vnstat qrencode || _install_status 1 "Unable to install dependencies" |     sudo apt-get install $apt_option lighttpd git hostapd dnsmasq iptables-persistent $php_package $dhcpcd_package vnstat qrencode || _install_status 1 "Unable to install dependencies" | ||||||
|  |     sudo apt-get install wvdial socat bc || _install_status 1 "Unable to install dependencies" | ||||||
|     _install_status 0 |     _install_status 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -170,6 +173,11 @@ function _create_raspap_directories() { | |||||||
|     # Create a directory to store networking configs |     # Create a directory to store networking configs | ||||||
|     echo "Creating $raspap_dir/networking" |     echo "Creating $raspap_dir/networking" | ||||||
|     sudo mkdir -p "$raspap_dir/networking" |     sudo mkdir -p "$raspap_dir/networking" | ||||||
|  |     # Copy existing dhcpcd.conf to use as base config | ||||||
|  |     echo "Adding /etc/dhcpcd.conf as base configuration" | ||||||
|  |     cat /etc/dhcpcd.conf | sudo tee -a /etc/raspap/networking/defaults > /dev/null | ||||||
|  |     echo "Changing file ownership of $raspap_dir" | ||||||
|  |     sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" | ||||||
| } | } | ||||||
|  |  | ||||||
| # Generate hostapd logging and service control scripts | # Generate hostapd logging and service control scripts | ||||||
| @@ -464,6 +472,23 @@ function _enable_raspap_daemon() { | |||||||
|     sudo systemctl enable raspapd.service || _install_status 1 "Failed to enable raspap.service" |     sudo systemctl enable raspapd.service || _install_status 1 "Failed to enable raspap.service" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function _install_client_config() { | ||||||
|  |     _install_log "Install mobile client scripts and settings" | ||||||
|  |     # Move scripts  | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/"*.sh "$raspap_client_scripts/" || _install_status 1 "Unable to move client scripts" | ||||||
|  |     sudo chmod a+rx "$raspap_client_scripts/"*.sh  || _install_status 1 "Unable to chmod client scripts" | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/mcc-mnc-table.csv" "$raspap_client_scripts/" || _install_status 1 "Unable to move client data" | ||||||
|  |     # wvdial settings | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/wvdial.conf" "/etc/" || _install_status 1 "Unable to install client configuration" | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/interfaces" "/etc/network/interfaces" || _install_status 1 "Unable to install interface settings" | ||||||
|  |     # udev rules/services to auto start mobile data services | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/70-mobile-data-sticks.rules" "/etc/udev/rules.d/" || _install_status 1 "Unable to install client udev rules" | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/80-raspap-net-devices.rules" "/etc/udev/rules.d/" || _install_status 1 "Unable to install client udev rules" | ||||||
|  |     sudo cp "$webroot_dir/config/client_config/"*.service "/etc/systemd/system/" || _install_status 1 "Unable to install client startup services" | ||||||
|  |     # client configuration and udev rule templates | ||||||
|  |     sudo cp "$webroot_dir/config/client_udev_prototypes.json" "/etc/raspap/networking/" || _install_status 1 "Unable to install client configuration" | ||||||
|  | } | ||||||
|  |  | ||||||
| # Configure IP forwarding, set IP tables rules, prompt to install RaspAP daemon | # Configure IP forwarding, set IP tables rules, prompt to install RaspAP daemon | ||||||
| function _configure_networking() { | function _configure_networking() { | ||||||
|     _install_log "Configuring networking" |     _install_log "Configuring networking" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user