Skip to content

Commit

Permalink
ap.bash
Browse files Browse the repository at this point in the history
  • Loading branch information
eexpress committed Nov 7, 2014
1 parent 2e0708c commit 880dc26
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
23 changes: 22 additions & 1 deletion ap.bash
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
#!/bin/bash

pgrep hostapd
s=$?
if [ $s -eq 0 ]; then
t=启动; o=关闭; i='warning'
else
t=关闭; o=开启; i='error'
fi

zenity --question --window-icon=$i --title="AP热点状态 - $t" --text=选择启动或关闭无线热点 --ok-label=$o --cancel-label="保持$t"
[ $? -eq 1 ] && exit

#切换模式
if [ $s -eq 0 ]; then
msg AP热点 关闭
gksudo pkill hostapd
exit
fi

msg AP热点 开启
#exit

#● ai hostapd dhcp3-server
iw list|grep '* AP'
[ $? -ne 0 ] && echo "No device support AP mode." && exit

sudo nmcli nm wifi off
zenity --password --title=输入sudo密码|sudo -S nmcli nm wifi off
sudo rfkill unblock wlan
sudo ifconfig wlan0 192.168.0.1 netmask 255.255.255.0
sudo sysctl -w net.ipv4.ip_forward=1
Expand Down
12 changes: 1 addition & 11 deletions desktop-file/ap.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,4 @@ Type=Application
Terminal=false
Name=AP 热点
Icon=/home/eexp/图片/inkscape/单色图标/wifi.svg
Actions=Start;Stop

[Desktop Action Start]
Name=Start AP
Exec=gksudo /home/eexp/bin/ap.bash
OnlyShowIn=Unity;

[Desktop Action Stop]
Name=Stop AP
Exec=gksudo pkill hostapd
OnlyShowIn=Unity;
Exec=/home/eexp/bin/ap.bash

0 comments on commit 880dc26

Please sign in to comment.