install.sh-c98ac052/install.sh
Darko Lukić cb2ff4172e
2018-05-21 12:29:51 +02:00

104 lines
No EOL
2.6 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 hostapd git
echo "--- Install CosmicPi software --"
sudo pip install cosmicpi
echo "--- Configure AP mode ---"
curl https://gist.githubusercontent.com/lukicdarkoo/6b92d182d37d0a10400060d8344f86e4/raw | sh -s FooSSID FooPass CosmicPi cosmicpi
: '
# Configure AP mode
# This configuration is based on CosmicPi 1.5 software
# We do not need it as we now have, shiny, new script that configures AP and client Wifi mode
# I will leave this piece of code commented, for a while, as a fallback
# Populate `/etc/dnsmasq.conf` file
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
# 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
# Populate `/etc/create_ap.conf` file
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 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=none
IEEE80211N=0
IEEE80211AC=0
HT_CAPAB=[HT40+]
VHT_CAPAB=
DRIVER=nl80211
NO_VIRT=1
COUNTRY=
FREQ_BAND=2.4
NEW_MACADDR=
DAEMONIZE=0
NO_HAVEGED=0
WIFI_IFACE=wlan0
INTERNET_IFACE=
SSID=CosmicPi
PASSPHRASE=
USE_PSK=0
EOF
'
sudo reboot