blob: cbf3e4c600be1c4c9981dbdef4173f29cc0a5498 [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
10 echo "interface=ap0" > /run/wg870/dnsmasq.conf
11 echo "listen-address=127.0.0.1,192.168.15.1" >> /run/wg870/dnsmasq.conf
12 echo "bind-interfaces" >> /run/wg870/dnsmasq.conf
13 echo "localise-queries" >> /run/wg870/dnsmasq.conf
14 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 +080015 ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep
you.chencd882682023-04-24 15:39:37 +080016 if [ $? != 0 ]; then
17 /usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid -7 /run/wg870/dnsmasq.d --local-service -C /run/wg870/dnsmasq.conf -r /run/wg870
18 fi
19
20elif [ "$1" == "stop" ]; then
you.chen3c309002023-04-26 10:00:06 +080021 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 +080022 ifconfig ap0 down
23 if [ $? != 0 ]; then
24 exit 1
25 fi
26else
27 exit 2
28fi
you.chen3c309002023-04-26 10:00:06 +080029
30exit 0