Skip to content

Commit

Permalink
changes after feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nandub committed Dec 10, 2020
1 parent 1ffea52 commit 36f2c95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions dhcp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#20200225 km4ack

DHCP=$(cat /var/lib/misc/dnsmasq.leases)
HSS=$(cat /usr/bin/autohotspotN | grep "ip a add" | awk '{ print $4 }' | sed 's/\/24//')
CIP=$(ip address show dev wlan0 | grep -v inet6 | grep inet | awk '{ print $2 }' | sed 's/\/24//')
#CIP=$(ifconfig | grep -A 1 wlan0 | grep inet | awk '{ print $2 }')
HSS=$(cat /usr/bin/autohotspotN | grep "ip a add" | awk '{ print $4 }' | sed 's/\/2[4,8]//')
CIP=$(ip address show dev wlan0 | grep -v inet6 | grep inet | awk '{ print $2 }' | sed 's/\/2[4,8]//')

This comment has been minimized.

Copy link
@n2aws

n2aws Dec 11, 2020

Instead of the sed here.. you may want to consider doing something like cut -f 1 -d \/ to trim just the IP, and remove all subnets, regardless of value. For instance, at my house, on one of my vlans, this still wouldn't match.

This comment has been minimized.

Copy link
@n2aws

n2aws Dec 11, 2020

Same comment, on the other changes in this commit for the seds.

This comment has been minimized.

Copy link
@nandub

nandub Dec 25, 2020

Author

@n2aws thanks so much for this. I made the changes.


if [ $HSS = $CIP ]
then
Expand Down
5 changes: 2 additions & 3 deletions hotspot-menu
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ HS=$(systemctl is-enabled autohotspot)
HSR=$(systemctl is-active autohotspot)
CURRENTNAME=$(sudo cat /etc/hostapd/hostapd.conf | grep ssid= | head -1 | sed 's/ssid=//')
CURRENTPASS=$(sudo cat /etc/hostapd/hostapd.conf | grep wpa_passphrase= | sed 's/wpa_passphrase=//')
HSIP=$(cat /usr/bin/autohotspotN | grep "ip a add" | awk '{ print $4 }' | sed 's/\/24//')
CIP=$(ip address show dev wlan0 | grep -v inet6 | grep inet | awk '{ print $2 }' | sed 's/\/24//')
#CIP=$(ifconfig | grep -A 1 wlan0 | grep inet | awk '{ print $2 }')
HSIP=$(cat /usr/bin/autohotspotN | grep "ip a add" | awk '{ print $4 }' | sed 's/\/2[4,8]//')
CIP=$(ip address show dev wlan0 | grep -v inet6 | grep inet | awk '{ print $2 }' | sed 's/\/2[4,8]//')

if [ $HSR = 'inactive' ]
then
Expand Down
2 changes: 1 addition & 1 deletion knowssid
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ HS=$(systemctl is-enabled autohotspot)
HSR=$(systemctl is-active autohotspot)
CURRENTNAME=$(sudo cat /etc/hostapd/hostapd.conf | grep ssid= | head -1 | sed 's/ssid=//')
CURRENTPASS=$(sudo cat /etc/hostapd/hostapd.conf | grep wpa_passphrase= | sed 's/wpa_passphrase=//')
HSIP=$(cat /usr/bin/autohotspotN | grep "ip a add" | sed 's/ip\ a\ add\ //' | sed 's/\/24.*$//' | tr -d " ")
HSIP=$(cat /usr/bin/autohotspotN | grep "ip a add" | awk '{ print $4 }' | sed 's/\/2[4,8]//')

if [ $HSR = 'inactive' ]
then
Expand Down

0 comments on commit 36f2c95

Please sign in to comment.