blob: 541560252c7aedcb4339524b8ff3ca6531bda1e0 [file] [log] [blame]
you.chencd882682023-04-24 15:39:37 +08001#!/bin/sh
2
3if [ "$1" == "start" ]; then
4 ifconfig ap0 192.168.15.1 netmask 255.255.255.240
5
6 if [ $? != 0 ]; then
7 exit 1
8 fi
9 mkdir -p /run/wg870/dnsmasq.d
you.chen51962642023-05-10 15:52:57 +080010 echo "port=0" > /run/wg870/dnsmasq.conf
11 echo "interface=ap0" >> /run/wg870/dnsmasq.conf
12 echo "listen-address=192.168.15.1" >> /run/wg870/dnsmasq.conf
you.chencd882682023-04-24 15:39:37 +080013 echo "bind-interfaces" >> /run/wg870/dnsmasq.conf
14 echo "localise-queries" >> /run/wg870/dnsmasq.conf
15 echo "dhcp-range=192.168.15.2,192.168.15.14,255.255.255.240,1h" >> /run/wg870/dnsmasq.conf
you.chen3c309002023-04-26 10:00:06 +080016 ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep
you.chencd882682023-04-24 15:39:37 +080017 if [ $? != 0 ]; then
18 /usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid -7 /run/wg870/dnsmasq.d --local-service -C /run/wg870/dnsmasq.conf -r /run/wg870
19 fi
20
21elif [ "$1" == "stop" ]; then
you.chen3c309002023-04-26 10:00:06 +080022 ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep | awk '{print "kill "$1}' | sh
you.chencd882682023-04-24 15:39:37 +080023 ifconfig ap0 down
24 if [ $? != 0 ]; then
25 exit 1
26 fi
27else
28 exit 2
29fi
you.chen3c309002023-04-26 10:00:06 +080030
31exit 0