blob: 259aa01d17fe22d59734d19456d15374db89ddd0 [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.chen57eb5842023-05-18 14:19:46 +080016 echo "dhcp-leasefile=/run/wg870/ap0.lease" >> /run/wg870/dnsmasq.conf
you.chen3c309002023-04-26 10:00:06 +080017 ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep
you.chencd882682023-04-24 15:39:37 +080018 if [ $? != 0 ]; then
19 /usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid -7 /run/wg870/dnsmasq.d --local-service -C /run/wg870/dnsmasq.conf -r /run/wg870
20 fi
21
22elif [ "$1" == "stop" ]; then
you.chen3c309002023-04-26 10:00:06 +080023 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 +080024 ifconfig ap0 down
25 if [ $? != 0 ]; then
26 exit 1
27 fi
28else
29 exit 2
30fi
you.chen3c309002023-04-26 10:00:06 +080031
32exit 0