diff --git a/adhoc_setup.sh b/adhoc_setup.sh index 7be7c2d..448971c 100755 --- a/adhoc_setup.sh +++ b/adhoc_setup.sh @@ -54,10 +54,28 @@ case "$PI_TYPE" in #!/bin/sh -e # Ad-Hoc Network creation echo "Creating Ad-Hoc Network" -iwconfig wlan0 mode ad-hoc essid test-adhoc channel 01 txpower 0 +iwconfig wlan0 mode ad-hoc essid test-adhoc channel 01 txpower 3 exit 0 EOF + echo "Changing network/interfaces file.." + cp /etc/network/interfaces /etc/network/interfaces.backup + tee <<- 'EOF' > /etc/network/interfaces +# loopback interface +auto lo +iface lo inet loopback + +# ethernet eth0 +iface eth0 inet manual + +# WLAN wlan0 for Ad Hoc network +# TWIN Node for Pi-3 +allow-hotplug wlan0 +iface wlan0 inet6 auto + +EOF +# here-doc ends for /etc/network/interfaces file + ;; # Switch Case for Pi-3 Over "a01041" | "a21041" | "a22042") # Pi 3 Revision Numbers @@ -75,38 +93,35 @@ EOF #!/bin/sh -e echo "Creating Ad-Hoc Network" ifconfig wlan0 down -iwconfig wlan0 mode ad-hoc essid test-adhoc channel 01 txpower 0 +iwconfig wlan0 mode ad-hoc essid test-adhoc channel 01 txpower 3 ifconfig wlan0 up exit 0 EOF # here-doc ends here for /etc/rc.local + echo "Changing network/interfaces file.." + cp /etc/network/interfaces /etc/network/interfaces.backup + tee <<- 'EOF' > /etc/network/interfaces +# loopback interface +auto lo +iface lo inet loopback + +# ethernet eth0 +iface eth0 inet manual + +# WLAN wlan0 for Ad Hoc network +# TWIN Node with rt2x00lib driver +allow-hotplug wlan0 +iface wlan0 inet6 auto + +EOF +# here-doc ends for /etc/network/interfaces file elif [[ "$EXT_WLAN_CHIP_2" == "r8188eu" ]]; then # if RTL8188EU driver echo "ipv6" >> /etc/modules; echo "$EXT_WLAN_CHIP_2" >> /etc/modules echo - echo "Changing rc.local files.." - cp /etc/rc.local /etc/rc.local.backup - tee <<- 'EOF' > /etc/rc.local -#!/bin/sh -e -echo "Creating Ad-Hoc Network" -ifconfig wlan0 down -iwconfig wlan0 mode ad-hoc essid test-adhoc channel 01 -# cannot change tx power for r8188eu drivers -# cannot change channel parameters for r8188eu drivers -ifconfig wlan0 up -exit 0 -EOF - else - echo "no chipset found.." - exit 1 - fi - ;; # Switch Case for Pi - 2 ends here -esac - -echo -echo "Changing network/interfaces file.." -cp /etc/network/interfaces /etc/network/interfaces.backup -tee <<'EOF' > /etc/network/interfaces + echo "Changing network/interfaces files.." + cp /etc/network/interfaces /etc/network/interfaces.backup + tee <<- 'EOF' > /etc/network/interfaces # loopback interface auto lo iface lo inet loopback @@ -115,12 +130,20 @@ iface lo inet loopback iface eth0 inet manual # WLAN wlan0 for Ad Hoc network -# TWIN Node +# TWIN Node with r8188eu driver allow-hotplug wlan0 iface wlan0 inet6 auto - + wireless-channel 01 + wireless-mode ad-hoc + wireless-essid test-adhoc EOF -# here-doc ends for /etc/network/interfaces file +# here-doc for /etc/network/interfaces file for r8188eu driver ends here + else + echo "no chipset found.." + exit 1 + fi + ;; # Switch Case for Pi - 2 ends here +esac echo echo "Changing other network configurations.."