99 lines
No EOL
2.3 KiB
Bash
99 lines
No EOL
2.3 KiB
Bash
#!/bin/bash
|
|
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/e33e00c6780ad0215d3932b810a10e46/raw | sh
|
|
|
|
echo "In case of any issues please consult cosmicpi.org for help, or contact us via Facebook "
|
|
|
|
echo "--- Expand the file system ---"
|
|
sudo resize2fs /dev/mmcblk0p2
|
|
|
|
echo "--- Update OS ---"
|
|
sudo apt -y update
|
|
sudo apt -y upgrade
|
|
sudo apt -y install python-pip dnsmasq dhcpcd git
|
|
|
|
echo "--- Install CosmicPi software --"
|
|
sudo pip install cosmicpi
|
|
|
|
# Configure AP mode
|
|
# Populate `/etc/dnsmasq.conf` file
|
|
echo "--- Configure AP mode ---"
|
|
sudo bash -c 'cat > /etc/dnsmasq_.conf' << EOF
|
|
interface=wlan0
|
|
dhcp-range=192.168.12.50,192.168.12.150,255.255.255.0,24h
|
|
|
|
address=/apple.com/192.168.12.1
|
|
address=/appleiphonecell.com/192.168.12.1
|
|
address=/airport.us/192.168.12.1
|
|
address=/akamaiedge.net/192.168.12.1
|
|
address=/akamaitechnologies.com/192.168.12.1
|
|
address=/microsoft.com/192.168.12.1
|
|
address=/msftncsi.com/192.168.12.1
|
|
address=/msftconnecttest.com/192.168.12.1
|
|
address=/google.com/192.168.12.1
|
|
address=/gstatic.com/192.168.12.1
|
|
address=/googleapis.com/192.168.12.1
|
|
address=/android.com/192.168.12.1
|
|
EOF
|
|
sudo systemctl restart dnsmasq
|
|
|
|
# Populate `/etc/dhcpcd.conf` file
|
|
sudo bash -c 'cat > /etc/dhcpcd_.conf' << EOF
|
|
hostname
|
|
clientid
|
|
presistent
|
|
option rapid_commit
|
|
option domain_name_servers, domain_name, domain_search, host_name
|
|
option classless_static_routes
|
|
option interface_mtu
|
|
option ntp_servers
|
|
require dhcp_server_identifier
|
|
|
|
slaac private
|
|
|
|
profile static_wlan0
|
|
static ip_address=192.168.12.1
|
|
static routers=192.168.12.1
|
|
static domain_name_servers=192.168.12.1
|
|
|
|
interface wlan0
|
|
fallback static_wlan0
|
|
EOF
|
|
sudo systemctl restart dhcpcd
|
|
|
|
# Populate `/etc/create_ap.conf` file
|
|
sudo bash -c 'cat > /etc/create_ap.conf' << EOF
|
|
CHANNEL=default
|
|
GATEWAY=10.0.0.1
|
|
WPA_VERSION=2
|
|
ETC_HOSTS=0
|
|
DHCP_DNS=gateway
|
|
NO_DNS=0
|
|
NO_DNSMASQ=0
|
|
HIDDEN=0
|
|
MAC_FILTER=0
|
|
MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept
|
|
ISOLATE_CLIENTS=0
|
|
SHARE_METHOD=nat
|
|
IEEE80211N=0
|
|
IEEE80211AC=0
|
|
HT_CAPAB=[HT40+]
|
|
VHT_CAPAB=
|
|
DRIVER=nl80211
|
|
NO_VIRT=0
|
|
COUNTRY=
|
|
FREQ_BAND=2.4
|
|
NEW_MACADDR=
|
|
DAEMONIZE=0
|
|
NO_HAVEGED=0
|
|
WIFI_IFACE=wlan0
|
|
INTERNET_IFACE=eth0
|
|
SSID=CosmicPi
|
|
PASSPHRASE=
|
|
USE_PSK=0
|
|
EOF
|
|
|
|
git clone https://www.github.com/oblique/create_ap /tmp/create_ap --depth 1
|
|
sudo make -C /tmp/create_ap install
|
|
sudo systemctl enable create_ap
|
|
|
|
sudo reboot |